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

com.azure.resourcemanager.storagecache.implementation.CachesImpl 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.CachesClient;
import com.azure.resourcemanager.storagecache.fluent.models.CacheInner;
import com.azure.resourcemanager.storagecache.models.Cache;
import com.azure.resourcemanager.storagecache.models.Caches;
import com.azure.resourcemanager.storagecache.models.PrimingJob;
import com.azure.resourcemanager.storagecache.models.PrimingJobIdParameter;
import com.azure.resourcemanager.storagecache.models.StorageTargetSpaceAllocation;
import java.util.List;

public final class CachesImpl implements Caches {
    private static final ClientLogger LOGGER = new ClientLogger(CachesImpl.class);

    private final CachesClient innerClient;

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

    public CachesImpl(CachesClient 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 CacheImpl(inner1, this.manager()));
    }

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

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

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

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

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

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

    public Cache getByResourceGroup(String resourceGroupName, String cacheName) {
        CacheInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cacheName);
        if (inner != null) {
            return new CacheImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public void debugInfo(String resourceGroupName, String cacheName) {
        this.serviceClient().debugInfo(resourceGroupName, cacheName);
    }

    public void debugInfo(String resourceGroupName, String cacheName, Context context) {
        this.serviceClient().debugInfo(resourceGroupName, cacheName, context);
    }

    public void flush(String resourceGroupName, String cacheName) {
        this.serviceClient().flush(resourceGroupName, cacheName);
    }

    public void flush(String resourceGroupName, String cacheName, Context context) {
        this.serviceClient().flush(resourceGroupName, cacheName, context);
    }

    public void start(String resourceGroupName, String cacheName) {
        this.serviceClient().start(resourceGroupName, cacheName);
    }

    public void start(String resourceGroupName, String cacheName, Context context) {
        this.serviceClient().start(resourceGroupName, cacheName, context);
    }

    public void stop(String resourceGroupName, String cacheName) {
        this.serviceClient().stop(resourceGroupName, cacheName);
    }

    public void stop(String resourceGroupName, String cacheName, Context context) {
        this.serviceClient().stop(resourceGroupName, cacheName, context);
    }

    public void startPrimingJob(String resourceGroupName, String cacheName) {
        this.serviceClient().startPrimingJob(resourceGroupName, cacheName);
    }

    public void startPrimingJob(String resourceGroupName, String cacheName, PrimingJob primingjob, Context context) {
        this.serviceClient().startPrimingJob(resourceGroupName, cacheName, primingjob, context);
    }

    public void stopPrimingJob(String resourceGroupName, String cacheName) {
        this.serviceClient().stopPrimingJob(resourceGroupName, cacheName);
    }

    public void stopPrimingJob(String resourceGroupName, String cacheName, PrimingJobIdParameter primingJobId,
        Context context) {
        this.serviceClient().stopPrimingJob(resourceGroupName, cacheName, primingJobId, context);
    }

    public void pausePrimingJob(String resourceGroupName, String cacheName) {
        this.serviceClient().pausePrimingJob(resourceGroupName, cacheName);
    }

    public void pausePrimingJob(String resourceGroupName, String cacheName, PrimingJobIdParameter primingJobId,
        Context context) {
        this.serviceClient().pausePrimingJob(resourceGroupName, cacheName, primingJobId, context);
    }

    public void resumePrimingJob(String resourceGroupName, String cacheName) {
        this.serviceClient().resumePrimingJob(resourceGroupName, cacheName);
    }

    public void resumePrimingJob(String resourceGroupName, String cacheName, PrimingJobIdParameter primingJobId,
        Context context) {
        this.serviceClient().resumePrimingJob(resourceGroupName, cacheName, primingJobId, context);
    }

    public void upgradeFirmware(String resourceGroupName, String cacheName) {
        this.serviceClient().upgradeFirmware(resourceGroupName, cacheName);
    }

    public void upgradeFirmware(String resourceGroupName, String cacheName, Context context) {
        this.serviceClient().upgradeFirmware(resourceGroupName, cacheName, context);
    }

    public void spaceAllocation(String resourceGroupName, String cacheName) {
        this.serviceClient().spaceAllocation(resourceGroupName, cacheName);
    }

    public void spaceAllocation(String resourceGroupName, String cacheName,
        List spaceAllocation, Context context) {
        this.serviceClient().spaceAllocation(resourceGroupName, cacheName, spaceAllocation, context);
    }

    public Cache 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 cacheName = ResourceManagerUtils.getValueFromIdByName(id, "caches");
        if (cacheName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id)));
        }
        return this.getByResourceGroupWithResponse(resourceGroupName, cacheName, 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 cacheName = ResourceManagerUtils.getValueFromIdByName(id, "caches");
        if (cacheName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id)));
        }
        return this.getByResourceGroupWithResponse(resourceGroupName, cacheName, 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 cacheName = ResourceManagerUtils.getValueFromIdByName(id, "caches");
        if (cacheName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id)));
        }
        this.delete(resourceGroupName, cacheName, 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 cacheName = ResourceManagerUtils.getValueFromIdByName(id, "caches");
        if (cacheName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id)));
        }
        this.delete(resourceGroupName, cacheName, context);
    }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy