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

com.azure.resourcemanager.storagecache.implementation.ImportJobsImpl 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.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storagecache.fluent.ImportJobsClient;
import com.azure.resourcemanager.storagecache.fluent.models.ImportJobInner;
import com.azure.resourcemanager.storagecache.models.ImportJob;
import com.azure.resourcemanager.storagecache.models.ImportJobs;

public final class ImportJobsImpl implements ImportJobs {
    private static final ClientLogger LOGGER = new ClientLogger(ImportJobsImpl.class);

    private final ImportJobsClient innerClient;

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

    public ImportJobsImpl(ImportJobsClient innerClient,
        com.azure.resourcemanager.storagecache.StorageCacheManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public void delete(String resourceGroupName, String amlFilesystemName, String importJobName) {
        this.serviceClient().delete(resourceGroupName, amlFilesystemName, importJobName);
    }

    public void delete(String resourceGroupName, String amlFilesystemName, String importJobName, Context context) {
        this.serviceClient().delete(resourceGroupName, amlFilesystemName, importJobName, context);
    }

    public Response getWithResponse(String resourceGroupName, String amlFilesystemName, String importJobName,
        Context context) {
        Response inner
            = this.serviceClient().getWithResponse(resourceGroupName, amlFilesystemName, importJobName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new ImportJobImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ImportJob get(String resourceGroupName, String amlFilesystemName, String importJobName) {
        ImportJobInner inner = this.serviceClient().get(resourceGroupName, amlFilesystemName, importJobName);
        if (inner != null) {
            return new ImportJobImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public PagedIterable listByAmlFilesystem(String resourceGroupName, String amlFilesystemName) {
        PagedIterable inner
            = this.serviceClient().listByAmlFilesystem(resourceGroupName, amlFilesystemName);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new ImportJobImpl(inner1, this.manager()));
    }

    public PagedIterable listByAmlFilesystem(String resourceGroupName, String amlFilesystemName,
        Context context) {
        PagedIterable inner
            = this.serviceClient().listByAmlFilesystem(resourceGroupName, amlFilesystemName, context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new ImportJobImpl(inner1, this.manager()));
    }

    public ImportJob getById(String id) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String amlFilesystemName = ResourceManagerUtils.getValueFromIdByName(id, "amlFilesystems");
        if (amlFilesystemName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'amlFilesystems'.", id)));
        }
        String importJobName = ResourceManagerUtils.getValueFromIdByName(id, "importJobs");
        if (importJobName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'importJobs'.", id)));
        }
        return this.getWithResponse(resourceGroupName, amlFilesystemName, importJobName, Context.NONE).getValue();
    }

    public Response getByIdWithResponse(String id, Context context) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String amlFilesystemName = ResourceManagerUtils.getValueFromIdByName(id, "amlFilesystems");
        if (amlFilesystemName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'amlFilesystems'.", id)));
        }
        String importJobName = ResourceManagerUtils.getValueFromIdByName(id, "importJobs");
        if (importJobName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'importJobs'.", id)));
        }
        return this.getWithResponse(resourceGroupName, amlFilesystemName, importJobName, context);
    }

    public void deleteById(String id) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String amlFilesystemName = ResourceManagerUtils.getValueFromIdByName(id, "amlFilesystems");
        if (amlFilesystemName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'amlFilesystems'.", id)));
        }
        String importJobName = ResourceManagerUtils.getValueFromIdByName(id, "importJobs");
        if (importJobName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'importJobs'.", id)));
        }
        this.delete(resourceGroupName, amlFilesystemName, importJobName, Context.NONE);
    }

    public void deleteByIdWithResponse(String id, Context context) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String amlFilesystemName = ResourceManagerUtils.getValueFromIdByName(id, "amlFilesystems");
        if (amlFilesystemName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'amlFilesystems'.", id)));
        }
        String importJobName = ResourceManagerUtils.getValueFromIdByName(id, "importJobs");
        if (importJobName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'importJobs'.", id)));
        }
        this.delete(resourceGroupName, amlFilesystemName, importJobName, context);
    }

    private ImportJobsClient serviceClient() {
        return this.innerClient;
    }

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

    public ImportJobImpl define(String name) {
        return new ImportJobImpl(name, this.manager());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy