
com.azure.resourcemanager.devcenter.implementation.GalleriesImpl 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.GalleriesClient;
import com.azure.resourcemanager.devcenter.fluent.models.GalleryInner;
import com.azure.resourcemanager.devcenter.models.Galleries;
import com.azure.resourcemanager.devcenter.models.Gallery;
public final class GalleriesImpl implements Galleries {
private static final ClientLogger LOGGER = new ClientLogger(GalleriesImpl.class);
private final GalleriesClient innerClient;
private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager;
public GalleriesImpl(GalleriesClient innerClient,
com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) {
PagedIterable inner = this.serviceClient().listByDevCenter(resourceGroupName, devCenterName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new GalleryImpl(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 GalleryImpl(inner1, this.manager()));
}
public Response getWithResponse(String resourceGroupName, String devCenterName, String galleryName,
Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, devCenterName, galleryName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new GalleryImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public Gallery get(String resourceGroupName, String devCenterName, String galleryName) {
GalleryInner inner = this.serviceClient().get(resourceGroupName, devCenterName, galleryName);
if (inner != null) {
return new GalleryImpl(inner, this.manager());
} else {
return null;
}
}
public void delete(String resourceGroupName, String devCenterName, String galleryName) {
this.serviceClient().delete(resourceGroupName, devCenterName, galleryName);
}
public void delete(String resourceGroupName, String devCenterName, String galleryName, Context context) {
this.serviceClient().delete(resourceGroupName, devCenterName, galleryName, context);
}
public Gallery 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 galleryName = ResourceManagerUtils.getValueFromIdByName(id, "galleries");
if (galleryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id)));
}
return this.getWithResponse(resourceGroupName, devCenterName, galleryName, 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 galleryName = ResourceManagerUtils.getValueFromIdByName(id, "galleries");
if (galleryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id)));
}
return this.getWithResponse(resourceGroupName, devCenterName, galleryName, 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 galleryName = ResourceManagerUtils.getValueFromIdByName(id, "galleries");
if (galleryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id)));
}
this.delete(resourceGroupName, devCenterName, galleryName, 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 galleryName = ResourceManagerUtils.getValueFromIdByName(id, "galleries");
if (galleryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id)));
}
this.delete(resourceGroupName, devCenterName, galleryName, context);
}
private GalleriesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.devcenter.DevCenterManager manager() {
return this.serviceManager;
}
public GalleryImpl define(String name) {
return new GalleryImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy