Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.azure.resourcemanager.elasticsan.implementation.ElasticSansImpl Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.elasticsan.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.elasticsan.fluent.ElasticSansClient;
import com.azure.resourcemanager.elasticsan.fluent.models.ElasticSanInner;
import com.azure.resourcemanager.elasticsan.models.ElasticSan;
import com.azure.resourcemanager.elasticsan.models.ElasticSans;
public final class ElasticSansImpl implements ElasticSans {
private static final ClientLogger LOGGER = new ClientLogger(ElasticSansImpl.class);
private final ElasticSansClient innerClient;
private final com.azure.resourcemanager.elasticsan.ElasticSanManager serviceManager;
public ElasticSansImpl(ElasticSansClient innerClient,
com.azure.resourcemanager.elasticsan.ElasticSanManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
return ResourceManagerUtils.mapPage(inner, inner1 -> new ElasticSanImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new ElasticSanImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new ElasticSanImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new ElasticSanImpl(inner1, this.manager()));
}
public void deleteByResourceGroup(String resourceGroupName, String elasticSanName) {
this.serviceClient().delete(resourceGroupName, elasticSanName);
}
public void delete(String resourceGroupName, String elasticSanName, Context context) {
this.serviceClient().delete(resourceGroupName, elasticSanName, context);
}
public Response getByResourceGroupWithResponse(String resourceGroupName, String elasticSanName,
Context context) {
Response inner
= this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, elasticSanName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new ElasticSanImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public ElasticSan getByResourceGroup(String resourceGroupName, String elasticSanName) {
ElasticSanInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, elasticSanName);
if (inner != null) {
return new ElasticSanImpl(inner, this.manager());
} else {
return null;
}
}
public ElasticSan 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 elasticSanName = ResourceManagerUtils.getValueFromIdByName(id, "elasticSans");
if (elasticSanName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'elasticSans'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, elasticSanName, 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 elasticSanName = ResourceManagerUtils.getValueFromIdByName(id, "elasticSans");
if (elasticSanName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'elasticSans'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, elasticSanName, 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 elasticSanName = ResourceManagerUtils.getValueFromIdByName(id, "elasticSans");
if (elasticSanName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'elasticSans'.", id)));
}
this.delete(resourceGroupName, elasticSanName, 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 elasticSanName = ResourceManagerUtils.getValueFromIdByName(id, "elasticSans");
if (elasticSanName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'elasticSans'.", id)));
}
this.delete(resourceGroupName, elasticSanName, context);
}
private ElasticSansClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.elasticsan.ElasticSanManager manager() {
return this.serviceManager;
}
public ElasticSanImpl define(String name) {
return new ElasticSanImpl(name, this.manager());
}
}