com.azure.resourcemanager.security.implementation.SecurityOperatorsClientImpl 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.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.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.SecurityOperatorsClient;
import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner;
import com.azure.resourcemanager.security.fluent.models.SecurityOperatorListInner;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in SecurityOperatorsClient.
*/
public final class SecurityOperatorsClientImpl implements SecurityOperatorsClient {
/**
* The proxy service used to perform REST calls.
*/
private final SecurityOperatorsService service;
/**
* The service client containing this operation class.
*/
private final SecurityCenterImpl client;
/**
* Initializes an instance of SecurityOperatorsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
SecurityOperatorsClientImpl(SecurityCenterImpl client) {
this.service
= RestProxy.create(SecurityOperatorsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityCenterSecurityOperators to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityCenterSecuri")
public interface SecurityOperatorsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("pricingName") String pricingName, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("pricingName") String pricingName,
@PathParam("securityOperatorName") String securityOperatorName, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("pricingName") String pricingName,
@PathParam("securityOperatorName") String securityOperatorName, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @PathParam("pricingName") String pricingName,
@PathParam("securityOperatorName") String securityOperatorName, @HeaderParam("Accept") String accept,
Context context);
}
/**
* Lists Microsoft Defender for Cloud securityOperators in the subscription.
*
* @param pricingName name of the pricing configuration.
* @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 SecurityOperator response along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync(String pricingName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(),
pricingName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists Microsoft Defender for Cloud securityOperators in the subscription.
*
* @param pricingName name of the pricing configuration.
* @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 SecurityOperator response along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync(String pricingName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, accept,
context);
}
/**
* Lists Microsoft Defender for Cloud securityOperators in the subscription.
*
* @param pricingName name of the pricing configuration.
* @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 SecurityOperator response on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listAsync(String pricingName) {
return listWithResponseAsync(pricingName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Lists Microsoft Defender for Cloud securityOperators in the subscription.
*
* @param pricingName name of the pricing configuration.
* @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 SecurityOperator response along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response listWithResponse(String pricingName, Context context) {
return listWithResponseAsync(pricingName, context).block();
}
/**
* Lists Microsoft Defender for Cloud securityOperators in the subscription.
*
* @param pricingName name of the pricing configuration.
* @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 SecurityOperator response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecurityOperatorListInner list(String pricingName) {
return listWithResponse(pricingName, Context.NONE).getValue();
}
/**
* Get a specific security operator for the requested scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator for the requested scope along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String pricingName,
String securityOperatorName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
if (securityOperatorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(),
pricingName, securityOperatorName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get a specific security operator for the requested scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator for the requested scope along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String pricingName, String securityOperatorName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
if (securityOperatorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName,
securityOperatorName, accept, context);
}
/**
* Get a specific security operator for the requested scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator for the requested scope on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String pricingName, String securityOperatorName) {
return getWithResponseAsync(pricingName, securityOperatorName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get a specific security operator for the requested scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator for the requested scope along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String pricingName, String securityOperatorName,
Context context) {
return getWithResponseAsync(pricingName, securityOperatorName, context).block();
}
/**
* Get a specific security operator for the requested scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator for the requested scope.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecurityOperatorInner get(String pricingName, String securityOperatorName) {
return getWithResponse(pricingName, securityOperatorName, Context.NONE).getValue();
}
/**
* Creates Microsoft Defender for Cloud security operator on the given scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator under a given subscription and pricing along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String pricingName,
String securityOperatorName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
if (securityOperatorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion,
this.client.getSubscriptionId(), pricingName, securityOperatorName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates Microsoft Defender for Cloud security operator on the given scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator under a given subscription and pricing along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String pricingName,
String securityOperatorName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
if (securityOperatorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(),
pricingName, securityOperatorName, accept, context);
}
/**
* Creates Microsoft Defender for Cloud security operator on the given scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator under a given subscription and pricing on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String pricingName, String securityOperatorName) {
return createOrUpdateWithResponseAsync(pricingName, securityOperatorName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Creates Microsoft Defender for Cloud security operator on the given scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator under a given subscription and pricing along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String pricingName, String securityOperatorName,
Context context) {
return createOrUpdateWithResponseAsync(pricingName, securityOperatorName, context).block();
}
/**
* Creates Microsoft Defender for Cloud security operator on the given scope.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 operator under a given subscription and pricing.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SecurityOperatorInner createOrUpdate(String pricingName, String securityOperatorName) {
return createOrUpdateWithResponse(pricingName, securityOperatorName, Context.NONE).getValue();
}
/**
* Delete Microsoft Defender for Cloud securityOperator in the subscription.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 pricingName, String securityOperatorName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
if (securityOperatorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), apiVersion,
this.client.getSubscriptionId(), pricingName, securityOperatorName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete Microsoft Defender for Cloud securityOperator in the subscription.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 pricingName, String securityOperatorName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (pricingName == null) {
return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null."));
}
if (securityOperatorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null."));
}
final String apiVersion = "2023-01-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName,
securityOperatorName, accept, context);
}
/**
* Delete Microsoft Defender for Cloud securityOperator in the subscription.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 pricingName, String securityOperatorName) {
return deleteWithResponseAsync(pricingName, securityOperatorName).flatMap(ignored -> Mono.empty());
}
/**
* Delete Microsoft Defender for Cloud securityOperator in the subscription.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 pricingName, String securityOperatorName, Context context) {
return deleteWithResponseAsync(pricingName, securityOperatorName, context).block();
}
/**
* Delete Microsoft Defender for Cloud securityOperator in the subscription.
*
* @param pricingName name of the pricing configuration.
* @param securityOperatorName name of the securityOperator.
* @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 pricingName, String securityOperatorName) {
deleteWithResponse(pricingName, securityOperatorName, Context.NONE);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy