![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.keyvault.implementation.SecretsClientImpl 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.keyvault.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.keyvault.fluent.SecretsClient;
import com.azure.resourcemanager.keyvault.fluent.models.SecretInner;
import com.azure.resourcemanager.keyvault.models.SecretCreateOrUpdateParameters;
import com.azure.resourcemanager.keyvault.models.SecretListResult;
import com.azure.resourcemanager.keyvault.models.SecretPatchParameters;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in SecretsClient.
*/
public final class SecretsClientImpl implements SecretsClient {
/**
* The proxy service used to perform REST calls.
*/
private final SecretsService service;
/**
* The service client containing this operation class.
*/
private final KeyVaultManagementClientImpl client;
/**
* Initializes an instance of SecretsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
SecretsClientImpl(KeyVaultManagementClientImpl client) {
this.service = RestProxy.create(SecretsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for KeyVaultManagementClientSecrets to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "KeyVaultManagementCl")
public interface SecretsService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName,
@PathParam("secretName") String secretName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") SecretCreateOrUpdateParameters parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> update(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName,
@PathParam("secretName") String secretName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") SecretPatchParameters parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName,
@PathParam("secretName") String secretName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName,
@QueryParam("$top") Integer top, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context);
}
/**
* Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal
* use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret. The value you provide may be copied globally for the purpose of running the
* service. The value provided should not include personally identifiable or sensitive information.
* @param parameters Parameters to create or update the secret.
* @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 resource information with extended details along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String vaultName,
String secretName, SecretCreateOrUpdateParameters parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (secretName == null) {
return Mono.error(new IllegalArgumentException("Parameter secretName 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 (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, vaultName,
secretName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal
* use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret. The value you provide may be copied globally for the purpose of running the
* service. The value provided should not include personally identifiable or sensitive information.
* @param parameters Parameters to create or update the secret.
* @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 resource information with extended details along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String vaultName,
String secretName, SecretCreateOrUpdateParameters parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (secretName == null) {
return Mono.error(new IllegalArgumentException("Parameter secretName 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 (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, vaultName, secretName,
this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal
* use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret. The value you provide may be copied globally for the purpose of running the
* service. The value provided should not include personally identifiable or sensitive information.
* @param parameters Parameters to create or update the secret.
* @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 resource information with extended details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String vaultName, String secretName,
SecretCreateOrUpdateParameters parameters) {
return createOrUpdateWithResponseAsync(resourceGroupName, vaultName, secretName, parameters)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal
* use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret. The value you provide may be copied globally for the purpose of running the
* service. The value provided should not include personally identifiable or sensitive information.
* @param parameters Parameters to create or update the secret.
* @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 resource information with extended details along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String resourceGroupName, String vaultName,
String secretName, SecretCreateOrUpdateParameters parameters, Context context) {
return createOrUpdateWithResponseAsync(resourceGroupName, vaultName, secretName, parameters, context).block();
}
/**
* Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal
* use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret. The value you provide may be copied globally for the purpose of running the
* service. The value provided should not include personally identifiable or sensitive information.
* @param parameters Parameters to create or update the secret.
* @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 resource information with extended details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecretInner createOrUpdate(String resourceGroupName, String vaultName, String secretName,
SecretCreateOrUpdateParameters parameters) {
return createOrUpdateWithResponse(resourceGroupName, vaultName, secretName, parameters, Context.NONE)
.getValue();
}
/**
* Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments.
* Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret.
* @param parameters Parameters to patch the secret.
* @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 resource information with extended details along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> updateWithResponseAsync(String resourceGroupName, String vaultName,
String secretName, SecretPatchParameters parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (secretName == null) {
return Mono.error(new IllegalArgumentException("Parameter secretName 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 (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), resourceGroupName, vaultName, secretName,
this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments.
* Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret.
* @param parameters Parameters to patch the secret.
* @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 resource information with extended details along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> updateWithResponseAsync(String resourceGroupName, String vaultName,
String secretName, SecretPatchParameters parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (secretName == null) {
return Mono.error(new IllegalArgumentException("Parameter secretName 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 (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), resourceGroupName, vaultName, secretName,
this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments.
* Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret.
* @param parameters Parameters to patch the secret.
* @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 resource information with extended details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String vaultName, String secretName,
SecretPatchParameters parameters) {
return updateWithResponseAsync(resourceGroupName, vaultName, secretName, parameters)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments.
* Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret.
* @param parameters Parameters to patch the secret.
* @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 resource information with extended details along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response updateWithResponse(String resourceGroupName, String vaultName, String secretName,
SecretPatchParameters parameters, Context context) {
return updateWithResponseAsync(resourceGroupName, vaultName, secretName, parameters, context).block();
}
/**
* Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments.
* Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName Name of the vault.
* @param secretName Name of the secret.
* @param parameters Parameters to patch the secret.
* @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 resource information with extended details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecretInner update(String resourceGroupName, String vaultName, String secretName,
SecretPatchParameters parameters) {
return updateWithResponse(resourceGroupName, vaultName, secretName, parameters, Context.NONE).getValue();
}
/**
* Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the
* data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param secretName The name of the secret.
* @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 specified secret along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName, String vaultName,
String secretName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (secretName == null) {
return Mono.error(new IllegalArgumentException("Parameter secretName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, vaultName, secretName,
this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the
* data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param secretName The name of the secret.
* @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 specified secret along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String vaultName,
String secretName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (secretName == null) {
return Mono.error(new IllegalArgumentException("Parameter secretName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, vaultName, secretName,
this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context);
}
/**
* Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the
* data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param secretName The name of the secret.
* @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 specified secret on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String vaultName, String secretName) {
return getWithResponseAsync(resourceGroupName, vaultName, secretName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the
* data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param secretName The name of the secret.
* @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 specified secret along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String vaultName, String secretName,
Context context) {
return getWithResponseAsync(resourceGroupName, vaultName, secretName, context).block();
}
/**
* Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the
* data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param secretName The name of the secret.
* @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 specified secret.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecretInner get(String resourceGroupName, String vaultName, String secretName) {
return getWithResponse(resourceGroupName, vaultName, secretName, Context.NONE).getValue();
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param top Maximum number of results to return.
* @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 list of secrets along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String vaultName,
Integer top) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), resourceGroupName, vaultName, top,
this.client.getApiVersion(), this.client.getSubscriptionId(), 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()));
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param top Maximum number of results to return.
* @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 list of secrets along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String vaultName,
Integer top, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vaultName == null) {
return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), resourceGroupName, vaultName, top, this.client.getApiVersion(),
this.client.getSubscriptionId(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param top Maximum number of results to return.
* @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 list of secrets as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync(String resourceGroupName, String vaultName, Integer top) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, vaultName, top),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @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 list of secrets as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync(String resourceGroupName, String vaultName) {
final Integer top = null;
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, vaultName, top),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param top Maximum number of results to return.
* @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 list of secrets as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String vaultName, Integer top, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, vaultName, top, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @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 list of secrets as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String vaultName) {
final Integer top = null;
return new PagedIterable<>(listAsync(resourceGroupName, vaultName, top));
}
/**
* The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in
* ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.
*
* @param resourceGroupName The name of the Resource Group to which the vault belongs.
* @param vaultName The name of the vault.
* @param top Maximum number of results to return.
* @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 list of secrets as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String vaultName, Integer top, Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, vaultName, top, context));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return list of secrets along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return list of secrets along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy