com.azure.resourcemanager.webpubsub.implementation.WebPubSubSharedPrivateLinkResourcesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-webpubsub Show documentation
Show all versions of azure-resourcemanager-webpubsub Show documentation
This package contains Microsoft Azure SDK for WebPubSub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure WebPubSub Service. Package tag package-2024-03-01.
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.webpubsub.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.webpubsub.fluent.WebPubSubSharedPrivateLinkResourcesClient;
import com.azure.resourcemanager.webpubsub.fluent.models.SharedPrivateLinkResourceInner;
import com.azure.resourcemanager.webpubsub.models.SharedPrivateLinkResource;
import com.azure.resourcemanager.webpubsub.models.WebPubSubSharedPrivateLinkResources;
public final class WebPubSubSharedPrivateLinkResourcesImpl implements WebPubSubSharedPrivateLinkResources {
private static final ClientLogger LOGGER = new ClientLogger(WebPubSubSharedPrivateLinkResourcesImpl.class);
private final WebPubSubSharedPrivateLinkResourcesClient innerClient;
private final com.azure.resourcemanager.webpubsub.WebPubSubManager serviceManager;
public WebPubSubSharedPrivateLinkResourcesImpl(WebPubSubSharedPrivateLinkResourcesClient innerClient,
com.azure.resourcemanager.webpubsub.WebPubSubManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list(String resourceGroupName, String resourceName) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, resourceName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SharedPrivateLinkResourceImpl(inner1, this.manager()));
}
public PagedIterable list(String resourceGroupName, String resourceName,
Context context) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, resourceName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SharedPrivateLinkResourceImpl(inner1, this.manager()));
}
public Response getWithResponse(String sharedPrivateLinkResourceName,
String resourceGroupName, String resourceName, Context context) {
Response inner = this.serviceClient()
.getWithResponse(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new SharedPrivateLinkResourceImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public SharedPrivateLinkResource get(String sharedPrivateLinkResourceName, String resourceGroupName,
String resourceName) {
SharedPrivateLinkResourceInner inner
= this.serviceClient().get(sharedPrivateLinkResourceName, resourceGroupName, resourceName);
if (inner != null) {
return new SharedPrivateLinkResourceImpl(inner, this.manager());
} else {
return null;
}
}
public void delete(String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
this.serviceClient().delete(sharedPrivateLinkResourceName, resourceGroupName, resourceName);
}
public void delete(String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName,
Context context) {
this.serviceClient().delete(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context);
}
public SharedPrivateLinkResource getById(String id) {
String sharedPrivateLinkResourceName
= ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources");
if (sharedPrivateLinkResourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "webPubSub");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webPubSub'.", id)));
}
return this.getWithResponse(sharedPrivateLinkResourceName, resourceGroupName, resourceName, Context.NONE)
.getValue();
}
public Response getByIdWithResponse(String id, Context context) {
String sharedPrivateLinkResourceName
= ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources");
if (sharedPrivateLinkResourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "webPubSub");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webPubSub'.", id)));
}
return this.getWithResponse(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context);
}
public void deleteById(String id) {
String sharedPrivateLinkResourceName
= ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources");
if (sharedPrivateLinkResourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "webPubSub");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webPubSub'.", id)));
}
this.delete(sharedPrivateLinkResourceName, resourceGroupName, resourceName, Context.NONE);
}
public void deleteByIdWithResponse(String id, Context context) {
String sharedPrivateLinkResourceName
= ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources");
if (sharedPrivateLinkResourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "webPubSub");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webPubSub'.", id)));
}
this.delete(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context);
}
private WebPubSubSharedPrivateLinkResourcesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.webpubsub.WebPubSubManager manager() {
return this.serviceManager;
}
public SharedPrivateLinkResourceImpl define(String name) {
return new SharedPrivateLinkResourceImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy