com.azure.resourcemanager.qumulo.implementation.FileSystemsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-qumulo Show documentation
Show all versions of azure-resourcemanager-qumulo Show documentation
This package contains Microsoft Azure SDK for Qumulo Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-06-19.
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.qumulo.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.qumulo.fluent.FileSystemsClient;
import com.azure.resourcemanager.qumulo.fluent.models.FileSystemResourceInner;
import com.azure.resourcemanager.qumulo.models.FileSystemResource;
import com.azure.resourcemanager.qumulo.models.FileSystems;
public final class FileSystemsImpl implements FileSystems {
private static final ClientLogger LOGGER = new ClientLogger(FileSystemsImpl.class);
private final FileSystemsClient innerClient;
private final com.azure.resourcemanager.qumulo.QumuloManager serviceManager;
public FileSystemsImpl(FileSystemsClient innerClient,
com.azure.resourcemanager.qumulo.QumuloManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
return ResourceManagerUtils.mapPage(inner, inner1 -> new FileSystemResourceImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new FileSystemResourceImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new FileSystemResourceImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner
= this.serviceClient().listByResourceGroup(resourceGroupName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new FileSystemResourceImpl(inner1, this.manager()));
}
public Response getByResourceGroupWithResponse(String resourceGroupName, String fileSystemName,
Context context) {
Response inner
= this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, fileSystemName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new FileSystemResourceImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public FileSystemResource getByResourceGroup(String resourceGroupName, String fileSystemName) {
FileSystemResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, fileSystemName);
if (inner != null) {
return new FileSystemResourceImpl(inner, this.manager());
} else {
return null;
}
}
public void deleteByResourceGroup(String resourceGroupName, String fileSystemName) {
this.serviceClient().delete(resourceGroupName, fileSystemName);
}
public void delete(String resourceGroupName, String fileSystemName, Context context) {
this.serviceClient().delete(resourceGroupName, fileSystemName, context);
}
public FileSystemResource 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 fileSystemName = ResourceManagerUtils.getValueFromIdByName(id, "fileSystems");
if (fileSystemName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'fileSystems'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, fileSystemName, 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 fileSystemName = ResourceManagerUtils.getValueFromIdByName(id, "fileSystems");
if (fileSystemName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'fileSystems'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, fileSystemName, 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 fileSystemName = ResourceManagerUtils.getValueFromIdByName(id, "fileSystems");
if (fileSystemName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'fileSystems'.", id)));
}
this.delete(resourceGroupName, fileSystemName, 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 fileSystemName = ResourceManagerUtils.getValueFromIdByName(id, "fileSystems");
if (fileSystemName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'fileSystems'.", id)));
}
this.delete(resourceGroupName, fileSystemName, context);
}
private FileSystemsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.qumulo.QumuloManager manager() {
return this.serviceManager;
}
public FileSystemResourceImpl define(String name) {
return new FileSystemResourceImpl(name, this.manager());
}
}