com.azure.resourcemanager.confidentialledger.implementation.LedgersClientImpl 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.confidentialledger.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.Patch;
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.confidentialledger.fluent.LedgersClient;
import com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner;
import com.azure.resourcemanager.confidentialledger.models.ConfidentialLedgerList;
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 LedgersClient. */
public final class LedgersClientImpl implements LedgersClient {
/** The proxy service used to perform REST calls. */
private final LedgersService service;
/** The service client containing this operation class. */
private final ConfidentialLedgerManagementClientImpl client;
/**
* Initializes an instance of LedgersClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
LedgersClientImpl(ConfidentialLedgerManagementClientImpl client) {
this.service = RestProxy.create(LedgersService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ConfidentialLedgerManagementClientLedgers to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ConfidentialLedgerMa")
public interface LedgersService {
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> getByResourceGroup(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("ledgerName") String ledgerName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}")
@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("ledgerName") String ledgerName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> create(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("ledgerName") String ledgerName,
@BodyParam("application/json") ConfidentialLedgerInner confidentialLedger,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> update(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("ledgerName") String ledgerName,
@BodyParam("application/json") ConfidentialLedgerInner confidentialLedger,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroup(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("$filter") String filter,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers/")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("$filter") String filter,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupNext(
@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listBySubscriptionNext(
@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Retrieves information about a Confidential Ledger resource.
*
* Retrieves the properties of a Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 confidential Ledger along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(
String resourceGroupName, String ledgerName) {
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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.getByResourceGroup(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
ledgerName,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Retrieves information about a Confidential Ledger resource.
*
* Retrieves the properties of a Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 confidential Ledger along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(
String resourceGroupName, String ledgerName, 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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.getByResourceGroup(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
ledgerName,
accept,
context);
}
/**
* Retrieves information about a Confidential Ledger resource.
*
* Retrieves the properties of a Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 confidential Ledger on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getByResourceGroupAsync(String resourceGroupName, String ledgerName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, ledgerName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Retrieves information about a Confidential Ledger resource.
*
* Retrieves the properties of a Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 confidential Ledger along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(
String resourceGroupName, String ledgerName, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, ledgerName, context).block();
}
/**
* Retrieves information about a Confidential Ledger resource.
*
* Retrieves the properties of a Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConfidentialLedgerInner getByResourceGroup(String resourceGroupName, String ledgerName) {
return getByResourceGroupWithResponse(resourceGroupName, ledgerName, Context.NONE).getValue();
}
/**
* Deletes a Confidential Ledger resource.
*
*
Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String ledgerName) {
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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName 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,
ledgerName,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(
String resourceGroupName, String ledgerName, 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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName 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,
ledgerName,
accept,
context);
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String ledgerName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, ledgerName);
return this
.client
.getLroResult(
mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(
String resourceGroupName, String ledgerName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteWithResponseAsync(resourceGroupName, ledgerName, context);
return this
.client
.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String ledgerName) {
return this.beginDeleteAsync(resourceGroupName, ledgerName).getSyncPoller();
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(
String resourceGroupName, String ledgerName, Context context) {
return this.beginDeleteAsync(resourceGroupName, ledgerName, context).getSyncPoller();
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String ledgerName) {
return beginDeleteAsync(resourceGroupName, ledgerName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String ledgerName, Context context) {
return beginDeleteAsync(resourceGroupName, ledgerName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a Confidential Ledger resource.
*
* Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String ledgerName) {
deleteAsync(resourceGroupName, ledgerName).block();
}
/**
* Deletes a Confidential Ledger resource.
*
*
Deletes an existing Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String ledgerName, Context context) {
deleteAsync(resourceGroupName, ledgerName, context).block();
}
/**
* Creates a Confidential Ledger.
*
*
Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createWithResponseAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null."));
}
if (confidentialLedger == null) {
return Mono
.error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null."));
} else {
confidentialLedger.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.create(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
ledgerName,
confidentialLedger,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createWithResponseAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, 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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null."));
}
if (confidentialLedger == null) {
return Mono
.error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null."));
} else {
confidentialLedger.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.create(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
ledgerName,
confidentialLedger,
accept,
context);
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ConfidentialLedgerInner> beginCreateAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
Mono>> mono =
createWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger);
return this
.client
.getLroResult(
mono,
this.client.getHttpPipeline(),
ConfidentialLedgerInner.class,
ConfidentialLedgerInner.class,
this.client.getContext());
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ConfidentialLedgerInner> beginCreateAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
context = this.client.mergeContext(context);
Mono>> mono =
createWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger, context);
return this
.client
.getLroResult(
mono,
this.client.getHttpPipeline(),
ConfidentialLedgerInner.class,
ConfidentialLedgerInner.class,
context);
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConfidentialLedgerInner> beginCreate(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
return this.beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger).getSyncPoller();
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConfidentialLedgerInner> beginCreate(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
return this.beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger, context).getSyncPoller();
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
return beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
return beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a Confidential Ledger.
*
* Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConfidentialLedgerInner create(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
return createAsync(resourceGroupName, ledgerName, confidentialLedger).block();
}
/**
* Creates a Confidential Ledger.
*
*
Creates a Confidential Ledger with the specified ledger parameters.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger Create Request Body.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConfidentialLedgerInner create(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
return createAsync(resourceGroupName, ledgerName, confidentialLedger, context).block();
}
/**
* Update Confidential Ledger properties
*
*
Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null."));
}
if (confidentialLedger == null) {
return Mono
.error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null."));
} else {
confidentialLedger.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
ledgerName,
confidentialLedger,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, 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 (ledgerName == null) {
return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null."));
}
if (confidentialLedger == null) {
return Mono
.error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null."));
} else {
confidentialLedger.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.update(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
ledgerName,
confidentialLedger,
accept,
context);
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ConfidentialLedgerInner> beginUpdateAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
Mono>> mono =
updateWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger);
return this
.client
.getLroResult(
mono,
this.client.getHttpPipeline(),
ConfidentialLedgerInner.class,
ConfidentialLedgerInner.class,
this.client.getContext());
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ConfidentialLedgerInner> beginUpdateAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
context = this.client.mergeContext(context);
Mono>> mono =
updateWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger, context);
return this
.client
.getLroResult(
mono,
this.client.getHttpPipeline(),
ConfidentialLedgerInner.class,
ConfidentialLedgerInner.class,
context);
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConfidentialLedgerInner> beginUpdate(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
return this.beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger).getSyncPoller();
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConfidentialLedgerInner> beginUpdate(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
return this.beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger, context).getSyncPoller();
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
return beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
return beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update Confidential Ledger properties
*
* Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConfidentialLedgerInner update(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) {
return updateAsync(resourceGroupName, ledgerName, confidentialLedger).block();
}
/**
* Update Confidential Ledger properties
*
*
Updates properties of Confidential Ledger.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param ledgerName Name of the Confidential Ledger.
* @param confidentialLedger Confidential Ledger request body for Updating Ledger.
* @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 confidential Ledger.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConfidentialLedgerInner update(
String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) {
return updateAsync(resourceGroupName, ledgerName, confidentialLedger, context).block();
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
*
Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(
String resourceGroupName, String filter) {
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."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.listByResourceGroup(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
filter,
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()));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(
String resourceGroupName, String filter, 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."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByResourceGroup(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
filter,
accept,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName) {
final String filter = null;
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(
String resourceGroupName, String filter, Context context) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName) {
final String filter = null;
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription and resource group
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(
String resourceGroupName, String filter, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String filter) {
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."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.list(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
filter,
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()));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String filter, 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."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
filter,
accept,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String filter) {
return new PagedFlux<>(
() -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync() {
final String filter = null;
return new PagedFlux<>(
() -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String filter, Context context) {
return new PagedFlux<>(
() -> listSinglePageAsync(filter, context),
nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list() {
final String filter = null;
return new PagedIterable<>(listAsync(filter));
}
/**
* Retrieves information about all Confidential Ledger resources under the given subscription
*
* Retrieves the properties of all Confidential Ledgers.
*
* @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String filter, Context context) {
return new PagedIterable<>(listAsync(filter, context));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
* The nextLink parameter.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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
* The nextLink parameter.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(
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
.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
* The nextLink parameter.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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
* The nextLink parameter.
* @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 object that includes an array of Confidential Ledgers and a possible link for next set along with {@link
* PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionNextSinglePageAsync(
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
.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}