
com.azure.resourcemanager.appcontainers.implementation.ContainerAppsRevisionsClientImpl 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.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
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.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.appcontainers.fluent.ContainerAppsRevisionsClient;
import com.azure.resourcemanager.appcontainers.fluent.models.RevisionInner;
import com.azure.resourcemanager.appcontainers.models.DefaultErrorResponseErrorException;
import com.azure.resourcemanager.appcontainers.models.RevisionCollection;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in ContainerAppsRevisionsClient.
*/
public final class ContainerAppsRevisionsClientImpl implements ContainerAppsRevisionsClient {
/**
* The proxy service used to perform REST calls.
*/
private final ContainerAppsRevisionsService service;
/**
* The service client containing this operation class.
*/
private final ContainerAppsApiClientImpl client;
/**
* Initializes an instance of ContainerAppsRevisionsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ContainerAppsRevisionsClientImpl(ContainerAppsApiClientImpl client) {
this.service = RestProxy.create(ContainerAppsRevisionsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ContainerAppsApiClientContainerAppsRevisions to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ContainerAppsApiClie")
public interface ContainerAppsRevisionsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> listRevisions(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("containerAppName") String containerAppName, @QueryParam("api-version") String apiVersion,
@QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> getRevision(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("containerAppName") String containerAppName, @PathParam("revisionName") String revisionName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> activateRevision(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("containerAppName") String containerAppName, @PathParam("revisionName") String revisionName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> deactivateRevision(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("containerAppName") String containerAppName, @PathParam("revisionName") String revisionName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> restartRevision(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("containerAppName") String containerAppName, @PathParam("revisionName") String revisionName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(DefaultErrorResponseErrorException.class)
Mono> listRevisionsNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @param filter The filter to apply on the 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 Revisions for a given Container App along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listRevisionsSinglePageAsync(String resourceGroupName,
String containerAppName, 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."));
}
if (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listRevisions(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, containerAppName, this.client.getApiVersion(), 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()));
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @param filter The filter to apply on the operation.
* @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 Revisions for a given Container App along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listRevisionsSinglePageAsync(String resourceGroupName,
String containerAppName, 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."));
}
if (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listRevisions(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
containerAppName, this.client.getApiVersion(), filter, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @param filter The filter to apply on the 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 Revisions for a given Container App as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listRevisionsAsync(String resourceGroupName, String containerAppName,
String filter) {
return new PagedFlux<>(() -> listRevisionsSinglePageAsync(resourceGroupName, containerAppName, filter),
nextLink -> listRevisionsNextSinglePageAsync(nextLink));
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @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 Revisions for a given Container App as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listRevisionsAsync(String resourceGroupName, String containerAppName) {
final String filter = null;
return new PagedFlux<>(() -> listRevisionsSinglePageAsync(resourceGroupName, containerAppName, filter),
nextLink -> listRevisionsNextSinglePageAsync(nextLink));
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @param filter The filter to apply on the operation.
* @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 Revisions for a given Container App as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listRevisionsAsync(String resourceGroupName, String containerAppName,
String filter, Context context) {
return new PagedFlux<>(() -> listRevisionsSinglePageAsync(resourceGroupName, containerAppName, filter, context),
nextLink -> listRevisionsNextSinglePageAsync(nextLink, context));
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @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 Revisions for a given Container App as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listRevisions(String resourceGroupName, String containerAppName) {
final String filter = null;
return new PagedIterable<>(listRevisionsAsync(resourceGroupName, containerAppName, filter));
}
/**
* Get the Revisions for a given Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App for which Revisions are needed.
* @param filter The filter to apply on the operation.
* @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 Revisions for a given Container App as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listRevisions(String resourceGroupName, String containerAppName, String filter,
Context context) {
return new PagedIterable<>(listRevisionsAsync(resourceGroupName, containerAppName, filter, context));
}
/**
* Get a revision of a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 revision of a Container App along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getRevisionWithResponseAsync(String resourceGroupName,
String containerAppName, String revisionName) {
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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getRevision(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, containerAppName, revisionName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get a revision of a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 revision of a Container App along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getRevisionWithResponseAsync(String resourceGroupName,
String containerAppName, String revisionName, 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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getRevision(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
containerAppName, revisionName, this.client.getApiVersion(), accept, context);
}
/**
* Get a revision of a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 revision of a Container App on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getRevisionAsync(String resourceGroupName, String containerAppName,
String revisionName) {
return getRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get a revision of a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 revision of a Container App along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getRevisionWithResponse(String resourceGroupName, String containerAppName,
String revisionName, Context context) {
return getRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName, context).block();
}
/**
* Get a revision of a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 revision of a Container App.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RevisionInner getRevision(String resourceGroupName, String containerAppName, String revisionName) {
return getRevisionWithResponse(resourceGroupName, containerAppName, revisionName, Context.NONE).getValue();
}
/**
* Activates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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> activateRevisionWithResponseAsync(String resourceGroupName, String containerAppName,
String revisionName) {
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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.activateRevision(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, containerAppName, revisionName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Activates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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> activateRevisionWithResponseAsync(String resourceGroupName, String containerAppName,
String revisionName, 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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.activateRevision(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
containerAppName, revisionName, this.client.getApiVersion(), accept, context);
}
/**
* Activates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 activateRevisionAsync(String resourceGroupName, String containerAppName, String revisionName) {
return activateRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName)
.flatMap(ignored -> Mono.empty());
}
/**
* Activates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response activateRevisionWithResponse(String resourceGroupName, String containerAppName,
String revisionName, Context context) {
return activateRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName, context).block();
}
/**
* Activates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 activateRevision(String resourceGroupName, String containerAppName, String revisionName) {
activateRevisionWithResponse(resourceGroupName, containerAppName, revisionName, Context.NONE);
}
/**
* Deactivates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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> deactivateRevisionWithResponseAsync(String resourceGroupName, String containerAppName,
String revisionName) {
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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.deactivateRevision(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, containerAppName, revisionName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deactivates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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> deactivateRevisionWithResponseAsync(String resourceGroupName, String containerAppName,
String revisionName, 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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.deactivateRevision(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
containerAppName, revisionName, this.client.getApiVersion(), accept, context);
}
/**
* Deactivates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 deactivateRevisionAsync(String resourceGroupName, String containerAppName, String revisionName) {
return deactivateRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName)
.flatMap(ignored -> Mono.empty());
}
/**
* Deactivates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deactivateRevisionWithResponse(String resourceGroupName, String containerAppName,
String revisionName, Context context) {
return deactivateRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName, context).block();
}
/**
* Deactivates a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 deactivateRevision(String resourceGroupName, String containerAppName, String revisionName) {
deactivateRevisionWithResponse(resourceGroupName, containerAppName, revisionName, Context.NONE);
}
/**
* Restarts a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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> restartRevisionWithResponseAsync(String resourceGroupName, String containerAppName,
String revisionName) {
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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.restartRevision(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, containerAppName, revisionName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Restarts a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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> restartRevisionWithResponseAsync(String resourceGroupName, String containerAppName,
String revisionName, 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 (containerAppName == null) {
return Mono
.error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null."));
}
if (revisionName == null) {
return Mono.error(new IllegalArgumentException("Parameter revisionName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.restartRevision(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
containerAppName, revisionName, this.client.getApiVersion(), accept, context);
}
/**
* Restarts a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 restartRevisionAsync(String resourceGroupName, String containerAppName, String revisionName) {
return restartRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName)
.flatMap(ignored -> Mono.empty());
}
/**
* Restarts a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response restartRevisionWithResponse(String resourceGroupName, String containerAppName,
String revisionName, Context context) {
return restartRevisionWithResponseAsync(resourceGroupName, containerAppName, revisionName, context).block();
}
/**
* Restarts a revision for a Container App.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param containerAppName Name of the Container App.
* @param revisionName Name of the Container App Revision.
* @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 restartRevision(String resourceGroupName, String containerAppName, String revisionName) {
restartRevisionWithResponse(resourceGroupName, containerAppName, revisionName, Context.NONE);
}
/**
* 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 container App Revisions collection ARM resource along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listRevisionsNextSinglePageAsync(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.listRevisionsNext(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 container App Revisions collection ARM resource along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listRevisionsNextSinglePageAsync(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.listRevisionsNext(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