com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.securityinsights.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.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.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.securityinsights.fluent.ThreatIntelligenceIndicatorsClient;
import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceInformationInner;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAppendTags;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceFilteringCriteria;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceInformationList;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in ThreatIntelligenceIndicatorsClient.
*/
public final class ThreatIntelligenceIndicatorsClientImpl implements ThreatIntelligenceIndicatorsClient {
/**
* The proxy service used to perform REST calls.
*/
private final ThreatIntelligenceIndicatorsService service;
/**
* The service client containing this operation class.
*/
private final SecurityInsightsImpl client;
/**
* Initializes an instance of ThreatIntelligenceIndicatorsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ThreatIntelligenceIndicatorsClientImpl(SecurityInsightsImpl client) {
this.service = RestProxy.create(ThreatIntelligenceIndicatorsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for SecurityInsightsThreatIntelligenceIndicators to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "SecurityInsightsThre")
public interface ThreatIntelligenceIndicatorsService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createIndicator(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@BodyParam("application/json") ThreatIntelligenceIndicatorModel threatIntelligenceProperties,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@PathParam("name") String name, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> create(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@PathParam("name") String name,
@BodyParam("application/json") ThreatIntelligenceIndicatorModel threatIntelligenceProperties,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@PathParam("name") String name, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> queryIndicators(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@BodyParam("application/json") ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> appendTags(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@PathParam("name") String name,
@BodyParam("application/json") ThreatIntelligenceAppendTags threatIntelligenceAppendTags,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> replaceTags(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName,
@PathParam("name") String name,
@BodyParam("application/json") ThreatIntelligenceIndicatorModel threatIntelligenceReplaceTags,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> queryIndicatorsNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Create a new threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createIndicatorWithResponseAsync(
String resourceGroupName, String workspaceName, ThreatIntelligenceIndicatorModel threatIntelligenceProperties) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (threatIntelligenceProperties == null) {
return Mono.error(
new IllegalArgumentException("Parameter threatIntelligenceProperties is required and cannot be null."));
} else {
threatIntelligenceProperties.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createIndicator(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, threatIntelligenceProperties, accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create a new threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createIndicatorWithResponseAsync(
String resourceGroupName, String workspaceName, ThreatIntelligenceIndicatorModel threatIntelligenceProperties,
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (threatIntelligenceProperties == null) {
return Mono.error(
new IllegalArgumentException("Parameter threatIntelligenceProperties is required and cannot be null."));
} else {
threatIntelligenceProperties.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createIndicator(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, threatIntelligenceProperties, accept,
context);
}
/**
* Create a new threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createIndicatorAsync(String resourceGroupName,
String workspaceName, ThreatIntelligenceIndicatorModel threatIntelligenceProperties) {
return createIndicatorWithResponseAsync(resourceGroupName, workspaceName, threatIntelligenceProperties)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Create a new threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createIndicatorWithResponse(String resourceGroupName,
String workspaceName, ThreatIntelligenceIndicatorModel threatIntelligenceProperties, Context context) {
return createIndicatorWithResponseAsync(resourceGroupName, workspaceName, threatIntelligenceProperties, context)
.block();
}
/**
* Create a new threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ThreatIntelligenceInformationInner createIndicator(String resourceGroupName, String workspaceName,
ThreatIntelligenceIndicatorModel threatIntelligenceProperties) {
return createIndicatorWithResponse(resourceGroupName, workspaceName, threatIntelligenceProperties, Context.NONE)
.getValue();
}
/**
* View a threat intelligence indicator by name.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String workspaceName, String name) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* View a threat intelligence indicator by name.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String workspaceName, String name, 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, workspaceName, name, accept, context);
}
/**
* View a threat intelligence indicator by name.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 threat intelligence information object on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceGroupName, String workspaceName,
String name) {
return getWithResponseAsync(resourceGroupName, workspaceName, name)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* View a threat intelligence indicator by name.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 threat intelligence information object along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String workspaceName,
String name, Context context) {
return getWithResponseAsync(resourceGroupName, workspaceName, name, context).block();
}
/**
* View a threat intelligence indicator by name.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 threat intelligence information object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ThreatIntelligenceInformationInner get(String resourceGroupName, String workspaceName, String name) {
return getWithResponse(resourceGroupName, workspaceName, name, Context.NONE).getValue();
}
/**
* Update a threat Intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createWithResponseAsync(String resourceGroupName,
String workspaceName, String name, ThreatIntelligenceIndicatorModel threatIntelligenceProperties) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
if (threatIntelligenceProperties == null) {
return Mono.error(
new IllegalArgumentException("Parameter threatIntelligenceProperties is required and cannot be null."));
} else {
threatIntelligenceProperties.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, threatIntelligenceProperties,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update a threat Intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createWithResponseAsync(String resourceGroupName,
String workspaceName, String name, ThreatIntelligenceIndicatorModel threatIntelligenceProperties,
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
if (threatIntelligenceProperties == null) {
return Mono.error(
new IllegalArgumentException("Parameter threatIntelligenceProperties is required and cannot be null."));
} else {
threatIntelligenceProperties.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, workspaceName, name, threatIntelligenceProperties, accept, context);
}
/**
* Update a threat Intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(String resourceGroupName, String workspaceName,
String name, ThreatIntelligenceIndicatorModel threatIntelligenceProperties) {
return createWithResponseAsync(resourceGroupName, workspaceName, name, threatIntelligenceProperties)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Update a threat Intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createWithResponse(String resourceGroupName,
String workspaceName, String name, ThreatIntelligenceIndicatorModel threatIntelligenceProperties,
Context context) {
return createWithResponseAsync(resourceGroupName, workspaceName, name, threatIntelligenceProperties, context)
.block();
}
/**
* Update a threat Intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceProperties Properties of threat intelligence indicators to create and 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 threat intelligence information object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ThreatIntelligenceInformationInner create(String resourceGroupName, String workspaceName, String name,
ThreatIntelligenceIndicatorModel threatIntelligenceProperties) {
return createWithResponse(resourceGroupName, workspaceName, name, threatIntelligenceProperties, Context.NONE)
.getValue();
}
/**
* Delete a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 resourceGroupName, String workspaceName, String name) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 resourceGroupName, String workspaceName, String name,
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, workspaceName, name, accept, context);
}
/**
* Delete a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 resourceGroupName, String workspaceName, String name) {
return deleteWithResponseAsync(resourceGroupName, workspaceName, name).flatMap(ignored -> Mono.empty());
}
/**
* Delete a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 resourceGroupName, String workspaceName, String name,
Context context) {
return deleteWithResponseAsync(resourceGroupName, workspaceName, name, context).block();
}
/**
* Delete a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @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 resourceGroupName, String workspaceName, String name) {
deleteWithResponse(resourceGroupName, workspaceName, name, Context.NONE);
}
/**
* Query threat intelligence indicators as per filtering criteria.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceFilteringCriteria Filtering criteria for querying threat intelligence indicators.
* @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 all the threat intelligence information objects along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> queryIndicatorsSinglePageAsync(
String resourceGroupName, String workspaceName,
ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (threatIntelligenceFilteringCriteria == null) {
return Mono.error(new IllegalArgumentException(
"Parameter threatIntelligenceFilteringCriteria is required and cannot be null."));
} else {
threatIntelligenceFilteringCriteria.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.queryIndicators(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria,
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()));
}
/**
* Query threat intelligence indicators as per filtering criteria.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceFilteringCriteria Filtering criteria for querying threat intelligence indicators.
* @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 all the threat intelligence information objects along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> queryIndicatorsSinglePageAsync(
String resourceGroupName, String workspaceName,
ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria, 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (threatIntelligenceFilteringCriteria == null) {
return Mono.error(new IllegalArgumentException(
"Parameter threatIntelligenceFilteringCriteria is required and cannot be null."));
} else {
threatIntelligenceFilteringCriteria.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.queryIndicators(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Query threat intelligence indicators as per filtering criteria.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceFilteringCriteria Filtering criteria for querying threat intelligence indicators.
* @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 all the threat intelligence information objects as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux queryIndicatorsAsync(String resourceGroupName,
String workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria) {
return new PagedFlux<>(
() -> queryIndicatorsSinglePageAsync(resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria),
nextLink -> queryIndicatorsNextSinglePageAsync(nextLink));
}
/**
* Query threat intelligence indicators as per filtering criteria.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceFilteringCriteria Filtering criteria for querying threat intelligence indicators.
* @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 all the threat intelligence information objects as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux queryIndicatorsAsync(String resourceGroupName,
String workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria,
Context context) {
return new PagedFlux<>(() -> queryIndicatorsSinglePageAsync(resourceGroupName, workspaceName,
threatIntelligenceFilteringCriteria, context),
nextLink -> queryIndicatorsNextSinglePageAsync(nextLink, context));
}
/**
* Query threat intelligence indicators as per filtering criteria.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceFilteringCriteria Filtering criteria for querying threat intelligence indicators.
* @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 all the threat intelligence information objects as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable queryIndicators(String resourceGroupName,
String workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria) {
return new PagedIterable<>(
queryIndicatorsAsync(resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria));
}
/**
* Query threat intelligence indicators as per filtering criteria.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param threatIntelligenceFilteringCriteria Filtering criteria for querying threat intelligence indicators.
* @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 all the threat intelligence information objects as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable queryIndicators(String resourceGroupName,
String workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria,
Context context) {
return new PagedIterable<>(
queryIndicatorsAsync(resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria, context));
}
/**
* Append tags to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceAppendTags The threat intelligence append tags request body.
* @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> appendTagsWithResponseAsync(String resourceGroupName, String workspaceName,
String name, ThreatIntelligenceAppendTags threatIntelligenceAppendTags) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
if (threatIntelligenceAppendTags == null) {
return Mono.error(
new IllegalArgumentException("Parameter threatIntelligenceAppendTags is required and cannot be null."));
} else {
threatIntelligenceAppendTags.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.appendTags(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, threatIntelligenceAppendTags,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Append tags to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceAppendTags The threat intelligence append tags request body.
* @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> appendTagsWithResponseAsync(String resourceGroupName, String workspaceName,
String name, ThreatIntelligenceAppendTags threatIntelligenceAppendTags, 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
if (threatIntelligenceAppendTags == null) {
return Mono.error(
new IllegalArgumentException("Parameter threatIntelligenceAppendTags is required and cannot be null."));
} else {
threatIntelligenceAppendTags.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.appendTags(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, threatIntelligenceAppendTags,
accept, context);
}
/**
* Append tags to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceAppendTags The threat intelligence append tags request body.
* @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 appendTagsAsync(String resourceGroupName, String workspaceName, String name,
ThreatIntelligenceAppendTags threatIntelligenceAppendTags) {
return appendTagsWithResponseAsync(resourceGroupName, workspaceName, name, threatIntelligenceAppendTags)
.flatMap(ignored -> Mono.empty());
}
/**
* Append tags to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceAppendTags The threat intelligence append tags request body.
* @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 appendTagsWithResponse(String resourceGroupName, String workspaceName, String name,
ThreatIntelligenceAppendTags threatIntelligenceAppendTags, Context context) {
return appendTagsWithResponseAsync(resourceGroupName, workspaceName, name, threatIntelligenceAppendTags,
context).block();
}
/**
* Append tags to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceAppendTags The threat intelligence append tags request body.
* @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 appendTags(String resourceGroupName, String workspaceName, String name,
ThreatIntelligenceAppendTags threatIntelligenceAppendTags) {
appendTagsWithResponse(resourceGroupName, workspaceName, name, threatIntelligenceAppendTags, Context.NONE);
}
/**
* Replace tags added to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceReplaceTags Tags in the threat intelligence indicator to be replaced.
* @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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> replaceTagsWithResponseAsync(String resourceGroupName,
String workspaceName, String name, ThreatIntelligenceIndicatorModel threatIntelligenceReplaceTags) {
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
if (threatIntelligenceReplaceTags == null) {
return Mono.error(new IllegalArgumentException(
"Parameter threatIntelligenceReplaceTags is required and cannot be null."));
} else {
threatIntelligenceReplaceTags.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.replaceTags(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, threatIntelligenceReplaceTags,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Replace tags added to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceReplaceTags Tags in the threat intelligence indicator to be replaced.
* @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 threat intelligence information object along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> replaceTagsWithResponseAsync(String resourceGroupName,
String workspaceName, String name, ThreatIntelligenceIndicatorModel threatIntelligenceReplaceTags,
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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (name == null) {
return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));
}
if (threatIntelligenceReplaceTags == null) {
return Mono.error(new IllegalArgumentException(
"Parameter threatIntelligenceReplaceTags is required and cannot be null."));
} else {
threatIntelligenceReplaceTags.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.replaceTags(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, workspaceName, name, threatIntelligenceReplaceTags,
accept, context);
}
/**
* Replace tags added to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceReplaceTags Tags in the threat intelligence indicator to be replaced.
* @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 threat intelligence information object on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono replaceTagsAsync(String resourceGroupName, String workspaceName,
String name, ThreatIntelligenceIndicatorModel threatIntelligenceReplaceTags) {
return replaceTagsWithResponseAsync(resourceGroupName, workspaceName, name, threatIntelligenceReplaceTags)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Replace tags added to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceReplaceTags Tags in the threat intelligence indicator to be replaced.
* @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 threat intelligence information object along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response replaceTagsWithResponse(String resourceGroupName,
String workspaceName, String name, ThreatIntelligenceIndicatorModel threatIntelligenceReplaceTags,
Context context) {
return replaceTagsWithResponseAsync(resourceGroupName, workspaceName, name, threatIntelligenceReplaceTags,
context).block();
}
/**
* Replace tags added to a threat intelligence indicator.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param name Threat intelligence indicator name field.
* @param threatIntelligenceReplaceTags Tags in the threat intelligence indicator to be replaced.
* @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 threat intelligence information object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ThreatIntelligenceInformationInner replaceTags(String resourceGroupName, String workspaceName, String name,
ThreatIntelligenceIndicatorModel threatIntelligenceReplaceTags) {
return replaceTagsWithResponse(resourceGroupName, workspaceName, name, threatIntelligenceReplaceTags,
Context.NONE).getValue();
}
/**
* 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 all the threat intelligence information objects along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
queryIndicatorsNextSinglePageAsync(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.queryIndicatorsNext(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 all the threat intelligence information objects along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> queryIndicatorsNextSinglePageAsync(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.queryIndicatorsNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}