From e595497437a4aebe1cf0a88ec02d7788fd251026 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 16 Dec 2019 18:10:06 +0000 Subject: [PATCH] Generated from ca54be28788f28d675922ac12b6ebde2fe90c224 Add error property to ScriptStatus --- sdk/features/mgmt-v2015_12_01/pom.xml | 10 +- .../v2015_12_01/OperationDisplay.java | 95 ++++++ .../implementation/FeatureClientImpl.java | 277 +++++++++++++++++- .../implementation/FeatureResultImpl.java | 1 + .../implementation/FeaturesImpl.java | 10 +- .../implementation/OperationInner.java | 70 +++++ 6 files changed, 446 insertions(+), 17 deletions(-) create mode 100644 sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java create mode 100644 sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/OperationInner.java diff --git a/sdk/features/mgmt-v2015_12_01/pom.xml b/sdk/features/mgmt-v2015_12_01/pom.xml index 5aa22f96cbe43..5ad6f8738e6cf 100644 --- a/sdk/features/mgmt-v2015_12_01/pom.xml +++ b/sdk/features/mgmt-v2015_12_01/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.2.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-features @@ -19,7 +19,7 @@ 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 @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java b/sdk/features/mgmt-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/sdk/features/mgmt-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/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java b/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java index db2b6732bd674..a6c74d7761c41 100644 --- a/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java +++ b/sdk/features/mgmt-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/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java b/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java index ee2a56edd3f33..e4322acf92332 100644 --- a/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java +++ b/sdk/features/mgmt-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 getAsync(String resourceProviderNamespace, String featureName) { FeaturesInner client = this.inner(); return client.getAsync(resourceProviderNamespace, featureName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public FeatureResult call(FeatureResultInner inner) { - return wrapModel(inner); + public Observable call(FeatureResultInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((FeatureResult)wrapModel(inner)); + } } }); } diff --git a/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/OperationInner.java b/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..a31eb8d629a0c --- /dev/null +++ b/sdk/features/mgmt-v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/OperationInner.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.features.v2015_12_01.implementation; + +import com.microsoft.azure.management.features.v2015_12_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Features operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +}