From 082bb2fed618eb6ab728c0f10d1a397c3be49f91 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 14 Mar 2018 16:43:13 -0700 Subject: [PATCH 01/10] Generated from 189d112e0d578ff72b4e4531174f8d3c80c0b2f3 (#291) [Monitor] Fixing incorrect specification of top parameter for Metrics API (#2655) --- .../monitor/implementation/MetricsInner.java | 12 ++++++------ .../azure/management/monitor/package-info.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java index 17354274a57..4351df4782b 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java @@ -55,7 +55,7 @@ public MetricsInner(Retrofit retrofit, MonitorManagementClientImpl client) { interface MetricsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.Metrics list" }) @GET("{resourceUri}/providers/microsoft.insights/metrics") - Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("metricnames") String metricnames, @Query("aggregation") String aggregation, @Query("top") Double top, @Query("orderby") String orderby, @Query("$filter") String filter, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Query("metricnamespace") String metricnamespace, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("metricnames") String metricnames, @Query("aggregation") String aggregation, @Query("top") Integer top, @Query("orderby") String orderby, @Query("$filter") String filter, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Query("metricnamespace") String metricnamespace, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -116,7 +116,7 @@ public Observable> listWithServiceResponseAsync(S final Period interval = null; final String metricnames = null; final String aggregation = null; - final Double top = null; + final Integer top = null; final String orderby = null; final String filter = null; final ResultType resultType = null; @@ -157,7 +157,7 @@ public Observable> call(Response re * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ResponseInner object if successful. */ - public ResponseInner list(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Double top, String orderby, String filter, ResultType resultType, String metricnamespace) { + public ResponseInner list(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace) { return listWithServiceResponseAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace).toBlocking().single().body(); } @@ -182,7 +182,7 @@ public ResponseInner list(String resourceUri, String timespan, Period interval, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Double top, String orderby, String filter, ResultType resultType, String metricnamespace, final ServiceCallback serviceCallback) { + public ServiceFuture listAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace), serviceCallback); } @@ -206,7 +206,7 @@ public ServiceFuture listAsync(String resourceUri, String timespa * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ResponseInner object */ - public Observable listAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Double top, String orderby, String filter, ResultType resultType, String metricnamespace) { + public Observable listAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace) { return listWithServiceResponseAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace).map(new Func1, ResponseInner>() { @Override public ResponseInner call(ServiceResponse response) { @@ -235,7 +235,7 @@ public ResponseInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ResponseInner object */ - public Observable> listWithServiceResponseAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Double top, String orderby, String filter, ResultType resultType, String metricnamespace) { + public Observable> listWithServiceResponseAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace) { if (resourceUri == null) { throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java index 869b80781e2..fdcbdcf7339 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for managing Azure Monitor and getting logs and metrics. + * This package contains the classes for MonitorManagementClient. * Monitor Management Client. */ package com.microsoft.azure.management.monitor; From 6da4694fb60ff11e821d593dd4b49bdd5ff98fe6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 16 Mar 2018 13:45:01 -0700 Subject: [PATCH 02/10] Generated from a878bd64cf43e5cb9155fdecff440bfee98a49ce (#286) Support azureFunctionReceivers in actionGroup APIs From 89a52977c6ae96f4008f808f0b1a5d025ae00fe9 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 23 Mar 2018 10:05:46 -0700 Subject: [PATCH 03/10] [AutoPR monitor/resource-manager] [Monitoring] Add metric alerts api 2018-03-01 (#269) * Generated from 2e30b3b8dc4f256be2e18cbbbfdfe90ab3c63959 fix operation id * Generated from d2c0142c3622bbfc3bb8ead784179d7f85d646df fix type definition * Generated from 52b5586ac5772f40e6737713d295856c82587285 remove old property * Generated from 89e1369c4877001e2e40cead125ccfa4430e7fd7 fix type definitions * Generated from f81b39a8a23ec058ca2c72757aedc29896428426 Change flatten flag to false * Generated from f55f6ab4bf342187e73b81b2ac967bfafc63cab2 Update with review feedback * Generated from 56e36aba5586ca28ffa15bf1e4ced88a73fdba25 review feedback corrections, typos * Generated from 39e64c50ed648db6330d2c91ccf30beda754b46e fix examples * Generated from c7c883711c9ea38d5802e14942e5763f8307b607 spelling error in comment * Generated from c7c883711c9ea38d5802e14942e5763f8307b607 spelling error in comment --- .../azure/management/monitor/Action.java | 70 ++ .../azure/management/monitor/AlertStatus.java | 69 ++ .../monitor/MetricAlertCriteria.java | 52 ++ ...tSingleResourceMultipleMetricCriteria.java | 49 ++ .../management/monitor/MetricAlertStatus.java | 121 ++++ .../monitor/MetricAlertStatusProperties.java | 97 +++ .../management/monitor/MetricCriteria.java | 200 ++++++ .../management/monitor/MetricDimension.java | 96 +++ .../MetricAlertResourceInner.java | 252 ++++++++ .../MetricAlertResourcePatchInner.java | 278 ++++++++ .../MetricAlertStatusCollectionInner.java | 45 ++ .../implementation/MetricAlertsInner.java | 601 ++++++++++++++++++ .../MetricAlertsStatusInner.java | 239 +++++++ .../MonitorManagementClientImpl.java | 28 + 14 files changed, 2197 insertions(+) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourcePatchInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java new file mode 100644 index 00000000000..e174b47cd5e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert action. + */ +public class Action { + /** + * the id of the action group to use. + */ + @JsonProperty(value = "actionGroupId") + private String actionGroupId; + + /** + * The webhookProperties property. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the actionGroupId value. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the actionGroupId value. + * + * @param actionGroupId the actionGroupId value to set + * @return the Action object itself. + */ + public Action withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the webhookProperties value. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the webhookProperties value. + * + * @param webhookProperties the webhookProperties value to set + * @return the Action object itself. + */ + public Action withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java new file mode 100644 index 00000000000..14de61e2de6 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status. + */ +public class AlertStatus { + /** + * status value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * UTC time when the status was checked. + */ + @JsonProperty(value = "timestamp") + private String timestamp; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the AlertStatus object itself. + */ + public AlertStatus withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the timestamp value. + * + * @return the timestamp value + */ + public String timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp value. + * + * @param timestamp the timestamp value to set + * @return the AlertStatus object itself. + */ + public AlertStatus withTimestamp(String timestamp) { + this.timestamp = timestamp; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java new file mode 100644 index 00000000000..5e6b02bafcd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The rule criteria that defines the conditions of the alert rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("MetricAlertCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", value = MetricAlertSingleResourceMultipleMetricCriteria.class) +}) +public class MetricAlertCriteria { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Get the additionalProperties value. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties value. + * + * @param additionalProperties the additionalProperties value to set + * @return the MetricAlertCriteria object itself. + */ + public MetricAlertCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java new file mode 100644 index 00000000000..20d754b040f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria") +public class MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /** + * The list of metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** + * Get the allOf value. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf value. + * + * @param allOf the allOf value to set + * @return the MetricAlertSingleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertSingleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java new file mode 100644 index 00000000000..8a3fb875106 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status. + */ +public class MetricAlertStatus { + /** + * The status name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The alert rule arm id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The extended resource type name. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The alert status properties of the metric alert status. + */ + @JsonProperty(value = "properties") + private MetricAlertStatusProperties properties; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withType(String type) { + this.type = type; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public MetricAlertStatusProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withProperties(MetricAlertStatusProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java new file mode 100644 index 00000000000..94360c50133 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status properties. + */ +public class MetricAlertStatusProperties { + /** + * The dimensions property. + */ + @JsonProperty(value = "dimensions") + private Map dimensions; + + /** + * status value. + */ + @JsonProperty(value = "status") + private String status; + + /** + * UTC time when the status was checked. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Get the dimensions value. + * + * @return the dimensions value + */ + public Map dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions value. + * + * @param dimensions the dimensions value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withDimensions(Map dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the status value. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the timestamp value. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp value. + * + * @param timestamp the timestamp value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java new file mode 100644 index 00000000000..c5b0ce6869c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MetricCriteria model. + */ +public class MetricCriteria { + /** + * Name of the criteria. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * Namespace of the metric. + */ + @JsonProperty(value = "metricNamespace") + private String metricNamespace; + + /** + * the criteria operator. + */ + @JsonProperty(value = "operator", required = true) + private Object operator; + + /** + * the criteria time aggregation types. + */ + @JsonProperty(value = "timeAggregation", required = true) + private Object timeAggregation; + + /** + * the criteria threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * List of dimension conditions. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withName(String name) { + this.name = name; + return this; + } + + /** + * Get the metricName value. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName value. + * + * @param metricName the metricName value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the metricNamespace value. + * + * @return the metricNamespace value + */ + public String metricNamespace() { + return this.metricNamespace; + } + + /** + * Set the metricNamespace value. + * + * @param metricNamespace the metricNamespace value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + return this; + } + + /** + * Get the operator value. + * + * @return the operator value + */ + public Object operator() { + return this.operator; + } + + /** + * Set the operator value. + * + * @param operator the operator value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withOperator(Object operator) { + this.operator = operator; + return this; + } + + /** + * Get the timeAggregation value. + * + * @return the timeAggregation value + */ + public Object timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the timeAggregation value. + * + * @param timeAggregation the timeAggregation value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withTimeAggregation(Object timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get the threshold value. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold value. + * + * @param threshold the threshold value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the dimensions value. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions value. + * + * @param dimensions the dimensions value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java new file mode 100644 index 00000000000..3309c284328 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MetricDimension model. + */ +public class MetricDimension { + /** + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * the dimension operator. + */ + @JsonProperty(value = "operator", required = true) + private String operator; + + /** + * list of dimension values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operator value. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set the operator value. + * + * @param operator the operator value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get the values value. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the values value. + * + * @param values the values value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java new file mode 100644 index 00000000000..d646967537b --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java @@ -0,0 +1,252 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import org.joda.time.Period; +import com.microsoft.azure.management.monitor.MetricAlertCriteria; +import com.microsoft.azure.management.monitor.Action; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The metric alert resource. + */ +@JsonFlatten +public class MetricAlertResourceInner extends Resource { + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the severity value. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set the severity value. + * + * @param severity the severity value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the scopes value. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes value. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the evaluationFrequency value. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set the evaluationFrequency value. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the windowSize value. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize value. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the criteria value. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set the criteria value. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the actions value. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions value. + * + * @param actions the actions value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourcePatchInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourcePatchInner.java new file mode 100644 index 00000000000..d6ece9bfa04 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourcePatchInner.java @@ -0,0 +1,278 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.Map; +import java.util.List; +import org.joda.time.Period; +import com.microsoft.azure.management.monitor.MetricAlertCriteria; +import com.microsoft.azure.management.monitor.Action; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The metric alert resource for patch operations. + */ +@JsonFlatten +public class MetricAlertResourcePatchInner { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the severity value. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set the severity value. + * + * @param severity the severity value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the scopes value. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes value. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the evaluationFrequency value. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set the evaluationFrequency value. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the windowSize value. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize value. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the criteria value. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set the criteria value. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the actions value. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions value. + * + * @param actions the actions value to set + * @return the MetricAlertResourcePatchInner object itself. + */ + public MetricAlertResourcePatchInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java new file mode 100644 index 00000000000..de139575806 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.MetricAlertStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a collection of alert rule resources. + */ +public class MetricAlertStatusCollectionInner { + /** + * the values for the alert rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the MetricAlertStatusCollectionInner object itself. + */ + public MetricAlertStatusCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java new file mode 100644 index 00000000000..b77ed8139da --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java @@ -0,0 +1,601 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricAlerts. + */ +public class MetricAlertsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private MetricAlertsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricAlertsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricAlertsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricAlerts to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricAlertsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Insight/metricAlerts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourcePatchInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve an alert rule definiton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule definiton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Retrieve an alert rule definiton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule definiton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner createOrUpdate(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-03-01"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner update(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-03-01"; + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an alert rule defitiniton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Delete an alert rule defitiniton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Delete an alert rule defitiniton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an alert rule defitiniton. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.delete(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java new file mode 100644 index 00000000000..ebe0f2f6c27 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java @@ -0,0 +1,239 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricAlertsStatus. + */ +public class MetricAlertsStatusInner { + /** The Retrofit service to perform REST calls. */ + private MetricAlertsStatusService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricAlertsStatusInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricAlertsStatusInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricAlertsStatusService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricAlertsStatus to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricAlertsStatusService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlertsStatus list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}/status") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlertsStatus listByName" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}/status/{statusName}") + Observable> listByName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("statusName") String statusName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertStatusCollectionInner object if successful. + */ + public MetricAlertStatusCollectionInner list(String resourceGroupName, String ruleName) { + return listWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable listAsync(String resourceGroupName, String ruleName) { + return listWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, MetricAlertStatusCollectionInner>() { + @Override + public MetricAlertStatusCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable> listWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertStatusCollectionInner object if successful. + */ + public MetricAlertStatusCollectionInner listByName(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByNameAsync(String resourceGroupName, String ruleName, String statusName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName), serviceCallback); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable listByNameAsync(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName).map(new Func1, MetricAlertStatusCollectionInner>() { + @Override + public MetricAlertStatusCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable> listByNameWithServiceResponseAsync(String resourceGroupName, String ruleName, String statusName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (statusName == null) { + throw new IllegalArgumentException("Parameter statusName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.listByName(this.client.subscriptionId(), resourceGroupName, ruleName, statusName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java index 7a27435e62d..f41e2cda0ee 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java @@ -315,6 +315,32 @@ public MetricBaselinesInner metricBaselines() { return this.metricBaselines; } + /** + * The MetricAlertsInner object to access its operations. + */ + private MetricAlertsInner metricAlerts; + + /** + * Gets the MetricAlertsInner object to access its operations. + * @return the MetricAlertsInner object. + */ + public MetricAlertsInner metricAlerts() { + return this.metricAlerts; + } + + /** + * The MetricAlertsStatusInner object to access its operations. + */ + private MetricAlertsStatusInner metricAlertsStatus; + + /** + * Gets the MetricAlertsStatusInner object to access its operations. + * @return the MetricAlertsStatusInner object. + */ + public MetricAlertsStatusInner metricAlertsStatus() { + return this.metricAlertsStatus; + } + /** * Initializes an instance of MonitorManagementClient client. * @@ -364,6 +390,8 @@ protected void initialize() { this.metricDefinitions = new MetricDefinitionsInner(restClient().retrofit(), this); this.metrics = new MetricsInner(restClient().retrofit(), this); this.metricBaselines = new MetricBaselinesInner(restClient().retrofit(), this); + this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); + this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } From c4e0e331d2de7e57f4dfba9b8bb66026f6cb2a3a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 29 Mar 2018 14:57:26 -0700 Subject: [PATCH 04/10] Generated from b48e884abf37b969e12fd673c7b88e620346d635 (#30) Fix regression in tag --- .../monitor/AzureFunctionReceiver.java | 122 ++++++++++++++++++ .../management/monitor/LogicAppReceiver.java | 96 ++++++++++++++ .../management/monitor/VoiceReceiver.java | 96 ++++++++++++++ .../ActionGroupResourceInner.java | 81 ++++++++++++ .../implementation/ActionGroupsInner.java | 14 +- 5 files changed, 402 insertions(+), 7 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java new file mode 100644 index 00000000000..620bef52631 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An azure function receiver. + */ +public class AzureFunctionReceiver { + /** + * The name of the azure function receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the function app. + */ + @JsonProperty(value = "functionAppResourceId", required = true) + private String functionAppResourceId; + + /** + * The function name in the function app. + */ + @JsonProperty(value = "functionName", required = true) + private String functionName; + + /** + * The http trigger url where http request sent to. + */ + @JsonProperty(value = "httpTriggerUrl", required = true) + private String httpTriggerUrl; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the functionAppResourceId value. + * + * @return the functionAppResourceId value + */ + public String functionAppResourceId() { + return this.functionAppResourceId; + } + + /** + * Set the functionAppResourceId value. + * + * @param functionAppResourceId the functionAppResourceId value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionAppResourceId(String functionAppResourceId) { + this.functionAppResourceId = functionAppResourceId; + return this; + } + + /** + * Get the functionName value. + * + * @return the functionName value + */ + public String functionName() { + return this.functionName; + } + + /** + * Set the functionName value. + * + * @param functionName the functionName value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionName(String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get the httpTriggerUrl value. + * + * @return the httpTriggerUrl value + */ + public String httpTriggerUrl() { + return this.httpTriggerUrl; + } + + /** + * Set the httpTriggerUrl value. + * + * @param httpTriggerUrl the httpTriggerUrl value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withHttpTriggerUrl(String httpTriggerUrl) { + this.httpTriggerUrl = httpTriggerUrl; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java new file mode 100644 index 00000000000..042a3191577 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A logic app receiver. + */ +public class LogicAppReceiver { + /** + * The name of the logic app receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the logic app receiver. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /** + * The callback url where http request sent to. + */ + @JsonProperty(value = "callbackUrl", required = true) + private String callbackUrl; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resourceId value. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId value. + * + * @param resourceId the resourceId value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the callbackUrl value. + * + * @return the callbackUrl value + */ + public String callbackUrl() { + return this.callbackUrl; + } + + /** + * Set the callbackUrl value. + * + * @param callbackUrl the callbackUrl value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java new file mode 100644 index 00000000000..36aab350337 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A voice receiver. + */ +public class VoiceReceiver { + /** + * The name of the voice receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the voice receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the voice receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the countryCode value. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode value. + * + * @param countryCode the countryCode value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phoneNumber value. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber value. + * + * @param phoneNumber the phoneNumber value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java index 21b481e12da..8fb8513bd57 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java @@ -15,6 +15,9 @@ import com.microsoft.azure.management.monitor.ItsmReceiver; import com.microsoft.azure.management.monitor.AzureAppPushReceiver; import com.microsoft.azure.management.monitor.AutomationRunbookReceiver; +import com.microsoft.azure.management.monitor.VoiceReceiver; +import com.microsoft.azure.management.monitor.LogicAppReceiver; +import com.microsoft.azure.management.monitor.AzureFunctionReceiver; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -74,6 +77,24 @@ public class ActionGroupResourceInner extends Resource { @JsonProperty(value = "properties.automationRunbookReceivers") private List automationRunbookReceivers; + /** + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "properties.voiceReceivers") + private List voiceReceivers; + + /** + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "properties.logicAppReceivers") + private List logicAppReceivers; + + /** + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureFunctionReceivers") + private List azureFunctionReceivers; + /** * Get the groupShortName value. * @@ -234,4 +255,64 @@ public ActionGroupResourceInner withAutomationRunbookReceivers(List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the voiceReceivers value. + * + * @param voiceReceivers the voiceReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Get the logicAppReceivers value. + * + * @return the logicAppReceivers value + */ + public List logicAppReceivers() { + return this.logicAppReceivers; + } + + /** + * Set the logicAppReceivers value. + * + * @param logicAppReceivers the logicAppReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withLogicAppReceivers(List logicAppReceivers) { + this.logicAppReceivers = logicAppReceivers; + return this; + } + + /** + * Get the azureFunctionReceivers value. + * + * @return the azureFunctionReceivers value + */ + public List azureFunctionReceivers() { + return this.azureFunctionReceivers; + } + + /** + * Set the azureFunctionReceivers value. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureFunctionReceivers(List azureFunctionReceivers) { + this.azureFunctionReceivers = azureFunctionReceivers; + return this; + } + } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java index ec4987538a3..56a9f06700f 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java @@ -164,7 +164,7 @@ public Observable> createOrUpdateWithS throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); } Validator.validate(actionGroup); - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; return service.createOrUpdate(resourceGroupName, actionGroupName, this.client.subscriptionId(), actionGroup, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -249,7 +249,7 @@ public Observable> getByResourceGroupW if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; return service.getByResourceGroup(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -332,7 +332,7 @@ public Observable> deleteWithServiceResponseAsync(String r if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; return service.delete(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -425,7 +425,7 @@ public Observable> updateWithServiceRe throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); } Validator.validate(actionGroupPatch); - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; return service.update(this.client.subscriptionId(), resourceGroupName, actionGroupName, apiVersion, actionGroupPatch, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -499,7 +499,7 @@ public Observable>> listWithServi if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -581,7 +581,7 @@ public Observable>> listByResourc if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -672,7 +672,7 @@ public Observable> enableReceiverWithServiceResponseAsync( if (receiverName == null) { throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); } - final String apiVersion = "2017-04-01"; + final String apiVersion = "2018-03-01"; EnableRequest enableRequest = new EnableRequest(); enableRequest.withReceiverName(receiverName); return service.enableReceiver(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), enableRequest, this.client.userAgent()) From a47c2c7b41a056ad446ba5af96837b37fad8931f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 10:37:43 -0700 Subject: [PATCH 05/10] Generated from 992c89b743e8428fad25d981499b32665cfffc1c (#38) merge from upstream --- .../monitor/implementation/MetricAlertsInner.java | 12 ++++++------ .../implementation/MetricAlertsStatusInner.java | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java index b77ed8139da..2dc5dd484f8 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java @@ -64,27 +64,27 @@ public MetricAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) */ interface MetricAlertsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts list" }) - @GET("subscriptions/{subscriptionId}/providers/Microsoft.Insight/metricAlerts") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts listByResourceGroup" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts") Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts getByResourceGroup" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts createOrUpdate" }) - @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts update" }) - @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourcePatchInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts delete" }) - @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}", method = "DELETE", hasBody = true) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", method = "DELETE", hasBody = true) Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java index ebe0f2f6c27..b7c32623336 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java @@ -52,11 +52,11 @@ public MetricAlertsStatusInner(Retrofit retrofit, MonitorManagementClientImpl cl */ interface MetricAlertsStatusService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlertsStatus list" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}/status") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status") Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlertsStatus listByName" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insight/metricAlerts/{ruleName}/status/{statusName}") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}") Observable> listByName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("statusName") String statusName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } From cc5885d8b1821d0ad1a548cb8a418ca1abb07989 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 5 Apr 2018 11:39:07 -0700 Subject: [PATCH 06/10] Generated from 18015d33322270e3572da438b7548e1f8bc109fc (#59) Add extra description for Subscribe API --- .../monitor/implementation/ActionGroupsInner.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java index 56a9f06700f..3c00da21137 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java @@ -605,7 +605,7 @@ private ServiceResponse> listByResourceGroup } /** - * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. * * @param resourceGroupName The name of the resource group. * @param actionGroupName The name of the action group. @@ -619,7 +619,7 @@ public void enableReceiver(String resourceGroupName, String actionGroupName, Str } /** - * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. * * @param resourceGroupName The name of the resource group. * @param actionGroupName The name of the action group. @@ -633,7 +633,7 @@ public ServiceFuture enableReceiverAsync(String resourceGroupName, String } /** - * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. * * @param resourceGroupName The name of the resource group. * @param actionGroupName The name of the action group. @@ -651,7 +651,7 @@ public Void call(ServiceResponse response) { } /** - * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. * * @param resourceGroupName The name of the resource group. * @param actionGroupName The name of the action group. From 7282303af13ec8a340b9008f9812e969f88c6abc Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 24 Apr 2018 10:53:20 -0700 Subject: [PATCH 07/10] [AutoPR monitor/resource-manager] Added GA API version for Scheduled Query Rule (#71) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Generated from 2e4c790d16eb6be9299db7a75798bca1697fd5e9 Added GA API version for Scheduled Query Rule Added GA API version for Scheduled Query Rule * Generated from d183bad923d3a0a4092d21203f850db6cde9f4e9 Resolving Comments Resolving Comments * Generated from df40ac3bbf17ea0180dd4adff2af3094065feca0 Made SKU as top level proprty and including generic error response format Couple of changes - 1. Made SKU as top level proprty as mentioned here - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#put-resource 2. including generic error response format * Generated from 7578160670750a68d05f77ec8163b25bb72f391e Minor Changes to align implementation 1. Removed SKU - Billing Model is still under discussion, hence need not to be exposed to customers. 2. Enabled field ichanged to align with camel case. 3. 'throttleTillDate' in properties.action changed to 'throttlingInMin' to denote correct meaning and it’s data type changed to number instead of date. 4. 'status' to be removed in properties.action from examples. 5. 'severity' made a required field in properties.action. 6. Removed Examples from original spec json * Generated from fb180fb311d73934d0f5150f72638cc3de155ea0 Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear --- .../azure/management/monitor/Action.java | 8 + .../management/monitor/AlertSeverity.java | 50 ++ .../azure/management/monitor/AlertStatus.java | 64 +- .../management/monitor/AlertingAction.java | 125 ++++ .../management/monitor/AzNsActionGroup.java | 96 +++ .../monitor/ConditionalOperator.java | 44 ++ .../azure/management/monitor/Enabled.java | 41 ++ .../management/monitor/MetricTrigger.java | 80 +++ .../management/monitor/MetricTriggerType.java | 41 ++ .../management/monitor/ProvisioningState.java | 47 ++ .../azure/management/monitor/QueryType.java | 38 + .../azure/management/monitor/Schedule.java | 70 ++ .../azure/management/monitor/Sku.java | 44 ++ .../azure/management/monitor/Sku1.java | 44 ++ .../azure/management/monitor/SkuType.java | 44 ++ .../azure/management/monitor/Source.java | 124 ++++ .../management/monitor/TriggerCondition.java | 96 +++ .../LogSearchRuleResourceInner.java | 188 +++++ .../MonitorManagementClientImpl.java | 14 + .../ScheduledQueryRulesInner.java | 657 ++++++++++++++++++ 20 files changed, 1869 insertions(+), 46 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java index e174b47cd5e..0e5bf9cb828 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java @@ -10,10 +10,18 @@ import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; /** * An alert action. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Action") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", value = AlertingAction.class) +}) public class Action { /** * the id of the action group to use. diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java new file mode 100644 index 00000000000..ba4209cd3f1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AlertSeverity. + */ +public final class AlertSeverity extends ExpandableStringEnum { + /** Static value 0 for AlertSeverity. */ + public static final AlertSeverity ZERO = fromString("0"); + + /** Static value 1 for AlertSeverity. */ + public static final AlertSeverity ONE = fromString("1"); + + /** Static value 2 for AlertSeverity. */ + public static final AlertSeverity TWO = fromString("2"); + + /** Static value 3 for AlertSeverity. */ + public static final AlertSeverity THREE = fromString("3"); + + /** Static value 4 for AlertSeverity. */ + public static final AlertSeverity FOUR = fromString("4"); + + /** + * Creates or finds a AlertSeverity from its string representation. + * @param name a name to look for + * @return the corresponding AlertSeverity + */ + @JsonCreator + public static AlertSeverity fromString(String name) { + return fromString(name, AlertSeverity.class); + } + + /** + * @return known AlertSeverity values + */ + public static Collection values() { + return values(AlertSeverity.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java index 14de61e2de6..70f280e0124 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java @@ -8,62 +8,34 @@ package com.microsoft.azure.management.monitor; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; /** - * An alert status. + * Defines values for AlertStatus. */ -public class AlertStatus { - /** - * status value. - */ - @JsonProperty(value = "value") - private String value; +public final class AlertStatus extends ExpandableStringEnum { + /** Static value Active for AlertStatus. */ + public static final AlertStatus ACTIVE = fromString("Active"); - /** - * UTC time when the status was checked. - */ - @JsonProperty(value = "timestamp") - private String timestamp; + /** Static value Inactive for AlertStatus. */ + public static final AlertStatus INACTIVE = fromString("Inactive"); /** - * Get the value value. - * - * @return the value value + * Creates or finds a AlertStatus from its string representation. + * @param name a name to look for + * @return the corresponding AlertStatus */ - public String value() { - return this.value; + @JsonCreator + public static AlertStatus fromString(String name) { + return fromString(name, AlertStatus.class); } /** - * Set the value value. - * - * @param value the value value to set - * @return the AlertStatus object itself. + * @return known AlertStatus values */ - public AlertStatus withValue(String value) { - this.value = value; - return this; + public static Collection values() { + return values(AlertStatus.class); } - - /** - * Get the timestamp value. - * - * @return the timestamp value - */ - public String timestamp() { - return this.timestamp; - } - - /** - * Set the timestamp value. - * - * @param timestamp the timestamp value to set - * @return the AlertStatus object itself. - */ - public AlertStatus withTimestamp(String timestamp) { - this.timestamp = timestamp; - return this; - } - } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java new file mode 100644 index 00000000000..f18f5d019b1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifiy action need to be taken when rule type is Alert. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction") +public class AlertingAction extends Action { + /** + * Severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + */ + @JsonProperty(value = "severity", required = true) + private AlertSeverity severity; + + /** + * azns notification group reference. + */ + @JsonProperty(value = "aznsAction", required = true) + private AzNsActionGroup aznsAction; + + /** + * time (in minutes) for which Alerts should be throttled. + */ + @JsonProperty(value = "throttlingInMin") + private Integer throttlingInMin; + + /** + * The trigger condition that results in the alert rule being. + */ + @JsonProperty(value = "trigger", required = true) + private TriggerCondition trigger; + + /** + * Get the severity value. + * + * @return the severity value + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity value. + * + * @param severity the severity value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the aznsAction value. + * + * @return the aznsAction value + */ + public AzNsActionGroup aznsAction() { + return this.aznsAction; + } + + /** + * Set the aznsAction value. + * + * @param aznsAction the aznsAction value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withAznsAction(AzNsActionGroup aznsAction) { + this.aznsAction = aznsAction; + return this; + } + + /** + * Get the throttlingInMin value. + * + * @return the throttlingInMin value + */ + public Integer throttlingInMin() { + return this.throttlingInMin; + } + + /** + * Set the throttlingInMin value. + * + * @param throttlingInMin the throttlingInMin value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withThrottlingInMin(Integer throttlingInMin) { + this.throttlingInMin = throttlingInMin; + return this; + } + + /** + * Get the trigger value. + * + * @return the trigger value + */ + public TriggerCondition trigger() { + return this.trigger; + } + + /** + * Set the trigger value. + * + * @param trigger the trigger value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withTrigger(TriggerCondition trigger) { + this.trigger = trigger; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java new file mode 100644 index 00000000000..b33a01f9236 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * azns notification group. + */ +public class AzNsActionGroup { + /** + * Azure Group reference. + */ + @JsonProperty(value = "actionGroup") + private List actionGroup; + + /** + * Custom subject for Azns email. + */ + @JsonProperty(value = "emailSubject") + private String emailSubject; + + /** + * Custom webhook payload to be send to azns action group. + */ + @JsonProperty(value = "customWebhookPayload") + private String customWebhookPayload; + + /** + * Get the actionGroup value. + * + * @return the actionGroup value + */ + public List actionGroup() { + return this.actionGroup; + } + + /** + * Set the actionGroup value. + * + * @param actionGroup the actionGroup value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withActionGroup(List actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + /** + * Get the emailSubject value. + * + * @return the emailSubject value + */ + public String emailSubject() { + return this.emailSubject; + } + + /** + * Set the emailSubject value. + * + * @param emailSubject the emailSubject value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withEmailSubject(String emailSubject) { + this.emailSubject = emailSubject; + return this; + } + + /** + * Get the customWebhookPayload value. + * + * @return the customWebhookPayload value + */ + public String customWebhookPayload() { + return this.customWebhookPayload; + } + + /** + * Set the customWebhookPayload value. + * + * @param customWebhookPayload the customWebhookPayload value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withCustomWebhookPayload(String customWebhookPayload) { + this.customWebhookPayload = customWebhookPayload; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java new file mode 100644 index 00000000000..a853f79cd0f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConditionalOperator. + */ +public final class ConditionalOperator extends ExpandableStringEnum { + /** Static value GreaterThan for ConditionalOperator. */ + public static final ConditionalOperator GREATER_THAN = fromString("GreaterThan"); + + /** Static value LessThan for ConditionalOperator. */ + public static final ConditionalOperator LESS_THAN = fromString("LessThan"); + + /** Static value Equal for ConditionalOperator. */ + public static final ConditionalOperator EQUAL = fromString("Equal"); + + /** + * Creates or finds a ConditionalOperator from its string representation. + * @param name a name to look for + * @return the corresponding ConditionalOperator + */ + @JsonCreator + public static ConditionalOperator fromString(String name) { + return fromString(name, ConditionalOperator.class); + } + + /** + * @return known ConditionalOperator values + */ + public static Collection values() { + return values(ConditionalOperator.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java new file mode 100644 index 00000000000..7f7eebb1c20 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Enabled. + */ +public final class Enabled extends ExpandableStringEnum { + /** Static value true for Enabled. */ + public static final Enabled TRUE = fromString("true"); + + /** Static value false for Enabled. */ + public static final Enabled FALSE = fromString("false"); + + /** + * Creates or finds a Enabled from its string representation. + * @param name a name to look for + * @return the corresponding Enabled + */ + @JsonCreator + public static Enabled fromString(String name) { + return fromString(name, Enabled.class); + } + + /** + * @return known Enabled values + */ + public static Collection values() { + return values(Enabled.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java index a3556ef56ee..4cbb583aa65 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java @@ -72,6 +72,26 @@ public class MetricTrigger { @JsonProperty(value = "threshold", required = true) private double threshold; + /** + * Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + * Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator") + private ConditionalOperator thresholdOperator; + + /** + * Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: + * 'Consecutive', 'Total'. + */ + @JsonProperty(value = "metricTriggerType") + private MetricTriggerType metricTriggerType; + + /** + * Evaluation of metric on a particular column. + */ + @JsonProperty(value = "metricColumn") + private String metricColumn; + /** * Get the metricName value. * @@ -232,4 +252,64 @@ public MetricTrigger withThreshold(double threshold) { return this; } + /** + * Get the thresholdOperator value. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set the thresholdOperator value. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the metricTriggerType value. + * + * @return the metricTriggerType value + */ + public MetricTriggerType metricTriggerType() { + return this.metricTriggerType; + } + + /** + * Set the metricTriggerType value. + * + * @param metricTriggerType the metricTriggerType value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricTriggerType(MetricTriggerType metricTriggerType) { + this.metricTriggerType = metricTriggerType; + return this; + } + + /** + * Get the metricColumn value. + * + * @return the metricColumn value + */ + public String metricColumn() { + return this.metricColumn; + } + + /** + * Set the metricColumn value. + * + * @param metricColumn the metricColumn value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricColumn(String metricColumn) { + this.metricColumn = metricColumn; + return this; + } + } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java new file mode 100644 index 00000000000..8df88be4b0e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MetricTriggerType. + */ +public final class MetricTriggerType extends ExpandableStringEnum { + /** Static value Consecutive for MetricTriggerType. */ + public static final MetricTriggerType CONSECUTIVE = fromString("Consecutive"); + + /** Static value Total for MetricTriggerType. */ + public static final MetricTriggerType TOTAL = fromString("Total"); + + /** + * Creates or finds a MetricTriggerType from its string representation. + * @param name a name to look for + * @return the corresponding MetricTriggerType + */ + @JsonCreator + public static MetricTriggerType fromString(String name) { + return fromString(name, MetricTriggerType.class); + } + + /** + * @return known MetricTriggerType values + */ + public static Collection values() { + return values(MetricTriggerType.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java new file mode 100644 index 00000000000..5f5d1db1f35 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deploying for ProvisioningState. */ + public static final ProvisioningState DEPLOYING = fromString("Deploying"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java new file mode 100644 index 00000000000..40bbcec076e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for QueryType. + */ +public final class QueryType extends ExpandableStringEnum { + /** Static value ResultCount for QueryType. */ + public static final QueryType RESULT_COUNT = fromString("ResultCount"); + + /** + * Creates or finds a QueryType from its string representation. + * @param name a name to look for + * @return the corresponding QueryType + */ + @JsonCreator + public static QueryType fromString(String name) { + return fromString(name, QueryType.class); + } + + /** + * @return known QueryType values + */ + public static Collection values() { + return values(QueryType.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java new file mode 100644 index 00000000000..ef2ff407afe --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines how often to run the search and the time interval. + */ +public class Schedule { + /** + * frequency (in minutes) at which rule condition should be evaluated. + */ + @JsonProperty(value = "frequencyInMinutes", required = true) + private int frequencyInMinutes; + + /** + * Time window for which data needs to be fetched for query (should be + * greater than or equal to frequencyInMinutes). + */ + @JsonProperty(value = "timeWindowInMinutes", required = true) + private int timeWindowInMinutes; + + /** + * Get the frequencyInMinutes value. + * + * @return the frequencyInMinutes value + */ + public int frequencyInMinutes() { + return this.frequencyInMinutes; + } + + /** + * Set the frequencyInMinutes value. + * + * @param frequencyInMinutes the frequencyInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withFrequencyInMinutes(int frequencyInMinutes) { + this.frequencyInMinutes = frequencyInMinutes; + return this; + } + + /** + * Get the timeWindowInMinutes value. + * + * @return the timeWindowInMinutes value + */ + public int timeWindowInMinutes() { + return this.timeWindowInMinutes; + } + + /** + * Set the timeWindowInMinutes value. + * + * @param timeWindowInMinutes the timeWindowInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withTimeWindowInMinutes(int timeWindowInMinutes) { + this.timeWindowInMinutes = timeWindowInMinutes; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java new file mode 100644 index 00000000000..4f39a05de57 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Sku. + */ +public final class Sku extends ExpandableStringEnum { + /** Static value L1 for Sku. */ + public static final Sku L1 = fromString("L1"); + + /** Static value L2 for Sku. */ + public static final Sku L2 = fromString("L2"); + + /** Static value L3 for Sku. */ + public static final Sku L3 = fromString("L3"); + + /** + * Creates or finds a Sku from its string representation. + * @param name a name to look for + * @return the corresponding Sku + */ + @JsonCreator + public static Sku fromString(String name) { + return fromString(name, Sku.class); + } + + /** + * @return known Sku values + */ + public static Collection values() { + return values(Sku.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java new file mode 100644 index 00000000000..d44ef142baa --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU of rule. + */ +public class Sku1 { + /** + * The name of the SKU (L1, L2, L3). Possible values include: 'L1', 'L2', + * 'L3'. + */ + @JsonProperty(value = "name") + private Sku name; + + /** + * Get the name value. + * + * @return the name value + */ + public Sku name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the Sku1 object itself. + */ + public Sku1 withName(Sku name) { + this.name = name; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.java new file mode 100644 index 00000000000..4c057fe4e02 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuType. + */ +public final class SkuType extends ExpandableStringEnum { + /** Static value L1 for SkuType. */ + public static final SkuType L1 = fromString("L1"); + + /** Static value L2 for SkuType. */ + public static final SkuType L2 = fromString("L2"); + + /** Static value L3 for SkuType. */ + public static final SkuType L3 = fromString("L3"); + + /** + * Creates or finds a SkuType from its string representation. + * @param name a name to look for + * @return the corresponding SkuType + */ + @JsonCreator + public static SkuType fromString(String name) { + return fromString(name, SkuType.class); + } + + /** + * @return known SkuType values + */ + public static Collection values() { + return values(SkuType.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java new file mode 100644 index 00000000000..9975f717548 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the log search query. + */ +public class Source { + /** + * Log search query. + */ + @JsonProperty(value = "query", required = true) + private String query; + + /** + * List of Resource referred into query. + */ + @JsonProperty(value = "authorizedResources") + private List authorizedResources; + + /** + * The resource uri over which log search query is to be run. + */ + @JsonProperty(value = "datasourceId", required = true) + private String datasourceId; + + /** + * Set value to ResultCount if query should be returning search result + * count. Set it to Number if its a metric query. Possible values include: + * 'ResultCount'. + */ + @JsonProperty(value = "queryType") + private QueryType queryType; + + /** + * Get the query value. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set the query value. + * + * @param query the query value to set + * @return the Source object itself. + */ + public Source withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the authorizedResources value. + * + * @return the authorizedResources value + */ + public List authorizedResources() { + return this.authorizedResources; + } + + /** + * Set the authorizedResources value. + * + * @param authorizedResources the authorizedResources value to set + * @return the Source object itself. + */ + public Source withAuthorizedResources(List authorizedResources) { + this.authorizedResources = authorizedResources; + return this; + } + + /** + * Get the datasourceId value. + * + * @return the datasourceId value + */ + public String datasourceId() { + return this.datasourceId; + } + + /** + * Set the datasourceId value. + * + * @param datasourceId the datasourceId value to set + * @return the Source object itself. + */ + public Source withDatasourceId(String datasourceId) { + this.datasourceId = datasourceId; + return this; + } + + /** + * Get the queryType value. + * + * @return the queryType value + */ + public QueryType queryType() { + return this.queryType; + } + + /** + * Set the queryType value. + * + * @param queryType the queryType value to set + * @return the Source object itself. + */ + public Source withQueryType(QueryType queryType) { + this.queryType = queryType; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java new file mode 100644 index 00000000000..1ea896e30a4 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The condition that results in the Log Search rule. + */ +public class TriggerCondition { + /** + * Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible + * values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator", required = true) + private ConditionalOperator thresholdOperator; + + /** + * Result or count threshold based on which rule should be triggered. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * Trigger condition for metric query rule. + */ + @JsonProperty(value = "metricTrigger") + private MetricTrigger metricTrigger; + + /** + * Get the thresholdOperator value. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set the thresholdOperator value. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the threshold value. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold value. + * + * @param threshold the threshold value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the metricTrigger value. + * + * @return the metricTrigger value + */ + public MetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set the metricTrigger value. + * + * @param metricTrigger the metricTrigger value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withMetricTrigger(MetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java new file mode 100644 index 00000000000..6be988338a9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.Enabled; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.ProvisioningState; +import com.microsoft.azure.management.monitor.Source; +import com.microsoft.azure.management.monitor.Schedule; +import com.microsoft.azure.management.monitor.Action; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The Log Search Rule resource. + */ +@JsonFlatten +public class LogSearchRuleResourceInner extends Resource { + /** + * The description of the Log Search rule. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. Possible values include: 'true', 'false'. + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * Last time the rule was updated in IS08601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Provisioning state of the scheduledquery rule. Possible values include: + * 'Succeeded', 'Deploying', 'Canceled', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Data Source against which rule will Query Data. + */ + @JsonProperty(value = "properties.source", required = true) + private Source source; + + /** + * Schedule (Frequnecy, Time Window) for rule. + */ + @JsonProperty(value = "properties.schedule", required = true) + private Schedule schedule; + + /** + * Action needs to be taken on rule execution. + */ + @JsonProperty(value = "properties.action", required = true) + private Action action; + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the source value. + * + * @return the source value + */ + public Source source() { + return this.source; + } + + /** + * Set the source value. + * + * @param source the source value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSource(Source source) { + this.source = source; + return this; + } + + /** + * Get the schedule value. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule value. + * + * @param schedule the schedule value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the action value. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set the action value. + * + * @param action the action value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withAction(Action action) { + this.action = action; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java index f41e2cda0ee..0dbb43f8d39 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java @@ -341,6 +341,19 @@ public MetricAlertsStatusInner metricAlertsStatus() { return this.metricAlertsStatus; } + /** + * The ScheduledQueryRulesInner object to access its operations. + */ + private ScheduledQueryRulesInner scheduledQueryRules; + + /** + * Gets the ScheduledQueryRulesInner object to access its operations. + * @return the ScheduledQueryRulesInner object. + */ + public ScheduledQueryRulesInner scheduledQueryRules() { + return this.scheduledQueryRules; + } + /** * Initializes an instance of MonitorManagementClient client. * @@ -392,6 +405,7 @@ protected void initialize() { this.metricBaselines = new MetricBaselinesInner(restClient().retrofit(), this); this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); + this.scheduledQueryRules = new ScheduledQueryRulesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java new file mode 100644 index 00000000000..d2da7e63829 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java @@ -0,0 +1,657 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ScheduledQueryRules. + */ +public class ScheduledQueryRulesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ScheduledQueryRulesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ScheduledQueryRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ScheduledQueryRulesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ScheduledQueryRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ScheduledQueryRules to be + * used by Retrofit to perform actually REST calls. + */ + interface ScheduledQueryRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body LogSearchRuleResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner createOrUpdate(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-04-16"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.getByResourceGroup(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.delete(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a subscription group. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.list(this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the PagedList object if successful. + */ + public PagedList list(String filter) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync(filter).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(filter), serviceCallback); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listAsync(String filter) { + return listWithServiceResponseAsync(filter).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync(String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.list(this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName, String filter) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter), serviceCallback); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName, String filter) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName, String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} From 5350c38cc7fd4acd435bcc9c28682e40a65fe685 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 3 May 2018 08:33:33 -0700 Subject: [PATCH 08/10] Generated from 0c826790271a1be2d4af5905ee0eb089b4260feb (#132) Merge pull request #1 from abversqr/MinorUpdates Minor updates --- .../management/monitor/AlertingAction.java | 4 ++-- .../management/monitor/AzNsActionGroup.java | 8 ++++---- .../azure/management/monitor/Source.java | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java index f18f5d019b1..c3c709e77df 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java @@ -25,13 +25,13 @@ public class AlertingAction extends Action { private AlertSeverity severity; /** - * azns notification group reference. + * Azure action group reference. */ @JsonProperty(value = "aznsAction", required = true) private AzNsActionGroup aznsAction; /** - * time (in minutes) for which Alerts should be throttled. + * time (in minutes) for which Alerts should be throttled or suppressed. */ @JsonProperty(value = "throttlingInMin") private Integer throttlingInMin; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java index b33a01f9236..78d21eb6059 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java @@ -12,23 +12,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * azns notification group. + * Azure action group. */ public class AzNsActionGroup { /** - * Azure Group reference. + * Azure Action Group reference. */ @JsonProperty(value = "actionGroup") private List actionGroup; /** - * Custom subject for Azns email. + * Custom subject override for all email ids in Azure action group. */ @JsonProperty(value = "emailSubject") private String emailSubject; /** - * Custom webhook payload to be send to azns action group. + * Custom payload to be sent for all webook URI in Azure action group. */ @JsonProperty(value = "customWebhookPayload") private String customWebhookPayload; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java index 9975f717548..692ae34d192 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java @@ -30,8 +30,8 @@ public class Source { /** * The resource uri over which log search query is to be run. */ - @JsonProperty(value = "datasourceId", required = true) - private String datasourceId; + @JsonProperty(value = "dataSourceId", required = true) + private String dataSourceId; /** * Set value to ResultCount if query should be returning search result @@ -82,22 +82,22 @@ public Source withAuthorizedResources(List authorizedResources) { } /** - * Get the datasourceId value. + * Get the dataSourceId value. * - * @return the datasourceId value + * @return the dataSourceId value */ - public String datasourceId() { - return this.datasourceId; + public String dataSourceId() { + return this.dataSourceId; } /** - * Set the datasourceId value. + * Set the dataSourceId value. * - * @param datasourceId the datasourceId value to set + * @param dataSourceId the dataSourceId value to set * @return the Source object itself. */ - public Source withDatasourceId(String datasourceId) { - this.datasourceId = datasourceId; + public Source withDataSourceId(String dataSourceId) { + this.dataSourceId = dataSourceId; return this; } From 05059552a778100dc2abe53c9270da43fac2ec86 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 21 May 2018 08:57:14 -0700 Subject: [PATCH 09/10] [AutoPR monitor/resource-manager] Add "autoMitigate" to Metric Alert API spec for 2018-03-01 (#177) * Generated from d5b9b4545a8d15c70d3c8318d39e2f7b43229387 AutoMitigate changes * Generated from d5b9b4545a8d15c70d3c8318d39e2f7b43229387 AutoMitigate changes --- .../monitor/ActionGroupPatchBody.java | 73 +++++ .../monitor/ActivityLogAlertPatchBody.java | 73 +++++ .../monitor/AlertRuleResourcePatch.java | 195 +++++++++++ .../management/monitor/AlertingAction.java | 4 +- .../AutoscaleSettingResourcePatch.java | 181 +++++++++++ .../management/monitor/AzNsActionGroup.java | 8 +- .../monitor/LogProfileResourcePatch.java | 185 +++++++++++ .../monitor/MetricAlertResourcePatch.java | 303 ++++++++++++++++++ .../azure/management/monitor/Source.java | 20 +- .../monitor/TimeSeriesInformation.java | 97 ++++++ .../implementation/ActionGroupsInner.java | 23 +- .../ActivityLogAlertsInner.java | 23 +- .../AlertRuleIncidentsInner.java | 6 +- .../implementation/AlertRulesInner.java | 17 +- .../AutoscaleSettingsInner.java | 11 +- .../implementation/EventCategoriesInner.java | 6 +- .../implementation/LogProfilesInner.java | 17 +- .../MetricAlertResourceInner.java | 27 ++ .../implementation/MetricAlertsInner.java | 23 +- .../implementation/MetricBaselinesInner.java | 11 +- .../MetricDefinitionsInner.java | 12 +- .../monitor/implementation/MetricInner.java | 153 +++++++++ .../implementation/OperationInner.java | 70 ++++ .../OperationListResultInner.java | 7 +- .../monitor/implementation/ResponseInner.java | 7 +- .../ScheduledQueryRulesInner.java | 24 +- 26 files changed, 1501 insertions(+), 75 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java new file mode 100644 index 00000000000..94328598223 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An action group object for the body of patch operations. + */ +@JsonFlatten +public class ActionGroupPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java new file mode 100644 index 00000000000..02b866de8aa --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An activity log alert object for the body of patch operations. + */ +@JsonFlatten +public class ActivityLogAlertPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java new file mode 100644 index 00000000000..e4d1065951d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The alert rule object for patch operations. + */ +@JsonFlatten +public class AlertRuleResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name", required = true) + private String name; + + /** + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled", required = true) + private boolean isEnabled; + + /** + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.condition", required = true) + private RuleCondition condition; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the isEnabled value. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled value. + * + * @param isEnabled the isEnabled value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the condition value. + * + * @return the condition value + */ + public RuleCondition condition() { + return this.condition; + } + + /** + * Set the condition value. + * + * @param condition the condition value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withCondition(RuleCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the actions value. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions value. + * + * @param actions the actions value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java index c3c709e77df..f18f5d019b1 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java @@ -25,13 +25,13 @@ public class AlertingAction extends Action { private AlertSeverity severity; /** - * Azure action group reference. + * azns notification group reference. */ @JsonProperty(value = "aznsAction", required = true) private AzNsActionGroup aznsAction; /** - * time (in minutes) for which Alerts should be throttled or suppressed. + * time (in minutes) for which Alerts should be throttled. */ @JsonProperty(value = "throttlingInMin") private Integer throttlingInMin; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java new file mode 100644 index 00000000000..af655d8e6ef --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The autoscale setting object for patch operations. + */ +@JsonFlatten +public class AutoscaleSettingResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the collection of automatic scaling profiles that specify different + * scaling parameters for different time periods. A maximum of 20 profiles + * can be specified. + */ + @JsonProperty(value = "properties.profiles", required = true) + private List profiles; + + /** + * the collection of notifications. + */ + @JsonProperty(value = "properties.notifications") + private List notifications; + + /** + * the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'true'. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * the name of the autoscale setting. + */ + @JsonProperty(value = "properties.name") + private String name; + + /** + * the resource identifier of the resource that the autoscale setting + * should be added to. + */ + @JsonProperty(value = "properties.targetResourceUri") + private String targetResourceUri; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the profiles value. + * + * @return the profiles value + */ + public List profiles() { + return this.profiles; + } + + /** + * Set the profiles value. + * + * @param profiles the profiles value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withProfiles(List profiles) { + this.profiles = profiles; + return this; + } + + /** + * Get the notifications value. + * + * @return the notifications value + */ + public List notifications() { + return this.notifications; + } + + /** + * Set the notifications value. + * + * @param notifications the notifications value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withNotifications(List notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withName(String name) { + this.name = name; + return this; + } + + /** + * Get the targetResourceUri value. + * + * @return the targetResourceUri value + */ + public String targetResourceUri() { + return this.targetResourceUri; + } + + /** + * Set the targetResourceUri value. + * + * @param targetResourceUri the targetResourceUri value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTargetResourceUri(String targetResourceUri) { + this.targetResourceUri = targetResourceUri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java index 78d21eb6059..b33a01f9236 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java @@ -12,23 +12,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Azure action group. + * azns notification group. */ public class AzNsActionGroup { /** - * Azure Action Group reference. + * Azure Group reference. */ @JsonProperty(value = "actionGroup") private List actionGroup; /** - * Custom subject override for all email ids in Azure action group. + * Custom subject for Azns email. */ @JsonProperty(value = "emailSubject") private String emailSubject; /** - * Custom payload to be sent for all webook URI in Azure action group. + * Custom webhook payload to be send to azns action group. */ @JsonProperty(value = "customWebhookPayload") private String customWebhookPayload; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java new file mode 100644 index 00000000000..12dec8935e0 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The log profile resource for patch operations. + */ +@JsonFlatten +public class LogProfileResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule ID of the service bus namespace in which you would + * like to have Event Hubs created for streaming the Activity Log. The rule + * ID is of the format: '{service bus resource ID}/authorizationrules/{key + * name}'. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * List of regions for which Activity Log events should be stored or + * streamed. It is a comma separated list of valid ARM locations including + * the 'global' location. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /** + * the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or + * 'Action.'. + */ + @JsonProperty(value = "properties.categories", required = true) + private List categories; + + /** + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.retentionPolicy", required = true) + private RetentionPolicy retentionPolicy; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the storageAccountId value. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId value. + * + * @param storageAccountId the storageAccountId value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the serviceBusRuleId value. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the serviceBusRuleId value. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get the locations value. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations value. + * + * @param locations the locations value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the categories value. + * + * @return the categories value + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories value. + * + * @param categories the categories value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the retentionPolicy value. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retentionPolicy value. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java new file mode 100644 index 00000000000..f3742e24d1e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java @@ -0,0 +1,303 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import org.joda.time.Period; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The metric alert resource for patch operations. + */ +@JsonFlatten +public class MetricAlertResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the flag that indicates whether the alert should be auto resolved or + * not. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the severity value. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set the severity value. + * + * @param severity the severity value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the scopes value. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes value. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the evaluationFrequency value. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set the evaluationFrequency value. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the windowSize value. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize value. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the criteria value. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set the criteria value. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the autoMitigate value. + * + * @return the autoMitigate value + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the autoMitigate value. + * + * @param autoMitigate the autoMitigate value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the actions value. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions value. + * + * @param actions the actions value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java index 692ae34d192..9975f717548 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java @@ -30,8 +30,8 @@ public class Source { /** * The resource uri over which log search query is to be run. */ - @JsonProperty(value = "dataSourceId", required = true) - private String dataSourceId; + @JsonProperty(value = "datasourceId", required = true) + private String datasourceId; /** * Set value to ResultCount if query should be returning search result @@ -82,22 +82,22 @@ public Source withAuthorizedResources(List authorizedResources) { } /** - * Get the dataSourceId value. + * Get the datasourceId value. * - * @return the dataSourceId value + * @return the datasourceId value */ - public String dataSourceId() { - return this.dataSourceId; + public String datasourceId() { + return this.datasourceId; } /** - * Set the dataSourceId value. + * Set the datasourceId value. * - * @param dataSourceId the dataSourceId value to set + * @param datasourceId the datasourceId value to set * @return the Source object itself. */ - public Source withDataSourceId(String dataSourceId) { - this.dataSourceId = dataSourceId; + public Source withDatasourceId(String datasourceId) { + this.datasourceId = datasourceId; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java new file mode 100644 index 00000000000..7cdba9e7c7f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The time series info needed for calculating the baseline. + */ +public class TimeSeriesInformation { + /** + * the list of sensitivities for calculating the baseline. + */ + @JsonProperty(value = "sensitivities", required = true) + private List sensitivities; + + /** + * The metric values to calculate the baseline. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * the array of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps") + private List timestamps; + + /** + * Get the sensitivities value. + * + * @return the sensitivities value + */ + public List sensitivities() { + return this.sensitivities; + } + + /** + * Set the sensitivities value. + * + * @param sensitivities the sensitivities value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withSensitivities(List sensitivities) { + this.sensitivities = sensitivities; + return this; + } + + /** + * Get the values value. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the values value. + * + * @param values the values value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the timestamps value. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the timestamps value. + * + * @param timestamps the timestamps value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java index 3c00da21137..dc27541438d 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java @@ -13,6 +13,7 @@ import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ActionGroupPatchBody; import com.microsoft.azure.management.monitor.EnableRequest; import com.microsoft.azure.management.monitor.ErrorResponseException; import com.microsoft.azure.Page; @@ -78,7 +79,7 @@ interface ActionGroupsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Query("api-version") String apiVersion, @Body ActionGroupPatchBodyInner actionGroupPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Query("api-version") String apiVersion, @Body ActionGroupPatchBody actionGroupPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups list" }) @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") @@ -366,7 +367,7 @@ private ServiceResponse deleteDelegate(Response response) th * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ActionGroupResourceInner object if successful. */ - public ActionGroupResourceInner update(String resourceGroupName, String actionGroupName, ActionGroupPatchBodyInner actionGroupPatch) { + public ActionGroupResourceInner update(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).toBlocking().single().body(); } @@ -380,7 +381,7 @@ public ActionGroupResourceInner update(String resourceGroupName, String actionGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBodyInner actionGroupPatch, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch), serviceCallback); } @@ -393,7 +394,7 @@ public ServiceFuture updateAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ActionGroupResourceInner object */ - public Observable updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBodyInner actionGroupPatch) { + public Observable updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).map(new Func1, ActionGroupResourceInner>() { @Override public ActionGroupResourceInner call(ServiceResponse response) { @@ -411,7 +412,7 @@ public ActionGroupResourceInner call(ServiceResponse r * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ActionGroupResourceInner object */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBodyInner actionGroupPatch) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -506,7 +507,11 @@ public Observable>> listWithServi public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -588,7 +593,11 @@ public Observable>> listByResourc public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java index c51bcee888a..ecfba36c6c8 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java @@ -13,6 +13,7 @@ import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ActivityLogAlertPatchBody; import com.microsoft.azure.management.monitor.ErrorResponseException; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; @@ -76,7 +77,7 @@ interface ActivityLogAlertsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertPatchBodyInner activityLogAlertPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertPatchBody activityLogAlertPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts list" }) @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") @@ -360,7 +361,7 @@ private ServiceResponse deleteDelegate(Response response) th * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ActivityLogAlertResourceInner object if successful. */ - public ActivityLogAlertResourceInner update(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBodyInner activityLogAlertPatch) { + public ActivityLogAlertResourceInner update(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).toBlocking().single().body(); } @@ -374,7 +375,7 @@ public ActivityLogAlertResourceInner update(String resourceGroupName, String act * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBodyInner activityLogAlertPatch, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch), serviceCallback); } @@ -387,7 +388,7 @@ public ServiceFuture updateAsync(String resourceG * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ActivityLogAlertResourceInner object */ - public Observable updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBodyInner activityLogAlertPatch) { + public Observable updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).map(new Func1, ActivityLogAlertResourceInner>() { @Override public ActivityLogAlertResourceInner call(ServiceResponse response) { @@ -405,7 +406,7 @@ public ActivityLogAlertResourceInner call(ServiceResponse> updateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBodyInner activityLogAlertPatch) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -500,7 +501,11 @@ public Observable>> listWith public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -582,7 +587,11 @@ public Observable>> listByRe public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java index 829effd303e..0582f08c7fe 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java @@ -223,7 +223,11 @@ public Observable>> listByAlertRuleWithServi public Observable>> call(Response response) { try { ServiceResponse> result = listByAlertRuleDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java index 7722eb20a4c..4858b842db1 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java @@ -13,6 +13,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.AlertRuleResourcePatch; import com.microsoft.azure.management.monitor.ErrorResponseException; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; @@ -76,7 +77,7 @@ interface AlertRulesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules update" }) @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body AlertRuleResourcePatchInner alertRulesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body AlertRuleResourcePatch alertRulesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules") @@ -356,7 +357,7 @@ private ServiceResponse getByResourceGroupDelegate(Respo * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the AlertRuleResourceInner object if successful. */ - public AlertRuleResourceInner update(String resourceGroupName, String ruleName, AlertRuleResourcePatchInner alertRulesResource) { + public AlertRuleResourceInner update(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { return updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource).toBlocking().single().body(); } @@ -370,7 +371,7 @@ public AlertRuleResourceInner update(String resourceGroupName, String ruleName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatchInner alertRulesResource, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource), serviceCallback); } @@ -383,7 +384,7 @@ public ServiceFuture updateAsync(String resourceGroupNam * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AlertRuleResourceInner object */ - public Observable updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatchInner alertRulesResource) { + public Observable updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { return updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource).map(new Func1, AlertRuleResourceInner>() { @Override public AlertRuleResourceInner call(ServiceResponse response) { @@ -401,7 +402,7 @@ public AlertRuleResourceInner call(ServiceResponse respo * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AlertRuleResourceInner object */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatchInner alertRulesResource) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -504,7 +505,11 @@ public Observable>> listByResourceG public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java index 27c2b457bfd..d3900756875 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java @@ -14,6 +14,7 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.monitor.AutoscaleSettingResourcePatch; import com.microsoft.azure.management.monitor.ErrorResponseException; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; @@ -82,7 +83,7 @@ interface AutoscaleSettingsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings update" }) @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("autoscaleSettingName") String autoscaleSettingName, @Query("api-version") String apiVersion, @Body AutoscaleSettingResourcePatchInner autoscaleSettingResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("autoscaleSettingName") String autoscaleSettingName, @Query("api-version") String apiVersion, @Body AutoscaleSettingResourcePatch autoscaleSettingResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings listByResourceGroupNext" }) @GET @@ -475,7 +476,7 @@ private ServiceResponse getByResourceGroupDelegat * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the AutoscaleSettingResourceInner object if successful. */ - public AutoscaleSettingResourceInner update(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatchInner autoscaleSettingResource) { + public AutoscaleSettingResourceInner update(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { return updateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).toBlocking().single().body(); } @@ -489,7 +490,7 @@ public AutoscaleSettingResourceInner update(String resourceGroupName, String aut * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatchInner autoscaleSettingResource, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource), serviceCallback); } @@ -502,7 +503,7 @@ public ServiceFuture updateAsync(String resourceG * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AutoscaleSettingResourceInner object */ - public Observable updateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatchInner autoscaleSettingResource) { + public Observable updateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { return updateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).map(new Func1, AutoscaleSettingResourceInner>() { @Override public AutoscaleSettingResourceInner call(ServiceResponse response) { @@ -520,7 +521,7 @@ public AutoscaleSettingResourceInner call(ServiceResponse> updateWithServiceResponseAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatchInner autoscaleSettingResource) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java index ef7d2b16063..baa063f2738 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java @@ -109,7 +109,11 @@ public Observable>> listWithService public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java index 06212db0fe3..5084cbf238a 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java @@ -12,6 +12,7 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.LogProfileResourcePatch; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -74,7 +75,7 @@ interface LogProfilesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles update" }) @PATCH("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("logProfileName") String logProfileName, @Query("api-version") String apiVersion, @Body LogProfileResourcePatchInner logProfilesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("logProfileName") String logProfileName, @Query("api-version") String apiVersion, @Body LogProfileResourcePatch logProfilesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles list" }) @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles") @@ -330,7 +331,7 @@ private ServiceResponse createOrUpdateDelegate(Response * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the LogProfileResourceInner object if successful. */ - public LogProfileResourceInner update(String logProfileName, LogProfileResourcePatchInner logProfilesResource) { + public LogProfileResourceInner update(String logProfileName, LogProfileResourcePatch logProfilesResource) { return updateWithServiceResponseAsync(logProfileName, logProfilesResource).toBlocking().single().body(); } @@ -343,7 +344,7 @@ public LogProfileResourceInner update(String logProfileName, LogProfileResourceP * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String logProfileName, LogProfileResourcePatchInner logProfilesResource, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String logProfileName, LogProfileResourcePatch logProfilesResource, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(logProfileName, logProfilesResource), serviceCallback); } @@ -355,7 +356,7 @@ public ServiceFuture updateAsync(String logProfileName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the LogProfileResourceInner object */ - public Observable updateAsync(String logProfileName, LogProfileResourcePatchInner logProfilesResource) { + public Observable updateAsync(String logProfileName, LogProfileResourcePatch logProfilesResource) { return updateWithServiceResponseAsync(logProfileName, logProfilesResource).map(new Func1, LogProfileResourceInner>() { @Override public LogProfileResourceInner call(ServiceResponse response) { @@ -372,7 +373,7 @@ public LogProfileResourceInner call(ServiceResponse res * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the LogProfileResourceInner object */ - public Observable> updateWithServiceResponseAsync(String logProfileName, LogProfileResourcePatchInner logProfilesResource) { + public Observable> updateWithServiceResponseAsync(String logProfileName, LogProfileResourcePatch logProfilesResource) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -464,7 +465,11 @@ public Observable>> listWithServic public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java index d646967537b..37939e0910e 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java @@ -67,6 +67,13 @@ public class MetricAlertResourceInner extends Resource { @JsonProperty(value = "properties.criteria", required = true) private MetricAlertCriteria criteria; + /** + * the flag that indicates whether the alert should be auto resolved or + * not. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + /** * the array of actions that are performed when the alert rule becomes * active, and when an alert condition is resolved. @@ -220,6 +227,26 @@ public MetricAlertResourceInner withCriteria(MetricAlertCriteria criteria) { return this; } + /** + * Get the autoMitigate value. + * + * @return the autoMitigate value + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the autoMitigate value. + * + * @param autoMitigate the autoMitigate value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + /** * Get the actions value. * diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java index 2dc5dd484f8..5cc7ac2e805 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java @@ -15,6 +15,7 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.MetricAlertResourcePatch; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -81,7 +82,7 @@ interface MetricAlertsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourcePatchInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourcePatch parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", method = "DELETE", hasBody = true) @@ -148,7 +149,11 @@ public Observable>> listWithServi public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -230,7 +235,11 @@ public Observable>> listByResourc public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -433,7 +442,7 @@ private ServiceResponse createOrUpdateDelegate(Respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the MetricAlertResourceInner object if successful. */ - public MetricAlertResourceInner update(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters) { + public MetricAlertResourceInner update(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); } @@ -447,7 +456,7 @@ public MetricAlertResourceInner update(String resourceGroupName, String ruleName * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); } @@ -460,7 +469,7 @@ public ServiceFuture updateAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the MetricAlertResourceInner object */ - public Observable updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters) { + public Observable updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { @Override public MetricAlertResourceInner call(ServiceResponse response) { @@ -478,7 +487,7 @@ public MetricAlertResourceInner call(ServiceResponse r * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the MetricAlertResourceInner object */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatchInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java index 17e55ebbe83..b2855c0b9fd 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java @@ -12,6 +12,7 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.management.monitor.ErrorResponseException; import com.microsoft.azure.management.monitor.ResultType; +import com.microsoft.azure.management.monitor.TimeSeriesInformation; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; @@ -62,7 +63,7 @@ interface MetricBaselinesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricBaselines calculateBaseline" }) @POST("{resourceUri}/providers/microsoft.insights/calculatebaseline") - Observable> calculateBaseline(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Body TimeSeriesInformationInner timeSeriesInformation, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> calculateBaseline(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Body TimeSeriesInformation timeSeriesInformation, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -256,7 +257,7 @@ private ServiceResponse getDelegate(Response calculateBaselineAsync(String resourceUri, TimeSeriesInformationInner timeSeriesInformation, final ServiceCallback serviceCallback) { + public ServiceFuture calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation), serviceCallback); } @@ -281,7 +282,7 @@ public ServiceFuture calculateBaselineAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CalculateBaselineResponseInner object */ - public Observable calculateBaselineAsync(String resourceUri, TimeSeriesInformationInner timeSeriesInformation) { + public Observable calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { return calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation).map(new Func1, CalculateBaselineResponseInner>() { @Override public CalculateBaselineResponseInner call(ServiceResponse response) { @@ -298,7 +299,7 @@ public CalculateBaselineResponseInner call(ServiceResponse> calculateBaselineWithServiceResponseAsync(String resourceUri, TimeSeriesInformationInner timeSeriesInformation) { + public Observable> calculateBaselineWithServiceResponseAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { if (resourceUri == null) { throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java index c3976d9c411..5d4cb841b25 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java @@ -118,7 +118,11 @@ public Observable>> listWithServiceR public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -190,7 +194,11 @@ public Observable>> listWithServiceR public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java new file mode 100644 index 00000000000..0856a1b2be3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.Unit; +import java.util.List; +import com.microsoft.azure.management.monitor.TimeSeriesElement; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result data of a query. + */ +public class MetricInner { + /** + * the metric Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * the resource type of the metric resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * the name and the display name of the metric, i.e. it is localizable + * string. + */ + @JsonProperty(value = "name", required = true) + private LocalizableStringInner name; + + /** + * the unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + */ + @JsonProperty(value = "unit", required = true) + private Unit unit; + + /** + * the time series returned when a data query is performed. + */ + @JsonProperty(value = "timeseries", required = true) + private List timeseries; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the MetricInner object itself. + */ + public MetricInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the MetricInner object itself. + */ + public MetricInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the MetricInner object itself. + */ + public MetricInner withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the unit value. + * + * @return the unit value + */ + public Unit unit() { + return this.unit; + } + + /** + * Set the unit value. + * + * @param unit the unit value to set + * @return the MetricInner object itself. + */ + public MetricInner withUnit(Unit unit) { + this.unit = unit; + return this; + } + + /** + * Get the timeseries value. + * + * @return the timeseries value + */ + public List timeseries() { + return this.timeseries; + } + + /** + * Set the timeseries value. + * + * @param timeseries the timeseries value to set + * @return the MetricInner object itself. + */ + public MetricInner withTimeseries(List timeseries) { + this.timeseries = timeseries; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java new file mode 100644 index 00000000000..62b2f51a240 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft Insights API operation definition. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java index 9181700a4f8..b3b1a72e87f 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.monitor.implementation; import java.util.List; -import com.microsoft.azure.management.monitor.Operation; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -21,7 +20,7 @@ public class OperationListResultInner { * List of operations supported by the Microsoft.Insights provider. */ @JsonProperty(value = "value") - private List value; + private List value; /** * URL to get the next set of operation list results if there are any. @@ -34,7 +33,7 @@ public class OperationListResultInner { * * @return the value value */ - public List value() { + public List value() { return this.value; } @@ -44,7 +43,7 @@ public List value() { * @param value the value value to set * @return the OperationListResultInner object itself. */ - public OperationListResultInner withValue(List value) { + public OperationListResultInner withValue(List value) { this.value = value; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java index 84b48ef811b..4ed92b46869 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java @@ -10,7 +10,6 @@ import org.joda.time.Period; import java.util.List; -import com.microsoft.azure.management.monitor.Metric; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -56,7 +55,7 @@ public class ResponseInner { * the value of the collection. */ @JsonProperty(value = "value", required = true) - private List value; + private List value; /** * Get the cost value. @@ -163,7 +162,7 @@ public ResponseInner withResourceregion(String resourceregion) { * * @return the value value */ - public List value() { + public List value() { return this.value; } @@ -173,7 +172,7 @@ public List value() { * @param value the value value to set * @return the ResponseInner object itself. */ - public ResponseInner withValue(List value) { + public ResponseInner withValue(List value) { this.value = value; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java index d2da7e63829..385f57a3992 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java @@ -404,7 +404,11 @@ public Observable>> listWithSer public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -476,7 +480,11 @@ public Observable>> listWithSer public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -559,7 +567,11 @@ public Observable>> listByResou public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -638,7 +650,11 @@ public Observable>> listByResou public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); From 8371326afa55d009f34a1c7af862422884d183df Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 24 May 2018 14:06:24 -0700 Subject: [PATCH 10/10] [AutoPR monitor/resource-manager] [Monitor] Deconflict "Action" name in MetricAlert (#191) * Generated from 35adc5e493c20a57e6e2cb35d87c578133d2b7a6 [Monitor] Deconflict "Action" name in MetricAlert Generates bad SDK. * Generated from ebfaf0bdd7f2bcf736598d8ec501f490a83d1268 Update reference to MetricAlertAction --- .../azure/management/monitor/Action.java | 56 +-------------- .../management/monitor/AlertingAction.java | 4 +- .../management/monitor/AzNsActionGroup.java | 8 +-- .../management/monitor/MetricAlertAction.java | 70 +++++++++++++++++++ .../monitor/MetricAlertResourcePatch.java | 6 +- .../azure/management/monitor/Source.java | 20 +++--- .../MetricAlertResourceInner.java | 8 +-- 7 files changed, 94 insertions(+), 78 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java index 0e5bf9cb828..33f96695d21 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java @@ -8,14 +8,12 @@ package com.microsoft.azure.management.monitor; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonSubTypes; /** - * An alert action. + * The Action model. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") @JsonTypeName("Action") @@ -23,56 +21,4 @@ @JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", value = AlertingAction.class) }) public class Action { - /** - * the id of the action group to use. - */ - @JsonProperty(value = "actionGroupId") - private String actionGroupId; - - /** - * The webhookProperties property. - */ - @JsonProperty(value = "webhookProperties") - private Map webhookProperties; - - /** - * Get the actionGroupId value. - * - * @return the actionGroupId value - */ - public String actionGroupId() { - return this.actionGroupId; - } - - /** - * Set the actionGroupId value. - * - * @param actionGroupId the actionGroupId value to set - * @return the Action object itself. - */ - public Action withActionGroupId(String actionGroupId) { - this.actionGroupId = actionGroupId; - return this; - } - - /** - * Get the webhookProperties value. - * - * @return the webhookProperties value - */ - public Map webhookProperties() { - return this.webhookProperties; - } - - /** - * Set the webhookProperties value. - * - * @param webhookProperties the webhookProperties value to set - * @return the Action object itself. - */ - public Action withWebhookProperties(Map webhookProperties) { - this.webhookProperties = webhookProperties; - return this; - } - } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java index f18f5d019b1..c3c709e77df 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java @@ -25,13 +25,13 @@ public class AlertingAction extends Action { private AlertSeverity severity; /** - * azns notification group reference. + * Azure action group reference. */ @JsonProperty(value = "aznsAction", required = true) private AzNsActionGroup aznsAction; /** - * time (in minutes) for which Alerts should be throttled. + * time (in minutes) for which Alerts should be throttled or suppressed. */ @JsonProperty(value = "throttlingInMin") private Integer throttlingInMin; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java index b33a01f9236..78d21eb6059 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java @@ -12,23 +12,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * azns notification group. + * Azure action group. */ public class AzNsActionGroup { /** - * Azure Group reference. + * Azure Action Group reference. */ @JsonProperty(value = "actionGroup") private List actionGroup; /** - * Custom subject for Azns email. + * Custom subject override for all email ids in Azure action group. */ @JsonProperty(value = "emailSubject") private String emailSubject; /** - * Custom webhook payload to be send to azns action group. + * Custom payload to be sent for all webook URI in Azure action group. */ @JsonProperty(value = "customWebhookPayload") private String customWebhookPayload; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java new file mode 100644 index 00000000000..94ae95d02d0 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert action. + */ +public class MetricAlertAction { + /** + * the id of the action group to use. + */ + @JsonProperty(value = "actionGroupId") + private String actionGroupId; + + /** + * The webhookProperties property. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the actionGroupId value. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the actionGroupId value. + * + * @param actionGroupId the actionGroupId value to set + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the webhookProperties value. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the webhookProperties value. + * + * @param webhookProperties the webhookProperties value to set + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java index f3742e24d1e..c4f0820dd40 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java @@ -83,7 +83,7 @@ public class MetricAlertResourcePatch { * active, and when an alert condition is resolved. */ @JsonProperty(value = "properties.actions") - private List actions; + private List actions; /** * Last time the rule was updated in ISO8601 format. @@ -276,7 +276,7 @@ public MetricAlertResourcePatch withAutoMitigate(Boolean autoMitigate) { * * @return the actions value */ - public List actions() { + public List actions() { return this.actions; } @@ -286,7 +286,7 @@ public List actions() { * @param actions the actions value to set * @return the MetricAlertResourcePatch object itself. */ - public MetricAlertResourcePatch withActions(List actions) { + public MetricAlertResourcePatch withActions(List actions) { this.actions = actions; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java index 9975f717548..692ae34d192 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java @@ -30,8 +30,8 @@ public class Source { /** * The resource uri over which log search query is to be run. */ - @JsonProperty(value = "datasourceId", required = true) - private String datasourceId; + @JsonProperty(value = "dataSourceId", required = true) + private String dataSourceId; /** * Set value to ResultCount if query should be returning search result @@ -82,22 +82,22 @@ public Source withAuthorizedResources(List authorizedResources) { } /** - * Get the datasourceId value. + * Get the dataSourceId value. * - * @return the datasourceId value + * @return the dataSourceId value */ - public String datasourceId() { - return this.datasourceId; + public String dataSourceId() { + return this.dataSourceId; } /** - * Set the datasourceId value. + * Set the dataSourceId value. * - * @param datasourceId the datasourceId value to set + * @param dataSourceId the dataSourceId value to set * @return the Source object itself. */ - public Source withDatasourceId(String datasourceId) { - this.datasourceId = datasourceId; + public Source withDataSourceId(String dataSourceId) { + this.dataSourceId = dataSourceId; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java index 37939e0910e..dd2047c69e8 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java @@ -11,7 +11,7 @@ import java.util.List; import org.joda.time.Period; import com.microsoft.azure.management.monitor.MetricAlertCriteria; -import com.microsoft.azure.management.monitor.Action; +import com.microsoft.azure.management.monitor.MetricAlertAction; import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -79,7 +79,7 @@ public class MetricAlertResourceInner extends Resource { * active, and when an alert condition is resolved. */ @JsonProperty(value = "properties.actions") - private List actions; + private List actions; /** * Last time the rule was updated in ISO8601 format. @@ -252,7 +252,7 @@ public MetricAlertResourceInner withAutoMitigate(Boolean autoMitigate) { * * @return the actions value */ - public List actions() { + public List actions() { return this.actions; } @@ -262,7 +262,7 @@ public List actions() { * @param actions the actions value to set * @return the MetricAlertResourceInner object itself. */ - public MetricAlertResourceInner withActions(List actions) { + public MetricAlertResourceInner withActions(List actions) { this.actions = actions; return this; }