
com.azure.resourcemanager.devcenter.implementation.AttachedNetworksImpl 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.devcenter.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.devcenter.fluent.AttachedNetworksClient;
import com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner;
import com.azure.resourcemanager.devcenter.models.AttachedNetworkConnection;
import com.azure.resourcemanager.devcenter.models.AttachedNetworks;
public final class AttachedNetworksImpl implements AttachedNetworks {
private static final ClientLogger LOGGER = new ClientLogger(AttachedNetworksImpl.class);
private final AttachedNetworksClient innerClient;
private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager;
public AttachedNetworksImpl(AttachedNetworksClient innerClient,
com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable listByProject(String resourceGroupName, String projectName) {
PagedIterable inner
= this.serviceClient().listByProject(resourceGroupName, projectName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager()));
}
public PagedIterable listByProject(String resourceGroupName, String projectName,
Integer top, Context context) {
PagedIterable inner
= this.serviceClient().listByProject(resourceGroupName, projectName, top, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager()));
}
public Response getByProjectWithResponse(String resourceGroupName, String projectName,
String attachedNetworkConnectionName, Context context) {
Response inner = this.serviceClient()
.getByProjectWithResponse(resourceGroupName, projectName, attachedNetworkConnectionName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new AttachedNetworkConnectionImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public AttachedNetworkConnection getByProject(String resourceGroupName, String projectName,
String attachedNetworkConnectionName) {
AttachedNetworkConnectionInner inner
= this.serviceClient().getByProject(resourceGroupName, projectName, attachedNetworkConnectionName);
if (inner != null) {
return new AttachedNetworkConnectionImpl(inner, this.manager());
} else {
return null;
}
}
public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) {
PagedIterable inner
= this.serviceClient().listByDevCenter(resourceGroupName, devCenterName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager()));
}
public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName,
Integer top, Context context) {
PagedIterable inner
= this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager()));
}
public Response getByDevCenterWithResponse(String resourceGroupName,
String devCenterName, String attachedNetworkConnectionName, Context context) {
Response inner = this.serviceClient()
.getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new AttachedNetworkConnectionImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public AttachedNetworkConnection getByDevCenter(String resourceGroupName, String devCenterName,
String attachedNetworkConnectionName) {
AttachedNetworkConnectionInner inner
= this.serviceClient().getByDevCenter(resourceGroupName, devCenterName, attachedNetworkConnectionName);
if (inner != null) {
return new AttachedNetworkConnectionImpl(inner, this.manager());
} else {
return null;
}
}
public void delete(String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) {
this.serviceClient().delete(resourceGroupName, devCenterName, attachedNetworkConnectionName);
}
public void delete(String resourceGroupName, String devCenterName, String attachedNetworkConnectionName,
Context context) {
this.serviceClient().delete(resourceGroupName, devCenterName, attachedNetworkConnectionName, context);
}
public AttachedNetworkConnection 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 devCenterName = ResourceManagerUtils.getValueFromIdByName(id, "devcenters");
if (devCenterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id)));
}
String attachedNetworkConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "attachednetworks");
if (attachedNetworkConnectionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id)));
}
return this
.getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName, 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 devCenterName = ResourceManagerUtils.getValueFromIdByName(id, "devcenters");
if (devCenterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id)));
}
String attachedNetworkConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "attachednetworks");
if (attachedNetworkConnectionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id)));
}
return this.getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName,
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 devCenterName = ResourceManagerUtils.getValueFromIdByName(id, "devcenters");
if (devCenterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id)));
}
String attachedNetworkConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "attachednetworks");
if (attachedNetworkConnectionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id)));
}
this.delete(resourceGroupName, devCenterName, attachedNetworkConnectionName, 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 devCenterName = ResourceManagerUtils.getValueFromIdByName(id, "devcenters");
if (devCenterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id)));
}
String attachedNetworkConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "attachednetworks");
if (attachedNetworkConnectionName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id)));
}
this.delete(resourceGroupName, devCenterName, attachedNetworkConnectionName, context);
}
private AttachedNetworksClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.devcenter.DevCenterManager manager() {
return this.serviceManager;
}
public AttachedNetworkConnectionImpl define(String name) {
return new AttachedNetworkConnectionImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy