com.azure.resourcemanager.delegatednetwork.implementation.DelegatedSubnetServicesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-delegatednetwork Show documentation
Show all versions of azure-resourcemanager-delegatednetwork Show documentation
This package contains Microsoft Azure SDK for DelegatedNetwork Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. DNC web api provides way to create, get and delete dnc controller. Package tag package-2021-03-15.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.delegatednetwork.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.delegatednetwork.fluent.DelegatedSubnetServicesClient;
import com.azure.resourcemanager.delegatednetwork.fluent.models.DelegatedSubnetInner;
import com.azure.resourcemanager.delegatednetwork.models.DelegatedSubnet;
import com.azure.resourcemanager.delegatednetwork.models.DelegatedSubnetServices;
import com.fasterxml.jackson.annotation.JsonIgnore;
public final class DelegatedSubnetServicesImpl implements DelegatedSubnetServices {
@JsonIgnore private final ClientLogger logger = new ClientLogger(DelegatedSubnetServicesImpl.class);
private final DelegatedSubnetServicesClient innerClient;
private final com.azure.resourcemanager.delegatednetwork.DelegatedNetworkManager serviceManager;
public DelegatedSubnetServicesImpl(
DelegatedSubnetServicesClient innerClient,
com.azure.resourcemanager.delegatednetwork.DelegatedNetworkManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public DelegatedSubnet getByResourceGroup(String resourceGroupName, String resourceName) {
DelegatedSubnetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName);
if (inner != null) {
return new DelegatedSubnetImpl(inner, this.manager());
} else {
return null;
}
}
public Response getByResourceGroupWithResponse(
String resourceGroupName, String resourceName, Context context) {
Response inner =
this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new DelegatedSubnetImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public void delete(String resourceGroupName, String resourceName, Boolean forceDelete) {
this.serviceClient().delete(resourceGroupName, resourceName, forceDelete);
}
public void delete(String resourceGroupName, String resourceName) {
this.serviceClient().delete(resourceGroupName, resourceName);
}
public void delete(String resourceGroupName, String resourceName, Boolean forceDelete, Context context) {
this.serviceClient().delete(resourceGroupName, resourceName, forceDelete, context);
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
return Utils.mapPage(inner, inner1 -> new DelegatedSubnetImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return Utils.mapPage(inner, inner1 -> new DelegatedSubnetImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
return Utils.mapPage(inner, inner1 -> new DelegatedSubnetImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner =
this.serviceClient().listByResourceGroup(resourceGroupName, context);
return Utils.mapPage(inner, inner1 -> new DelegatedSubnetImpl(inner1, this.manager()));
}
public DelegatedSubnet getById(String id) {
String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "delegatedSubnets");
if (resourceName == null) {
throw logger
.logExceptionAsError(
new IllegalArgumentException(
String
.format(
"The resource ID '%s' is not valid. Missing path segment 'delegatedSubnets'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue();
}
public Response getByIdWithResponse(String id, Context context) {
String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "delegatedSubnets");
if (resourceName == null) {
throw logger
.logExceptionAsError(
new IllegalArgumentException(
String
.format(
"The resource ID '%s' is not valid. Missing path segment 'delegatedSubnets'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context);
}
public void deleteById(String id) {
String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "delegatedSubnets");
if (resourceName == null) {
throw logger
.logExceptionAsError(
new IllegalArgumentException(
String
.format(
"The resource ID '%s' is not valid. Missing path segment 'delegatedSubnets'.", id)));
}
Boolean localForceDelete = null;
this.delete(resourceGroupName, resourceName, localForceDelete, Context.NONE);
}
public void deleteByIdWithResponse(String id, Boolean forceDelete, Context context) {
String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "delegatedSubnets");
if (resourceName == null) {
throw logger
.logExceptionAsError(
new IllegalArgumentException(
String
.format(
"The resource ID '%s' is not valid. Missing path segment 'delegatedSubnets'.", id)));
}
this.delete(resourceGroupName, resourceName, forceDelete, context);
}
private DelegatedSubnetServicesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.delegatednetwork.DelegatedNetworkManager manager() {
return this.serviceManager;
}
public DelegatedSubnetImpl define(String name) {
return new DelegatedSubnetImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy