com.azure.resourcemanager.digitaltwins.implementation.DigitalTwinsEndpointsClientImpl 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.digitaltwins.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.digitaltwins.fluent.DigitalTwinsEndpointsClient;
import com.azure.resourcemanager.digitaltwins.fluent.models.DigitalTwinsEndpointResourceInner;
import com.azure.resourcemanager.digitaltwins.models.DigitalTwinsEndpointResourceListResult;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in DigitalTwinsEndpointsClient.
*/
public final class DigitalTwinsEndpointsClientImpl implements DigitalTwinsEndpointsClient {
/**
* The proxy service used to perform REST calls.
*/
private final DigitalTwinsEndpointsService service;
/**
* The service client containing this operation class.
*/
private final AzureDigitalTwinsManagementClientImpl client;
/**
* Initializes an instance of DigitalTwinsEndpointsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DigitalTwinsEndpointsClientImpl(AzureDigitalTwinsManagementClientImpl client) {
this.service = RestProxy.create(DigitalTwinsEndpointsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for AzureDigitalTwinsManagementClientDigitalTwinsEndpoints to be used by
* the proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "AzureDigitalTwinsMan")
public interface DigitalTwinsEndpointsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("endpointName") String endpointName, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("endpointName") String endpointName,
@BodyParam("application/json") DigitalTwinsEndpointResourceInner endpointDescription,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName,
@PathParam("endpointName") String endpointName, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Get DigitalTwinsInstance Endpoints.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance Endpoints along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName,
String resourceName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get DigitalTwinsInstance Endpoints.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance Endpoints along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName,
String resourceName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get DigitalTwinsInstance Endpoints.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance Endpoints as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String resourceName) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, resourceName),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Get DigitalTwinsInstance Endpoints.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance Endpoints as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String resourceName,
Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, resourceName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Get DigitalTwinsInstance Endpoints.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance Endpoints as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String resourceName) {
return new PagedIterable<>(listAsync(resourceGroupName, resourceName));
}
/**
* Get DigitalTwinsInstance Endpoints.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance Endpoints as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String resourceName,
Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, resourceName, context));
}
/**
* Get DigitalTwinsInstances Endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstances Endpoint along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String resourceName, String endpointName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (endpointName == null) {
return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, resourceName, endpointName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get DigitalTwinsInstances Endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstances Endpoint along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String resourceName, String endpointName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (endpointName == null) {
return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, endpointName, accept, context);
}
/**
* Get DigitalTwinsInstances Endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstances Endpoint on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceGroupName, String resourceName,
String endpointName) {
return getWithResponseAsync(resourceGroupName, resourceName, endpointName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get DigitalTwinsInstances Endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstances Endpoint along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String resourceName,
String endpointName, Context context) {
return getWithResponseAsync(resourceGroupName, resourceName, endpointName, context).block();
}
/**
* Get DigitalTwinsInstances Endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstances Endpoint.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DigitalTwinsEndpointResourceInner get(String resourceGroupName, String resourceName, String endpointName) {
return getWithResponse(resourceGroupName, resourceName, endpointName, Context.NONE).getValue();
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String resourceName, String endpointName, DigitalTwinsEndpointResourceInner endpointDescription) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (endpointName == null) {
return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null."));
}
if (endpointDescription == null) {
return Mono
.error(new IllegalArgumentException("Parameter endpointDescription is required and cannot be null."));
} else {
endpointDescription.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, resourceName, endpointName, endpointDescription,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String resourceName, String endpointName, DigitalTwinsEndpointResourceInner endpointDescription,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (endpointName == null) {
return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null."));
}
if (endpointDescription == null) {
return Mono
.error(new IllegalArgumentException("Parameter endpointDescription is required and cannot be null."));
} else {
endpointDescription.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, resourceName, endpointName, endpointDescription, accept,
context);
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DigitalTwinsEndpointResourceInner>
beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, String endpointName,
DigitalTwinsEndpointResourceInner endpointDescription) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, resourceName, endpointName, endpointDescription);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), DigitalTwinsEndpointResourceInner.class,
DigitalTwinsEndpointResourceInner.class, this.client.getContext());
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DigitalTwinsEndpointResourceInner>
beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, String endpointName,
DigitalTwinsEndpointResourceInner endpointDescription, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, resourceName,
endpointName, endpointDescription, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), DigitalTwinsEndpointResourceInner.class,
DigitalTwinsEndpointResourceInner.class, context);
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DigitalTwinsEndpointResourceInner>
beginCreateOrUpdate(String resourceGroupName, String resourceName, String endpointName,
DigitalTwinsEndpointResourceInner endpointDescription) {
return this.beginCreateOrUpdateAsync(resourceGroupName, resourceName, endpointName, endpointDescription)
.getSyncPoller();
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DigitalTwinsEndpointResourceInner>
beginCreateOrUpdate(String resourceGroupName, String resourceName, String endpointName,
DigitalTwinsEndpointResourceInner endpointDescription, Context context) {
return this
.beginCreateOrUpdateAsync(resourceGroupName, resourceName, endpointName, endpointDescription, context)
.getSyncPoller();
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String resourceName,
String endpointName, DigitalTwinsEndpointResourceInner endpointDescription) {
return beginCreateOrUpdateAsync(resourceGroupName, resourceName, endpointName, endpointDescription).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String resourceName,
String endpointName, DigitalTwinsEndpointResourceInner endpointDescription, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, resourceName, endpointName, endpointDescription, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DigitalTwinsEndpointResourceInner createOrUpdate(String resourceGroupName, String resourceName,
String endpointName, DigitalTwinsEndpointResourceInner endpointDescription) {
return createOrUpdateAsync(resourceGroupName, resourceName, endpointName, endpointDescription).block();
}
/**
* Create or update DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DigitalTwinsEndpointResourceInner createOrUpdate(String resourceGroupName, String resourceName,
String endpointName, DigitalTwinsEndpointResourceInner endpointDescription, Context context) {
return createOrUpdateAsync(resourceGroupName, resourceName, endpointName, endpointDescription, context).block();
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceName,
String endpointName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (endpointName == null) {
return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, resourceName, endpointName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceName,
String endpointName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (endpointName == null) {
return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, resourceName, endpointName, accept, context);
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DigitalTwinsEndpointResourceInner>
beginDeleteAsync(String resourceGroupName, String resourceName, String endpointName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, endpointName);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), DigitalTwinsEndpointResourceInner.class,
DigitalTwinsEndpointResourceInner.class, this.client.getContext());
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DigitalTwinsEndpointResourceInner>
beginDeleteAsync(String resourceGroupName, String resourceName, String endpointName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, resourceName, endpointName, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), DigitalTwinsEndpointResourceInner.class,
DigitalTwinsEndpointResourceInner.class, context);
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DigitalTwinsEndpointResourceInner>
beginDelete(String resourceGroupName, String resourceName, String endpointName) {
return this.beginDeleteAsync(resourceGroupName, resourceName, endpointName).getSyncPoller();
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DigitalTwinsEndpointResourceInner>
beginDelete(String resourceGroupName, String resourceName, String endpointName, Context context) {
return this.beginDeleteAsync(resourceGroupName, resourceName, endpointName, context).getSyncPoller();
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String resourceName,
String endpointName) {
return beginDeleteAsync(resourceGroupName, resourceName, endpointName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String resourceName,
String endpointName, Context context) {
return beginDeleteAsync(resourceGroupName, resourceName, endpointName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DigitalTwinsEndpointResourceInner delete(String resourceGroupName, String resourceName,
String endpointName) {
return deleteAsync(resourceGroupName, resourceName, endpointName).block();
}
/**
* Delete a DigitalTwinsInstance endpoint.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param endpointName Name of Endpoint Resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return digitalTwinsInstance endpoint resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DigitalTwinsEndpointResourceInner delete(String resourceGroupName, String resourceName, String endpointName,
Context context) {
return deleteAsync(resourceGroupName, resourceName, endpointName, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of DigitalTwinsInstance Endpoints with a next link along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of DigitalTwinsInstance Endpoints with a next link along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink,
Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy