diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java index 1848629459a5..34010798ff33 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java @@ -25,40 +25,20 @@ * Type representing CognitiveServicesAccount. */ public interface CognitiveServicesAccount extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { - /** - * @return the customSubDomainName value. - */ - String customSubDomainName(); - - /** - * @return the endpoint value. - */ - String endpoint(); - /** * @return the etag value. */ String etag(); - /** - * @return the internalId value. - */ - String internalId(); - /** * @return the kind value. */ String kind(); /** - * @return the networkAcls value. + * @return the properties value. */ - NetworkRuleSet networkAcls(); - - /** - * @return the provisioningState value. - */ - ProvisioningState provisioningState(); + CognitiveServicesAccountProperties properties(); /** * @return the sku value. @@ -68,7 +48,7 @@ public interface CognitiveServicesAccount extends HasInner { /** * The stage of the CognitiveServicesAccount definition allowing to specify the resource group. */ - interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { } /** * The stage of the cognitiveservicesaccount definition allowing to specify Kind. */ interface WithKind { - /** - * Specifies kind. - * @param kind Required. Gets or sets the Kind of the resource - * @return the next definition stage -*/ - WithProperties withKind(String kind); + /** + * Specifies kind. + * @param kind The Kind of the resource + * @return the next definition stage + */ + WithCreate withKind(String kind); } /** * The stage of the cognitiveservicesaccount definition allowing to specify Properties. */ interface WithProperties { - /** - * Specifies properties. - * @param properties Must exist in the request. Must be an empty object. Must not be null - * @return the next definition stage -*/ - WithSku withProperties(Object properties); + /** + * Specifies properties. + * @param properties Properties of Cognitive Services account + * @return the next definition stage + */ + WithCreate withProperties(CognitiveServicesAccountProperties properties); } /** * The stage of the cognitiveservicesaccount definition allowing to specify Sku. */ interface WithSku { - /** - * Specifies sku. - * @param sku Required. Gets or sets the SKU of the resource - * @return the next definition stage -*/ + /** + * Specifies sku. + * @param sku The SKU of Cognitive Services account + * @return the next definition stage + */ WithCreate withSku(Sku sku); } @@ -128,13 +108,13 @@ interface WithSku { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithKind, DefinitionStages.WithProperties, DefinitionStages.WithSku { } } /** * The template for a CognitiveServicesAccount update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku, UpdateStages.WithTags, UpdateStages.WithProperties { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithKind, UpdateStages.WithProperties, UpdateStages.WithSku { } /** @@ -142,39 +122,39 @@ interface Update extends Appliable, Resource.UpdateWit */ interface UpdateStages { /** - * The stage of the cognitiveservicesaccount update allowing to specify Sku. + * The stage of the cognitiveservicesaccount update allowing to specify Kind. */ - interface WithSku { + interface WithKind { /** - * Specifies sku. - * @param sku Gets or sets the SKU of the resource + * Specifies kind. + * @param kind The Kind of the resource * @return the next update stage */ - Update withSku(Sku sku); + Update withKind(String kind); } /** - * The stage of the cognitiveservicesaccount update allowing to specify Tags. + * The stage of the cognitiveservicesaccount update allowing to specify Properties. */ - interface WithTags { + interface WithProperties { /** - * Specifies tags. - * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters + * Specifies properties. + * @param properties Properties of Cognitive Services account * @return the next update stage */ - Update withTags(Map tags); + Update withProperties(CognitiveServicesAccountProperties properties); } /** - * The stage of the cognitiveservicesaccount update allowing to specify Properties. + * The stage of the cognitiveservicesaccount update allowing to specify Sku. */ - interface WithProperties { + interface WithSku { /** - * Specifies properties. - * @param properties Additional properties for Account. Only provided fields will be updated + * Specifies sku. + * @param sku The SKU of Cognitive Services account * @return the next update stage */ - Update withProperties(Object properties); + Update withSku(Sku sku); } } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountApiProperties.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountApiProperties.java new file mode 100644 index 000000000000..ae7e19c59759 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountApiProperties.java @@ -0,0 +1,121 @@ +/** + * 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.cognitiveservices.v2017_04_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The api properties for special APIs. + */ +public class CognitiveServicesAccountApiProperties { + /** + * (QnAMaker Only) The runtime endpoint of QnAMaker. + */ + @JsonProperty(value = "qnaRuntimeEndpoint") + private String qnaRuntimeEndpoint; + + /** + * (Bing Search Only) The flag to enable statistics of Bing Search. + */ + @JsonProperty(value = "statisticsEnabled") + private Boolean statisticsEnabled; + + /** + * (Personalization Only) The flag to enable statistics of Bing Search. + */ + @JsonProperty(value = "eventHubConnectionString") + private String eventHubConnectionString; + + /** + * (Personalization Only) The storage account connection string. + */ + @JsonProperty(value = "storageAccountConnectionString") + private String storageAccountConnectionString; + + /** + * Get (QnAMaker Only) The runtime endpoint of QnAMaker. + * + * @return the qnaRuntimeEndpoint value + */ + public String qnaRuntimeEndpoint() { + return this.qnaRuntimeEndpoint; + } + + /** + * Set (QnAMaker Only) The runtime endpoint of QnAMaker. + * + * @param qnaRuntimeEndpoint the qnaRuntimeEndpoint value to set + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withQnaRuntimeEndpoint(String qnaRuntimeEndpoint) { + this.qnaRuntimeEndpoint = qnaRuntimeEndpoint; + return this; + } + + /** + * Get (Bing Search Only) The flag to enable statistics of Bing Search. + * + * @return the statisticsEnabled value + */ + public Boolean statisticsEnabled() { + return this.statisticsEnabled; + } + + /** + * Set (Bing Search Only) The flag to enable statistics of Bing Search. + * + * @param statisticsEnabled the statisticsEnabled value to set + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withStatisticsEnabled(Boolean statisticsEnabled) { + this.statisticsEnabled = statisticsEnabled; + return this; + } + + /** + * Get (Personalization Only) The flag to enable statistics of Bing Search. + * + * @return the eventHubConnectionString value + */ + public String eventHubConnectionString() { + return this.eventHubConnectionString; + } + + /** + * Set (Personalization Only) The flag to enable statistics of Bing Search. + * + * @param eventHubConnectionString the eventHubConnectionString value to set + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withEventHubConnectionString(String eventHubConnectionString) { + this.eventHubConnectionString = eventHubConnectionString; + return this; + } + + /** + * Get (Personalization Only) The storage account connection string. + * + * @return the storageAccountConnectionString value + */ + public String storageAccountConnectionString() { + return this.storageAccountConnectionString; + } + + /** + * Set (Personalization Only) The storage account connection string. + * + * @param storageAccountConnectionString the storageAccountConnectionString value to set + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withStorageAccountConnectionString(String storageAccountConnectionString) { + this.storageAccountConnectionString = storageAccountConnectionString; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountProperties.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountProperties.java new file mode 100644 index 000000000000..304ff4e3fc40 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountProperties.java @@ -0,0 +1,143 @@ +/** + * 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.cognitiveservices.v2017_04_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of Cognitive Services account. + */ +public class CognitiveServicesAccountProperties { + /** + * Gets the status of the cognitive services account at the time the + * operation was called. Possible values include: 'Creating', + * 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed'. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Endpoint of the created account. + */ + @JsonProperty(value = "endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /** + * The internal identifier. + */ + @JsonProperty(value = "internalId", access = JsonProperty.Access.WRITE_ONLY) + private String internalId; + + /** + * Optional subdomain name used for token-based authentication. + */ + @JsonProperty(value = "customSubDomainName") + private String customSubDomainName; + + /** + * A collection of rules governing the accessibility from specific network + * locations. + */ + @JsonProperty(value = "networkAcls") + private NetworkRuleSet networkAcls; + + /** + * The api properties for special APIs. + */ + @JsonProperty(value = "apiProperties") + private CognitiveServicesAccountApiProperties apiProperties; + + /** + * Get gets the status of the cognitive services account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get endpoint of the created account. + * + * @return the endpoint value + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Get the internal identifier. + * + * @return the internalId value + */ + public String internalId() { + return this.internalId; + } + + /** + * Get optional subdomain name used for token-based authentication. + * + * @return the customSubDomainName value + */ + public String customSubDomainName() { + return this.customSubDomainName; + } + + /** + * Set optional subdomain name used for token-based authentication. + * + * @param customSubDomainName the customSubDomainName value to set + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withCustomSubDomainName(String customSubDomainName) { + this.customSubDomainName = customSubDomainName; + return this; + } + + /** + * Get a collection of rules governing the accessibility from specific network locations. + * + * @return the networkAcls value + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set a collection of rules governing the accessibility from specific network locations. + * + * @param networkAcls the networkAcls value to set + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the api properties for special APIs. + * + * @return the apiProperties value + */ + public CognitiveServicesAccountApiProperties apiProperties() { + return this.apiProperties; + } + + /** + * Set the api properties for special APIs. + * + * @param apiProperties the apiProperties value to set + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withApiProperties(CognitiveServicesAccountApiProperties apiProperties) { + this.apiProperties = apiProperties; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java index 389183f15722..848be4550e41 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java @@ -15,14 +15,6 @@ * A set of rules governing the network accessibility. */ public class NetworkRuleSet { - /** - * Tells what traffic can bypass network rules. This can be 'AzureServices' - * or 'None'. If not specified the default is 'AzureServices'. Possible - * values include: 'AzureServices', 'None'. - */ - @JsonProperty(value = "bypass") - private NetworkRuleBypassOptions bypass; - /** * The default action when no rule from ipRules and from * virtualNetworkRules match. This is only used after the bypass property @@ -43,26 +35,6 @@ public class NetworkRuleSet { @JsonProperty(value = "virtualNetworkRules") private List virtualNetworkRules; - /** - * Get tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None'. - * - * @return the bypass value - */ - public NetworkRuleBypassOptions bypass() { - return this.bypass; - } - - /** - * Set tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None'. - * - * @param bypass the bypass value to set - * @return the NetworkRuleSet object itself. - */ - public NetworkRuleSet withBypass(NetworkRuleBypassOptions bypass) { - this.bypass = bypass; - return this; - } - /** * Get the default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny'. * diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java index 9a0de28b8aa5..2f3c1d3319bf 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java @@ -15,12 +15,9 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.ListOperationCallback; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccountCreateParameters; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccountUpdateParameters; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.ErrorException; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.KeyName; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.RegenerateKeyParameters; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Sku; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -29,7 +26,6 @@ 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; @@ -74,11 +70,11 @@ public AccountsInner(Retrofit retrofit, CognitiveServicesManagementClientImpl cl interface AccountsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.v2017_04_18.Accounts create" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}") - Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body CognitiveServicesAccountCreateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body CognitiveServicesAccountInner account, @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.cognitiveservices.v2017_04_18.Accounts update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CognitiveServicesAccountUpdateParameters parameters, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body CognitiveServicesAccountInner account, @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.cognitiveservices.v2017_04_18.Accounts delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", method = "DELETE", hasBody = true) @@ -127,14 +123,14 @@ interface AccountsService { * * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of Cognitive Services account. - * @param parameters The parameters to provide for the created account. + * @param account The parameters to provide for the created account. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the CognitiveServicesAccountInner object if successful. */ - public CognitiveServicesAccountInner create(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParameters parameters) { - return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); + public CognitiveServicesAccountInner create(String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return createWithServiceResponseAsync(resourceGroupName, accountName, account).toBlocking().single().body(); } /** @@ -142,13 +138,13 @@ public CognitiveServicesAccountInner create(String resourceGroupName, String acc * * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of Cognitive Services account. - * @param parameters The parameters to provide for the created account. + * @param account The parameters to provide for the created account. * @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 createAsync(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParameters parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, parameters), serviceCallback); + public ServiceFuture createAsync(String resourceGroupName, String accountName, CognitiveServicesAccountInner account, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, account), serviceCallback); } /** @@ -156,12 +152,12 @@ public ServiceFuture createAsync(String resourceG * * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of Cognitive Services account. - * @param parameters The parameters to provide for the created account. + * @param account The parameters to provide for the created account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CognitiveServicesAccountInner object */ - public Observable createAsync(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParameters parameters) { - return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1, CognitiveServicesAccountInner>() { + public Observable createAsync(String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return createWithServiceResponseAsync(resourceGroupName, accountName, account).map(new Func1, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse response) { return response.body(); @@ -174,11 +170,11 @@ public CognitiveServicesAccountInner call(ServiceResponse> createWithServiceResponseAsync(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParameters parameters) { + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -188,14 +184,14 @@ public Observable> createWithServ if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + if (account == null) { + throw new IllegalArgumentException("Parameter account is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Validator.validate(parameters); - return service.create(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + Validator.validate(account); + return service.create(resourceGroupName, accountName, this.client.subscriptionId(), account, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -222,13 +218,14 @@ private ServiceResponse createDelegate(Response updateAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + public ServiceFuture updateAsync(String resourceGroupName, String accountName, CognitiveServicesAccountInner account, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, account), serviceCallback); } /** @@ -249,11 +247,12 @@ public ServiceFuture updateAsync(String resourceG * * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of Cognitive Services account. + * @param account The parameters to provide for the created account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CognitiveServicesAccountInner object */ - public Observable updateAsync(String resourceGroupName, String accountName) { - return updateWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, CognitiveServicesAccountInner>() { + public Observable updateAsync(String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, account).map(new Func1, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse response) { return response.body(); @@ -266,10 +265,11 @@ public CognitiveServicesAccountInner call(ServiceResponse> updateWithServiceResponseAsync(String resourceGroupName, String accountName) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -279,114 +279,14 @@ public Observable> updateWithServ if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - final Sku sku = null; - final Map tags = null; - final Object properties = null; - CognitiveServicesAccountUpdateParameters parameters = new CognitiveServicesAccountUpdateParameters(); - parameters.withSku(null); - parameters.withTags(null); - parameters.withProperties(null); - return service.update(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Updates a Cognitive Services account. - * - * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of Cognitive Services account. - * @param sku Gets or sets the SKU of the resource. - * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * @param properties Additional properties for Account. Only provided fields will be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the CognitiveServicesAccountInner object if successful. - */ - public CognitiveServicesAccountInner update(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties) { - return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags, properties).toBlocking().single().body(); - } - - /** - * Updates a Cognitive Services account. - * - * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of Cognitive Services account. - * @param sku Gets or sets the SKU of the resource. - * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * @param properties Additional properties for Account. Only provided fields will be updated. - * @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 updateAsync(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags, properties), serviceCallback); - } - - /** - * Updates a Cognitive Services account. - * - * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of Cognitive Services account. - * @param sku Gets or sets the SKU of the resource. - * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * @param properties Additional properties for Account. Only provided fields will be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the CognitiveServicesAccountInner object - */ - public Observable updateAsync(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties) { - return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags, properties).map(new Func1, CognitiveServicesAccountInner>() { - @Override - public CognitiveServicesAccountInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Updates a Cognitive Services account. - * - * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of Cognitive Services account. - * @param sku Gets or sets the SKU of the resource. - * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * @param properties Additional properties for Account. Only provided fields will be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the CognitiveServicesAccountInner object - */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (accountName == null) { - throw new IllegalArgumentException("Parameter accountName 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 (account == null) { + throw new IllegalArgumentException("Parameter account is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Validator.validate(sku); - Validator.validate(tags); - CognitiveServicesAccountUpdateParameters parameters = new CognitiveServicesAccountUpdateParameters(); - parameters.withSku(sku); - parameters.withTags(tags); - parameters.withProperties(properties); - return service.update(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + Validator.validate(account); + return service.update(resourceGroupName, accountName, this.client.subscriptionId(), account, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java index e4ecf0e12dcf..c67b7875833a 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java @@ -11,51 +11,25 @@ import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccount; import rx.Observable; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccountProperties; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Sku; -import java.util.Map; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccountCreateParameters; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.NetworkRuleSet; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.ProvisioningState; -import rx.functions.Func1; class CognitiveServicesAccountImpl extends GroupableResourceCoreImpl implements CognitiveServicesAccount, CognitiveServicesAccount.Definition, CognitiveServicesAccount.Update { - private Sku usku; - private Map utags; - private Object uproperties; - private CognitiveServicesAccountCreateParameters createParameter; CognitiveServicesAccountImpl(String name, CognitiveServicesAccountInner inner, CognitiveServicesManager manager) { super(name, inner, manager); - this.usku = new Sku(); - this.createParameter = new CognitiveServicesAccountCreateParameters(); } @Override public Observable createResourceAsync() { AccountsInner client = this.manager().inner().accounts(); - this.createParameter.withLocation(inner().location()); - this.createParameter.withTags(inner().getTags()); - return client.createAsync(this.resourceGroupName(), this.name(), this.createParameter) - .map(new Func1() { - @Override - public CognitiveServicesAccountInner call(CognitiveServicesAccountInner resource) { - resetCreateUpdateParameters(); - return resource; - } - }) + return client.createAsync(this.resourceGroupName(), this.name(), this.inner()) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { AccountsInner client = this.manager().inner().accounts(); - return client.updateAsync(this.resourceGroupName(), this.name(), this.usku, this.utags, this.uproperties) - .map(new Func1() { - @Override - public CognitiveServicesAccountInner call(CognitiveServicesAccountInner resource) { - resetCreateUpdateParameters(); - return resource; - } - }) + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner()) .map(innerToFluentMap(this)); } @@ -70,44 +44,20 @@ public boolean isInCreateMode() { return this.inner().id() == null; } - private void resetCreateUpdateParameters() { - this.usku = new Sku(); - this.createParameter = new CognitiveServicesAccountCreateParameters(); - } - - @Override - public String customSubDomainName() { - return this.inner().customSubDomainName(); - } - - @Override - public String endpoint() { - return this.inner().endpoint(); - } @Override public String etag() { return this.inner().etag(); } - @Override - public String internalId() { - return this.inner().internalId(); - } - @Override public String kind() { return this.inner().kind(); } @Override - public NetworkRuleSet networkAcls() { - return this.inner().networkAcls(); - } - - @Override - public ProvisioningState provisioningState() { - return this.inner().provisioningState(); + public CognitiveServicesAccountProperties properties() { + return this.inner().properties(); } @Override @@ -117,33 +67,19 @@ public Sku sku() { @Override public CognitiveServicesAccountImpl withKind(String kind) { - this.createParameter.withKind(kind); - return this; - } - - @Override - public CognitiveServicesAccountImpl withTags(Map tags) { - this.utags = tags; + this.inner().withKind(kind); return this; } @Override - public CognitiveServicesAccountImpl withProperties(Object properties) { - if (isInCreateMode()) { - this.createParameter.withProperties(properties); - } else { - this.uproperties = properties; - } + public CognitiveServicesAccountImpl withProperties(CognitiveServicesAccountProperties properties) { + this.inner().withProperties(properties); return this; } @Override public CognitiveServicesAccountImpl withSku(Sku sku) { - if (isInCreateMode()) { - this.createParameter.withSku(sku); - } else { - this.usku = sku; - } + this.inner().withSku(sku); return this; } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java index 6d5e79d9f5a6..7e5901f177f7 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java @@ -8,50 +8,33 @@ package com.microsoft.azure.management.cognitiveservices.v2017_04_18.implementation; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.ProvisioningState; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.NetworkRuleSet; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccountProperties; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Sku; import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; /** * Cognitive Services Account is an Azure resource representing the provisioned * account, its type, location and SKU. */ -@JsonFlatten public class CognitiveServicesAccountInner extends Resource { /** * Entity Tag. */ - @JsonProperty(value = "etag") + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) private String etag; /** - * Type of cognitive service account. + * The Kind of the resource. */ @JsonProperty(value = "kind") private String kind; /** - * Gets the status of the cognitive services account at the time the - * operation was called. Possible values include: 'Creating', - * 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed'. + * Properties of Cognitive Services account. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private ProvisioningState provisioningState; - - /** - * Endpoint of the created account. - */ - @JsonProperty(value = "properties.endpoint") - private String endpoint; - - /** - * The internal identifier. - */ - @JsonProperty(value = "properties.internalId") - private String internalId; + @JsonProperty(value = "properties") + private CognitiveServicesAccountProperties properties; /** * Optional subdomain name used for token-based authentication. @@ -82,18 +65,7 @@ public String etag() { } /** - * Set entity Tag. - * - * @param etag the etag value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withEtag(String etag) { - this.etag = etag; - return this; - } - - /** - * Get type of cognitive service account. + * Get the Kind of the resource. * * @return the kind value */ @@ -102,7 +74,7 @@ public String kind() { } /** - * Set type of cognitive service account. + * Set the Kind of the resource. * * @param kind the kind value to set * @return the CognitiveServicesAccountInner object itself. @@ -113,91 +85,22 @@ public CognitiveServicesAccountInner withKind(String kind) { } /** - * Get gets the status of the cognitive services account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed'. - * - * @return the provisioningState value - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get endpoint of the created account. - * - * @return the endpoint value - */ - public String endpoint() { - return this.endpoint; - } - - /** - * Set endpoint of the created account. - * - * @param endpoint the endpoint value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withEndpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /** - * Get the internal identifier. - * - * @return the internalId value - */ - public String internalId() { - return this.internalId; - } - - /** - * Set the internal identifier. - * - * @param internalId the internalId value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withInternalId(String internalId) { - this.internalId = internalId; - return this; - } - - /** - * Get optional subdomain name used for token-based authentication. - * - * @return the customSubDomainName value - */ - public String customSubDomainName() { - return this.customSubDomainName; - } - - /** - * Set optional subdomain name used for token-based authentication. - * - * @param customSubDomainName the customSubDomainName value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withCustomSubDomainName(String customSubDomainName) { - this.customSubDomainName = customSubDomainName; - return this; - } - - /** - * Get a collection of rules governing the accessibility from specific network locations. + * Get properties of Cognitive Services account. * - * @return the networkAcls value + * @return the properties value */ - public NetworkRuleSet networkAcls() { - return this.networkAcls; + public CognitiveServicesAccountProperties properties() { + return this.properties; } /** - * Set a collection of rules governing the accessibility from specific network locations. + * Set properties of Cognitive Services account. * - * @param networkAcls the networkAcls value to set + * @param properties the properties value to set * @return the CognitiveServicesAccountInner object itself. */ - public CognitiveServicesAccountInner withNetworkAcls(NetworkRuleSet networkAcls) { - this.networkAcls = networkAcls; + public CognitiveServicesAccountInner withProperties(CognitiveServicesAccountProperties properties) { + this.properties = properties; return this; } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java index 1647b6b86739..5da4953e335c 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java @@ -13,12 +13,15 @@ import com.microsoft.azure.AzureServiceClient; import com.microsoft.azure.CloudException; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CheckDomainAvailabilityParameter; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CheckSkuAvailabilityParameter; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.Header; @@ -190,19 +193,6 @@ public OperationsInner operations() { return this.operations; } - /** - * The CheckSkuAvailabilitysInner object to access its operations. - */ - private CheckSkuAvailabilitysInner checkSkuAvailabilitys; - - /** - * Gets the CheckSkuAvailabilitysInner object to access its operations. - * @return the CheckSkuAvailabilitysInner object. - */ - public CheckSkuAvailabilitysInner checkSkuAvailabilitys() { - return this.checkSkuAvailabilitys; - } - /** * Initializes an instance of CognitiveServicesManagementClient client. * @@ -241,7 +231,6 @@ protected void initialize() { this.accounts = new AccountsInner(restClient().retrofit(), this); this.resourceSkus = new ResourceSkusInner(restClient().retrofit(), this); this.operations = new OperationsInner(restClient().retrofit(), this); - this.checkSkuAvailabilitys = new CheckSkuAvailabilitysInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); initializeService(); } @@ -265,12 +254,121 @@ private void initializeService() { * used by Retrofit to perform actually REST calls. */ interface CognitiveServicesManagementClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesManagementClient checkSkuAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability") + Observable> checkSkuAvailability(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckSkuAvailabilityParameter parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesManagementClient checkDomainAvailability" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability") Observable> checkDomainAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckDomainAvailabilityParameter parameters, @Header("User-Agent") String userAgent); } + /** + * Check available SKUs. + * + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type of the resource. + * @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 CheckSkuAvailabilityResultListInner object if successful. + */ + public CheckSkuAvailabilityResultListInner checkSkuAvailability(String location, List skus, String kind, String type) { + return checkSkuAvailabilityWithServiceResponseAsync(location, skus, kind, type).toBlocking().single().body(); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type 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 checkSkuAvailabilityAsync(String location, List skus, String kind, String type, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkSkuAvailabilityWithServiceResponseAsync(location, skus, kind, type), serviceCallback); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckSkuAvailabilityResultListInner object + */ + public Observable checkSkuAvailabilityAsync(String location, List skus, String kind, String type) { + return checkSkuAvailabilityWithServiceResponseAsync(location, skus, kind, type).map(new Func1, CheckSkuAvailabilityResultListInner>() { + @Override + public CheckSkuAvailabilityResultListInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckSkuAvailabilityResultListInner object + */ + public Observable> checkSkuAvailabilityWithServiceResponseAsync(String location, List skus, String kind, String type) { + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + if (skus == null) { + throw new IllegalArgumentException("Parameter skus is required and cannot be null."); + } + if (kind == null) { + throw new IllegalArgumentException("Parameter kind is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type is required and cannot be null."); + } + Validator.validate(skus); + CheckSkuAvailabilityParameter parameters = new CheckSkuAvailabilityParameter(); + parameters.withSkus(skus); + parameters.withKind(kind); + parameters.withType(type); + return service.checkSkuAvailability(this.subscriptionId(), location, this.apiVersion(), this.acceptLanguage(), parameters, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkSkuAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkSkuAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Check whether a domain is available. * diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManager.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManager.java index f0eaa535088c..ae833c978ac3 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManager.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManager.java @@ -19,7 +19,6 @@ import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Accounts; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.ResourceSkus; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Operations; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CheckSkuAvailabilitys; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -30,7 +29,6 @@ public final class CognitiveServicesManager extends ManagerCore