NotebookWorkspacesClientImpl.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.cosmos.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.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.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.cosmos.fluent.NotebookWorkspacesClient;
import com.azure.resourcemanager.cosmos.fluent.models.NotebookWorkspaceConnectionInfoResultInner;
import com.azure.resourcemanager.cosmos.fluent.models.NotebookWorkspaceInner;
import com.azure.resourcemanager.cosmos.models.ArmProxyResource;
import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceListResult;
import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName;
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 NotebookWorkspacesClient. */
public final class NotebookWorkspacesClientImpl implements NotebookWorkspacesClient {
private final ClientLogger logger = new ClientLogger(NotebookWorkspacesClientImpl.class);
/** The proxy service used to perform REST calls. */
private final NotebookWorkspacesService service;
/** The service client containing this operation class. */
private final CosmosDBManagementClientImpl client;
/**
* Initializes an instance of NotebookWorkspacesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
NotebookWorkspacesClientImpl(CosmosDBManagementClientImpl client) {
this.service =
RestProxy.create(NotebookWorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for CosmosDBManagementClientNotebookWorkspaces to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "CosmosDBManagementCl")
private interface NotebookWorkspacesService {
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<NotebookWorkspaceListResult>> listByDatabaseAccount(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<NotebookWorkspaceInner>> get(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName,
@BodyParam("application/json") ArmProxyResource notebookCreateUpdateParameters,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}")
@ExpectedResponses({202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<NotebookWorkspaceConnectionInfoResultInner>> listConnectionInfo(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> regenerateAuthToken(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB"
+ "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> start(
@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("accountName") String accountName,
@PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Gets the notebook workspace resources of an existing Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace resources of an existing Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<NotebookWorkspaceInner>> listByDatabaseAccountSinglePageAsync(
String resourceGroupName, String accountName) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.listByDatabaseAccount(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
accept,
context))
.<PagedResponse<NotebookWorkspaceInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets the notebook workspace resources of an existing Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace resources of an existing Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<NotebookWorkspaceInner>> listByDatabaseAccountSinglePageAsync(
String resourceGroupName, String accountName, 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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByDatabaseAccount(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
accept,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));
}
/**
* Gets the notebook workspace resources of an existing Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace resources of an existing Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<NotebookWorkspaceInner> listByDatabaseAccountAsync(String resourceGroupName, String accountName) {
return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName));
}
/**
* Gets the notebook workspace resources of an existing Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace resources of an existing Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<NotebookWorkspaceInner> listByDatabaseAccountAsync(
String resourceGroupName, String accountName, Context context) {
return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context));
}
/**
* Gets the notebook workspace resources of an existing Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace resources of an existing Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<NotebookWorkspaceInner> listByDatabaseAccount(String resourceGroupName, String accountName) {
return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName));
}
/**
* Gets the notebook workspace resources of an existing Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace resources of an existing Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<NotebookWorkspaceInner> listByDatabaseAccount(
String resourceGroupName, String accountName, Context context) {
return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context));
}
/**
* Gets the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace for a Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<NotebookWorkspaceInner>> getWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace for a Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<NotebookWorkspaceInner>> getWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, 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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context);
}
/**
* Gets the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace for a Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<NotebookWorkspaceInner> getAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName)
.flatMap(
(Response<NotebookWorkspaceInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace for a Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public NotebookWorkspaceInner get(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return getAsync(resourceGroupName, accountName, notebookWorkspaceName).block();
}
/**
* Gets the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the notebook workspace for a Cosmos DB account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<NotebookWorkspaceInner> getWithResponse(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block();
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
if (notebookCreateUpdateParameters == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter notebookCreateUpdateParameters is required and cannot be null."));
} else {
notebookCreateUpdateParameters.validate();
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
notebookCreateUpdateParameters,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters,
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
if (notebookCreateUpdateParameters == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter notebookCreateUpdateParameters is required and cannot be null."));
} else {
notebookCreateUpdateParameters.validate();
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
notebookCreateUpdateParameters,
accept,
context);
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<NotebookWorkspaceInner>, NotebookWorkspaceInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters) {
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters);
return this
.client
.<NotebookWorkspaceInner, NotebookWorkspaceInner>getLroResult(
mono,
this.client.getHttpPipeline(),
NotebookWorkspaceInner.class,
NotebookWorkspaceInner.class,
Context.NONE);
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<NotebookWorkspaceInner>, NotebookWorkspaceInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context);
return this
.client
.<NotebookWorkspaceInner, NotebookWorkspaceInner>getLroResult(
mono,
this.client.getHttpPipeline(),
NotebookWorkspaceInner.class,
NotebookWorkspaceInner.class,
context);
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<NotebookWorkspaceInner>, NotebookWorkspaceInner> beginCreateOrUpdate(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters) {
return beginCreateOrUpdateAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters)
.getSyncPoller();
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<NotebookWorkspaceInner>, NotebookWorkspaceInner> beginCreateOrUpdate(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters,
Context context) {
return beginCreateOrUpdateAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context)
.getSyncPoller();
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<NotebookWorkspaceInner> createOrUpdateAsync(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters) {
return beginCreateOrUpdateAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<NotebookWorkspaceInner> createOrUpdateAsync(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters,
Context context) {
return beginCreateOrUpdateAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public NotebookWorkspaceInner createOrUpdate(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters) {
return createOrUpdateAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters)
.block();
}
/**
* Creates the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param notebookCreateUpdateParameters The resource model definition for a ARM proxy resource. It will have
* everything other than required location and tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a notebook workspace resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public NotebookWorkspaceInner createOrUpdate(
String resourceGroupName,
String accountName,
NotebookWorkspaceName notebookWorkspaceName,
ArmProxyResource notebookCreateUpdateParameters,
Context context) {
return createOrUpdateAsync(
resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context)
.block();
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, 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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context);
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller();
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context).getSyncPoller();
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
deleteAsync(resourceGroupName, accountName, notebookWorkspaceName).block();
}
/**
* Deletes the notebook workspace for a Cosmos DB account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
deleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block();
}
/**
* Retrieves the connection info for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the connection info for the given notebook workspace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<NotebookWorkspaceConnectionInfoResultInner>> listConnectionInfoWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.listConnectionInfo(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Retrieves the connection info for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the connection info for the given notebook workspace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<NotebookWorkspaceConnectionInfoResultInner>> listConnectionInfoWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, 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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listConnectionInfo(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context);
}
/**
* Retrieves the connection info for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the connection info for the given notebook workspace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<NotebookWorkspaceConnectionInfoResultInner> listConnectionInfoAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName)
.flatMap(
(Response<NotebookWorkspaceConnectionInfoResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves the connection info for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the connection info for the given notebook workspace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public NotebookWorkspaceConnectionInfoResultInner listConnectionInfo(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return listConnectionInfoAsync(resourceGroupName, accountName, notebookWorkspaceName).block();
}
/**
* Retrieves the connection info for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the connection info for the given notebook workspace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<NotebookWorkspaceConnectionInfoResultInner> listConnectionInfoWithResponse(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context)
.block();
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> regenerateAuthTokenWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.regenerateAuthToken(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> regenerateAuthTokenWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, 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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.regenerateAuthToken(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context);
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginRegenerateAuthTokenAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
Mono<Response<Flux<ByteBuffer>>> mono =
regenerateAuthTokenWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginRegenerateAuthTokenAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
regenerateAuthTokenWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRegenerateAuthToken(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller();
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRegenerateAuthToken(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context)
.getSyncPoller();
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> regenerateAuthTokenAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> regenerateAuthTokenAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void regenerateAuthToken(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
regenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName).block();
}
/**
* Regenerates the auth token for the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void regenerateAuthToken(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
regenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block();
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.start(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, 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 (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (notebookWorkspaceName == null) {
return Mono
.error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null."));
}
final String apiVersion = "2020-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.start(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
apiVersion,
accountName,
notebookWorkspaceName,
accept,
context);
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginStartAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
Mono<Response<Flux<ByteBuffer>>> mono =
startWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginStartAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
startWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStart(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller();
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStart(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName, context).getSyncPoller();
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> startAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> startAsync(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) {
startAsync(resourceGroupName, accountName, notebookWorkspaceName).block();
}
/**
* Starts the notebook workspace.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param notebookWorkspaceName The name of the notebook workspace resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(
String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) {
startAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block();
}
}