From d950041230d40308747ad4c759d7a2d4668e162d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 30 Aug 2018 18:31:10 +0000 Subject: [PATCH 1/2] Generated from 6709389ca55555d09604502a060411f0e7c5c6d7 change md file --- .../management/monitor/ArmRoleReceiver.java | 70 +++++++++++++++++++ .../ActionGroupResourceInner.java | 27 +++++++ .../implementation/ActionGroupsInner.java | 14 ++-- 3 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.java new file mode 100644 index 000000000000..49ab9ab2fd26 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.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; + +/** + * An arm role receiver. + */ +public class ArmRoleReceiver { + /** + * The name of the arm role receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The arm role id. + */ + @JsonProperty(value = "roleId", required = true) + private String roleId; + + /** + * Get the name of the arm role receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the arm role receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the arm role id. + * + * @return the roleId value + */ + public String roleId() { + return this.roleId; + } + + /** + * Set the arm role id. + * + * @param roleId the roleId value to set + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withRoleId(String roleId) { + this.roleId = roleId; + 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 40f3b6f7a401..3d2d19e099fb 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 @@ -18,6 +18,7 @@ import com.microsoft.azure.management.monitor.VoiceReceiver; import com.microsoft.azure.management.monitor.LogicAppReceiver; import com.microsoft.azure.management.monitor.AzureFunctionReceiver; +import com.microsoft.azure.management.monitor.ArmRoleReceiver; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -95,6 +96,12 @@ public class ActionGroupResourceInner extends Resource { @JsonProperty(value = "properties.azureFunctionReceivers") private List azureFunctionReceivers; + /** + * The list of arm role receivers that are part of this action group. + */ + @JsonProperty(value = "properties.armRoleReceivers") + private List armRoleReceivers; + /** * Get the short name of the action group. This will be used in SMS messages. * @@ -315,4 +322,24 @@ public ActionGroupResourceInner withAzureFunctionReceivers(List armRoleReceivers() { + return this.armRoleReceivers; + } + + /** + * Set the list of arm role receivers that are part of this action group. + * + * @param armRoleReceivers the armRoleReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) { + this.armRoleReceivers = armRoleReceivers; + 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 ff1efa5e68d3..a3118ffea7fb 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 @@ -165,7 +165,7 @@ public Observable> createOrUpdateWithS throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); } Validator.validate(actionGroup); - final String apiVersion = "2018-03-01"; + final String apiVersion = "2018-09-01"; return service.createOrUpdate(resourceGroupName, actionGroupName, this.client.subscriptionId(), actionGroup, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -250,7 +250,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 = "2018-03-01"; + final String apiVersion = "2018-09-01"; return service.getByResourceGroup(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -333,7 +333,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 = "2018-03-01"; + final String apiVersion = "2018-09-01"; return service.delete(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -426,7 +426,7 @@ public Observable> updateWithServiceRe throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); } Validator.validate(actionGroupPatch); - final String apiVersion = "2018-03-01"; + final String apiVersion = "2018-09-01"; return service.update(this.client.subscriptionId(), resourceGroupName, actionGroupName, apiVersion, actionGroupPatch, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -500,7 +500,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 = "2018-03-01"; + final String apiVersion = "2018-09-01"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -586,7 +586,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 = "2018-03-01"; + final String apiVersion = "2018-09-01"; return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -681,7 +681,7 @@ public Observable> enableReceiverWithServiceResponseAsync( if (receiverName == null) { throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); } - final String apiVersion = "2018-03-01"; + final String apiVersion = "2018-09-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 0f39b52dc381b2128b01aee7b58f10c949380f1c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 24 Sep 2018 23:29:44 +0000 Subject: [PATCH 2/2] Generated from 6709389ca55555d09604502a060411f0e7c5c6d7 change md file --- .../monitor/MetricNamespaceName.java | 43 ++++ .../management/monitor/MetricTrigger.java | 6 +- .../monitor/TimeAggregationType.java | 5 +- .../ActionGroupResourceInner.java | 27 --- .../implementation/ActionGroupsInner.java | 14 +- .../implementation/MetricNamespaceInner.java | 122 ++++++++++ .../implementation/MetricNamespacesInner.java | 217 ++++++++++++++++++ .../MonitorManagementClientImpl.java | 14 ++ 8 files changed, 410 insertions(+), 38 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java new file mode 100644 index 000000000000..de5a2d0f45c7 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java @@ -0,0 +1,43 @@ +/** + * 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 fully qualified metric namespace name. + */ +public class MetricNamespaceName { + /** + * The metric namespace name. + */ + @JsonProperty(value = "metricNamespaceName") + private String metricNamespaceName; + + /** + * Get the metric namespace name. + * + * @return the metricNamespaceName value + */ + public String metricNamespaceName() { + return this.metricNamespaceName; + } + + /** + * Set the metric namespace name. + * + * @param metricNamespaceName the metricNamespaceName value to set + * @return the MetricNamespaceName object itself. + */ + public MetricNamespaceName withMetricNamespaceName(String metricNamespaceName) { + this.metricNamespaceName = metricNamespaceName; + return this; + } + +} 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 8c2f9df230e5..c97c60f7f457 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 @@ -53,7 +53,7 @@ public class MetricTrigger { /** * time aggregation type. How the data that is collected should be combined * over time. The default value is Average. Possible values include: - * 'Average', 'Minimum', 'Maximum', 'Total', 'Count'. + * 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last'. */ @JsonProperty(value = "timeAggregation", required = true) private TimeAggregationType timeAggregation; @@ -173,7 +173,7 @@ public MetricTrigger withTimeWindow(Period timeWindow) { } /** - * Get time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count'. + * Get time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last'. * * @return the timeAggregation value */ @@ -182,7 +182,7 @@ public TimeAggregationType timeAggregation() { } /** - * Set time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count'. + * Set time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last'. * * @param timeAggregation the timeAggregation value to set * @return the MetricTrigger object itself. diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java index 9b8391944c59..5130730d98fe 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java @@ -28,7 +28,10 @@ public enum TimeAggregationType { TOTAL("Total"), /** Enum value Count. */ - COUNT("Count"); + COUNT("Count"), + + /** Enum value Last. */ + LAST("Last"); /** The actual serialized value for a TimeAggregationType instance. */ private String value; 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 3d2d19e099fb..40f3b6f7a401 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 @@ -18,7 +18,6 @@ import com.microsoft.azure.management.monitor.VoiceReceiver; import com.microsoft.azure.management.monitor.LogicAppReceiver; import com.microsoft.azure.management.monitor.AzureFunctionReceiver; -import com.microsoft.azure.management.monitor.ArmRoleReceiver; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -96,12 +95,6 @@ public class ActionGroupResourceInner extends Resource { @JsonProperty(value = "properties.azureFunctionReceivers") private List azureFunctionReceivers; - /** - * The list of arm role receivers that are part of this action group. - */ - @JsonProperty(value = "properties.armRoleReceivers") - private List armRoleReceivers; - /** * Get the short name of the action group. This will be used in SMS messages. * @@ -322,24 +315,4 @@ public ActionGroupResourceInner withAzureFunctionReceivers(List armRoleReceivers() { - return this.armRoleReceivers; - } - - /** - * Set the list of arm role receivers that are part of this action group. - * - * @param armRoleReceivers the armRoleReceivers value to set - * @return the ActionGroupResourceInner object itself. - */ - public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) { - this.armRoleReceivers = armRoleReceivers; - 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 a3118ffea7fb..ff1efa5e68d3 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 @@ -165,7 +165,7 @@ public Observable> createOrUpdateWithS throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); } Validator.validate(actionGroup); - final String apiVersion = "2018-09-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 @@ -250,7 +250,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 = "2018-09-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 @@ -333,7 +333,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 = "2018-09-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 @@ -426,7 +426,7 @@ public Observable> updateWithServiceRe throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); } Validator.validate(actionGroupPatch); - final String apiVersion = "2018-09-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 @@ -500,7 +500,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 = "2018-09-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 @@ -586,7 +586,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 = "2018-09-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 @@ -681,7 +681,7 @@ public Observable> enableReceiverWithServiceResponseAsync( if (receiverName == null) { throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); } - final String apiVersion = "2018-09-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()) diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.java new file mode 100644 index 000000000000..16befcbab181 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.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.implementation; + +import com.microsoft.azure.management.monitor.MetricNamespaceName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric namespace class specifies the metadata for a metric namespace. + */ +public class MetricNamespaceInner { + /** + * The ID of the metricNamespace. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The type of the namespace. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The name of the namespace. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Properties which include the fully qualified namespace name. + */ + @JsonProperty(value = "properties") + private MetricNamespaceName properties; + + /** + * Get the ID of the metricNamespace. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the metricNamespace. + * + * @param id the id value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type of the namespace. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the namespace. + * + * @param type the type value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name of the namespace. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the namespace. + * + * @param name the name value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get properties which include the fully qualified namespace name. + * + * @return the properties value + */ + public MetricNamespaceName properties() { + return this.properties; + } + + /** + * Set properties which include the fully qualified namespace name. + * + * @param properties the properties value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withProperties(MetricNamespaceName properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java new file mode 100644 index 000000000000..1dda443239f3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java @@ -0,0 +1,217 @@ +/** + * 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 java.util.List; +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 MetricNamespaces. + */ +public class MetricNamespacesInner { + /** The Retrofit service to perform REST calls. */ + private MetricNamespacesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricNamespacesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricNamespacesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricNamespacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricNamespaces to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricNamespacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricNamespaces list" }) + @GET("{resourceUri}/providers/microsoft.insights/metricNamespaces") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Query("startTime") String startTime, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the metric namespaces for the 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<MetricNamespaceInner> object if successful. + */ + public List list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Lists the metric namespaces for the 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 namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> 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 namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2017-12-01-preview"; + final String startTime = null; + return service.list(resourceUri, apiVersion, startTime, 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 namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @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<MetricNamespaceInner> object if successful. + */ + public List list(String resourceUri, String startTime) { + return listWithServiceResponseAsync(resourceUri, startTime).toBlocking().single().body(); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @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 startTime, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, startTime), serviceCallback); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable> listAsync(String resourceUri, String startTime) { + return listWithServiceResponseAsync(resourceUri, startTime).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri, String startTime) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2017-12-01-preview"; + return service.list(resourceUri, apiVersion, startTime, 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/MonitorManagementClientImpl.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java index 0dbb43f8d39e..f208c0ac84b0 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 @@ -354,6 +354,19 @@ public ScheduledQueryRulesInner scheduledQueryRules() { return this.scheduledQueryRules; } + /** + * The MetricNamespacesInner object to access its operations. + */ + private MetricNamespacesInner metricNamespaces; + + /** + * Gets the MetricNamespacesInner object to access its operations. + * @return the MetricNamespacesInner object. + */ + public MetricNamespacesInner metricNamespaces() { + return this.metricNamespaces; + } + /** * Initializes an instance of MonitorManagementClient client. * @@ -406,6 +419,7 @@ protected void initialize() { this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); this.scheduledQueryRules = new ScheduledQueryRulesInner(restClient().retrofit(), this); + this.metricNamespaces = new MetricNamespacesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); }