com.azure.resourcemanager.security.implementation.DefenderForStoragesClientImpl 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.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.Post;
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.DefenderForStoragesClient;
import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner;
import com.azure.resourcemanager.security.fluent.models.MalwareScanInner;
import com.azure.resourcemanager.security.models.SettingName;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in DefenderForStoragesClient.
*/
public final class DefenderForStoragesClientImpl implements DefenderForStoragesClient {
/**
* The proxy service used to perform REST calls.
*/
private final DefenderForStoragesService service;
/**
* The service client containing this operation class.
*/
private final SecurityCenterImpl client;
/**
* Initializes an instance of DefenderForStoragesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DefenderForStoragesClientImpl(SecurityCenterImpl client) {
this.service = RestProxy.create(DefenderForStoragesService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityCenterDefenderForStorages to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityCenterDefend")
public interface DefenderForStoragesService {
@Headers({ "Content-Type: application/json" })
@Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> create(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("settingName") SettingName settingName,
@BodyParam("application/json") DefenderForStorageSettingInner defenderForStorageSetting,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/startMalwareScan")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> startMalwareScan(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}/cancelMalwareScan")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> cancelMalwareScan(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("settingName") SettingName settingName, @PathParam("scanId") String scanId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> getMalwareScan(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("settingName") SettingName settingName, @PathParam("scanId") String scanId,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Gets the Defender for Storage settings for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 Defender for Storage settings for the specified storage account along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceId,
SettingName settingName) {
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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the Defender for Storage settings for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 Defender for Storage settings for the specified storage account along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceId,
SettingName settingName, 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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context);
}
/**
* Gets the Defender for Storage settings for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 Defender for Storage settings for the specified storage account on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceId, SettingName settingName) {
return getWithResponseAsync(resourceId, settingName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the Defender for Storage settings for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 Defender for Storage settings for the specified storage account along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceId, SettingName settingName,
Context context) {
return getWithResponseAsync(resourceId, settingName, context).block();
}
/**
* Gets the Defender for Storage settings for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 Defender for Storage settings for the specified storage account.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DefenderForStorageSettingInner get(String resourceId, SettingName settingName) {
return getWithResponse(resourceId, settingName, Context.NONE).getValue();
}
/**
* Creates or updates the Defender for Storage settings on a specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param defenderForStorageSetting Defender for Storage Settings.
* @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 Defender for Storage resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createWithResponseAsync(String resourceId,
SettingName settingName, DefenderForStorageSettingInner defenderForStorageSetting) {
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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
if (defenderForStorageSetting == null) {
return Mono.error(
new IllegalArgumentException("Parameter defenderForStorageSetting is required and cannot be null."));
} else {
defenderForStorageSetting.validate();
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName,
defenderForStorageSetting, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates the Defender for Storage settings on a specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param defenderForStorageSetting Defender for Storage Settings.
* @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 Defender for Storage resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createWithResponseAsync(String resourceId,
SettingName settingName, DefenderForStorageSettingInner defenderForStorageSetting, 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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
if (defenderForStorageSetting == null) {
return Mono.error(
new IllegalArgumentException("Parameter defenderForStorageSetting is required and cannot be null."));
} else {
defenderForStorageSetting.validate();
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, defenderForStorageSetting,
accept, context);
}
/**
* Creates or updates the Defender for Storage settings on a specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param defenderForStorageSetting Defender for Storage Settings.
* @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 Defender for Storage resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(String resourceId, SettingName settingName,
DefenderForStorageSettingInner defenderForStorageSetting) {
return createWithResponseAsync(resourceId, settingName, defenderForStorageSetting)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Creates or updates the Defender for Storage settings on a specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param defenderForStorageSetting Defender for Storage Settings.
* @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 Defender for Storage resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createWithResponse(String resourceId, SettingName settingName,
DefenderForStorageSettingInner defenderForStorageSetting, Context context) {
return createWithResponseAsync(resourceId, settingName, defenderForStorageSetting, context).block();
}
/**
* Creates or updates the Defender for Storage settings on a specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param defenderForStorageSetting Defender for Storage Settings.
* @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 Defender for Storage resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DefenderForStorageSettingInner create(String resourceId, SettingName settingName,
DefenderForStorageSettingInner defenderForStorageSetting) {
return createWithResponse(resourceId, settingName, defenderForStorageSetting, Context.NONE).getValue();
}
/**
* Initiate a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 describes the state of a malware scan operation along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> startMalwareScanWithResponseAsync(String resourceId,
SettingName settingName) {
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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.startMalwareScan(this.client.getEndpoint(), apiVersion, resourceId,
settingName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Initiate a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 describes the state of a malware scan operation along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> startMalwareScanWithResponseAsync(String resourceId,
SettingName settingName, 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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.startMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept,
context);
}
/**
* Initiate a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 describes the state of a malware scan operation on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono startMalwareScanAsync(String resourceId, SettingName settingName) {
return startMalwareScanWithResponseAsync(resourceId, settingName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Initiate a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 describes the state of a malware scan operation along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response startMalwareScanWithResponse(String resourceId, SettingName settingName,
Context context) {
return startMalwareScanWithResponseAsync(resourceId, settingName, context).block();
}
/**
* Initiate a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @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 describes the state of a malware scan operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public MalwareScanInner startMalwareScan(String resourceId, SettingName settingName) {
return startMalwareScanWithResponse(resourceId, settingName, Context.NONE).getValue();
}
/**
* Cancels a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 describes the state of a malware scan operation along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> cancelMalwareScanWithResponseAsync(String resourceId,
SettingName settingName, String scanId) {
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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
if (scanId == null) {
return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.cancelMalwareScan(this.client.getEndpoint(), apiVersion, resourceId,
settingName, scanId, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Cancels a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 describes the state of a malware scan operation along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> cancelMalwareScanWithResponseAsync(String resourceId,
SettingName settingName, String scanId, 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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
if (scanId == null) {
return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.cancelMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, settingName, scanId, accept,
context);
}
/**
* Cancels a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 describes the state of a malware scan operation on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono cancelMalwareScanAsync(String resourceId, SettingName settingName, String scanId) {
return cancelMalwareScanWithResponseAsync(resourceId, settingName, scanId)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Cancels a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 describes the state of a malware scan operation along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response cancelMalwareScanWithResponse(String resourceId, SettingName settingName,
String scanId, Context context) {
return cancelMalwareScanWithResponseAsync(resourceId, settingName, scanId, context).block();
}
/**
* Cancels a Defender for Storage malware scan for the specified storage account.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 describes the state of a malware scan operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public MalwareScanInner cancelMalwareScan(String resourceId, SettingName settingName, String scanId) {
return cancelMalwareScanWithResponse(resourceId, settingName, scanId, Context.NONE).getValue();
}
/**
* Gets the Defender for Storage malware scan for the specified storage resource.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 Defender for Storage malware scan for the specified storage resource along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getMalwareScanWithResponseAsync(String resourceId, SettingName settingName,
String scanId) {
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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
if (scanId == null) {
return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getMalwareScan(this.client.getEndpoint(), apiVersion, resourceId,
settingName, scanId, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the Defender for Storage malware scan for the specified storage resource.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 Defender for Storage malware scan for the specified storage resource along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getMalwareScanWithResponseAsync(String resourceId, SettingName settingName,
String scanId, 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 (settingName == null) {
return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null."));
}
if (scanId == null) {
return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null."));
}
final String apiVersion = "2024-10-01-preview";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, settingName, scanId, accept,
context);
}
/**
* Gets the Defender for Storage malware scan for the specified storage resource.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 Defender for Storage malware scan for the specified storage resource on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getMalwareScanAsync(String resourceId, SettingName settingName, String scanId) {
return getMalwareScanWithResponseAsync(resourceId, settingName, scanId)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the Defender for Storage malware scan for the specified storage resource.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 Defender for Storage malware scan for the specified storage resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getMalwareScanWithResponse(String resourceId, SettingName settingName,
String scanId, Context context) {
return getMalwareScanWithResponseAsync(resourceId, settingName, scanId, context).block();
}
/**
* Gets the Defender for Storage malware scan for the specified storage resource.
*
* @param resourceId The identifier of the resource.
* @param settingName Defender for Storage setting name.
* @param scanId The identifier of the scan. Can be either 'latest' or a GUID.
* @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 Defender for Storage malware scan for the specified storage resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public MalwareScanInner getMalwareScan(String resourceId, SettingName settingName, String scanId) {
return getMalwareScanWithResponse(resourceId, settingName, scanId, Context.NONE).getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy