
com.azure.resourcemanager.appcontainers.implementation.ManagedEnvironmentsClientImpl 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.appcontainers.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.Post;
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.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.appcontainers.fluent.ManagedEnvironmentsClient;
import com.azure.resourcemanager.appcontainers.fluent.models.EnvironmentAuthTokenInner;
import com.azure.resourcemanager.appcontainers.fluent.models.ManagedEnvironmentInner;
import com.azure.resourcemanager.appcontainers.fluent.models.WorkloadProfileStatesInner;
import com.azure.resourcemanager.appcontainers.models.DefaultErrorResponseErrorException;
import com.azure.resourcemanager.appcontainers.models.ManagedEnvironmentsCollection;
import com.azure.resourcemanager.appcontainers.models.WorkloadProfileStatesCollection;
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 ManagedEnvironmentsClient.
*/
public final class ManagedEnvironmentsClientImpl implements ManagedEnvironmentsClient {
/**
* The proxy service used to perform REST calls.
*/
private final ManagedEnvironmentsService service;
/**
* The service client containing this operation class.
*/
private final ContainerAppsApiClientImpl client;
/**
* Initializes an instance of ManagedEnvironmentsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ManagedEnvironmentsClientImpl(ContainerAppsApiClientImpl client) {
this.service = RestProxy.create(ManagedEnvironmentsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ContainerAppsApiClientManagedEnvironments to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ContainerAppsApiClie")
public interface ManagedEnvironmentsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> listByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> getByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("environmentName") String environmentName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("environmentName") String environmentName, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ManagedEnvironmentInner environmentEnvelope,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("environmentName") String environmentName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("environmentName") String environmentName, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ManagedEnvironmentInner environmentEnvelope,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> getAuthToken(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("environmentName") String environmentName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> listWorkloadProfileStates(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
@PathParam("environmentName") String environmentName, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> listBySubscriptionNext(
@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(DefaultErrorResponseErrorException.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(DefaultErrorResponseErrorException.class)
Mono> listWorkloadProfileStatesNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Get all Environments for a subscription.
*
* Get all Managed Environments for a subscription.
*
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all Managed Environments for a subscription along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync() {
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.getSubscriptionId(),
this.client.getApiVersion(), 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 all Environments for a subscription.
*
* Get all Managed Environments for a subscription.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all Managed Environments for a subscription along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(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.getSubscriptionId(), this.client.getApiVersion(), accept,
context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get all Environments for a subscription.
*
* Get all Managed Environments for a subscription.
*
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all Managed Environments for a subscription as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync() {
return new PagedFlux<>(() -> listSinglePageAsync(),
nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
}
/**
* Get all Environments for a subscription.
*
* Get all Managed Environments for a subscription.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all Managed Environments for a subscription as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(context),
nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context));
}
/**
* Get all Environments for a subscription.
*
* Get all Managed Environments for a subscription.
*
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all Managed Environments for a subscription as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list() {
return new PagedIterable<>(listAsync());
}
/**
* Get all Environments for a subscription.
*
* Get all Managed Environments for a subscription.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all Managed Environments for a subscription as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(Context context) {
return new PagedIterable<>(listAsync(context));
}
/**
* Get all the Environments in a resource group.
*
* Get all the Managed Environments in a resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the Managed Environments in a resource group along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) {
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.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 all the Environments in a resource group.
*
* Get all the Managed Environments in a resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the Managed Environments in a resource group along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName,
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.getSubscriptionId(), resourceGroupName,
this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get all the Environments in a resource group.
*
* Get all the Managed Environments in a resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the Managed Environments in a resource group as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* Get all the Environments in a resource group.
*
* Get all the Managed Environments in a resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the Managed Environments in a resource group as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
}
/**
* Get all the Environments in a resource group.
*
* Get all the Managed Environments in a resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the Managed Environments in a resource group as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
}
/**
* Get all the Environments in a resource group.
*
* Get all the Managed Environments in a resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the Managed Environments in a resource group as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}
/**
* Get the properties of a Managed Environment.
*
* Get the properties of a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the properties of a Managed Environment used to host container apps along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
String environmentName) {
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, environmentName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the properties of a Managed Environment.
*
* Get the properties of a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the properties of a Managed Environment used to host container apps along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
String environmentName, 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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
environmentName, this.client.getApiVersion(), accept, context);
}
/**
* Get the properties of a Managed Environment.
*
* Get the properties of a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the properties of a Managed Environment used to host container apps on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getByResourceGroupAsync(String resourceGroupName, String environmentName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, environmentName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get the properties of a Managed Environment.
*
* Get the properties of a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the properties of a Managed Environment used to host container apps along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(String resourceGroupName,
String environmentName, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, environmentName, context).block();
}
/**
* Get the properties of a Managed Environment.
*
* Get the properties of a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the properties of a Managed Environment used to host container apps.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedEnvironmentInner getByResourceGroup(String resourceGroupName, String environmentName) {
return getByResourceGroupWithResponse(resourceGroupName, environmentName, Context.NONE).getValue();
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String environmentName, ManagedEnvironmentInner environmentEnvelope) {
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
if (environmentEnvelope == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentEnvelope is required and cannot be null."));
} else {
environmentEnvelope.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, environmentName, this.client.getApiVersion(), environmentEnvelope, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String environmentName, ManagedEnvironmentInner environmentEnvelope, 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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
if (environmentEnvelope == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentEnvelope is required and cannot be null."));
} else {
environmentEnvelope.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
environmentName, this.client.getApiVersion(), environmentEnvelope, accept, context);
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ManagedEnvironmentInner> beginCreateOrUpdateAsync(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, environmentName, environmentEnvelope);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ManagedEnvironmentInner.class, ManagedEnvironmentInner.class,
this.client.getContext());
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ManagedEnvironmentInner> beginCreateOrUpdateAsync(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, environmentName, environmentEnvelope, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ManagedEnvironmentInner.class, ManagedEnvironmentInner.class, context);
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ManagedEnvironmentInner> beginCreateOrUpdate(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope) {
return this.beginCreateOrUpdateAsync(resourceGroupName, environmentName, environmentEnvelope).getSyncPoller();
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ManagedEnvironmentInner> beginCreateOrUpdate(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope,
Context context) {
return this.beginCreateOrUpdateAsync(resourceGroupName, environmentName, environmentEnvelope, context)
.getSyncPoller();
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope) {
return beginCreateOrUpdateAsync(resourceGroupName, environmentName, environmentEnvelope).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, environmentName, environmentEnvelope, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedEnvironmentInner createOrUpdate(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope) {
return createOrUpdateAsync(resourceGroupName, environmentName, environmentEnvelope).block();
}
/**
* Creates or updates a Managed Environment.
*
* Creates or updates a Managed Environment used to host container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedEnvironmentInner createOrUpdate(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope, Context context) {
return createOrUpdateAsync(resourceGroupName, environmentName, environmentEnvelope, context).block();
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName) {
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, environmentName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName,
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
environmentName, this.client.getApiVersion(), accept, context);
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, environmentName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteWithResponseAsync(resourceGroupName, environmentName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName) {
return this.beginDeleteAsync(resourceGroupName, environmentName).getSyncPoller();
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName,
Context context) {
return this.beginDeleteAsync(resourceGroupName, environmentName, context).getSyncPoller();
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName) {
return beginDeleteAsync(resourceGroupName, environmentName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName, Context context) {
return beginDeleteAsync(resourceGroupName, environmentName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName) {
deleteAsync(resourceGroupName, environmentName).block();
}
/**
* Delete a Managed Environment.
*
* Delete a Managed Environment if it does not have any container apps.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 environmentName, Context context) {
deleteAsync(resourceGroupName, environmentName, context).block();
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope) {
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
if (environmentEnvelope == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentEnvelope is required and cannot be null."));
} else {
environmentEnvelope.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, environmentName, this.client.getApiVersion(), environmentEnvelope, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope, 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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
if (environmentEnvelope == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentEnvelope is required and cannot be null."));
} else {
environmentEnvelope.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
environmentName, this.client.getApiVersion(), environmentEnvelope, accept, context);
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ManagedEnvironmentInner> beginUpdateAsync(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, environmentName, environmentEnvelope);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ManagedEnvironmentInner.class, ManagedEnvironmentInner.class,
this.client.getContext());
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ManagedEnvironmentInner> beginUpdateAsync(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, environmentName, environmentEnvelope, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ManagedEnvironmentInner.class, ManagedEnvironmentInner.class, context);
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ManagedEnvironmentInner>
beginUpdate(String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope) {
return this.beginUpdateAsync(resourceGroupName, environmentName, environmentEnvelope).getSyncPoller();
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException 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 an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ManagedEnvironmentInner> beginUpdate(
String resourceGroupName, String environmentName, ManagedEnvironmentInner environmentEnvelope,
Context context) {
return this.beginUpdateAsync(resourceGroupName, environmentName, environmentEnvelope, context).getSyncPoller();
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope) {
return beginUpdateAsync(resourceGroupName, environmentName, environmentEnvelope).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope, Context context) {
return beginUpdateAsync(resourceGroupName, environmentName, environmentEnvelope, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedEnvironmentInner update(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope) {
return updateAsync(resourceGroupName, environmentName, environmentEnvelope).block();
}
/**
* Update Managed Environment's properties.
*
* Patches a Managed Environment using JSON Merge Patch.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Environment.
* @param environmentEnvelope Configuration details of the Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an environment for hosting container apps.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ManagedEnvironmentInner update(String resourceGroupName, String environmentName,
ManagedEnvironmentInner environmentEnvelope, Context context) {
return updateAsync(resourceGroupName, environmentName, environmentEnvelope, context).block();
}
/**
* Get auth token for a managed environment
*
* Checks if resource name is available.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return environment Auth Token along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getAuthTokenWithResponseAsync(String resourceGroupName,
String environmentName) {
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getAuthToken(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, environmentName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get auth token for a managed environment
*
* Checks if resource name is available.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return environment Auth Token along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getAuthTokenWithResponseAsync(String resourceGroupName,
String environmentName, 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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getAuthToken(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
environmentName, this.client.getApiVersion(), accept, context);
}
/**
* Get auth token for a managed environment
*
* Checks if resource name is available.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return environment Auth Token on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAuthTokenAsync(String resourceGroupName, String environmentName) {
return getAuthTokenWithResponseAsync(resourceGroupName, environmentName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get auth token for a managed environment
*
* Checks if resource name is available.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return environment Auth Token along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getAuthTokenWithResponse(String resourceGroupName,
String environmentName, Context context) {
return getAuthTokenWithResponseAsync(resourceGroupName, environmentName, context).block();
}
/**
* Get auth token for a managed environment
*
* Checks if resource name is available.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return environment Auth Token.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public EnvironmentAuthTokenInner getAuthToken(String resourceGroupName, String environmentName) {
return getAuthTokenWithResponse(resourceGroupName, environmentName, Context.NONE).getValue();
}
/**
* Get all workload Profile States for a Managed Environment..
*
* Get all workload Profile States for a Managed Environment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all workload Profile States for a Managed Environment along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listWorkloadProfileStatesSinglePageAsync(String resourceGroupName, String environmentName) {
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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listWorkloadProfileStates(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, this.client.getApiVersion(), environmentName, 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 all workload Profile States for a Managed Environment..
*
* Get all workload Profile States for a Managed Environment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all workload Profile States for a Managed Environment along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listWorkloadProfileStatesSinglePageAsync(String resourceGroupName, String environmentName, 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 (environmentName == null) {
return Mono
.error(new IllegalArgumentException("Parameter environmentName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listWorkloadProfileStates(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
this.client.getApiVersion(), environmentName, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get all workload Profile States for a Managed Environment..
*
* Get all workload Profile States for a Managed Environment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all workload Profile States for a Managed Environment as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listWorkloadProfileStatesAsync(String resourceGroupName,
String environmentName) {
return new PagedFlux<>(() -> listWorkloadProfileStatesSinglePageAsync(resourceGroupName, environmentName),
nextLink -> listWorkloadProfileStatesNextSinglePageAsync(nextLink));
}
/**
* Get all workload Profile States for a Managed Environment..
*
* Get all workload Profile States for a Managed Environment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all workload Profile States for a Managed Environment as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listWorkloadProfileStatesAsync(String resourceGroupName,
String environmentName, Context context) {
return new PagedFlux<>(
() -> listWorkloadProfileStatesSinglePageAsync(resourceGroupName, environmentName, context),
nextLink -> listWorkloadProfileStatesNextSinglePageAsync(nextLink, context));
}
/**
* Get all workload Profile States for a Managed Environment..
*
* Get all workload Profile States for a Managed Environment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all workload Profile States for a Managed Environment as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listWorkloadProfileStates(String resourceGroupName,
String environmentName) {
return new PagedIterable<>(listWorkloadProfileStatesAsync(resourceGroupName, environmentName));
}
/**
* Get all workload Profile States for a Managed Environment..
*
* Get all workload Profile States for a Managed Environment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param environmentName Name of the Managed Environment.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all workload Profile States for a Managed Environment as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listWorkloadProfileStates(String resourceGroupName,
String environmentName, Context context) {
return new PagedIterable<>(listWorkloadProfileStatesAsync(resourceGroupName, environmentName, context));
}
/**
* 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 DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of Environments 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.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of Environments 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));
}
/**
* 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 DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of Environments 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.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of Environments 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.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of workloadProfileStates along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listWorkloadProfileStatesNextSinglePageAsync(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.listWorkloadProfileStatesNext(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 DefaultErrorResponseErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of workloadProfileStates along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listWorkloadProfileStatesNextSinglePageAsync(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.listWorkloadProfileStatesNext(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