com.azure.resourcemanager.security.implementation.SecurityStandardsClientImpl 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.security.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.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.security.fluent.SecurityStandardsClient;
import com.azure.resourcemanager.security.fluent.models.SecurityStandardInner;
import com.azure.resourcemanager.security.models.SecurityStandardList;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in SecurityStandardsClient.
*/
public final class SecurityStandardsClientImpl implements SecurityStandardsClient {
/**
* The proxy service used to perform REST calls.
*/
private final SecurityStandardsService service;
/**
* The service client containing this operation class.
*/
private final SecurityCenterImpl client;
/**
* Initializes an instance of SecurityStandardsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
SecurityStandardsClientImpl(SecurityCenterImpl client) {
this.service
= RestProxy.create(SecurityStandardsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityCenterSecurityStandards to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityCenterSecuri")
public interface SecurityStandardsService {
@Headers({ "Content-Type: application/json" })
@Get("/{scope}/providers/Microsoft.Security/securityStandards")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("scope") String scope,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("scope") String scope,
@PathParam("standardId") String standardId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("scope") String scope,
@PathParam("standardId") String standardId, @BodyParam("application/json") SecurityStandardInner standard,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion,
@PathParam("scope") String scope, @PathParam("standardId") String standardId,
@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);
}
/**
* Get a list of all relevant security standards over a scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @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 list of all relevant security standards over a scope along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String scope) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, 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 a list of all relevant security standards over a scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @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 list of all relevant security standards over a scope along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String scope, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get a list of all relevant security standards over a scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @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 list of all relevant security standards over a scope as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String scope) {
return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Get a list of all relevant security standards over a scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @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 list of all relevant security standards over a scope as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String scope, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(scope, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Get a list of all relevant security standards over a scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @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 list of all relevant security standards over a scope as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String scope) {
return new PagedIterable<>(listAsync(scope));
}
/**
* Get a list of all relevant security standards over a scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @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 list of all relevant security standards over a scope as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String scope, Context context) {
return new PagedIterable<>(listAsync(scope, context));
}
/**
* Get a specific security standard for the requested scope by standardId.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @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 specific security standard for the requested scope by standardId along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String scope, String standardId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (standardId == null) {
return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null."));
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.get(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get a specific security standard for the requested scope by standardId.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @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 specific security standard for the requested scope by standardId along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String scope, String standardId,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (standardId == null) {
return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null."));
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context);
}
/**
* Get a specific security standard for the requested scope by standardId.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @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 specific security standard for the requested scope by standardId on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String scope, String standardId) {
return getWithResponseAsync(scope, standardId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get a specific security standard for the requested scope by standardId.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @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 specific security standard for the requested scope by standardId along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String scope, String standardId, Context context) {
return getWithResponseAsync(scope, standardId, context).block();
}
/**
* Get a specific security standard for the requested scope by standardId.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @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 specific security standard for the requested scope by standardId.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecurityStandardInner get(String scope, String standardId) {
return getWithResponse(scope, standardId, Context.NONE).getValue();
}
/**
* Creates or updates a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param standard Custom security standard over a pre-defined scope.
* @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 security Standard on a resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String scope, String standardId,
SecurityStandardInner standard) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (standardId == null) {
return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null."));
}
if (standard == null) {
return Mono.error(new IllegalArgumentException("Parameter standard is required and cannot be null."));
} else {
standard.validate();
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId,
standard, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param standard Custom security standard over a pre-defined scope.
* @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 security Standard on a resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String scope, String standardId,
SecurityStandardInner standard, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (standardId == null) {
return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null."));
}
if (standard == null) {
return Mono.error(new IllegalArgumentException("Parameter standard is required and cannot be null."));
} else {
standard.validate();
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, standard, accept,
context);
}
/**
* Creates or updates a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param standard Custom security standard over a pre-defined scope.
* @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 security Standard on a resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String scope, String standardId,
SecurityStandardInner standard) {
return createOrUpdateWithResponseAsync(scope, standardId, standard)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Creates or updates a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param standard Custom security standard over a pre-defined scope.
* @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 security Standard on a resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String scope, String standardId,
SecurityStandardInner standard, Context context) {
return createOrUpdateWithResponseAsync(scope, standardId, standard, context).block();
}
/**
* Creates or updates a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param standard Custom security standard over a pre-defined scope.
* @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 security Standard on a resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecurityStandardInner createOrUpdate(String scope, String standardId, SecurityStandardInner standard) {
return createOrUpdateWithResponse(scope, standardId, standard, Context.NONE).getValue();
}
/**
* Delete a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deleteWithResponseAsync(String scope, String standardId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (standardId == null) {
return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null."));
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deleteWithResponseAsync(String scope, String standardId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (standardId == null) {
return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null."));
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context);
}
/**
* Delete a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String scope, String standardId) {
return deleteWithResponseAsync(scope, standardId).flatMap(ignored -> Mono.empty());
}
/**
* Delete a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteWithResponse(String scope, String standardId, Context context) {
return deleteWithResponseAsync(scope, standardId, context).block();
}
/**
* Delete a security standard over a given scope.
*
* @param scope The scope of the security standard. Valid scopes are: management group (format:
* 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format:
* 'subscriptions/{subscriptionId}'), or security connector (format:
* 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'.
* @param standardId The Security Standard key - unique key for the standard type.
* @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 scope, String standardId) {
deleteWithResponse(scope, standardId, Context.NONE);
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return page of a Standard list 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 page of a Standard list 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