diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/pom.xml b/sdk/windowsiot/mgmt-v2018_02_16_preview/pom.xml new file mode 100644 index 0000000000000..6a7eae532e257 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.windowsiot.v2018_02_16_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-windowsiot + 1.0.0-beta + jar + Microsoft Azure SDK for WindowsIoT Management + This package contains Microsoft WindowsIoT Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceService.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceService.java new file mode 100644 index 0000000000000..c644fa52976ae --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceService.java @@ -0,0 +1,219 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.WindowsIoTManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.DeviceServiceInner; + +/** + * Type representing DeviceService. + */ +public interface DeviceService extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the adminDomainName value. + */ + String adminDomainName(); + + /** + * @return the billingDomainName value. + */ + String billingDomainName(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the notes value. + */ + String notes(); + + /** + * @return the quantity value. + */ + Long quantity(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * The entirety of the DeviceService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithIfMatch, DefinitionStages.WithCreate { + } + + /** + * Grouping of DeviceService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DeviceService definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the DeviceService definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the deviceservice definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a new Windows IoT Device Service. Required to update an existing Windows IoT Device Service + * @return the next definition stage +*/ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the deviceservice definition allowing to specify AdminDomainName. + */ + interface WithAdminDomainName { + /** + * Specifies adminDomainName. + * @param adminDomainName Windows IoT Device Service OEM AAD domain + * @return the next definition stage + */ + WithCreate withAdminDomainName(String adminDomainName); + } + + /** + * The stage of the deviceservice definition allowing to specify Etag. + */ + interface WithEtag { + /** + * Specifies etag. + * @param etag The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention + * @return the next definition stage + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the deviceservice definition allowing to specify Notes. + */ + interface WithNotes { + /** + * Specifies notes. + * @param notes Windows IoT Device Service notes + * @return the next definition stage + */ + WithCreate withNotes(String notes); + } + + /** + * The stage of the deviceservice definition allowing to specify Quantity. + */ + interface WithQuantity { + /** + * Specifies quantity. + * @param quantity Windows IoT Device Service device allocation, + * @return the next definition stage + */ + WithCreate withQuantity(Long quantity); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * 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, DefinitionStages.WithAdminDomainName, DefinitionStages.WithEtag, DefinitionStages.WithNotes, DefinitionStages.WithQuantity { + } + } + /** + * The template for a DeviceService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithIfMatch, UpdateStages.WithAdminDomainName, UpdateStages.WithEtag, UpdateStages.WithNotes, UpdateStages.WithQuantity { + } + + /** + * Grouping of DeviceService update stages. + */ + interface UpdateStages { + /** + * The stage of the deviceservice update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a brand new Windows IoT Device Service. Required to update an existing Windows IoT Device Service + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the deviceservice update allowing to specify AdminDomainName. + */ + interface WithAdminDomainName { + /** + * Specifies adminDomainName. + * @param adminDomainName Windows IoT Device Service OEM AAD domain + * @return the next update stage + */ + Update withAdminDomainName(String adminDomainName); + } + + /** + * The stage of the deviceservice update allowing to specify Etag. + */ + interface WithEtag { + /** + * Specifies etag. + * @param etag The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention + * @return the next update stage + */ + Update withEtag(String etag); + } + + /** + * The stage of the deviceservice update allowing to specify Notes. + */ + interface WithNotes { + /** + * Specifies notes. + * @param notes Windows IoT Device Service notes + * @return the next update stage + */ + Update withNotes(String notes); + } + + /** + * The stage of the deviceservice update allowing to specify Quantity. + */ + interface WithQuantity { + /** + * Specifies quantity. + * @param quantity Windows IoT Device Service device allocation, + * @return the next update stage + */ + Update withQuantity(Long quantity); + } + + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceServiceCheckNameAvailabilityParameters.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceServiceCheckNameAvailabilityParameters.java new file mode 100644 index 0000000000000..6b268df16025f --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceServiceCheckNameAvailabilityParameters.java @@ -0,0 +1,43 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input values. + */ +public class DeviceServiceCheckNameAvailabilityParameters { + /** + * The name of the Windows IoT Device Service to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name of the Windows IoT Device Service to check. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Windows IoT Device Service to check. + * + * @param name the name value to set + * @return the DeviceServiceCheckNameAvailabilityParameters object itself. + */ + public DeviceServiceCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceServiceNameAvailabilityInfo.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceServiceNameAvailabilityInfo.java new file mode 100644 index 0000000000000..4a20f9f490f16 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/DeviceServiceNameAvailabilityInfo.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.windowsiot.v2018_02_16_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.WindowsIoTManager; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.DeviceServiceNameAvailabilityInfoInner; + +/** + * Type representing DeviceServiceNameAvailabilityInfo. + */ +public interface DeviceServiceNameAvailabilityInfo extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + ServiceNameUnavailabilityReason reason(); + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ErrorDetails.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ErrorDetails.java new file mode 100644 index 0000000000000..0deb85f9982b4 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ErrorDetails.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.windowsiot.v2018_02_16_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * One of a server-defined set of error codes. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * A human-readable representation of the error's details. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get one of a server-defined set of error codes. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set one of a server-defined set of error codes. + * + * @param code the code value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human-readable representation of the error. + * + * @param message the message value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target of the particular error. + * + * @param target the target value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get a human-readable representation of the error's details. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set a human-readable representation of the error's details. + * + * @param details the details value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ErrorDetailsException.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ErrorDetailsException.java new file mode 100644 index 0000000000000..83403ae06fda0 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ErrorDetailsException.java @@ -0,0 +1,44 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorDetails information. + */ +public class ErrorDetailsException extends RestException { + /** + * Initializes a new instance of the ErrorDetailsException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorDetailsException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorDetailsException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorDetailsException(final String message, final Response response, final ErrorDetails body) { + super(message, response, body); + } + + @Override + public ErrorDetails body() { + return (ErrorDetails) super.body(); + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/OperationDisplayInfo.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/OperationDisplayInfo.java new file mode 100644 index 0000000000000..067fb9ce8cf63 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/OperationDisplayInfo.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.windowsiot.v2018_02_16_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Azure Data Catalog Service. + */ +public class OperationDisplayInfo { + /** + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The action that users can perform, based on their permission level. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Service provider: Azure Data Catalog Service. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the operation. + * + * @param description the description value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action that users can perform, based on their permission level. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the action that users can perform, based on their permission level. + * + * @param operation the operation value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get service provider: Azure Data Catalog Service. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Azure Data Catalog Service. + * + * @param provider the provider value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withResource(String resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/OperationEntity.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/OperationEntity.java new file mode 100644 index 0000000000000..beb736c4e24a3 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/OperationEntity.java @@ -0,0 +1,30 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.WindowsIoTManager; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.OperationEntityInner; + +/** + * Type representing OperationEntity. + */ +public interface OperationEntity extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/Operations.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/Operations.java new file mode 100644 index 0000000000000..b70be75c4487c --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import rx.Observable; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ServiceNameUnavailabilityReason.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ServiceNameUnavailabilityReason.java new file mode 100644 index 0000000000000..24bc8eb638272 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/ServiceNameUnavailabilityReason.java @@ -0,0 +1,53 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ServiceNameUnavailabilityReason. + */ +public enum ServiceNameUnavailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a ServiceNameUnavailabilityReason instance. */ + private String value; + + ServiceNameUnavailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServiceNameUnavailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed ServiceNameUnavailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static ServiceNameUnavailabilityReason fromString(String value) { + ServiceNameUnavailabilityReason[] items = ServiceNameUnavailabilityReason.values(); + for (ServiceNameUnavailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/Services.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/Services.java new file mode 100644 index 0000000000000..74f43145943a6 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/Services.java @@ -0,0 +1,34 @@ +/** + * 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.windowsiot.v2018_02_16_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation.ServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Services. + */ +public interface Services extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Check if a Windows IoT Device Service name is available. + * + * @param name The name of the Windows IoT Device Service to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkDeviceServiceNameAvailabilityAsync(String name); + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceImpl.java new file mode 100644 index 0000000000000..ad2a74dfbdea9 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceImpl.java @@ -0,0 +1,113 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.DeviceService; +import rx.Observable; +import org.joda.time.DateTime; + +class DeviceServiceImpl extends GroupableResourceCoreImpl implements DeviceService, DeviceService.Definition, DeviceService.Update { + private String cifMatch; + private String uifMatch; + DeviceServiceImpl(String name, DeviceServiceInner inner, WindowsIoTManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + ServicesInner client = this.manager().inner().services(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServicesInner client = this.manager().inner().services(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServicesInner client = this.manager().inner().services(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String adminDomainName() { + return this.inner().adminDomainName(); + } + + @Override + public String billingDomainName() { + return this.inner().billingDomainName(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String notes() { + return this.inner().notes(); + } + + @Override + public Long quantity() { + return this.inner().quantity(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public DeviceServiceImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public DeviceServiceImpl withAdminDomainName(String adminDomainName) { + this.inner().withAdminDomainName(adminDomainName); + return this; + } + + @Override + public DeviceServiceImpl withEtag(String etag) { + this.inner().withEtag(etag); + return this; + } + + @Override + public DeviceServiceImpl withNotes(String notes) { + this.inner().withNotes(notes); + return this; + } + + @Override + public DeviceServiceImpl withQuantity(Long quantity) { + this.inner().withQuantity(quantity); + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceInner.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceInner.java new file mode 100644 index 0000000000000..413f23e3e0ca3 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceInner.java @@ -0,0 +1,159 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * The description of the Windows IoT Device Service. + */ +@JsonFlatten +@SkipParentValidation +public class DeviceServiceInner extends Resource { + /** + * The Etag field is *not* required. If it is provided in the response + * body, it must also be provided as a header per the normal ETag + * convention. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Windows IoT Device Service notes. + */ + @JsonProperty(value = "properties.notes") + private String notes; + + /** + * Windows IoT Device Service start date,. + */ + @JsonProperty(value = "properties.startDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startDate; + + /** + * Windows IoT Device Service device allocation,. + */ + @JsonProperty(value = "properties.quantity") + private Long quantity; + + /** + * Windows IoT Device Service ODM AAD domain. + */ + @JsonProperty(value = "properties.billingDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String billingDomainName; + + /** + * Windows IoT Device Service OEM AAD domain. + */ + @JsonProperty(value = "properties.adminDomainName") + private String adminDomainName; + + /** + * Get the Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. + * + * @param etag the etag value to set + * @return the DeviceServiceInner object itself. + */ + public DeviceServiceInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get windows IoT Device Service notes. + * + * @return the notes value + */ + public String notes() { + return this.notes; + } + + /** + * Set windows IoT Device Service notes. + * + * @param notes the notes value to set + * @return the DeviceServiceInner object itself. + */ + public DeviceServiceInner withNotes(String notes) { + this.notes = notes; + return this; + } + + /** + * Get windows IoT Device Service start date,. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Get windows IoT Device Service device allocation,. + * + * @return the quantity value + */ + public Long quantity() { + return this.quantity; + } + + /** + * Set windows IoT Device Service device allocation,. + * + * @param quantity the quantity value to set + * @return the DeviceServiceInner object itself. + */ + public DeviceServiceInner withQuantity(Long quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get windows IoT Device Service ODM AAD domain. + * + * @return the billingDomainName value + */ + public String billingDomainName() { + return this.billingDomainName; + } + + /** + * Get windows IoT Device Service OEM AAD domain. + * + * @return the adminDomainName value + */ + public String adminDomainName() { + return this.adminDomainName; + } + + /** + * Set windows IoT Device Service OEM AAD domain. + * + * @param adminDomainName the adminDomainName value to set + * @return the DeviceServiceInner object itself. + */ + public DeviceServiceInner withAdminDomainName(String adminDomainName) { + this.adminDomainName = adminDomainName; + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceNameAvailabilityInfoImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceNameAvailabilityInfoImpl.java new file mode 100644 index 0000000000000..aaeb30140a591 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceNameAvailabilityInfoImpl.java @@ -0,0 +1,42 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.DeviceServiceNameAvailabilityInfo; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.ServiceNameUnavailabilityReason; + +class DeviceServiceNameAvailabilityInfoImpl extends WrapperImpl implements DeviceServiceNameAvailabilityInfo { + private final WindowsIoTManager manager; + DeviceServiceNameAvailabilityInfoImpl(DeviceServiceNameAvailabilityInfoInner inner, WindowsIoTManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WindowsIoTManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public ServiceNameUnavailabilityReason reason() { + return this.inner().reason(); + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceNameAvailabilityInfoInner.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceNameAvailabilityInfoInner.java new file mode 100644 index 0000000000000..3c000e6132d42 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServiceNameAvailabilityInfoInner.java @@ -0,0 +1,76 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.ServiceNameUnavailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties indicating whether a given Windows IoT Device Service name is + * available. + */ +public class DeviceServiceNameAvailabilityInfoInner { + /** + * 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. Possible values include: 'Invalid', + * 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private ServiceNameUnavailabilityReason reason; + + /** + * The detailed reason message. + */ + @JsonProperty(value = "message") + 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. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public ServiceNameUnavailabilityReason reason() { + return this.reason; + } + + /** + * Get the detailed reason message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the detailed reason message. + * + * @param message the message value to set + * @return the DeviceServiceNameAvailabilityInfoInner object itself. + */ + public DeviceServiceNameAvailabilityInfoInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServicesImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServicesImpl.java new file mode 100644 index 0000000000000..709f71da7ef4e --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/DeviceServicesImpl.java @@ -0,0 +1,210 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the DeviceServicesImpl class. + */ +public class DeviceServicesImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription identifier. */ + private String subscriptionId; + + /** + * Gets The subscription identifier. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public DeviceServicesImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The version of the API. */ + private String apiVersion; + + /** + * Gets The version of the API. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public DeviceServicesImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public DeviceServicesImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public DeviceServicesImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The ServicesInner object to access its operations. + */ + private ServicesInner services; + + /** + * Gets the ServicesInner object to access its operations. + * @return the ServicesInner object. + */ + public ServicesInner services() { + return this.services; + } + + /** + * Initializes an instance of DeviceServices client. + * + * @param credentials the management credentials for Azure + */ + public DeviceServicesImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of DeviceServices client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public DeviceServicesImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of DeviceServices client. + * + * @param restClient the REST client to connect to Azure. + */ + public DeviceServicesImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-02-16-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.services = new ServicesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "DeviceServices", "2018-02-16-preview"); + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/IdParsingUtils.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..2ba4b89cd4898 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationEntityImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationEntityImpl.java new file mode 100644 index 0000000000000..2365315d7445c --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationEntityImpl.java @@ -0,0 +1,37 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.OperationEntity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.OperationDisplayInfo; + +class OperationEntityImpl extends WrapperImpl implements OperationEntity { + private final WindowsIoTManager manager; + OperationEntityImpl(OperationEntityInner inner, WindowsIoTManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WindowsIoTManager manager() { + return this.manager; + } + + @Override + public OperationDisplayInfo display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationEntityInner.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationEntityInner.java new file mode 100644 index 0000000000000..a1955890cdf77 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationEntityInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Azure Data Catalog Service. + */ +public class OperationEntityInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The operation supported by Azure Data Catalog Service. + */ + @JsonProperty(value = "display") + private OperationDisplayInfo display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operation supported by Azure Data Catalog Service. + * + * @return the display value + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Set the operation supported by Azure Data Catalog Service. + * + * @param display the display value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withDisplay(OperationDisplayInfo display) { + this.display = display; + return this; + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationsImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..accaaeedd72d3 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.OperationEntity; + +class OperationsImpl extends WrapperImpl implements Operations { + private final WindowsIoTManager manager; + + OperationsImpl(WindowsIoTManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public WindowsIoTManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OperationEntity call(OperationEntityInner inner) { + return new OperationEntityImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationsInner.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..d73fd4fe78051 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.ErrorDetailsException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private DeviceServicesImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, DeviceServicesImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Operations list" }) + @GET("providers/Microsoft.WindowsIoT/operations") + Observable> list(@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.windowsiot.v2018_02_16_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @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 PagedList<OperationEntityInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationEntityInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Windows IoT Services REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/PageImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..b0e76380a6e44 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/ServicesImpl.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/ServicesImpl.java new file mode 100644 index 0000000000000..d0699a0f576a5 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/ServicesImpl.java @@ -0,0 +1,151 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Services; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.DeviceService; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.DeviceServiceNameAvailabilityInfo; + +class ServicesImpl extends GroupableResourcesCoreImpl implements Services { + protected ServicesImpl(WindowsIoTManager manager) { + super(manager.inner().services(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ServicesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ServicesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ServicesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeviceService call(DeviceServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ServicesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ServicesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeviceService call(DeviceServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public DeviceServiceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable checkDeviceServiceNameAvailabilityAsync(String name) { + ServicesInner client = this.inner(); + return client.checkDeviceServiceNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public DeviceServiceNameAvailabilityInfo call(DeviceServiceNameAvailabilityInfoInner inner) { + return new DeviceServiceNameAvailabilityInfoImpl(inner, manager()); + } + }); + } + + @Override + protected DeviceServiceImpl wrapModel(DeviceServiceInner inner) { + return new DeviceServiceImpl(inner.name(), inner, manager()); + } + + @Override + protected DeviceServiceImpl wrapModel(String name) { + return new DeviceServiceImpl(name, new DeviceServiceInner(), this.manager()); + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/ServicesInner.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/ServicesInner.java new file mode 100644 index 0000000000000..2645997211f07 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/ServicesInner.java @@ -0,0 +1,1193 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.DeviceServiceCheckNameAvailabilityParameters; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.ErrorDetailsException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Services. + */ +public class ServicesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ServicesService service; + /** The service client containing this operation class. */ + private DeviceServicesImpl client; + + /** + * Initializes an instance of ServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServicesInner(Retrofit retrofit, DeviceServicesImpl client) { + this.service = retrofit.create(ServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Services to be + * used by Retrofit to perform actually REST calls. + */ + interface ServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Services getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("deviceName") String deviceName, @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.windowsiot.v2018_02_16_preview.Services createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("deviceName") String deviceName, @Query("api-version") String apiVersion, @Body DeviceServiceInner deviceService, @Header("If-Match") String ifMatch, @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.windowsiot.v2018_02_16_preview.Services update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("deviceName") String deviceName, @Query("api-version") String apiVersion, @Body DeviceServiceInner deviceService, @Header("If-Match") String ifMatch, @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.windowsiot.v2018_02_16_preview.Services delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("deviceName") String deviceName, @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.windowsiot.v2018_02_16_preview.Services listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.windowsiot.v2018_02_16_preview.Services list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/deviceServices") + Observable> list(@Path("subscriptionId") String subscriptionId, @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.windowsiot.v2018_02_16_preview.Services checkDeviceServiceNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/checkDeviceServiceNameAvailability") + Observable> checkDeviceServiceNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DeviceServiceCheckNameAvailabilityParameters deviceServiceCheckNameAvailabilityParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Services listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @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.windowsiot.v2018_02_16_preview.Services listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the non-security related metadata of a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @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 DeviceServiceInner object if successful. + */ + public DeviceServiceInner getByResourceGroup(String resourceGroupName, String deviceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, deviceName).toBlocking().single().body(); + } + + /** + * Get the non-security related metadata of a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @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 getByResourceGroupAsync(String resourceGroupName, String deviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, deviceName), serviceCallback); + } + + /** + * Get the non-security related metadata of a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String deviceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, deviceName).map(new Func1, DeviceServiceInner>() { + @Override + public DeviceServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the non-security related metadata of a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String deviceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deviceName == null) { + throw new IllegalArgumentException("Parameter deviceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, deviceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(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); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @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 DeviceServiceInner object if successful. + */ + public DeviceServiceInner createOrUpdate(String resourceGroupName, String deviceName, DeviceServiceInner deviceService) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService).toBlocking().single().body(); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @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 createOrUpdateAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService), serviceCallback); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService).map(new Func1, DeviceServiceInner>() { + @Override + public DeviceServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deviceName == null) { + throw new IllegalArgumentException("Parameter deviceName 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 (deviceService == null) { + throw new IllegalArgumentException("Parameter deviceService is required and cannot be null."); + } + Validator.validate(deviceService); + final String ifMatch = null; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, deviceName, this.client.apiVersion(), deviceService, ifMatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @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 DeviceServiceInner object if successful. + */ + public DeviceServiceInner createOrUpdate(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService, ifMatch).toBlocking().single().body(); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @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 createOrUpdateAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService, ifMatch), serviceCallback); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService, ifMatch).map(new Func1, DeviceServiceInner>() { + @Override + public DeviceServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of a Windows IoT Device Service. + * Create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deviceName == null) { + throw new IllegalArgumentException("Parameter deviceName 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 (deviceService == null) { + throw new IllegalArgumentException("Parameter deviceService is required and cannot be null."); + } + Validator.validate(deviceService); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, deviceName, this.client.apiVersion(), deviceService, ifMatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @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 DeviceServiceInner object if successful. + */ + public DeviceServiceInner update(String resourceGroupName, String deviceName, DeviceServiceInner deviceService) { + return updateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService).toBlocking().single().body(); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @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 deviceName, DeviceServiceInner deviceService, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService), serviceCallback); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable updateAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService) { + return updateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService).map(new Func1, DeviceServiceInner>() { + @Override + public DeviceServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deviceName == null) { + throw new IllegalArgumentException("Parameter deviceName 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 (deviceService == null) { + throw new IllegalArgumentException("Parameter deviceService is required and cannot be null."); + } + Validator.validate(deviceService); + final String ifMatch = null; + return service.update(this.client.subscriptionId(), resourceGroupName, deviceName, this.client.apiVersion(), deviceService, ifMatch, this.client.acceptLanguage(), 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 the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a brand new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @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 DeviceServiceInner object if successful. + */ + public DeviceServiceInner update(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a brand new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @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 deviceName, DeviceServiceInner deviceService, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService, ifMatch), serviceCallback); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a brand new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable updateAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, deviceName, deviceService, ifMatch).map(new Func1, DeviceServiceInner>() { + @Override + public DeviceServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the metadata of a Windows IoT Device Service. + * Updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a new body to update the Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @param deviceService The Windows IoT Device Service metadata and security metadata. + * @param ifMatch ETag of the Windows IoT Device Service. Do not specify for creating a brand new Windows IoT Device Service. Required to update an existing Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String deviceName, DeviceServiceInner deviceService, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deviceName == null) { + throw new IllegalArgumentException("Parameter deviceName 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 (deviceService == null) { + throw new IllegalArgumentException("Parameter deviceService is required and cannot be null."); + } + Validator.validate(deviceService); + return service.update(this.client.subscriptionId(), resourceGroupName, deviceName, this.client.apiVersion(), deviceService, ifMatch, this.client.acceptLanguage(), 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); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Delete a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @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 DeviceServiceInner object if successful. + */ + public DeviceServiceInner delete(String resourceGroupName, String deviceName) { + return deleteWithServiceResponseAsync(resourceGroupName, deviceName).toBlocking().single().body(); + } + + /** + * Delete a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @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 deleteAsync(String resourceGroupName, String deviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, deviceName), serviceCallback); + } + + /** + * Delete a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable deleteAsync(String resourceGroupName, String deviceName) { + return deleteWithServiceResponseAsync(resourceGroupName, deviceName).map(new Func1, DeviceServiceInner>() { + @Override + public DeviceServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a Windows IoT Device Service. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @param deviceName The name of the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceInner object + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String deviceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deviceName == null) { + throw new IllegalArgumentException("Parameter deviceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, deviceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @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 PagedList<DeviceServiceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the Windows IoT Device Service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeviceServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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 PagedList<DeviceServiceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeviceServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Check if a Windows IoT Device Service name is available. + * + * @param name The name of the Windows IoT Device Service 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 DeviceServiceNameAvailabilityInfoInner object if successful. + */ + public DeviceServiceNameAvailabilityInfoInner checkDeviceServiceNameAvailability(String name) { + return checkDeviceServiceNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Check if a Windows IoT Device Service name is available. + * + * @param name The name of the Windows IoT Device Service 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 checkDeviceServiceNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkDeviceServiceNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Check if a Windows IoT Device Service name is available. + * + * @param name The name of the Windows IoT Device Service to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceNameAvailabilityInfoInner object + */ + public Observable checkDeviceServiceNameAvailabilityAsync(String name) { + return checkDeviceServiceNameAvailabilityWithServiceResponseAsync(name).map(new Func1, DeviceServiceNameAvailabilityInfoInner>() { + @Override + public DeviceServiceNameAvailabilityInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check if a Windows IoT Device Service name is available. + * + * @param name The name of the Windows IoT Device Service to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeviceServiceNameAvailabilityInfoInner object + */ + public Observable> checkDeviceServiceNameAvailabilityWithServiceResponseAsync(String name) { + 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."); + } + DeviceServiceCheckNameAvailabilityParameters deviceServiceCheckNameAvailabilityParameters = new DeviceServiceCheckNameAvailabilityParameters(); + deviceServiceCheckNameAvailabilityParameters.withName(name); + return service.checkDeviceServiceNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), deviceServiceCheckNameAvailabilityParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkDeviceServiceNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkDeviceServiceNameAvailabilityDelegate(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); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<DeviceServiceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeviceServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<DeviceServiceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeviceServiceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeviceServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/WindowsIoTManager.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/WindowsIoTManager.java new file mode 100644 index 0000000000000..ad31cda477b7a --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/WindowsIoTManager.java @@ -0,0 +1,111 @@ +/** + * 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.windowsiot.v2018_02_16_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Operations; +import com.microsoft.azure.management.windowsiot.v2018_02_16_preview.Services; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure WindowsIoT resource management. + */ +public final class WindowsIoTManager extends ManagerCore { + private Operations operations; + private Services services; + /** + * Get a Configurable instance that can be used to create WindowsIoTManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new WindowsIoTManager.ConfigurableImpl(); + } + /** + * Creates an instance of WindowsIoTManager that exposes WindowsIoT resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the WindowsIoTManager + */ + public static WindowsIoTManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new WindowsIoTManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of WindowsIoTManager that exposes WindowsIoT resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the WindowsIoTManager + */ + public static WindowsIoTManager authenticate(RestClient restClient, String subscriptionId) { + return new WindowsIoTManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of WindowsIoTManager that exposes WindowsIoT management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing WindowsIoT management API entry points that work across subscriptions + */ + WindowsIoTManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(this); + } + return this.services; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public WindowsIoTManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return WindowsIoTManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private WindowsIoTManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new DeviceServicesImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/package-info.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/package-info.java new file mode 100644 index 0000000000000..98d5fb8531bb7 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for DeviceServices. + * Use this API to manage the Windows IoT device services in your Azure subscription. + */ +package com.microsoft.azure.management.windowsiot.v2018_02_16_preview.implementation; diff --git a/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/package-info.java b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/package-info.java new file mode 100644 index 0000000000000..7057cc1d872c4 --- /dev/null +++ b/sdk/windowsiot/mgmt-v2018_02_16_preview/src/main/java/com/microsoft/azure/management/windowsiot/v2018_02_16_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for DeviceServices. + * Use this API to manage the Windows IoT device services in your Azure subscription. + */ +package com.microsoft.azure.management.windowsiot.v2018_02_16_preview;