diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/AppAvailabilityInfo.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/AppAvailabilityInfo.java new file mode 100644 index 000000000000..5c74a2ea3a6b --- /dev/null +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/AppAvailabilityInfo.java @@ -0,0 +1,35 @@ +/** + * 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.iotcentral.v2018_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.iotcentral.v2018_09_01.implementation.IoTCentralManager; +import com.microsoft.azure.management.iotcentral.v2018_09_01.implementation.AppAvailabilityInfoInner; + +/** + * Type representing AppAvailabilityInfo. + */ +public interface AppAvailabilityInfo extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + String reason(); + +} diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/Apps.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/Apps.java index 4b97c49f5b0f..deec27d18075 100644 --- a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/Apps.java +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/Apps.java @@ -25,10 +25,19 @@ public interface Apps extends SupportsCreating, Supp /** * Check if an IoT Central application name is available. * - * @param name The name of the IoT Central application instance to check. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable checkNameAvailabilityAsync(String name); + Observable checkNameAvailabilityAsync(OperationInputs operationInputs); + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkSubdomainAvailabilityAsync(OperationInputs operationInputs); } diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorDetails.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorDetails.java index 1b0cc3bc4650..708471461f70 100644 --- a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorDetails.java +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorDetails.java @@ -8,30 +8,39 @@ package com.microsoft.azure.management.iotcentral.v2018_09_01; +import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; /** * Error details. */ +@JsonFlatten public class ErrorDetails { /** * The error code. */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "error.code", access = JsonProperty.Access.WRITE_ONLY) private String code; /** * The error message. */ - @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "error.message", access = JsonProperty.Access.WRITE_ONLY) private String message; /** * The target of the particular error. */ - @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "error.target", access = JsonProperty.Access.WRITE_ONLY) private String target; + /** + * A list of additional details about the error. + */ + @JsonProperty(value = "error.details") + private List details; + /** * Get the error code. * @@ -59,4 +68,24 @@ public String target() { return this.target; } + /** + * Get a list of additional details about the error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set a list of additional details about the error. + * + * @param details the details value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withDetails(List details) { + this.details = details; + return this; + } + } diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorResponseBody.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorResponseBody.java new file mode 100644 index 000000000000..a7b6c9d7730a --- /dev/null +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/ErrorResponseBody.java @@ -0,0 +1,89 @@ +/** + * 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.iotcentral.v2018_09_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of error response. + */ +public class ErrorResponseBody { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * A list of additional details about the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get a list of additional details about the error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set a list of additional details about the error. + * + * @param details the details value to set + * @return the ErrorResponseBody object itself. + */ + public ErrorResponseBody withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/NameAvailabilityInputs.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/NameAvailabilityInputs.java new file mode 100644 index 000000000000..ae0e3c6414d0 --- /dev/null +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/NameAvailabilityInputs.java @@ -0,0 +1,69 @@ +/** + * 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.iotcentral.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input values. + */ +public class NameAvailabilityInputs { + /** + * The name of the IoT Central application instance to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of the IoT Central resource to query. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name of the IoT Central application instance to check. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the IoT Central application instance to check. + * + * @param name the name value to set + * @return the NameAvailabilityInputs object itself. + */ + public NameAvailabilityInputs withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the IoT Central resource to query. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the IoT Central resource to query. + * + * @param type the type value to set + * @return the NameAvailabilityInputs object itself. + */ + public NameAvailabilityInputs withType(String type) { + this.type = type; + return this; + } + +} diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/OperationInputs.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/OperationInputs.java index 19aeb03c1131..5f507aee5198 100644 --- a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/OperationInputs.java +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/OperationInputs.java @@ -20,6 +20,12 @@ public class OperationInputs { @JsonProperty(value = "name", required = true) private String name; + /** + * The type of the IoT Central resource to query. + */ + @JsonProperty(value = "type") + private String type; + /** * Get the name of the IoT Central application instance to check. * @@ -40,4 +46,24 @@ public OperationInputs withName(String name) { return this; } + /** + * Get the type of the IoT Central resource to query. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the IoT Central resource to query. + * + * @param type the type value to set + * @return the OperationInputs object itself. + */ + public OperationInputs withType(String type) { + this.type = type; + return this; + } + } diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/SubdomainAvailabilityInputs.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/SubdomainAvailabilityInputs.java new file mode 100644 index 000000000000..ad53cb471be4 --- /dev/null +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/SubdomainAvailabilityInputs.java @@ -0,0 +1,69 @@ +/** + * 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.iotcentral.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input values. + */ +public class SubdomainAvailabilityInputs { + /** + * The subdomain of the IoT Central application instance to check. + */ + @JsonProperty(value = "subdomain", required = true) + private String subdomain; + + /** + * The type of the IoT Central resource to query. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the subdomain of the IoT Central application instance to check. + * + * @return the subdomain value + */ + public String subdomain() { + return this.subdomain; + } + + /** + * Set the subdomain of the IoT Central application instance to check. + * + * @param subdomain the subdomain value to set + * @return the SubdomainAvailabilityInputs object itself. + */ + public SubdomainAvailabilityInputs withSubdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Get the type of the IoT Central resource to query. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the IoT Central resource to query. + * + * @param type the type value to set + * @return the SubdomainAvailabilityInputs object itself. + */ + public SubdomainAvailabilityInputs withType(String type) { + this.type = type; + return this; + } + +} diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppAvailabilityInfoImpl.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppAvailabilityInfoImpl.java new file mode 100644 index 000000000000..525e00b7ec9f --- /dev/null +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppAvailabilityInfoImpl.java @@ -0,0 +1,41 @@ +/** + * 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.iotcentral.v2018_09_01.implementation; + +import com.microsoft.azure.management.iotcentral.v2018_09_01.AppAvailabilityInfo; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AppAvailabilityInfoImpl extends WrapperImpl implements AppAvailabilityInfo { + private final IoTCentralManager manager; + AppAvailabilityInfoImpl(AppAvailabilityInfoInner inner, IoTCentralManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public IoTCentralManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + +} diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppAvailabilityInfoInner.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppAvailabilityInfoInner.java new file mode 100644 index 000000000000..389b61db9ad4 --- /dev/null +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppAvailabilityInfoInner.java @@ -0,0 +1,63 @@ +/** + * 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.iotcentral.v2018_09_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties indicating whether a given IoT Central application name or + * subdomain is available. + */ +public class AppAvailabilityInfoInner { + /** + * The value which indicates whether the provided name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /** + * The reason for unavailability. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private String reason; + + /** + * The detailed reason message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the value which indicates whether the provided name is available. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason for unavailability. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Get the detailed reason message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsImpl.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsImpl.java index f231df1b0456..537fc693efa6 100644 --- a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsImpl.java +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsImpl.java @@ -22,7 +22,8 @@ import rx.functions.Func1; import com.microsoft.azure.PagedList; import com.microsoft.azure.Page; -import com.microsoft.azure.management.iotcentral.v2018_09_01.AppNameAvailabilityInfo; +import com.microsoft.azure.management.iotcentral.v2018_09_01.AppAvailabilityInfo; +import com.microsoft.azure.management.iotcentral.v2018_09_01.OperationInputs; class AppsImpl extends GroupableResourcesCoreImpl implements Apps { protected AppsImpl(IoTCentralManager manager) { @@ -127,13 +128,25 @@ public AppImpl define(String name) { } @Override - public Observable checkNameAvailabilityAsync(String name) { + public Observable checkNameAvailabilityAsync(OperationInputs operationInputs) { AppsInner client = this.inner(); - return client.checkNameAvailabilityAsync(name) - .map(new Func1() { + return client.checkNameAvailabilityAsync(operationInputs) + .map(new Func1() { @Override - public AppNameAvailabilityInfo call(AppNameAvailabilityInfoInner inner) { - return new AppNameAvailabilityInfoImpl(inner, manager()); + public AppAvailabilityInfo call(AppAvailabilityInfoInner inner) { + return new AppAvailabilityInfoImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkSubdomainAvailabilityAsync(OperationInputs operationInputs) { + AppsInner client = this.inner(); + return client.checkSubdomainAvailabilityAsync(operationInputs) + .map(new Func1() { + @Override + public AppAvailabilityInfo call(AppAvailabilityInfoInner inner) { + return new AppAvailabilityInfoImpl(inner, manager()); } }); } diff --git a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsInner.java b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsInner.java index b0572a838565..f551023b24b2 100644 --- a/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsInner.java +++ b/iotcentral/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/iotcentral/v2018_09_01/implementation/AppsInner.java @@ -106,7 +106,11 @@ interface AppsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iotcentral.v2018_09_01.Apps checkNameAvailability" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability") - Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body OperationInputs operationInputs, @Header("User-Agent") String userAgent); + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body OperationInputs operationInputs, @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.iotcentral.v2018_09_01.Apps checkSubdomainAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability") + Observable> checkSubdomainAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body OperationInputs operationInputs, @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.iotcentral.v2018_09_01.Apps listNext" }) @GET @@ -929,39 +933,39 @@ private ServiceResponse> listByResourceGroupDelegate(Response /** * Check if an IoT Central application name is available. * - * @param name The name of the IoT Central application instance to check. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorDetailsException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the AppNameAvailabilityInfoInner object if successful. + * @return the AppAvailabilityInfoInner object if successful. */ - public AppNameAvailabilityInfoInner checkNameAvailability(String name) { - return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + public AppAvailabilityInfoInner checkNameAvailability(OperationInputs operationInputs) { + return checkNameAvailabilityWithServiceResponseAsync(operationInputs).toBlocking().single().body(); } /** * Check if an IoT Central application name is available. * - * @param name The name of the IoT Central application instance to check. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. * @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 checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + public ServiceFuture checkNameAvailabilityAsync(OperationInputs operationInputs, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(operationInputs), serviceCallback); } /** * Check if an IoT Central application name is available. * - * @param name The name of the IoT Central application instance to check. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AppNameAvailabilityInfoInner object + * @return the observable to the AppAvailabilityInfoInner object */ - public Observable checkNameAvailabilityAsync(String name) { - return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, AppNameAvailabilityInfoInner>() { + public Observable checkNameAvailabilityAsync(OperationInputs operationInputs) { + return checkNameAvailabilityWithServiceResponseAsync(operationInputs).map(new Func1, AppAvailabilityInfoInner>() { @Override - public AppNameAvailabilityInfoInner call(ServiceResponse response) { + public AppAvailabilityInfoInner call(ServiceResponse response) { return response.body(); } }); @@ -970,28 +974,107 @@ public AppNameAvailabilityInfoInner call(ServiceResponse> checkNameAvailabilityWithServiceResponseAsync(OperationInputs operationInputs) { + 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."); + } + if (operationInputs == null) { + throw new IllegalArgumentException("Parameter operationInputs is required and cannot be null."); + } + Validator.validate(operationInputs); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), operationInputs, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AppAvailabilityInfoInner object if successful. + */ + public AppAvailabilityInfoInner checkSubdomainAvailability(OperationInputs operationInputs) { + return checkSubdomainAvailabilityWithServiceResponseAsync(operationInputs).toBlocking().single().body(); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. + * @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 checkSubdomainAvailabilityAsync(OperationInputs operationInputs, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkSubdomainAvailabilityWithServiceResponseAsync(operationInputs), serviceCallback); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AppAvailabilityInfoInner object + */ + public Observable checkSubdomainAvailabilityAsync(OperationInputs operationInputs) { + return checkSubdomainAvailabilityWithServiceResponseAsync(operationInputs).map(new Func1, AppAvailabilityInfoInner>() { + @Override + public AppAvailabilityInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AppNameAvailabilityInfoInner object + * @return the observable to the AppAvailabilityInfoInner object */ - public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + public Observable> checkSubdomainAvailabilityWithServiceResponseAsync(OperationInputs operationInputs) { 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."); } - if (name == null) { - throw new IllegalArgumentException("Parameter name is required and cannot be null."); + if (operationInputs == null) { + throw new IllegalArgumentException("Parameter operationInputs is required and cannot be null."); } - OperationInputs operationInputs = new OperationInputs(); - operationInputs.withName(name); - return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), operationInputs, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(operationInputs); + return service.checkSubdomainAvailability(this.client.subscriptionId(), this.client.apiVersion(), operationInputs, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + ServiceResponse clientResponse = checkSubdomainAvailabilityDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1000,9 +1083,9 @@ public Observable> call(Response checkNameAvailabilityDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse checkSubdomainAvailabilityDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ErrorDetailsException.class) .build(response); }