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

com.azure.resourcemanager.storagecache.implementation.AmlFilesystemsImpl 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.AmlFilesystemsClient;
import com.azure.resourcemanager.storagecache.fluent.models.AmlFilesystemInner;
import com.azure.resourcemanager.storagecache.models.AmlFilesystem;
import com.azure.resourcemanager.storagecache.models.AmlFilesystemArchiveInfo;
import com.azure.resourcemanager.storagecache.models.AmlFilesystems;

public final class AmlFilesystemsImpl implements AmlFilesystems {
    private static final ClientLogger LOGGER = new ClientLogger(AmlFilesystemsImpl.class);

    private final AmlFilesystemsClient innerClient;

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

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

    public PagedIterable list() {
        PagedIterable inner = this.serviceClient().list();
        return ResourceManagerUtils.mapPage(inner, inner1 -> new AmlFilesystemImpl(inner1, this.manager()));
    }

    public PagedIterable list(Context context) {
        PagedIterable inner = this.serviceClient().list(context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new AmlFilesystemImpl(inner1, this.manager()));
    }

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

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

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

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

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

    public AmlFilesystem getByResourceGroup(String resourceGroupName, String amlFilesystemName) {
        AmlFilesystemInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, amlFilesystemName);
        if (inner != null) {
            return new AmlFilesystemImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response archiveWithResponse(String resourceGroupName, String amlFilesystemName,
        AmlFilesystemArchiveInfo archiveInfo, Context context) {
        return this.serviceClient().archiveWithResponse(resourceGroupName, amlFilesystemName, archiveInfo, context);
    }

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

    public Response cancelArchiveWithResponse(String resourceGroupName, String amlFilesystemName,
        Context context) {
        return this.serviceClient().cancelArchiveWithResponse(resourceGroupName, amlFilesystemName, context);
    }

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

    public AmlFilesystem 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)));
        }
        return this.getByResourceGroupWithResponse(resourceGroupName, amlFilesystemName, 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)));
        }
        return this.getByResourceGroupWithResponse(resourceGroupName, amlFilesystemName, 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)));
        }
        this.delete(resourceGroupName, amlFilesystemName, 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)));
        }
        this.delete(resourceGroupName, amlFilesystemName, context);
    }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy