diff --git a/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/ApplicationGatewaysInner.java b/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/ApplicationGatewaysInner.java index 3df173af701c..709d86dec97b 100644 --- a/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/ApplicationGatewaysInner.java +++ b/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/ApplicationGatewaysInner.java @@ -1764,12 +1764,7 @@ public Observable>> listAvailableServerVariablesWit @Override public Observable>> call(Response response) { try { - ServiceResponse<> result = listAvailableServerVariablesDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + ServiceResponse> clientResponse = listAvailableServerVariablesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1778,9 +1773,9 @@ public Observable>> call(Response res }); } - private ServiceResponse<> listAvailableServerVariablesDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().<, ErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken<>() { }.getType()) + private ServiceResponse> listAvailableServerVariablesDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); } @@ -1839,12 +1834,7 @@ public Observable>> listAvailableRequestHeadersWith @Override public Observable>> call(Response response) { try { - ServiceResponse<> result = listAvailableRequestHeadersDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + ServiceResponse> clientResponse = listAvailableRequestHeadersDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1853,9 +1843,9 @@ public Observable>> call(Response res }); } - private ServiceResponse<> listAvailableRequestHeadersDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().<, ErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken<>() { }.getType()) + private ServiceResponse> listAvailableRequestHeadersDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); } @@ -1914,12 +1904,7 @@ public Observable>> listAvailableResponseHeadersWit @Override public Observable>> call(Response response) { try { - ServiceResponse<> result = listAvailableResponseHeadersDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + ServiceResponse> clientResponse = listAvailableResponseHeadersDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1928,9 +1913,9 @@ public Observable>> call(Response res }); } - private ServiceResponse<> listAvailableResponseHeadersDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().<, ErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken<>() { }.getType()) + private ServiceResponse> listAvailableResponseHeadersDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); } diff --git a/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/DdosProtectionPlansInner.java b/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/DdosProtectionPlansInner.java index fa8cbabdda06..9cc17d154a2b 100644 --- a/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/DdosProtectionPlansInner.java +++ b/network/resource-manager/v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/DdosProtectionPlansInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.network.v2018_12_01.TagsObject; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -24,12 +25,14 @@ import com.microsoft.rest.Validator; import java.io.IOException; import java.util.List; +import java.util.Map; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; +import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.PUT; import retrofit2.http.Query; @@ -84,6 +87,14 @@ interface DdosProtectionPlansService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}") Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("ddosProtectionPlanName") String ddosProtectionPlanName, @Path("subscriptionId") String subscriptionId, @Body DdosProtectionPlanInner parameters, @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.network.v2018_12_01.DdosProtectionPlans updateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}") + Observable> updateTags(@Path("resourceGroupName") String resourceGroupName, @Path("ddosProtectionPlanName") String ddosProtectionPlanName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_12_01.DdosProtectionPlans beginUpdateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}") + Observable> beginUpdateTags(@Path("resourceGroupName") String resourceGroupName, @Path("ddosProtectionPlanName") String ddosProtectionPlanName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_12_01.DdosProtectionPlans list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -505,6 +516,320 @@ private ServiceResponse beginCreateOrUpdateDelegate(Res .build(response); } + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @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 DdosProtectionPlanInner object if successful. + */ + public DdosProtectionPlanInner updateTags(String resourceGroupName, String ddosProtectionPlanName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName).toBlocking().last().body(); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @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 updateTagsAsync(String resourceGroupName, String ddosProtectionPlanName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName), serviceCallback); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTagsAsync(String resourceGroupName, String ddosProtectionPlanName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName).map(new Func1, DdosProtectionPlanInner>() { + @Override + public DdosProtectionPlanInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String ddosProtectionPlanName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ddosProtectionPlanName == null) { + throw new IllegalArgumentException("Parameter ddosProtectionPlanName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-12-01"; + final Map tags = null; + TagsObject parameters = new TagsObject(); + parameters.withTags(null); + Observable> observable = service.updateTags(resourceGroupName, ddosProtectionPlanName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @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 DdosProtectionPlanInner object if successful. + */ + public DdosProtectionPlanInner updateTags(String resourceGroupName, String ddosProtectionPlanName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, tags).toBlocking().last().body(); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @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 updateTagsAsync(String resourceGroupName, String ddosProtectionPlanName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, tags), serviceCallback); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTagsAsync(String resourceGroupName, String ddosProtectionPlanName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, tags).map(new Func1, DdosProtectionPlanInner>() { + @Override + public DdosProtectionPlanInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String ddosProtectionPlanName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ddosProtectionPlanName == null) { + throw new IllegalArgumentException("Parameter ddosProtectionPlanName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2018-12-01"; + TagsObject parameters = new TagsObject(); + parameters.withTags(tags); + Observable> observable = service.updateTags(resourceGroupName, ddosProtectionPlanName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @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 DdosProtectionPlanInner object if successful. + */ + public DdosProtectionPlanInner beginUpdateTags(String resourceGroupName, String ddosProtectionPlanName) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName).toBlocking().single().body(); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @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 beginUpdateTagsAsync(String resourceGroupName, String ddosProtectionPlanName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName), serviceCallback); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DdosProtectionPlanInner object + */ + public Observable beginUpdateTagsAsync(String resourceGroupName, String ddosProtectionPlanName) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName).map(new Func1, DdosProtectionPlanInner>() { + @Override + public DdosProtectionPlanInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DdosProtectionPlanInner object + */ + public Observable> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String ddosProtectionPlanName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ddosProtectionPlanName == null) { + throw new IllegalArgumentException("Parameter ddosProtectionPlanName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-12-01"; + final Map tags = null; + TagsObject parameters = new TagsObject(); + parameters.withTags(null); + return service.beginUpdateTags(resourceGroupName, ddosProtectionPlanName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @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 DdosProtectionPlanInner object if successful. + */ + public DdosProtectionPlanInner beginUpdateTags(String resourceGroupName, String ddosProtectionPlanName, Map tags) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, tags).toBlocking().single().body(); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @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 beginUpdateTagsAsync(String resourceGroupName, String ddosProtectionPlanName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, tags), serviceCallback); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DdosProtectionPlanInner object + */ + public Observable beginUpdateTagsAsync(String resourceGroupName, String ddosProtectionPlanName, Map tags) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, tags).map(new Func1, DdosProtectionPlanInner>() { + @Override + public DdosProtectionPlanInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a DDoS protection plan tags. + * + * @param resourceGroupName The name of the resource group. + * @param ddosProtectionPlanName The name of the DDoS protection plan. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DdosProtectionPlanInner object + */ + public Observable> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String ddosProtectionPlanName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ddosProtectionPlanName == null) { + throw new IllegalArgumentException("Parameter ddosProtectionPlanName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2018-12-01"; + TagsObject parameters = new TagsObject(); + parameters.withTags(tags); + return service.beginUpdateTags(resourceGroupName, ddosProtectionPlanName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateTagsDelegate(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); + } + /** * Gets all DDoS protection plans in a subscription. *