com.azure.resourcemanager.security.implementation.DeviceSecurityGroupsClientImpl 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.DeviceSecurityGroupsClient;
import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner;
import com.azure.resourcemanager.security.models.DeviceSecurityGroupList;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in DeviceSecurityGroupsClient.
*/
public final class DeviceSecurityGroupsClientImpl implements DeviceSecurityGroupsClient {
/**
* The proxy service used to perform REST calls.
*/
private final DeviceSecurityGroupsService service;
/**
* The service client containing this operation class.
*/
private final SecurityCenterImpl client;
/**
* Initializes an instance of DeviceSecurityGroupsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DeviceSecurityGroupsClientImpl(SecurityCenterImpl client) {
this.service = RestProxy.create(DeviceSecurityGroupsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityCenterDeviceSecurityGroups to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityCenterDevice")
public interface DeviceSecurityGroupsService {
@Headers({ "Content-Type: application/json" })
@Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Put("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("deviceSecurityGroupName") String deviceSecurityGroupName,
@BodyParam("application/json") DeviceSecurityGroupInner deviceSecurityGroup,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion,
@PathParam(value = "resourceId", encoded = true) String resourceId,
@PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, @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);
}
/**
* Use this method get the list of device security groups for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @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 device security groups along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceId) {
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."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, 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()));
}
/**
* Use this method get the list of device security groups for the specified IoT Hub resource.
*
* @param resourceId The identifier of the 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 list of device security groups along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceId, 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."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), apiVersion, resourceId, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Use this method get the list of device security groups for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @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 device security groups as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceId) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Use this method get the list of device security groups for the specified IoT Hub resource.
*
* @param resourceId The identifier of the 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 list of device security groups as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceId, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceId, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Use this method get the list of device security groups for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @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 device security groups as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceId) {
return new PagedIterable<>(listAsync(resourceId));
}
/**
* Use this method get the list of device security groups for the specified IoT Hub resource.
*
* @param resourceId The identifier of the 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 list of device security groups as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceId, Context context) {
return new PagedIterable<>(listAsync(resourceId, context));
}
/**
* Use this method to get the device security group for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 device security group resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceId,
String deviceSecurityGroupName) {
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 (deviceSecurityGroupName == null) {
return Mono.error(
new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId,
deviceSecurityGroupName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Use this method to get the device security group for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 device security group resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceId,
String deviceSecurityGroupName, 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 (deviceSecurityGroupName == null) {
return Mono.error(
new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, context);
}
/**
* Use this method to get the device security group for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 device security group resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceId, String deviceSecurityGroupName) {
return getWithResponseAsync(resourceId, deviceSecurityGroupName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Use this method to get the device security group for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 device security group resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceId, String deviceSecurityGroupName,
Context context) {
return getWithResponseAsync(resourceId, deviceSecurityGroupName, context).block();
}
/**
* Use this method to get the device security group for the specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 device security group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DeviceSecurityGroupInner get(String resourceId, String deviceSecurityGroupName) {
return getWithResponse(resourceId, deviceSecurityGroupName, Context.NONE).getValue();
}
/**
* Use this method to creates or updates the device security group on a specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @param deviceSecurityGroup Security group object.
* @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 device security group resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceId,
String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup) {
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 (deviceSecurityGroupName == null) {
return Mono.error(
new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null."));
}
if (deviceSecurityGroup == null) {
return Mono
.error(new IllegalArgumentException("Parameter deviceSecurityGroup is required and cannot be null."));
} else {
deviceSecurityGroup.validate();
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId,
deviceSecurityGroupName, deviceSecurityGroup, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Use this method to creates or updates the device security group on a specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @param deviceSecurityGroup Security group object.
* @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 device security group resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceId,
String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup, 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 (deviceSecurityGroupName == null) {
return Mono.error(
new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null."));
}
if (deviceSecurityGroup == null) {
return Mono
.error(new IllegalArgumentException("Parameter deviceSecurityGroup is required and cannot be null."));
} else {
deviceSecurityGroup.validate();
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName,
deviceSecurityGroup, accept, context);
}
/**
* Use this method to creates or updates the device security group on a specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @param deviceSecurityGroup Security group object.
* @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 device security group resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceId, String deviceSecurityGroupName,
DeviceSecurityGroupInner deviceSecurityGroup) {
return createOrUpdateWithResponseAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Use this method to creates or updates the device security group on a specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @param deviceSecurityGroup Security group object.
* @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 device security group resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String resourceId,
String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup, Context context) {
return createOrUpdateWithResponseAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup, context)
.block();
}
/**
* Use this method to creates or updates the device security group on a specified IoT Hub resource.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @param deviceSecurityGroup Security group object.
* @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 device security group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DeviceSecurityGroupInner createOrUpdate(String resourceId, String deviceSecurityGroupName,
DeviceSecurityGroupInner deviceSecurityGroup) {
return createOrUpdateWithResponse(resourceId, deviceSecurityGroupName, deviceSecurityGroup, Context.NONE)
.getValue();
}
/**
* User this method to deletes the device security group.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 deviceSecurityGroupName) {
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 (deviceSecurityGroupName == null) {
return Mono.error(
new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId,
deviceSecurityGroupName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* User this method to deletes the device security group.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 deviceSecurityGroupName,
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 (deviceSecurityGroupName == null) {
return Mono.error(
new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept,
context);
}
/**
* User this method to deletes the device security group.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 deviceSecurityGroupName) {
return deleteWithResponseAsync(resourceId, deviceSecurityGroupName).flatMap(ignored -> Mono.empty());
}
/**
* User this method to deletes the device security group.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 deviceSecurityGroupName, Context context) {
return deleteWithResponseAsync(resourceId, deviceSecurityGroupName, context).block();
}
/**
* User this method to deletes the device security group.
*
* @param resourceId The identifier of the resource.
* @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security
* group is case insensitive.
* @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 deviceSecurityGroupName) {
deleteWithResponse(resourceId, deviceSecurityGroupName, Context.NONE);
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return list of device security groups 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 list of device security groups 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