diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineMetadata.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineMetadata.java new file mode 100644 index 0000000000000..1b7b824d3d254 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineMetadata.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; + +/** + * Represents a baseline metadata value. + */ +public class BaselineMetadata { + /** + * Name of the baseline metadata. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Value of the baseline metadata. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get name of the baseline metadata. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the baseline metadata. + * + * @param name the name value to set + * @return the BaselineMetadata object itself. + */ + public BaselineMetadata withName(String name) { + this.name = name; + return this; + } + + /** + * Get value of the baseline metadata. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set value of the baseline metadata. + * + * @param value the value value to set + * @return the BaselineMetadata object itself. + */ + public BaselineMetadata withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineSensitivity.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineSensitivity.java new file mode 100644 index 0000000000000..c19b76336eeb1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineSensitivity.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 BaselineSensitivity. + */ +public final class BaselineSensitivity extends ExpandableStringEnum { + /** Static value Low for BaselineSensitivity. */ + public static final BaselineSensitivity LOW = fromString("Low"); + + /** Static value Medium for BaselineSensitivity. */ + public static final BaselineSensitivity MEDIUM = fromString("Medium"); + + /** Static value High for BaselineSensitivity. */ + public static final BaselineSensitivity HIGH = fromString("High"); + + /** + * Creates or finds a BaselineSensitivity from its string representation. + * @param name a name to look for + * @return the corresponding BaselineSensitivity + */ + @JsonCreator + public static BaselineSensitivity fromString(String name) { + return fromString(name, BaselineSensitivity.class); + } + + /** + * @return known BaselineSensitivity values + */ + public static Collection values() { + return values(BaselineSensitivity.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java index a1f5e4d94ad35..6ae94d204d9fc 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java @@ -8,6 +8,7 @@ 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; @@ -19,27 +20,27 @@ @JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction") public class LogToMetricAction extends Action { /** - * Severity of the alert. + * Criteria of Metric. */ @JsonProperty(value = "criteria", required = true) - private Criteria criteria; + private List criteria; /** - * Get severity of the alert. + * Get criteria of Metric. * * @return the criteria value */ - public Criteria criteria() { + public List criteria() { return this.criteria; } /** - * Set severity of the alert. + * Set criteria of Metric. * * @param criteria the criteria value to set * @return the LogToMetricAction object itself. */ - public LogToMetricAction withCriteria(Criteria criteria) { + public LogToMetricAction withCriteria(List criteria) { this.criteria = criteria; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricSingleDimension.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricSingleDimension.java new file mode 100644 index 0000000000000..d86c53e8f97e9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricSingleDimension.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; + +/** + * The metric dimension name and value. + */ +public class MetricSingleDimension { + /** + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Value of the dimension. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get name of the dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the dimension. + * + * @param name the name value to set + * @return the MetricSingleDimension object itself. + */ + public MetricSingleDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get value of the dimension. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set value of the dimension. + * + * @param value the value value to set + * @return the MetricSingleDimension object itself. + */ + public MetricSingleDimension withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SingleBaseline.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SingleBaseline.java new file mode 100644 index 0000000000000..38da60d8dd0bd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SingleBaseline.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 com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The baseline values for a single sensitivity value. + */ +public class SingleBaseline { + /** + * the sensitivity of the baseline. Possible values include: 'Low', + * 'Medium', 'High'. + */ + @JsonProperty(value = "sensitivity", required = true) + private BaselineSensitivity sensitivity; + + /** + * The low thresholds of the baseline. + */ + @JsonProperty(value = "lowThresholds", required = true) + private List lowThresholds; + + /** + * The high thresholds of the baseline. + */ + @JsonProperty(value = "highThresholds", required = true) + private List highThresholds; + + /** + * Get the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @return the sensitivity value + */ + public BaselineSensitivity sensitivity() { + return this.sensitivity; + } + + /** + * Set the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @param sensitivity the sensitivity value to set + * @return the SingleBaseline object itself. + */ + public SingleBaseline withSensitivity(BaselineSensitivity sensitivity) { + this.sensitivity = sensitivity; + return this; + } + + /** + * Get the low thresholds of the baseline. + * + * @return the lowThresholds value + */ + public List lowThresholds() { + return this.lowThresholds; + } + + /** + * Set the low thresholds of the baseline. + * + * @param lowThresholds the lowThresholds value to set + * @return the SingleBaseline object itself. + */ + public SingleBaseline withLowThresholds(List lowThresholds) { + this.lowThresholds = lowThresholds; + return this; + } + + /** + * Get the high thresholds of the baseline. + * + * @return the highThresholds value + */ + public List highThresholds() { + return this.highThresholds; + } + + /** + * Set the high thresholds of the baseline. + * + * @param highThresholds the highThresholds value to set + * @return the SingleBaseline object itself. + */ + public SingleBaseline withHighThresholds(List highThresholds) { + this.highThresholds = highThresholds; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SingleMetricBaseline.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SingleMetricBaseline.java new file mode 100644 index 0000000000000..35dabf471cdd8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SingleMetricBaseline.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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The baseline results of a single metric. + */ +public class SingleMetricBaseline { + /** + * The metric baseline Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The resource type of the metric baseline resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * The baseline for each time series that was queried. + */ + @JsonProperty(value = "baselines", required = true) + private List baselines; + + /** + * Get the metric baseline Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the metric baseline Id. + * + * @param id the id value to set + * @return the SingleMetricBaseline object itself. + */ + public SingleMetricBaseline withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resource type of the metric baseline resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type of the metric baseline resource. + * + * @param type the type value to set + * @return the SingleMetricBaseline object itself. + */ + public SingleMetricBaseline withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name of the metric. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the name of the metric. + * + * @param metricName the metricName value to set + * @return the SingleMetricBaseline object itself. + */ + public SingleMetricBaseline withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the baseline for each time series that was queried. + * + * @return the baselines value + */ + public List baselines() { + return this.baselines; + } + + /** + * Set the baseline for each time series that was queried. + * + * @param baselines the baselines value to set + * @return the SingleMetricBaseline object itself. + */ + public SingleMetricBaseline withBaselines(List baselines) { + this.baselines = baselines; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesBaseline.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesBaseline.java new file mode 100644 index 0000000000000..507227b696c81 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesBaseline.java @@ -0,0 +1,149 @@ +/** + * 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 baseline values for a single time series. + */ +public class TimeSeriesBaseline { + /** + * The aggregation type of the metric. + */ + @JsonProperty(value = "aggregation", required = true) + private String aggregation; + + /** + * The dimensions of this time series. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * The list of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps", required = true) + private List timestamps; + + /** + * The baseline values for each sensitivity. + */ + @JsonProperty(value = "data", required = true) + private List data; + + /** + * The baseline metadata values. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get the aggregation type of the metric. + * + * @return the aggregation value + */ + public String aggregation() { + return this.aggregation; + } + + /** + * Set the aggregation type of the metric. + * + * @param aggregation the aggregation value to set + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withAggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + /** + * Get the dimensions of this time series. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions of this time series. + * + * @param dimensions the dimensions value to set + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the list of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the list of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + + /** + * Get the baseline values for each sensitivity. + * + * @return the data value + */ + public List data() { + return this.data; + } + + /** + * Set the baseline values for each sensitivity. + * + * @param data the data value to set + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withData(List data) { + this.data = data; + return this; + } + + /** + * Get the baseline metadata values. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the baseline metadata values. + * + * @param metadata the metadata value to set + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineInner.java new file mode 100644 index 0000000000000..6198d8cd950fd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineInner.java @@ -0,0 +1,98 @@ +/** + * 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.Sensitivity; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The baseline values for a single sensitivity value. + */ +public class BaselineInner { + /** + * the sensitivity of the baseline. Possible values include: 'Low', + * 'Medium', 'High'. + */ + @JsonProperty(value = "sensitivity", required = true) + private Sensitivity sensitivity; + + /** + * The low thresholds of the baseline. + */ + @JsonProperty(value = "lowThresholds", required = true) + private List lowThresholds; + + /** + * The high thresholds of the baseline. + */ + @JsonProperty(value = "highThresholds", required = true) + private List highThresholds; + + /** + * Get the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @return the sensitivity value + */ + public Sensitivity sensitivity() { + return this.sensitivity; + } + + /** + * Set the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @param sensitivity the sensitivity value to set + * @return the BaselineInner object itself. + */ + public BaselineInner withSensitivity(Sensitivity sensitivity) { + this.sensitivity = sensitivity; + return this; + } + + /** + * Get the low thresholds of the baseline. + * + * @return the lowThresholds value + */ + public List lowThresholds() { + return this.lowThresholds; + } + + /** + * Set the low thresholds of the baseline. + * + * @param lowThresholds the lowThresholds value to set + * @return the BaselineInner object itself. + */ + public BaselineInner withLowThresholds(List lowThresholds) { + this.lowThresholds = lowThresholds; + return this; + } + + /** + * Get the high thresholds of the baseline. + * + * @return the highThresholds value + */ + public List highThresholds() { + return this.highThresholds; + } + + /** + * Set the high thresholds of the baseline. + * + * @param highThresholds the highThresholds value to set + * @return the BaselineInner object itself. + */ + public BaselineInner withHighThresholds(List highThresholds) { + this.highThresholds = highThresholds; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java index 051669178c4c8..21daba3b18119 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java @@ -11,7 +11,6 @@ import org.joda.time.Period; import java.util.List; import org.joda.time.DateTime; -import com.microsoft.azure.management.monitor.Baseline; import com.microsoft.azure.management.monitor.BaselineMetadataValue; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -73,7 +72,7 @@ public class BaselineResponseInner { * the baseline values for each sensitivity. */ @JsonProperty(value = "properties.baseline") - private List baseline; + private List baseline; /** * the baseline metadata values. @@ -193,7 +192,7 @@ public BaselineResponseInner withTimestamps(List timestamps) { * * @return the baseline value */ - public List baseline() { + public List baseline() { return this.baseline; } @@ -203,7 +202,7 @@ public List baseline() { * @param baseline the baseline value to set * @return the BaselineResponseInner object itself. */ - public BaselineResponseInner withBaseline(List baseline) { + public BaselineResponseInner withBaseline(List baseline) { this.baseline = baseline; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselinesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselinesInner.java new file mode 100644 index 0000000000000..5315618d1c41d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselinesInner.java @@ -0,0 +1,254 @@ +/** + * 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.azure.management.monitor.ResultType; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import org.joda.time.Period; +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 Baselines. + */ +public class BaselinesInner { + /** The Retrofit service to perform REST calls. */ + private BaselinesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of BaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BaselinesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(BaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Baselines to be + * used by Retrofit to perform actually REST calls. + */ + interface BaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.Baselines list" }) + @GET("{resourceUri}/providers/microsoft.insights/metricBaselines") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("metricnames") String metricnames, @Query("metricnamespace") String metricnamespace, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("aggregation") String aggregation, @Query("sensitivities") String sensitivities, @Query("$filter") String filter, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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 List<SingleMetricBaselineInner> object if successful. + */ + public List list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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 resourceUri, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SingleMetricBaselineInner> object + */ + public Observable> listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SingleMetricBaselineInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2019-03-01"; + final String metricnames = null; + final String metricnamespace = null; + final String timespan = null; + final Period interval = null; + final String aggregation = null; + final String sensitivities = null; + final String filter = null; + final ResultType resultType = null; + return service.list(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(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); + } + } + }); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @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 List<SingleMetricBaselineInner> object if successful. + */ + public List list(String resourceUri, String metricnames, String metricnamespace, String timespan, Period interval, String aggregation, String sensitivities, String filter, ResultType resultType) { + return listWithServiceResponseAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType).toBlocking().single().body(); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @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 resourceUri, String metricnames, String metricnamespace, String timespan, Period interval, String aggregation, String sensitivities, String filter, ResultType resultType, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType), serviceCallback); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SingleMetricBaselineInner> object + */ + public Observable> listAsync(String resourceUri, String metricnames, String metricnamespace, String timespan, Period interval, String aggregation, String sensitivities, String filter, ResultType resultType) { + return listWithServiceResponseAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SingleMetricBaselineInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri, String metricnames, String metricnamespace, String timespan, Period interval, String aggregation, String sensitivities, String filter, ResultType resultType) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2019-03-01"; + return service.list(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(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); + } + } + }); + } + + 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); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java index 170a6725c336b..2d49db97d275c 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java @@ -10,7 +10,6 @@ import java.util.List; import org.joda.time.DateTime; -import com.microsoft.azure.management.monitor.Baseline; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -33,7 +32,7 @@ public class CalculateBaselineResponseInner { * the baseline values for each sensitivity. */ @JsonProperty(value = "baseline", required = true) - private List baseline; + private List baseline; /** * Get the resource type of the baseline resource. @@ -80,7 +79,7 @@ public CalculateBaselineResponseInner withTimestamps(List timestamps) * * @return the baseline value */ - public List baseline() { + public List baseline() { return this.baseline; } @@ -90,7 +89,7 @@ public List baseline() { * @param baseline the baseline value to set * @return the CalculateBaselineResponseInner object itself. */ - public CalculateBaselineResponseInner withBaseline(List baseline) { + public CalculateBaselineResponseInner withBaseline(List baseline) { this.baseline = baseline; return this; } diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesResponseInner.java new file mode 100644 index 0000000000000..d86a8db10edd5 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesResponseInner.java @@ -0,0 +1,129 @@ +/** + * 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 org.joda.time.Period; +import java.util.List; +import com.microsoft.azure.management.monitor.SingleMetricBaseline; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response to a metric baselines query. + */ +public class MetricBaselinesResponseInner { + /** + * The timespan for which the data was retrieved. Its value consists of two + * datetimes concatenated, separated by '/'. This may be adjusted in the + * future and returned back from what was originally requested. + */ + @JsonProperty(value = "timespan", required = true) + private String timespan; + + /** + * The interval (window size) for which the metric data was returned in. + * This may be adjusted in the future and returned back from what was + * originally requested. This is not present if a metadata request was + * made. + */ + @JsonProperty(value = "interval", required = true) + private Period interval; + + /** + * The namespace of the metrics been queried. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /** + * The list of baseline results for each metric. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @return the timespan value + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @param timespan the timespan value to set + * @return the MetricBaselinesResponseInner object itself. + */ + public MetricBaselinesResponseInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @return the interval value + */ + public Period interval() { + return this.interval; + } + + /** + * Set the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @param interval the interval value to set + * @return the MetricBaselinesResponseInner object itself. + */ + public MetricBaselinesResponseInner withInterval(Period interval) { + this.interval = interval; + return this; + } + + /** + * Get the namespace of the metrics been queried. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace of the metrics been queried. + * + * @param namespace the namespace value to set + * @return the MetricBaselinesResponseInner object itself. + */ + public MetricBaselinesResponseInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the list of baseline results for each metric. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of baseline results for each metric. + * + * @param value the value value to set + * @return the MetricBaselinesResponseInner object itself. + */ + public MetricBaselinesResponseInner withValue(List value) { + this.value = value; + 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 3cc6bc951d862..1da4a50693d79 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,19 @@ public MetricBaselinesInner metricBaselines() { return this.metricBaselines; } + /** + * The BaselinesInner object to access its operations. + */ + private BaselinesInner baselines; + + /** + * Gets the BaselinesInner object to access its operations. + * @return the BaselinesInner object. + */ + public BaselinesInner baselines() { + return this.baselines; + } + /** * The MetricAlertsInner object to access its operations. */ @@ -429,6 +442,7 @@ 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.baselines = new BaselinesInner(restClient().retrofit(), this); this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); this.scheduledQueryRules = new ScheduledQueryRulesInner(restClient().retrofit(), this); diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/SingleMetricBaselineInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/SingleMetricBaselineInner.java new file mode 100644 index 0000000000000..27e9fb31963d8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/SingleMetricBaselineInner.java @@ -0,0 +1,209 @@ +/** + * 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 org.joda.time.Period; +import java.util.List; +import com.microsoft.azure.management.monitor.TimeSeriesBaseline; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The baseline results of a single metric. + */ +@JsonFlatten +public class SingleMetricBaselineInner { + /** + * The metric baseline Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The resource type of the metric baseline resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The name of the metric for which the baselines were retrieved. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The timespan for which the data was retrieved. Its value consists of two + * datetimes concatenated, separated by '/'. This may be adjusted in the + * future and returned back from what was originally requested. + */ + @JsonProperty(value = "properties.timespan", required = true) + private String timespan; + + /** + * The interval (window size) for which the metric data was returned in. + * This may be adjusted in the future and returned back from what was + * originally requested. This is not present if a metadata request was + * made. + */ + @JsonProperty(value = "properties.interval", required = true) + private Period interval; + + /** + * The namespace of the metrics been queried. + */ + @JsonProperty(value = "properties.namespace") + private String namespace; + + /** + * The baseline for each time series that was queried. + */ + @JsonProperty(value = "properties.baselines", required = true) + private List baselines; + + /** + * Get the metric baseline Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the metric baseline Id. + * + * @param id the id value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resource type of the metric baseline resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type of the metric baseline resource. + * + * @param type the type value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name of the metric for which the baselines were retrieved. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the metric for which the baselines were retrieved. + * + * @param name the name value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @return the timespan value + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @param timespan the timespan value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @return the interval value + */ + public Period interval() { + return this.interval; + } + + /** + * Set the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @param interval the interval value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withInterval(Period interval) { + this.interval = interval; + return this; + } + + /** + * Get the namespace of the metrics been queried. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace of the metrics been queried. + * + * @param namespace the namespace value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the baseline for each time series that was queried. + * + * @return the baselines value + */ + public List baselines() { + return this.baselines; + } + + /** + * Set the baseline for each time series that was queried. + * + * @param baselines the baselines value to set + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withBaselines(List baselines) { + this.baselines = baselines; + return this; + } + +}