All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.storagecache.implementation.ImportJobImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for StorageCache Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Managed Lustre provides a fully managed Lustre® file system, integrated with Blob storage, for use on demand. These operations create and manage Azure Managed Lustre file systems. Package tag package-2024-03.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.storagecache.implementation;

import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.storagecache.fluent.models.ImportJobInner;
import com.azure.resourcemanager.storagecache.models.ConflictResolutionMode;
import com.azure.resourcemanager.storagecache.models.ImportJob;
import com.azure.resourcemanager.storagecache.models.ImportJobProvisioningStateType;
import com.azure.resourcemanager.storagecache.models.ImportJobUpdate;
import com.azure.resourcemanager.storagecache.models.ImportStatusType;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class ImportJobImpl implements ImportJob, ImportJob.Definition, ImportJob.Update {
    private ImportJobInner innerObject;

    private final com.azure.resourcemanager.storagecache.StorageCacheManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public String location() {
        return this.innerModel().location();
    }

    public Map tags() {
        Map inner = this.innerModel().tags();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public ImportJobProvisioningStateType provisioningState() {
        return this.innerModel().provisioningState();
    }

    public List importPrefixes() {
        List inner = this.innerModel().importPrefixes();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public ConflictResolutionMode conflictResolutionMode() {
        return this.innerModel().conflictResolutionMode();
    }

    public Integer maximumErrors() {
        return this.innerModel().maximumErrors();
    }

    public ImportStatusType state() {
        return this.innerModel().state();
    }

    public String statusMessage() {
        return this.innerModel().statusMessage();
    }

    public Long totalBlobsWalked() {
        return this.innerModel().totalBlobsWalked();
    }

    public Long blobsWalkedPerSecond() {
        return this.innerModel().blobsWalkedPerSecond();
    }

    public Long totalBlobsImported() {
        return this.innerModel().totalBlobsImported();
    }

    public Long blobsImportedPerSecond() {
        return this.innerModel().blobsImportedPerSecond();
    }

    public OffsetDateTime lastCompletionTime() {
        return this.innerModel().lastCompletionTime();
    }

    public OffsetDateTime lastStartedTime() {
        return this.innerModel().lastStartedTime();
    }

    public Integer totalErrors() {
        return this.innerModel().totalErrors();
    }

    public Integer totalConflicts() {
        return this.innerModel().totalConflicts();
    }

    public Region region() {
        return Region.fromName(this.regionName());
    }

    public String regionName() {
        return this.location();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public ImportJobInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.storagecache.StorageCacheManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String amlFilesystemName;

    private String importJobName;

    private ImportJobUpdate updateImportJob;

    public ImportJobImpl withExistingAmlFilesystem(String resourceGroupName, String amlFilesystemName) {
        this.resourceGroupName = resourceGroupName;
        this.amlFilesystemName = amlFilesystemName;
        return this;
    }

    public ImportJob create() {
        this.innerObject = serviceManager.serviceClient()
            .getImportJobs()
            .createOrUpdate(resourceGroupName, amlFilesystemName, importJobName, this.innerModel(), Context.NONE);
        return this;
    }

    public ImportJob create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getImportJobs()
            .createOrUpdate(resourceGroupName, amlFilesystemName, importJobName, this.innerModel(), context);
        return this;
    }

    ImportJobImpl(String name, com.azure.resourcemanager.storagecache.StorageCacheManager serviceManager) {
        this.innerObject = new ImportJobInner();
        this.serviceManager = serviceManager;
        this.importJobName = name;
    }

    public ImportJobImpl update() {
        this.updateImportJob = new ImportJobUpdate();
        return this;
    }

    public ImportJob apply() {
        this.innerObject = serviceManager.serviceClient()
            .getImportJobs()
            .update(resourceGroupName, amlFilesystemName, importJobName, updateImportJob, Context.NONE);
        return this;
    }

    public ImportJob apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getImportJobs()
            .update(resourceGroupName, amlFilesystemName, importJobName, updateImportJob, context);
        return this;
    }

    ImportJobImpl(ImportJobInner innerObject,
        com.azure.resourcemanager.storagecache.StorageCacheManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.amlFilesystemName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "amlFilesystems");
        this.importJobName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "importJobs");
    }

    public ImportJob refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getImportJobs()
            .getWithResponse(resourceGroupName, amlFilesystemName, importJobName, Context.NONE)
            .getValue();
        return this;
    }

    public ImportJob refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getImportJobs()
            .getWithResponse(resourceGroupName, amlFilesystemName, importJobName, context)
            .getValue();
        return this;
    }

    public ImportJobImpl withRegion(Region location) {
        this.innerModel().withLocation(location.toString());
        return this;
    }

    public ImportJobImpl withRegion(String location) {
        this.innerModel().withLocation(location);
        return this;
    }

    public ImportJobImpl withTags(Map tags) {
        if (isInCreateMode()) {
            this.innerModel().withTags(tags);
            return this;
        } else {
            this.updateImportJob.withTags(tags);
            return this;
        }
    }

    public ImportJobImpl withImportPrefixes(List importPrefixes) {
        this.innerModel().withImportPrefixes(importPrefixes);
        return this;
    }

    public ImportJobImpl withConflictResolutionMode(ConflictResolutionMode conflictResolutionMode) {
        this.innerModel().withConflictResolutionMode(conflictResolutionMode);
        return this;
    }

    public ImportJobImpl withMaximumErrors(Integer maximumErrors) {
        this.innerModel().withMaximumErrors(maximumErrors);
        return this;
    }

    private boolean isInCreateMode() {
        return this.innerModel().id() == null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy