com.azure.resourcemanager.security.implementation.StandardAssignmentsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-security Show documentation
Show all versions of azure-resourcemanager-security Show documentation
This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.
// 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.StandardAssignmentsClient;
import com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner;
import com.azure.resourcemanager.security.models.StandardAssignmentsList;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in StandardAssignmentsClient.
*/
public final class StandardAssignmentsClientImpl implements StandardAssignmentsClient {
/**
* The proxy service used to perform REST calls.
*/
private final StandardAssignmentsService service;
/**
* The service client containing this operation class.
*/
private final SecurityCenterImpl client;
/**
* Initializes an instance of StandardAssignmentsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
StandardAssignmentsClientImpl(SecurityCenterImpl client) {
this.service = RestProxy.create(StandardAssignmentsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityCenterStandardAssignments to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityCenterStanda")
public interface StandardAssignmentsService {
@Headers({ "Content-Type: application/json" })
@Get("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("standardAssignmentName") String standardAssignmentName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> create(@HostParam("$host") String endpoint,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("standardAssignmentName") String standardAssignmentName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") StandardAssignmentInner standardAssignment,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("standardAssignmentName") String standardAssignmentName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/{scope}/providers/Microsoft.Security/standardAssignments")
@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("{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);
}
/**
* Retrieves a standard assignment.
*
* This operation retrieves a single standard assignment, given its name and the scope it was created at.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 Assignment on a resource group over a given scope along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceId,
String standardAssignmentName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (standardAssignmentName == null) {
return Mono.error(
new IllegalArgumentException("Parameter standardAssignmentName 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(), resourceId, standardAssignmentName,
apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Retrieves a standard assignment.
*
* This operation retrieves a single standard assignment, given its name and the scope it was created at.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 Assignment on a resource group over a given scope along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceId,
String standardAssignmentName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (standardAssignmentName == null) {
return Mono.error(
new IllegalArgumentException("Parameter standardAssignmentName 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(), resourceId, standardAssignmentName, apiVersion, accept, context);
}
/**
* Retrieves a standard assignment.
*
* This operation retrieves a single standard assignment, given its name and the scope it was created at.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 Assignment on a resource group over a given scope on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceId, String standardAssignmentName) {
return getWithResponseAsync(resourceId, standardAssignmentName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Retrieves a standard assignment.
*
* This operation retrieves a single standard assignment, given its name and the scope it was created at.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 Assignment on a resource group over a given scope along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceId, String standardAssignmentName,
Context context) {
return getWithResponseAsync(resourceId, standardAssignmentName, context).block();
}
/**
* Retrieves a standard assignment.
*
* This operation retrieves a single standard assignment, given its name and the scope it was created at.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 Assignment on a resource group over a given scope.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public StandardAssignmentInner get(String resourceId, String standardAssignmentName) {
return getWithResponse(resourceId, standardAssignmentName, Context.NONE).getValue();
}
/**
* Creates or updates a standard assignment.
*
* This operation creates or updates a standard assignment with the given scope and name. standard assignments apply
* to all resources contained within their scope. For example, when you assign a policy at resource group scope,
* that policy applies to all resources in the group.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @param standardAssignment Custom standard assignment 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 Assignment on a resource group over a given scope along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createWithResponseAsync(String resourceId,
String standardAssignmentName, StandardAssignmentInner standardAssignment) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (standardAssignmentName == null) {
return Mono.error(
new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null."));
}
if (standardAssignment == null) {
return Mono
.error(new IllegalArgumentException("Parameter standardAssignment is required and cannot be null."));
} else {
standardAssignment.validate();
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.create(this.client.getEndpoint(), resourceId, standardAssignmentName,
apiVersion, standardAssignment, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates a standard assignment.
*
* This operation creates or updates a standard assignment with the given scope and name. standard assignments apply
* to all resources contained within their scope. For example, when you assign a policy at resource group scope,
* that policy applies to all resources in the group.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @param standardAssignment Custom standard assignment 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 Assignment on a resource group over a given scope along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createWithResponseAsync(String resourceId,
String standardAssignmentName, StandardAssignmentInner standardAssignment, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (standardAssignmentName == null) {
return Mono.error(
new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null."));
}
if (standardAssignment == null) {
return Mono
.error(new IllegalArgumentException("Parameter standardAssignment is required and cannot be null."));
} else {
standardAssignment.validate();
}
final String apiVersion = "2024-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.create(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion,
standardAssignment, accept, context);
}
/**
* Creates or updates a standard assignment.
*
* This operation creates or updates a standard assignment with the given scope and name. standard assignments apply
* to all resources contained within their scope. For example, when you assign a policy at resource group scope,
* that policy applies to all resources in the group.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @param standardAssignment Custom standard assignment 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 Assignment on a resource group over a given scope on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(String resourceId, String standardAssignmentName,
StandardAssignmentInner standardAssignment) {
return createWithResponseAsync(resourceId, standardAssignmentName, standardAssignment)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Creates or updates a standard assignment.
*
* This operation creates or updates a standard assignment with the given scope and name. standard assignments apply
* to all resources contained within their scope. For example, when you assign a policy at resource group scope,
* that policy applies to all resources in the group.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @param standardAssignment Custom standard assignment 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 Assignment on a resource group over a given scope along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createWithResponse(String resourceId, String standardAssignmentName,
StandardAssignmentInner standardAssignment, Context context) {
return createWithResponseAsync(resourceId, standardAssignmentName, standardAssignment, context).block();
}
/**
* Creates or updates a standard assignment.
*
* This operation creates or updates a standard assignment with the given scope and name. standard assignments apply
* to all resources contained within their scope. For example, when you assign a policy at resource group scope,
* that policy applies to all resources in the group.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @param standardAssignment Custom standard assignment 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 Assignment on a resource group over a given scope.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public StandardAssignmentInner create(String resourceId, String standardAssignmentName,
StandardAssignmentInner standardAssignment) {
return createWithResponse(resourceId, standardAssignmentName, standardAssignment, Context.NONE).getValue();
}
/**
* Deletes a standard assignment.
*
* This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a
* standard assignment is the part of its ID preceding
* '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 resourceId, String standardAssignmentName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (standardAssignmentName == null) {
return Mono.error(
new IllegalArgumentException("Parameter standardAssignmentName 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(), resourceId, standardAssignmentName,
apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a standard assignment.
*
* This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a
* standard assignment is the part of its ID preceding
* '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 resourceId, String standardAssignmentName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (standardAssignmentName == null) {
return Mono.error(
new IllegalArgumentException("Parameter standardAssignmentName 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(), resourceId, standardAssignmentName, apiVersion, accept,
context);
}
/**
* Deletes a standard assignment.
*
* This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a
* standard assignment is the part of its ID preceding
* '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 resourceId, String standardAssignmentName) {
return deleteWithResponseAsync(resourceId, standardAssignmentName).flatMap(ignored -> Mono.empty());
}
/**
* Deletes a standard assignment.
*
* This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a
* standard assignment is the part of its ID preceding
* '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 resourceId, String standardAssignmentName, Context context) {
return deleteWithResponseAsync(resourceId, standardAssignmentName, context).block();
}
/**
* Deletes a standard assignment.
*
* This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a
* standard assignment is the part of its ID preceding
* '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'.
*
* @param resourceId The identifier of the resource.
* @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment.
* @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 resourceId, String standardAssignmentName) {
deleteWithResponse(resourceId, standardAssignmentName, Context.NONE);
}
/**
* Get a list of all relevant standard assignments over a scope.
*
* @param scope The scope of the standard assignment. 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 standard assignments 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 standard assignments over a scope.
*
* @param scope The scope of the standard assignment. 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 standard assignments 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 standard assignments over a scope.
*
* @param scope The scope of the standard assignment. 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 standard assignments 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 standard assignments over a scope.
*
* @param scope The scope of the standard assignment. 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 standard assignments 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 standard assignments over a scope.
*
* @param scope The scope of the standard assignment. 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 standard assignments 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 standard assignments over a scope.
*
* @param scope The scope of the standard assignment. 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 standard assignments 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 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 assignment 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 assignment 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