From 425537ee051db406a9255b83356b5b7aa4de8874 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2019 00:57:50 +0000 Subject: [PATCH] Generated from edd74f0a1be6f17caa185525a63e594aef956acc (#222) Addressed review comments. --- features/resource-manager/v2015_12_01/pom.xml | 10 +- .../v2015_12_01/OperationDisplay.java | 95 ++++++ .../implementation/FeatureClientImpl.java | 277 +++++++++++++++++- .../implementation/FeatureResultImpl.java | 1 + .../implementation/OperationInner.java | 70 +++++ 5 files changed, 438 insertions(+), 15 deletions(-) create mode 100644 features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java create mode 100644 features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/OperationInner.java diff --git a/features/resource-manager/v2015_12_01/pom.xml b/features/resource-manager/v2015_12_01/pom.xml index 1819142d116e8..f5a1268fb93dc 100644 --- a/features/resource-manager/v2015_12_01/pom.xml +++ b/features/resource-manager/v2015_12_01/pom.xml @@ -11,15 +11,15 @@ com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-features 1.0.0-beta jar Microsoft Azure SDK for Features Management This package contains Microsoft Features Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java new file mode 100644 index 0000000000000..13e97b37c8aec --- /dev/null +++ b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java @@ -0,0 +1,95 @@ +/** + * 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.features.v2015_12_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Features. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get service provider: Microsoft.Features. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Features. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java index db2b6732bd674..a6c74d7761c41 100644 --- a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java +++ b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java @@ -8,15 +8,36 @@ package com.microsoft.azure.management.features.v2015_12_01.implementation; +import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; +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.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; /** * Initializes a new instance of the FeatureClientImpl class. */ public class FeatureClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private FeatureClientService service; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; @@ -63,11 +84,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +97,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +107,11 @@ public FeatureClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +120,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +130,11 @@ public FeatureClientImpl withLongRunningOperationRetryTimeout(int longRunningOpe return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ private boolean generateClientRequestId; /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @return the generateClientRequestId value. */ @@ -122,7 +143,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. * @return the service client itself @@ -182,6 +203,7 @@ protected void initialize() { this.generateClientRequestId = true; this.features = new FeaturesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); + initializeService(); } /** @@ -191,6 +213,241 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "FeatureClient", "2015-12-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "FeatureClient", "2015-12-01"); } + + private void initializeService() { + service = restClient().retrofit().create(FeatureClientService.class); + } + + /** + * The interface defining all the services for FeatureClient to be + * used by Retrofit to perform actually REST calls. + */ + interface FeatureClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.features.v2015_12_01.FeatureClient listOperations" }) + @GET("providers/Microsoft.Features/operations") + Observable> listOperations(@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.features.v2015_12_01.FeatureClient listOperationsNext" }) + @GET + Observable> listOperationsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listOperations() { + ServiceResponse> response = listOperationsSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @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> listOperationsAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOperationsSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listOperationsAsync() { + return listOperationsWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listOperationsWithServiceResponseAsync() { + return listOperationsSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOperationsSinglePageAsync() { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + return service.listOperations(this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOperationsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOperationsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory()., CloudException>newInstance(this.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listOperationsNext(final String nextPageLink) { + ServiceResponse> response = listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listOperationsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOperationsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listOperationsNextAsync(final String nextPageLink) { + return listOperationsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listOperationsNextWithServiceResponseAsync(final String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOperationsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listOperationsNext(nextUrl, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOperationsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOperationsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory()., CloudException>newInstance(this.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java index ee2a56edd3f33..e4322acf92332 100644 --- a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java +++ b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java @@ -21,6 +21,7 @@ class FeatureResultImpl extends IndexableRefreshableWrapperImpl