com.azure.resourcemanager.security.implementation.SensitivitySettingsClientImpl 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.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.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.SensitivitySettingsClient;
import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsListResponseInner;
import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner;
import com.azure.resourcemanager.security.models.UpdateSensitivitySettingsRequest;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in SensitivitySettingsClient.
*/
public final class SensitivitySettingsClientImpl implements SensitivitySettingsClient {
/**
* The proxy service used to perform REST calls.
*/
private final SensitivitySettingsService service;
/**
* The service client containing this operation class.
*/
private final SecurityCenterImpl client;
/**
* Initializes an instance of SensitivitySettingsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
SensitivitySettingsClientImpl(SecurityCenterImpl client) {
this.service = RestProxy.create(SensitivitySettingsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityCenterSensitivitySettings to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityCenterSensit")
public interface SensitivitySettingsService {
@Headers({ "Content-Type: application/json" })
@Put("/providers/Microsoft.Security/sensitivitySettings/current")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") UpdateSensitivitySettingsRequest sensitivitySettings,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/providers/Microsoft.Security/sensitivitySettings/current")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/providers/Microsoft.Security/sensitivitySettings")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
}
/**
* Create or update data sensitivity settings for sensitive data discovery.
*
* @param sensitivitySettings The data sensitivity settings to update.
* @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
createOrUpdateWithResponseAsync(UpdateSensitivitySettingsRequest sensitivitySettings) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (sensitivitySettings == null) {
return Mono
.error(new IllegalArgumentException("Parameter sensitivitySettings is required and cannot be null."));
} else {
sensitivitySettings.validate();
}
final String apiVersion = "2023-02-15-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, sensitivitySettings,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update data sensitivity settings for sensitive data discovery.
*
* @param sensitivitySettings The data sensitivity settings to update.
* @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
createOrUpdateWithResponseAsync(UpdateSensitivitySettingsRequest sensitivitySettings, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (sensitivitySettings == null) {
return Mono
.error(new IllegalArgumentException("Parameter sensitivitySettings is required and cannot be null."));
} else {
sensitivitySettings.validate();
}
final String apiVersion = "2023-02-15-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), apiVersion, sensitivitySettings, accept, context);
}
/**
* Create or update data sensitivity settings for sensitive data discovery.
*
* @param sensitivitySettings The data sensitivity settings to update.
* @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 data sensitivity settings for sensitive data discovery on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono
createOrUpdateAsync(UpdateSensitivitySettingsRequest sensitivitySettings) {
return createOrUpdateWithResponseAsync(sensitivitySettings).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Create or update data sensitivity settings for sensitive data discovery.
*
* @param sensitivitySettings The data sensitivity settings to update.
* @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 data sensitivity settings for sensitive data discovery along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response
createOrUpdateWithResponse(UpdateSensitivitySettingsRequest sensitivitySettings, Context context) {
return createOrUpdateWithResponseAsync(sensitivitySettings, context).block();
}
/**
* Create or update data sensitivity settings for sensitive data discovery.
*
* @param sensitivitySettings The data sensitivity settings to update.
* @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 data sensitivity settings for sensitive data discovery.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GetSensitivitySettingsResponseInner createOrUpdate(UpdateSensitivitySettingsRequest sensitivitySettings) {
return createOrUpdateWithResponse(sensitivitySettings, Context.NONE).getValue();
}
/**
* Gets data sensitivity settings for sensitive data discovery.
*
* @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync() {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String apiVersion = "2023-02-15-preview";
final String accept = "application/json";
return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets data sensitivity settings for sensitive data discovery.
*
* @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String apiVersion = "2023-02-15-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), apiVersion, accept, context);
}
/**
* Gets data sensitivity settings for sensitive data discovery.
*
* @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 data sensitivity settings for sensitive data discovery on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync() {
return getWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets data sensitivity settings for sensitive data discovery.
*
* @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 data sensitivity settings for sensitive data discovery along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(Context context) {
return getWithResponseAsync(context).block();
}
/**
* Gets data sensitivity settings for sensitive data discovery.
*
* @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 data sensitivity settings for sensitive data discovery.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GetSensitivitySettingsResponseInner get() {
return getWithResponse(Context.NONE).getValue();
}
/**
* Gets a list with a single sensitivity settings resource.
*
* @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 with a single sensitivity settings resource along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync() {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String apiVersion = "2023-02-15-preview";
final String accept = "application/json";
return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a list with a single sensitivity settings resource.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list with a single sensitivity settings resource along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync(Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String apiVersion = "2023-02-15-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), apiVersion, accept, context);
}
/**
* Gets a list with a single sensitivity settings resource.
*
* @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 with a single sensitivity settings resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listAsync() {
return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a list with a single sensitivity settings resource.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list with a single sensitivity settings resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response listWithResponse(Context context) {
return listWithResponseAsync(context).block();
}
/**
* Gets a list with a single sensitivity settings resource.
*
* @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 with a single sensitivity settings resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GetSensitivitySettingsListResponseInner list() {
return listWithResponse(Context.NONE).getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy