diff --git a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfiguration.java b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfiguration.java index 00dc85892e93..b04d4649dfd6 100644 --- a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfiguration.java +++ b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfiguration.java @@ -10,13 +10,15 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.applicationinsights.v2015_05_01.implementation.WorkItemConfigurationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.applicationinsights.v2015_05_01.implementation.InsightsManager; /** * Type representing WorkItemConfiguration. */ -public interface WorkItemConfiguration extends HasInner, HasManager { +public interface WorkItemConfiguration extends HasInner, Indexable, Refreshable, HasManager { /** * @return the configDisplayName value. */ diff --git a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfigurations.java b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfigurations.java index 21856593e1df..5677d8602b6d 100644 --- a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfigurations.java +++ b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemConfigurations.java @@ -16,6 +16,17 @@ * Type representing WorkItemConfigurations. */ public interface WorkItemConfigurations { + /** + * Gets specified work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getItemAsync(String resourceGroupName, String resourceName, String workItemConfigId); + /** * Gets the list work item configurations that exist for the application. * @@ -37,6 +48,18 @@ public interface WorkItemConfigurations { */ Completable deleteAsync(String resourceGroupName, String resourceName, String workItemConfigId); + /** + * Update a work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @param workItemConfigurationProperties Properties that need to be specified to update a work item configuration for this Application Insights component. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateItemAsync(String resourceGroupName, String resourceName, String workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties); + /** * Create a work item configuration for an Application Insights component. * diff --git a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemCreateConfiguration.java b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemCreateConfiguration.java index a271adfb1ce6..b96789dd479c 100644 --- a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemCreateConfiguration.java +++ b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/WorkItemCreateConfiguration.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.applicationinsights.v2015_05_01; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -36,7 +37,7 @@ public class WorkItemCreateConfiguration { * Custom work item properties. */ @JsonProperty(value = "WorkItemProperties") - private String workItemProperties; + private Map workItemProperties; /** * Get unique connector id. @@ -103,7 +104,7 @@ public WorkItemCreateConfiguration withValidateOnly(Boolean validateOnly) { * * @return the workItemProperties value */ - public String workItemProperties() { + public Map workItemProperties() { return this.workItemProperties; } @@ -113,7 +114,7 @@ public String workItemProperties() { * @param workItemProperties the workItemProperties value to set * @return the WorkItemCreateConfiguration object itself. */ - public WorkItemCreateConfiguration withWorkItemProperties(String workItemProperties) { + public WorkItemCreateConfiguration withWorkItemProperties(Map workItemProperties) { this.workItemProperties = workItemProperties; return this; } diff --git a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationImpl.java b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationImpl.java index f1415a72138c..fc8a3fe0c37e 100644 --- a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationImpl.java +++ b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationImpl.java @@ -9,15 +9,22 @@ package com.microsoft.azure.management.applicationinsights.v2015_05_01.implementation; import com.microsoft.azure.management.applicationinsights.v2015_05_01.WorkItemConfiguration; -import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; import rx.Observable; -class WorkItemConfigurationImpl extends WrapperImpl implements WorkItemConfiguration { +class WorkItemConfigurationImpl extends IndexableRefreshableWrapperImpl implements WorkItemConfiguration { private final InsightsManager manager; + private String resourceGroupName; + private String resourceName; + private String workItemConfigId; WorkItemConfigurationImpl(WorkItemConfigurationInner inner, InsightsManager manager) { - super(inner); + super(null, inner); this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.resourceName = IdParsingUtils.getValueFromIdByName(inner.id(), "components"); + this.workItemConfigId = IdParsingUtils.getValueFromIdByName(inner.id(), "WorkItemConfigs"); } @Override @@ -25,6 +32,12 @@ public InsightsManager manager() { return this.manager; } + @Override + protected Observable getInnerAsync() { + WorkItemConfigurationsInner client = this.manager().inner().workItemConfigurations(); + return client.getItemAsync(this.resourceGroupName, this.resourceName, this.workItemConfigId); + } + @Override diff --git a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsImpl.java b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsImpl.java index 3766952f10eb..d49f2a42c5d2 100644 --- a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsImpl.java +++ b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsImpl.java @@ -13,8 +13,8 @@ import com.microsoft.azure.management.applicationinsights.v2015_05_01.WorkItemConfigurations; import rx.Observable; import rx.functions.Func1; -import java.util.List; import com.microsoft.azure.management.applicationinsights.v2015_05_01.WorkItemConfiguration; +import java.util.List; import rx.Completable; import com.microsoft.azure.management.applicationinsights.v2015_05_01.WorkItemCreateConfiguration; @@ -34,6 +34,26 @@ private WorkItemConfigurationImpl wrapWorkItemConfigurationModel(WorkItemConfigu return new WorkItemConfigurationImpl(inner, manager()); } + private Observable getWorkItemConfigurationInnerUsingWorkItemConfigurationsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String resourceName = IdParsingUtils.getValueFromIdByName(id, "components"); + String workItemConfigId = IdParsingUtils.getValueFromIdByName(id, "WorkItemConfigs"); + WorkItemConfigurationsInner client = this.inner(); + return client.getItemAsync(resourceGroupName, resourceName, workItemConfigId); + } + + @Override + public Observable getItemAsync(String resourceGroupName, String resourceName, String workItemConfigId) { + WorkItemConfigurationsInner client = this.inner(); + return client.getItemAsync(resourceGroupName, resourceName, workItemConfigId) + .map(new Func1() { + @Override + public WorkItemConfiguration call(WorkItemConfigurationInner inner) { + return wrapWorkItemConfigurationModel(inner); + } + }); + } + @Override public Observable listAsync(String resourceGroupName, String resourceName) { WorkItemConfigurationsInner client = this.inner(); @@ -58,6 +78,18 @@ public Completable deleteAsync(String resourceGroupName, String resourceName, St return client.deleteAsync(resourceGroupName, resourceName, workItemConfigId).toCompletable(); } + @Override + public Observable updateItemAsync(String resourceGroupName, String resourceName, String workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties) { + WorkItemConfigurationsInner client = this.inner(); + return client.updateItemAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties) + .map(new Func1() { + @Override + public WorkItemConfiguration call(WorkItemConfigurationInner inner) { + return new WorkItemConfigurationImpl(inner, manager()); + } + }); + } + @Override public Observable createAsync(String resourceGroupName, String resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) { WorkItemConfigurationsInner client = this.inner(); diff --git a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java index 27e022b0e46d..f0b520d68b7f 100644 --- a/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java +++ b/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java @@ -25,6 +25,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; +import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; @@ -74,6 +75,14 @@ interface WorkItemConfigurationsService { @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("resourceName") String resourceName, @Path("workItemConfigId") String workItemConfigId, @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.applicationinsights.v2015_05_01.WorkItemConfigurations getItem" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}") + Observable> getItem(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("resourceName") String resourceName, @Path("workItemConfigId") String workItemConfigId, @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.applicationinsights.v2015_05_01.WorkItemConfigurations updateItem" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}") + Observable> updateItem(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("resourceName") String resourceName, @Path("workItemConfigId") String workItemConfigId, @Query("api-version") String apiVersion, @Body WorkItemCreateConfiguration workItemConfigurationProperties, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -440,4 +449,198 @@ private ServiceResponse deleteDelegate(Response response) .build(response); } + /** + * Gets specified work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @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 + * @return the WorkItemConfigurationInner object if successful. + */ + public WorkItemConfigurationInner getItem(String resourceGroupName, String resourceName, String workItemConfigId) { + return getItemWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigId).toBlocking().single().body(); + } + + /** + * Gets specified work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @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 getItemAsync(String resourceGroupName, String resourceName, String workItemConfigId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getItemWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigId), serviceCallback); + } + + /** + * Gets specified work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkItemConfigurationInner object + */ + public Observable getItemAsync(String resourceGroupName, String resourceName, String workItemConfigId) { + return getItemWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigId).map(new Func1, WorkItemConfigurationInner>() { + @Override + public WorkItemConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets specified work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkItemConfigurationInner object + */ + public Observable> getItemWithServiceResponseAsync(String resourceGroupName, String resourceName, String workItemConfigId) { + 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."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (workItemConfigId == null) { + throw new IllegalArgumentException("Parameter workItemConfigId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getItem(resourceGroupName, this.client.subscriptionId(), resourceName, workItemConfigId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getItemDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getItemDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @param workItemConfigurationProperties Properties that need to be specified to update a work item configuration for this Application Insights component. + * @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 + * @return the WorkItemConfigurationInner object if successful. + */ + public WorkItemConfigurationInner updateItem(String resourceGroupName, String resourceName, String workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties) { + return updateItemWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties).toBlocking().single().body(); + } + + /** + * Update a work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @param workItemConfigurationProperties Properties that need to be specified to update a work item configuration for this Application Insights component. + * @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 updateItemAsync(String resourceGroupName, String resourceName, String workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateItemWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties), serviceCallback); + } + + /** + * Update a work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @param workItemConfigurationProperties Properties that need to be specified to update a work item configuration for this Application Insights component. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkItemConfigurationInner object + */ + public Observable updateItemAsync(String resourceGroupName, String resourceName, String workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties) { + return updateItemWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties).map(new Func1, WorkItemConfigurationInner>() { + @Override + public WorkItemConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a work item configuration for an Application Insights component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the Application Insights component resource. + * @param workItemConfigId The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration + * @param workItemConfigurationProperties Properties that need to be specified to update a work item configuration for this Application Insights component. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkItemConfigurationInner object + */ + public Observable> updateItemWithServiceResponseAsync(String resourceGroupName, String resourceName, String workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties) { + 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."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (workItemConfigId == null) { + throw new IllegalArgumentException("Parameter workItemConfigId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (workItemConfigurationProperties == null) { + throw new IllegalArgumentException("Parameter workItemConfigurationProperties is required and cannot be null."); + } + Validator.validate(workItemConfigurationProperties); + return service.updateItem(resourceGroupName, this.client.subscriptionId(), resourceName, workItemConfigId, this.client.apiVersion(), workItemConfigurationProperties, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateItemDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateItemDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + }