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..a6f47ea1b047 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 nameAvailabilityInputs Set the name parameter in the NameAvailabilityInputs 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(NameAvailabilityInputs nameAvailabilityInputs); + + /** + * Check if an IoT Central application subdomain is available. + * + * @param subdomainAvailabilityInputs Set the subdomain parameter in the SubdomainAvailabilityInputs 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(SubdomainAvailabilityInputs subdomainAvailabilityInputs); } 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..266247077b1d 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 @@ -15,48 +15,29 @@ */ public class ErrorDetails { /** - * The error code. + * The error property. */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) - private String code; + @JsonProperty(value = "error") + private ErrorResponseBody error; /** - * 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; - - /** - * Get the error code. - * - * @return the code value - */ - public String code() { - return this.code; - } - - /** - * Get the error message. + * Get the error value. * - * @return the message value + * @return the error value */ - public String message() { - return this.message; + public ErrorResponseBody error() { + return this.error; } /** - * Get the target of the particular error. + * Set the error value. * - * @return the target value + * @param error the error value to set + * @return the ErrorDetails object itself. */ - public String target() { - return this.target; + public ErrorDetails withError(ErrorResponseBody error) { + this.error = error; + 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..9b63d8a7ab45 --- /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 { + /** + * Error code, intended to be consumed programmatically. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Description of the error, intended for display in user interface. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Target of the particular error, for example name of the property. + */ + @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 error code, intended to be consumed programmatically. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get description of the error, intended for display in user interface. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get target of the particular error, for example name of the property. + * + * @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..7a4a3325c828 --- /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") + private String name; + + /** + * The name of the IoT Central resource name 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 name of the IoT Central resource name to query. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the name of the IoT Central resource name 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..cf2b91aaeec4 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 @@ -17,9 +17,21 @@ public class OperationInputs { /** * The name of the IoT Central application instance to check. */ - @JsonProperty(value = "name", required = true) + @JsonProperty(value = "name") private String name; + /** + * The subdomain of the IoT Central application instance to check. + */ + @JsonProperty(value = "subdomain") + private String subdomain; + + /** + * The name of the IoT Central resource name to query. + */ + @JsonProperty(value = "type") + private String type; + /** * Get the name of the IoT Central application instance to check. * @@ -40,4 +52,44 @@ public OperationInputs withName(String name) { return this; } + /** + * 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 OperationInputs object itself. + */ + public OperationInputs withSubdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Get the name of the IoT Central resource name to query. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the name of the IoT Central resource name 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..8d30248a94c6 --- /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") + private String subdomain; + + /** + * The name of the IoT Central resource name 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 name of the IoT Central resource name to query. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the name of the IoT Central resource name 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..9c8e6408898f --- /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 + * information 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..f30c81656e96 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,9 @@ 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.NameAvailabilityInputs; +import com.microsoft.azure.management.iotcentral.v2018_09_01.SubdomainAvailabilityInputs; class AppsImpl extends GroupableResourcesCoreImpl implements Apps { protected AppsImpl(IoTCentralManager manager) { @@ -127,13 +129,25 @@ public AppImpl define(String name) { } @Override - public Observable checkNameAvailabilityAsync(String name) { + public Observable checkNameAvailabilityAsync(NameAvailabilityInputs nameAvailabilityInputs) { AppsInner client = this.inner(); - return client.checkNameAvailabilityAsync(name) - .map(new Func1() { + return client.checkNameAvailabilityAsync(nameAvailabilityInputs) + .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(SubdomainAvailabilityInputs subdomainAvailabilityInputs) { + AppsInner client = this.inner(); + return client.checkSubdomainAvailabilityAsync(subdomainAvailabilityInputs) + .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..3f4f1638523b 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 @@ -17,7 +17,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.iotcentral.v2018_09_01.AppPatch; import com.microsoft.azure.management.iotcentral.v2018_09_01.ErrorDetailsException; -import com.microsoft.azure.management.iotcentral.v2018_09_01.OperationInputs; +import com.microsoft.azure.management.iotcentral.v2018_09_01.NameAvailabilityInputs; +import com.microsoft.azure.management.iotcentral.v2018_09_01.SubdomainAvailabilityInputs; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -106,7 +107,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 NameAvailabilityInputs nameAvailabilityInputs, @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 SubdomainAvailabilityInputs subdomainAvailabilityInputs, @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 +934,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 nameAvailabilityInputs Set the name parameter in the NameAvailabilityInputs 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(NameAvailabilityInputs nameAvailabilityInputs) { + return checkNameAvailabilityWithServiceResponseAsync(nameAvailabilityInputs).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 nameAvailabilityInputs Set the name parameter in the NameAvailabilityInputs 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(NameAvailabilityInputs nameAvailabilityInputs, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(nameAvailabilityInputs), serviceCallback); } /** * Check if an IoT Central application name is available. * - * @param name The name of the IoT Central application instance to check. + * @param nameAvailabilityInputs Set the name parameter in the NameAvailabilityInputs 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(NameAvailabilityInputs nameAvailabilityInputs) { + return checkNameAvailabilityWithServiceResponseAsync(nameAvailabilityInputs).map(new Func1, AppAvailabilityInfoInner>() { @Override - public AppNameAvailabilityInfoInner call(ServiceResponse response) { + public AppAvailabilityInfoInner call(ServiceResponse response) { return response.body(); } }); @@ -970,28 +975,107 @@ public AppNameAvailabilityInfoInner call(ServiceResponse> checkNameAvailabilityWithServiceResponseAsync(NameAvailabilityInputs nameAvailabilityInputs) { + 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 (nameAvailabilityInputs == null) { + throw new IllegalArgumentException("Parameter nameAvailabilityInputs is required and cannot be null."); + } + Validator.validate(nameAvailabilityInputs); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), nameAvailabilityInputs, 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 subdomainAvailabilityInputs Set the subdomain parameter in the SubdomainAvailabilityInputs 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(SubdomainAvailabilityInputs subdomainAvailabilityInputs) { + return checkSubdomainAvailabilityWithServiceResponseAsync(subdomainAvailabilityInputs).toBlocking().single().body(); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param subdomainAvailabilityInputs Set the subdomain parameter in the SubdomainAvailabilityInputs 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(SubdomainAvailabilityInputs subdomainAvailabilityInputs, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkSubdomainAvailabilityWithServiceResponseAsync(subdomainAvailabilityInputs), serviceCallback); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param subdomainAvailabilityInputs Set the subdomain parameter in the SubdomainAvailabilityInputs 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(SubdomainAvailabilityInputs subdomainAvailabilityInputs) { + return checkSubdomainAvailabilityWithServiceResponseAsync(subdomainAvailabilityInputs).map(new Func1, AppAvailabilityInfoInner>() { + @Override + public AppAvailabilityInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param subdomainAvailabilityInputs Set the subdomain parameter in the SubdomainAvailabilityInputs 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(SubdomainAvailabilityInputs subdomainAvailabilityInputs) { 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 (subdomainAvailabilityInputs == null) { + throw new IllegalArgumentException("Parameter subdomainAvailabilityInputs 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(subdomainAvailabilityInputs); + return service.checkSubdomainAvailability(this.client.subscriptionId(), this.client.apiVersion(), subdomainAvailabilityInputs, 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 +1084,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); }