com.azure.resourcemanager.costmanagement.implementation.AlertsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-costmanagement Show documentation
Show all versions of azure-resourcemanager-costmanagement Show documentation
This package contains Microsoft Azure SDK for CostManagement Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. CostManagement management client provides access to CostManagement resources for Azure Enterprise Subscriptions. Package tag package-2022-10.
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.costmanagement.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.costmanagement.fluent.AlertsClient;
import com.azure.resourcemanager.costmanagement.fluent.models.AlertInner;
import com.azure.resourcemanager.costmanagement.fluent.models.AlertsResultInner;
import com.azure.resourcemanager.costmanagement.models.DismissAlertPayload;
import com.azure.resourcemanager.costmanagement.models.ExternalCloudProviderType;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in AlertsClient. */
public final class AlertsClientImpl implements AlertsClient {
/** The proxy service used to perform REST calls. */
private final AlertsService service;
/** The service client containing this operation class. */
private final CostManagementClientImpl client;
/**
* Initializes an instance of AlertsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
AlertsClientImpl(CostManagementClientImpl client) {
this.service = RestProxy.create(AlertsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for CostManagementClientAlerts to be used by the proxy service to perform
* REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "CostManagementClient")
public interface AlertsService {
@Headers({"Content-Type: application/json"})
@Get("/{scope}/providers/Microsoft.CostManagement/alerts")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "scope", encoded = true) String scope,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "scope", encoded = true) String scope,
@PathParam(value = "alertId", encoded = true) String alertId,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Patch("/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> dismiss(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam(value = "scope", encoded = true) String scope,
@PathParam(value = "alertId", encoded = true) String alertId,
@BodyParam("application/json") DismissAlertPayload parameters,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listExternal(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("externalCloudProviderType") ExternalCloudProviderType externalCloudProviderType,
@PathParam("externalCloudProviderId") String externalCloudProviderId,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Lists the alerts for scope defined.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @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 result of alerts along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync(String scope) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), scope, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists the alerts for scope defined.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @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 result of alerts along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync(String scope, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), this.client.getApiVersion(), scope, accept, context);
}
/**
* Lists the alerts for scope defined.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @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 result of alerts on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listAsync(String scope) {
return listWithResponseAsync(scope).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Lists the alerts for scope defined.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @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 result of alerts along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response listWithResponse(String scope, Context context) {
return listWithResponseAsync(scope, context).block();
}
/**
* Lists the alerts for scope defined.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @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 result of alerts.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AlertsResultInner list(String scope) {
return listWithResponse(scope, Context.NONE).getValue();
}
/**
* Gets the alert for the scope by alert ID.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @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 alert for the scope by alert ID along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String scope, String alertId) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (alertId == null) {
return Mono.error(new IllegalArgumentException("Parameter alertId is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.get(this.client.getEndpoint(), this.client.getApiVersion(), scope, alertId, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the alert for the scope by alert ID.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @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 alert for the scope by alert ID along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String scope, String alertId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (alertId == null) {
return Mono.error(new IllegalArgumentException("Parameter alertId 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(), scope, alertId, accept, context);
}
/**
* Gets the alert for the scope by alert ID.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @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 alert for the scope by alert ID on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String scope, String alertId) {
return getWithResponseAsync(scope, alertId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the alert for the scope by alert ID.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @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 alert for the scope by alert ID along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String scope, String alertId, Context context) {
return getWithResponseAsync(scope, alertId, context).block();
}
/**
* Gets the alert for the scope by alert ID.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @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 alert for the scope by alert ID.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AlertInner get(String scope, String alertId) {
return getWithResponse(scope, alertId, Context.NONE).getValue();
}
/**
* Dismisses the specified alert.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @param parameters Parameters supplied to the Dismiss Alert 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 an individual alert along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> dismissWithResponseAsync(
String scope, String alertId, DismissAlertPayload parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (alertId == null) {
return Mono.error(new IllegalArgumentException("Parameter alertId is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.dismiss(
this.client.getEndpoint(),
this.client.getApiVersion(),
scope,
alertId,
parameters,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Dismisses the specified alert.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @param parameters Parameters supplied to the Dismiss Alert operation.
* @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 an individual alert along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> dismissWithResponseAsync(
String scope, String alertId, DismissAlertPayload parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (scope == null) {
return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null."));
}
if (alertId == null) {
return Mono.error(new IllegalArgumentException("Parameter alertId is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.dismiss(
this.client.getEndpoint(), this.client.getApiVersion(), scope, alertId, parameters, accept, context);
}
/**
* Dismisses the specified alert.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @param parameters Parameters supplied to the Dismiss Alert 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 an individual alert on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono dismissAsync(String scope, String alertId, DismissAlertPayload parameters) {
return dismissWithResponseAsync(scope, alertId, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Dismisses the specified alert.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @param parameters Parameters supplied to the Dismiss Alert operation.
* @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 an individual alert along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response dismissWithResponse(
String scope, String alertId, DismissAlertPayload parameters, Context context) {
return dismissWithResponseAsync(scope, alertId, parameters, context).block();
}
/**
* Dismisses the specified alert.
*
* @param scope The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for
* subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup
* scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department
* scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
* for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for
* Management Group scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for
* billingProfile scope,
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
* for invoiceSection scope, and
* '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for
* partners.
* @param alertId Alert ID.
* @param parameters Parameters supplied to the Dismiss Alert 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 an individual alert.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AlertInner dismiss(String scope, String alertId, DismissAlertPayload parameters) {
return dismissWithResponse(scope, alertId, parameters, Context.NONE).getValue();
}
/**
* Lists the Alerts for external cloud provider type defined.
*
* @param externalCloudProviderType The external cloud provider type associated with dimension/query operations.
* This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated
* account.
* @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or
* '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
* @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 result of alerts along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listExternalWithResponseAsync(
ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (externalCloudProviderType == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter externalCloudProviderType is required and cannot be null."));
}
if (externalCloudProviderId == null) {
return Mono
.error(
new IllegalArgumentException("Parameter externalCloudProviderId is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.listExternal(
this.client.getEndpoint(),
this.client.getApiVersion(),
externalCloudProviderType,
externalCloudProviderId,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists the Alerts for external cloud provider type defined.
*
* @param externalCloudProviderType The external cloud provider type associated with dimension/query operations.
* This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated
* account.
* @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or
* '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
* @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 result of alerts along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listExternalWithResponseAsync(
ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (externalCloudProviderType == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter externalCloudProviderType is required and cannot be null."));
}
if (externalCloudProviderId == null) {
return Mono
.error(
new IllegalArgumentException("Parameter externalCloudProviderId is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listExternal(
this.client.getEndpoint(),
this.client.getApiVersion(),
externalCloudProviderType,
externalCloudProviderId,
accept,
context);
}
/**
* Lists the Alerts for external cloud provider type defined.
*
* @param externalCloudProviderType The external cloud provider type associated with dimension/query operations.
* This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated
* account.
* @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or
* '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
* @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 result of alerts on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listExternalAsync(
ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId) {
return listExternalWithResponseAsync(externalCloudProviderType, externalCloudProviderId)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Lists the Alerts for external cloud provider type defined.
*
* @param externalCloudProviderType The external cloud provider type associated with dimension/query operations.
* This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated
* account.
* @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or
* '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
* @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 result of alerts along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response listExternalWithResponse(
ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId, Context context) {
return listExternalWithResponseAsync(externalCloudProviderType, externalCloudProviderId, context).block();
}
/**
* Lists the Alerts for external cloud provider type defined.
*
* @param externalCloudProviderType The external cloud provider type associated with dimension/query operations.
* This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated
* account.
* @param externalCloudProviderId This can be '{externalSubscriptionId}' for linked account or
* '{externalBillingAccountId}' for consolidated account used with dimension/query operations.
* @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 result of alerts.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AlertsResultInner listExternal(
ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId) {
return listExternalWithResponse(externalCloudProviderType, externalCloudProviderId, Context.NONE).getValue();
}
}