From 8169317eda3cd7508f819d1d43751b091fc8d50e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 13 Mar 2018 20:39:04 +0000 Subject: [PATCH] Generated from fd1de12c31aeac3065a82d41ee2fe7555c42733e Update iotdps.json "operationId": "DpsCertificates_List", -> "operationId": "DpsCertificate_List", so the list operation is grouped with the others on docs --- .../AccessRightsDescription.java | 53 + .../AllocationPolicy.java | 44 + .../CertificateBodyDescription.java | 44 + .../CertificateProperties.java | 118 + .../CertificatePurpose.java | 41 + .../provisioningservices/ErrorDetails.java | 77 + .../ErrorDetailsException.java | 44 + .../provisioningservices/ErrorMesssage.java | 95 + .../IotDpsPropertiesDescription.java | 200 ++ .../provisioningservices/IotDpsSku.java | 38 + .../provisioningservices/IotDpsSkuInfo.java | 84 + .../IotHubDefinitionDescription.java | 136 ++ .../NameUnavailabilityReason.java | 41 + .../OperationDisplay.java | 62 + .../provisioningservices/OperationInputs.java | 43 + .../provisioningservices/State.java | 71 + .../provisioningservices/TagsResource.java | 45 + .../VerificationCodeRequest.java | 44 + .../VerificationCodeResponseProperties.java | 199 ++ .../AsyncOperationResultInner.java | 70 + .../CertificateListDescriptionInner.java | 44 + .../CertificateResponseInner.java | 104 + .../implementation/DpsCertificatesInner.java | 1289 ++++++++++ .../implementation/IotDpsClientImpl.java | 224 ++ .../implementation/IotDpsResourcesInner.java | 2143 +++++++++++++++++ .../IotDpsSkuDefinitionInner.java | 44 + .../NameAvailabilityInfoInner.java | 97 + .../implementation/OperationInner.java | 59 + .../implementation/OperationsInner.java | 283 +++ .../implementation/PageImpl.java | 75 + .../ProvisioningServiceDescriptionInner.java | 100 + ...ationRuleAccessRightsDescriptionInner.java | 124 + .../VerificationCodeResponseInner.java | 104 + .../implementation/package-info.java | 11 + .../provisioningservices/package-info.java | 11 + 35 files changed, 6261 insertions(+) create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AccessRightsDescription.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AllocationPolicy.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateBodyDescription.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateProperties.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificatePurpose.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetails.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetailsException.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorMesssage.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsPropertiesDescription.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSku.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSkuInfo.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotHubDefinitionDescription.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/NameUnavailabilityReason.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationDisplay.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationInputs.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/State.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/TagsResource.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeRequest.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeResponseProperties.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/AsyncOperationResultInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateListDescriptionInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateResponseInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/DpsCertificatesInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsClientImpl.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsResourcesInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsSkuDefinitionInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/NameAvailabilityInfoInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationsInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/PageImpl.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/ProvisioningServiceDescriptionInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/VerificationCodeResponseInner.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/package-info.java create mode 100644 azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/package-info.java diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AccessRightsDescription.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AccessRightsDescription.java new file mode 100644 index 00000000000..b945d56a6f4 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AccessRightsDescription.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.provisioningservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AccessRightsDescription. + */ +public final class AccessRightsDescription extends ExpandableStringEnum { + /** Static value ServiceConfig for AccessRightsDescription. */ + public static final AccessRightsDescription SERVICE_CONFIG = fromString("ServiceConfig"); + + /** Static value EnrollmentRead for AccessRightsDescription. */ + public static final AccessRightsDescription ENROLLMENT_READ = fromString("EnrollmentRead"); + + /** Static value EnrollmentWrite for AccessRightsDescription. */ + public static final AccessRightsDescription ENROLLMENT_WRITE = fromString("EnrollmentWrite"); + + /** Static value DeviceConnect for AccessRightsDescription. */ + public static final AccessRightsDescription DEVICE_CONNECT = fromString("DeviceConnect"); + + /** Static value RegistrationStatusRead for AccessRightsDescription. */ + public static final AccessRightsDescription REGISTRATION_STATUS_READ = fromString("RegistrationStatusRead"); + + /** Static value RegistrationStatusWrite for AccessRightsDescription. */ + public static final AccessRightsDescription REGISTRATION_STATUS_WRITE = fromString("RegistrationStatusWrite"); + + /** + * Creates or finds a AccessRightsDescription from its string representation. + * @param name a name to look for + * @return the corresponding AccessRightsDescription + */ + @JsonCreator + public static AccessRightsDescription fromString(String name) { + return fromString(name, AccessRightsDescription.class); + } + + /** + * @return known AccessRightsDescription values + */ + public static Collection values() { + return values(AccessRightsDescription.class); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AllocationPolicy.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AllocationPolicy.java new file mode 100644 index 00000000000..141c9224c4c --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/AllocationPolicy.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.provisioningservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AllocationPolicy. + */ +public final class AllocationPolicy extends ExpandableStringEnum { + /** Static value Hashed for AllocationPolicy. */ + public static final AllocationPolicy HASHED = fromString("Hashed"); + + /** Static value GeoLatency for AllocationPolicy. */ + public static final AllocationPolicy GEO_LATENCY = fromString("GeoLatency"); + + /** Static value Static for AllocationPolicy. */ + public static final AllocationPolicy STATIC = fromString("Static"); + + /** + * Creates or finds a AllocationPolicy from its string representation. + * @param name a name to look for + * @return the corresponding AllocationPolicy + */ + @JsonCreator + public static AllocationPolicy fromString(String name) { + return fromString(name, AllocationPolicy.class); + } + + /** + * @return known AllocationPolicy values + */ + public static Collection values() { + return values(AllocationPolicy.class); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateBodyDescription.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateBodyDescription.java new file mode 100644 index 00000000000..ba6548b6cda --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateBodyDescription.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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The JSON-serialized X509 Certificate. + */ +public class CertificateBodyDescription { + /** + * Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content. + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * Get the certificate value. + * + * @return the certificate value + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate value. + * + * @param certificate the certificate value to set + * @return the CertificateBodyDescription object itself. + */ + public CertificateBodyDescription withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateProperties.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateProperties.java new file mode 100644 index 00000000000..3953981c11d --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificateProperties.java @@ -0,0 +1,118 @@ +/** + * 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.provisioningservices; + +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The description of an X509 CA Certificate. + */ +public class CertificateProperties { + /** + * The certificate's subject name. + */ + @JsonProperty(value = "subject", access = JsonProperty.Access.WRITE_ONLY) + private String subject; + + /** + * The certificate's expiration date and time. + */ + @JsonProperty(value = "expiry", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 expiry; + + /** + * The certificate's thumbprint. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /** + * Determines whether certificate has been verified. + */ + @JsonProperty(value = "isVerified", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isVerified; + + /** + * The certificate's creation date and time. + */ + @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 created; + + /** + * The certificate's last update date and time. + */ + @JsonProperty(value = "updated", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 updated; + + /** + * Get the subject value. + * + * @return the subject value + */ + public String subject() { + return this.subject; + } + + /** + * Get the expiry value. + * + * @return the expiry value + */ + public DateTime expiry() { + if (this.expiry == null) { + return null; + } + return this.expiry.dateTime(); + } + + /** + * Get the thumbprint value. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the isVerified value. + * + * @return the isVerified value + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Get the created value. + * + * @return the created value + */ + public DateTime created() { + if (this.created == null) { + return null; + } + return this.created.dateTime(); + } + + /** + * Get the updated value. + * + * @return the updated value + */ + public DateTime updated() { + if (this.updated == null) { + return null; + } + return this.updated.dateTime(); + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificatePurpose.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificatePurpose.java new file mode 100644 index 00000000000..dd83aa47d43 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/CertificatePurpose.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.provisioningservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CertificatePurpose. + */ +public final class CertificatePurpose extends ExpandableStringEnum { + /** Static value clientAuthentication for CertificatePurpose. */ + public static final CertificatePurpose CLIENT_AUTHENTICATION = fromString("clientAuthentication"); + + /** Static value serverAuthentication for CertificatePurpose. */ + public static final CertificatePurpose SERVER_AUTHENTICATION = fromString("serverAuthentication"); + + /** + * Creates or finds a CertificatePurpose from its string representation. + * @param name a name to look for + * @return the corresponding CertificatePurpose + */ + @JsonCreator + public static CertificatePurpose fromString(String name) { + return fromString(name, CertificatePurpose.class); + } + + /** + * @return known CertificatePurpose values + */ + public static Collection values() { + return values(CertificatePurpose.class); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetails.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetails.java new file mode 100644 index 00000000000..163aedb0d37 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetails.java @@ -0,0 +1,77 @@ +/** + * 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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + */ +public class ErrorDetails { + /** + * The error code. + */ + @JsonProperty(value = "Code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The HTTP status code. + */ + @JsonProperty(value = "HttpStatusCode", access = JsonProperty.Access.WRITE_ONLY) + private String httpStatusCode; + + /** + * The error message. + */ + @JsonProperty(value = "Message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The error details. + */ + @JsonProperty(value = "Details", access = JsonProperty.Access.WRITE_ONLY) + private String details; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the httpStatusCode value. + * + * @return the httpStatusCode value + */ + public String httpStatusCode() { + return this.httpStatusCode; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the details value. + * + * @return the details value + */ + public String details() { + return this.details; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetailsException.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorDetailsException.java new file mode 100644 index 00000000000..1a72d265d32 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/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.provisioningservices; + +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/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorMesssage.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorMesssage.java new file mode 100644 index 00000000000..4b11bc10316 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/ErrorMesssage.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response containing message and code. + */ +public class ErrorMesssage { + /** + * standard error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * standard error description. + */ + @JsonProperty(value = "message") + private String message; + + /** + * detailed summary of error. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details value. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsPropertiesDescription.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsPropertiesDescription.java new file mode 100644 index 00000000000..565714e4362 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsPropertiesDescription.java @@ -0,0 +1,200 @@ +/** + * 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.provisioningservices; + +import java.util.List; +import com.microsoft.azure.management.provisioningservices.implementation.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * the service specific properties of a provisoning service, including keys, + * linked iot hubs, current state, and system generated properties such as + * hostname and idScope. + */ +public class IotDpsPropertiesDescription { + /** + * Current state of the provisioning service. Possible values include: + * 'Activating', 'Active', 'Deleting', 'Deleted', 'ActivationFailed', + * 'DeletionFailed', 'Transitioning', 'Suspending', 'Suspended', + * 'Resuming', 'FailingOver', 'FailoverFailed'. + */ + @JsonProperty(value = "state") + private State state; + + /** + * The ARM provisioning state of the provisioning service. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** + * List of IoT hubs assosciated with this provisioning service. + */ + @JsonProperty(value = "iotHubs") + private List iotHubs; + + /** + * Allocation policy to be used by this provisioning service. Possible + * values include: 'Hashed', 'GeoLatency', 'Static'. + */ + @JsonProperty(value = "allocationPolicy") + private AllocationPolicy allocationPolicy; + + /** + * Service endpoint for provisioning service. + */ + @JsonProperty(value = "serviceOperationsHostName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceOperationsHostName; + + /** + * Device endpoint for this provisioning service. + */ + @JsonProperty(value = "deviceProvisioningHostName", access = JsonProperty.Access.WRITE_ONLY) + private String deviceProvisioningHostName; + + /** + * Unique identifier of this provisioning service. + */ + @JsonProperty(value = "idScope", access = JsonProperty.Access.WRITE_ONLY) + private String idScope; + + /** + * List of authorization keys for a provisioning service. + */ + @JsonProperty(value = "authorizationPolicies") + private List authorizationPolicies; + + /** + * Get the state value. + * + * @return the state value + */ + public State state() { + return this.state; + } + + /** + * Set the state value. + * + * @param state the state value to set + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withState(State state) { + this.state = state; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the iotHubs value. + * + * @return the iotHubs value + */ + public List iotHubs() { + return this.iotHubs; + } + + /** + * Set the iotHubs value. + * + * @param iotHubs the iotHubs value to set + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withIotHubs(List iotHubs) { + this.iotHubs = iotHubs; + return this; + } + + /** + * Get the allocationPolicy value. + * + * @return the allocationPolicy value + */ + public AllocationPolicy allocationPolicy() { + return this.allocationPolicy; + } + + /** + * Set the allocationPolicy value. + * + * @param allocationPolicy the allocationPolicy value to set + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withAllocationPolicy(AllocationPolicy allocationPolicy) { + this.allocationPolicy = allocationPolicy; + return this; + } + + /** + * Get the serviceOperationsHostName value. + * + * @return the serviceOperationsHostName value + */ + public String serviceOperationsHostName() { + return this.serviceOperationsHostName; + } + + /** + * Get the deviceProvisioningHostName value. + * + * @return the deviceProvisioningHostName value + */ + public String deviceProvisioningHostName() { + return this.deviceProvisioningHostName; + } + + /** + * Get the idScope value. + * + * @return the idScope value + */ + public String idScope() { + return this.idScope; + } + + /** + * Get the authorizationPolicies value. + * + * @return the authorizationPolicies value + */ + public List authorizationPolicies() { + return this.authorizationPolicies; + } + + /** + * Set the authorizationPolicies value. + * + * @param authorizationPolicies the authorizationPolicies value to set + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withAuthorizationPolicies(List authorizationPolicies) { + this.authorizationPolicies = authorizationPolicies; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSku.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSku.java new file mode 100644 index 00000000000..e05c10c7945 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSku.java @@ -0,0 +1,38 @@ +/** + * 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.provisioningservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IotDpsSku. + */ +public final class IotDpsSku extends ExpandableStringEnum { + /** Static value S1 for IotDpsSku. */ + public static final IotDpsSku S1 = fromString("S1"); + + /** + * Creates or finds a IotDpsSku from its string representation. + * @param name a name to look for + * @return the corresponding IotDpsSku + */ + @JsonCreator + public static IotDpsSku fromString(String name) { + return fromString(name, IotDpsSku.class); + } + + /** + * @return known IotDpsSku values + */ + public static Collection values() { + return values(IotDpsSku.class); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSkuInfo.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSkuInfo.java new file mode 100644 index 00000000000..a53264a8720 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotDpsSkuInfo.java @@ -0,0 +1,84 @@ +/** + * 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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * List of possible provisoning service SKUs. + */ +public class IotDpsSkuInfo { + /** + * Sku name. Possible values include: 'S1'. + */ + @JsonProperty(value = "name") + private IotDpsSku name; + + /** + * Pricing tier name of the provisioning service. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /** + * The number of units to provision. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name value. + * + * @return the name value + */ + public IotDpsSku name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the IotDpsSkuInfo object itself. + */ + public IotDpsSkuInfo withName(IotDpsSku name) { + this.name = name; + return this; + } + + /** + * Get the tier value. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Get the capacity value. + * + * @return the capacity value + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity value. + * + * @param capacity the capacity value to set + * @return the IotDpsSkuInfo object itself. + */ + public IotDpsSkuInfo withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotHubDefinitionDescription.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotHubDefinitionDescription.java new file mode 100644 index 00000000000..1d70efcb4f6 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/IotHubDefinitionDescription.java @@ -0,0 +1,136 @@ +/** + * 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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of the IoT hub. + */ +public class IotHubDefinitionDescription { + /** + * flag for applying allocationPolicy or not for a given iot hub. + */ + @JsonProperty(value = "applyAllocationPolicy") + private Boolean applyAllocationPolicy; + + /** + * weight to apply for a given iot h. + */ + @JsonProperty(value = "allocationWeight") + private Integer allocationWeight; + + /** + * Host name of the IoT hub. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Connection string og the IoT hub. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * ARM region of the IoT hub. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get the applyAllocationPolicy value. + * + * @return the applyAllocationPolicy value + */ + public Boolean applyAllocationPolicy() { + return this.applyAllocationPolicy; + } + + /** + * Set the applyAllocationPolicy value. + * + * @param applyAllocationPolicy the applyAllocationPolicy value to set + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withApplyAllocationPolicy(Boolean applyAllocationPolicy) { + this.applyAllocationPolicy = applyAllocationPolicy; + return this; + } + + /** + * Get the allocationWeight value. + * + * @return the allocationWeight value + */ + public Integer allocationWeight() { + return this.allocationWeight; + } + + /** + * Set the allocationWeight value. + * + * @param allocationWeight the allocationWeight value to set + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withAllocationWeight(Integer allocationWeight) { + this.allocationWeight = allocationWeight; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the connectionString value. + * + * @return the connectionString value + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString value. + * + * @param connectionString the connectionString value to set + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/NameUnavailabilityReason.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/NameUnavailabilityReason.java new file mode 100644 index 00000000000..adfe0928e4f --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/NameUnavailabilityReason.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.provisioningservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NameUnavailabilityReason. + */ +public final class NameUnavailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for NameUnavailabilityReason. */ + public static final NameUnavailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for NameUnavailabilityReason. */ + public static final NameUnavailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a NameUnavailabilityReason from its string representation. + * @param name a name to look for + * @return the corresponding NameUnavailabilityReason + */ + @JsonCreator + public static NameUnavailabilityReason fromString(String name) { + return fromString(name, NameUnavailabilityReason.class); + } + + /** + * @return known NameUnavailabilityReason values + */ + public static Collection values() { + return values(NameUnavailabilityReason.class); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationDisplay.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationDisplay.java new file mode 100644 index 00000000000..bebcec046a7 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * 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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft Devices. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource Type: ProvisioningServices. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Name of the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationInputs.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationInputs.java new file mode 100644 index 00000000000..ca692333d2d --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/OperationInputs.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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input values for operation results call. + */ +public class OperationInputs { + /** + * The name of the Provisioning Service to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the OperationInputs object itself. + */ + public OperationInputs withName(String name) { + this.name = name; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/State.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/State.java new file mode 100644 index 00000000000..081a8614fc6 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/State.java @@ -0,0 +1,71 @@ +/** + * 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.provisioningservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for State. + */ +public final class State extends ExpandableStringEnum { + /** Static value Activating for State. */ + public static final State ACTIVATING = fromString("Activating"); + + /** Static value Active for State. */ + public static final State ACTIVE = fromString("Active"); + + /** Static value Deleting for State. */ + public static final State DELETING = fromString("Deleting"); + + /** Static value Deleted for State. */ + public static final State DELETED = fromString("Deleted"); + + /** Static value ActivationFailed for State. */ + public static final State ACTIVATION_FAILED = fromString("ActivationFailed"); + + /** Static value DeletionFailed for State. */ + public static final State DELETION_FAILED = fromString("DeletionFailed"); + + /** Static value Transitioning for State. */ + public static final State TRANSITIONING = fromString("Transitioning"); + + /** Static value Suspending for State. */ + public static final State SUSPENDING = fromString("Suspending"); + + /** Static value Suspended for State. */ + public static final State SUSPENDED = fromString("Suspended"); + + /** Static value Resuming for State. */ + public static final State RESUMING = fromString("Resuming"); + + /** Static value FailingOver for State. */ + public static final State FAILING_OVER = fromString("FailingOver"); + + /** Static value FailoverFailed for State. */ + public static final State FAILOVER_FAILED = fromString("FailoverFailed"); + + /** + * Creates or finds a State from its string representation. + * @param name a name to look for + * @return the corresponding State + */ + @JsonCreator + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * @return known State values + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/TagsResource.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/TagsResource.java new file mode 100644 index 00000000000..016db2a4492 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/TagsResource.java @@ -0,0 +1,45 @@ +/** + * 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.provisioningservices; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A container holding only the Tags for a resource, allowing the user to + * update the tags on a Provisioning Service instance. + */ +public class TagsResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeRequest.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeRequest.java new file mode 100644 index 00000000000..2428cd31cc9 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeRequest.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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The JSON-serialized leaf certificate. + */ +public class VerificationCodeRequest { + /** + * base-64 representation of X509 certificate .cer file or just .pem file + * content. + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * Get the certificate value. + * + * @return the certificate value + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate value. + * + * @param certificate the certificate value to set + * @return the VerificationCodeRequest object itself. + */ + public VerificationCodeRequest withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeResponseProperties.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeResponseProperties.java new file mode 100644 index 00000000000..31de99050ff --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/VerificationCodeResponseProperties.java @@ -0,0 +1,199 @@ +/** + * 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.provisioningservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The VerificationCodeResponseProperties model. + */ +public class VerificationCodeResponseProperties { + /** + * Verification code. + */ + @JsonProperty(value = "verificationCode") + private String verificationCode; + + /** + * Certificate subject. + */ + @JsonProperty(value = "subject") + private String subject; + + /** + * Code expiry. + */ + @JsonProperty(value = "expiry") + private String expiry; + + /** + * Certificate thumbprint. + */ + @JsonProperty(value = "thumbprint") + private String thumbprint; + + /** + * Indicate if the certificate is verified by owner of private key. + */ + @JsonProperty(value = "isVerified") + private Boolean isVerified; + + /** + * Certificate created time. + */ + @JsonProperty(value = "created") + private String created; + + /** + * Certificate updated time. + */ + @JsonProperty(value = "updated") + private String updated; + + /** + * Get the verificationCode value. + * + * @return the verificationCode value + */ + public String verificationCode() { + return this.verificationCode; + } + + /** + * Set the verificationCode value. + * + * @param verificationCode the verificationCode value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withVerificationCode(String verificationCode) { + this.verificationCode = verificationCode; + return this; + } + + /** + * Get the subject value. + * + * @return the subject value + */ + public String subject() { + return this.subject; + } + + /** + * Set the subject value. + * + * @param subject the subject value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get the expiry value. + * + * @return the expiry value + */ + public String expiry() { + return this.expiry; + } + + /** + * Set the expiry value. + * + * @param expiry the expiry value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withExpiry(String expiry) { + this.expiry = expiry; + return this; + } + + /** + * Get the thumbprint value. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint value. + * + * @param thumbprint the thumbprint value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the isVerified value. + * + * @return the isVerified value + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Set the isVerified value. + * + * @param isVerified the isVerified value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withIsVerified(Boolean isVerified) { + this.isVerified = isVerified; + return this; + } + + /** + * Get the created value. + * + * @return the created value + */ + public String created() { + return this.created; + } + + /** + * Set the created value. + * + * @param created the created value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withCreated(String created) { + this.created = created; + return this; + } + + /** + * Get the updated value. + * + * @return the updated value + */ + public String updated() { + return this.updated; + } + + /** + * Set the updated value. + * + * @param updated the updated value to set + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withUpdated(String updated) { + this.updated = updated; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/AsyncOperationResultInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/AsyncOperationResultInner.java new file mode 100644 index 00000000000..bf1810a53d6 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/AsyncOperationResultInner.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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.ErrorMesssage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of a long running operation. + */ +public class AsyncOperationResultInner { + /** + * current status of a long running operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Error message containing code, description and details. + */ + @JsonProperty(value = "error") + private ErrorMesssage error; + + /** + * Get the status value. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the AsyncOperationResultInner object itself. + */ + public AsyncOperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error value. + * + * @return the error value + */ + public ErrorMesssage error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the AsyncOperationResultInner object itself. + */ + public AsyncOperationResultInner withError(ErrorMesssage error) { + this.error = error; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateListDescriptionInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateListDescriptionInner.java new file mode 100644 index 00000000000..1e3a3762cce --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateListDescriptionInner.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.provisioningservices.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The JSON-serialized array of Certificate objects. + */ +public class CertificateListDescriptionInner { + /** + * The array of Certificate objects. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the CertificateListDescriptionInner object itself. + */ + public CertificateListDescriptionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateResponseInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateResponseInner.java new file mode 100644 index 00000000000..808477b6593 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/CertificateResponseInner.java @@ -0,0 +1,104 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.CertificateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The X509 Certificate. + */ +public class CertificateResponseInner { + /** + * properties of a certificate. + */ + @JsonProperty(value = "properties") + private CertificateProperties properties; + + /** + * The resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the certificate. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The entity tag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the properties value. + * + * @return the properties value + */ + public CertificateProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the CertificateResponseInner object itself. + */ + public CertificateResponseInner withProperties(CertificateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/DpsCertificatesInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/DpsCertificatesInner.java new file mode 100644 index 00000000000..4cf0458154d --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/DpsCertificatesInner.java @@ -0,0 +1,1289 @@ +/** + * 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.provisioningservices.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.provisioningservices.CertificateBodyDescription; +import com.microsoft.azure.management.provisioningservices.CertificatePurpose; +import com.microsoft.azure.management.provisioningservices.ErrorDetailsException; +import com.microsoft.azure.management.provisioningservices.VerificationCodeRequest; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import org.apache.commons.codec.binary.Base64; +import org.joda.time.DateTime; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DpsCertificates. + */ +public class DpsCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private DpsCertificatesService service; + /** The service client containing this operation class. */ + private IotDpsClientImpl client; + + /** + * Initializes an instance of DpsCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DpsCertificatesInner(Retrofit retrofit, IotDpsClientImpl client) { + this.service = retrofit.create(DpsCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DpsCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface DpsCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.provisioningservices.DpsCertificates get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + Observable> get(@Path("certificateName") String certificateName, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Header("If-Match") String ifMatch, @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.provisioningservices.DpsCertificates createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Path("certificateName") String certificateName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body CertificateBodyDescription certificateDescription, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.provisioningservices.DpsCertificates delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Path("certificateName") String certificateName, @Header("If-Match") String ifMatch, @Query("certificate.name") String certificatename, @Query("certificate.rawBytes") String certificaterawBytes, @Query("certificate.isVerified") Boolean certificateisVerified, @Query("certificate.purpose") CertificatePurpose certificatepurpose, @Query("certificate.created") DateTime certificatecreated, @Query("certificate.lastUpdated") DateTime certificatelastUpdated, @Query("certificate.hasPrivateKey") Boolean certificatehasPrivateKey, @Query("certificate.nonce") String certificatenonce, @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.provisioningservices.DpsCertificates list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @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.provisioningservices.DpsCertificates generateVerificationCode" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode") + Observable> generateVerificationCode(@Path("certificateName") String certificateName, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Header("If-Match") String ifMatch, @Query("certificate.name") String certificatename, @Query("certificate.rawBytes") String certificaterawBytes, @Query("certificate.isVerified") Boolean certificateisVerified, @Query("certificate.purpose") CertificatePurpose certificatepurpose, @Query("certificate.created") DateTime certificatecreated, @Query("certificate.lastUpdated") DateTime certificatelastUpdated, @Query("certificate.hasPrivateKey") Boolean certificatehasPrivateKey, @Query("certificate.nonce") String certificatenonce, @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.provisioningservices.DpsCertificates verifyCertificate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify") + Observable> verifyCertificate(@Path("certificateName") String certificateName, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Header("If-Match") String ifMatch, @Query("certificate.name") String certificatename, @Query("certificate.rawBytes") String certificaterawBytes, @Query("certificate.isVerified") Boolean certificateisVerified, @Query("certificate.purpose") CertificatePurpose certificatepurpose, @Query("certificate.created") DateTime certificatecreated, @Query("certificate.lastUpdated") DateTime certificatelastUpdated, @Query("certificate.hasPrivateKey") Boolean certificatehasPrivateKey, @Query("certificate.nonce") String certificatenonce, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VerificationCodeRequest request, @Header("User-Agent") String userAgent); + + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @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 CertificateResponseInner object if successful. + */ + public CertificateResponseInner get(String certificateName, String resourceGroupName, String provisioningServiceName) { + return getWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName).toBlocking().single().body(); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @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 getAsync(String certificateName, String resourceGroupName, String provisioningServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName), serviceCallback); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable getAsync(String certificateName, String resourceGroupName, String provisioningServiceName) { + return getWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName).map(new Func1, CertificateResponseInner>() { + @Override + public CertificateResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable> getWithServiceResponseAsync(String certificateName, String resourceGroupName, String provisioningServiceName) { + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String ifMatch = null; + return service.get(certificateName, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @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 CertificateResponseInner object if successful. + */ + public CertificateResponseInner get(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return getWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).toBlocking().single().body(); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @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 getAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch), serviceCallback); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable getAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return getWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).map(new Func1, CertificateResponseInner>() { + @Override + public CertificateResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable> getWithServiceResponseAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName 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.get(certificateName, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @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 CertificateResponseInner object if successful. + */ + public CertificateResponseInner createOrUpdate(String resourceGroupName, String provisioningServiceName, String certificateName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName).toBlocking().single().body(); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @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 provisioningServiceName, String certificateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName), serviceCallback); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String provisioningServiceName, String certificateName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName).map(new Func1, CertificateResponseInner>() { + @Override + public CertificateResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, String certificateName) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String ifMatch = null; + final String certificate = null; + CertificateBodyDescription certificateDescription = new CertificateBodyDescription(); + certificateDescription.withCertificate(null); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, certificateName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), certificateDescription, 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); + } + } + }); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file content. + * @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 CertificateResponseInner object if successful. + */ + public CertificateResponseInner createOrUpdate(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch, String certificate) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificate).toBlocking().single().body(); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file content. + * @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 provisioningServiceName, String certificateName, String ifMatch, String certificate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificate), serviceCallback); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file content. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch, String certificate) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificate).map(new Func1, CertificateResponseInner>() { + @Override + public CertificateResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upload the certificate to the provisioning service. + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file content. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch, String certificate) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + CertificateBodyDescription certificateDescription = new CertificateBodyDescription(); + certificateDescription.withCertificate(certificate); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, certificateName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), certificateDescription, 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); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @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 + */ + public void delete(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch).toBlocking().single().body(); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @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 provisioningServiceName, String certificateName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch), serviceCallback); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, String certificateName, 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String certificatename = null; + final byte[] certificaterawBytes = new byte[0]; + final Boolean certificateisVerified = null; + final CertificatePurpose certificatepurpose = null; + final DateTime certificatecreated = null; + final DateTime certificatelastUpdated = null; + final Boolean certificatehasPrivateKey = null; + final String certificatenonce = null; + String certificaterawBytesConverted = Base64.encodeBase64String(certificaterawBytes); + return service.delete(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificatename, certificaterawBytesConverted, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, 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); + } + } + }); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @param certificatename This is optional, and it is the Common Name of the certificate. + * @param certificaterawBytes Raw data within the certificate. + * @param certificateisVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatepurpose A description that mentions the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Time the certificate is created. + * @param certificatelastUpdated Time the certificate is last updated. + * @param certificatehasPrivateKey Indicates if the certificate contains a private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @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 + */ + public void delete(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce) { + deleteWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).toBlocking().single().body(); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @param certificatename This is optional, and it is the Common Name of the certificate. + * @param certificaterawBytes Raw data within the certificate. + * @param certificateisVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatepurpose A description that mentions the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Time the certificate is created. + * @param certificatelastUpdated Time the certificate is last updated. + * @param certificatehasPrivateKey Indicates if the certificate contains a private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @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 provisioningServiceName, String certificateName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce), serviceCallback); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @param certificatename This is optional, and it is the Common Name of the certificate. + * @param certificaterawBytes Raw data within the certificate. + * @param certificateisVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatepurpose A description that mentions the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Time the certificate is created. + * @param certificatelastUpdated Time the certificate is last updated. + * @param certificatehasPrivateKey Indicates if the certificate contains a private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce) { + return deleteWithServiceResponseAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the Provisioning Service Certificate. + * Deletes the specified certificate assosciated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the provisioning service will access by. + * @param ifMatch ETag of the certificate + * @param certificatename This is optional, and it is the Common Name of the certificate. + * @param certificaterawBytes Raw data within the certificate. + * @param certificateisVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatepurpose A description that mentions the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Time the certificate is created. + * @param certificatelastUpdated Time the certificate is last updated. + * @param certificatehasPrivateKey Indicates if the certificate contains a private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, String certificateName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String certificaterawBytesConverted = Base64.encodeBase64String(certificaterawBytes); + return service.delete(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificatename, certificaterawBytesConverted, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @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 CertificateListDescriptionInner object if successful. + */ + public CertificateListDescriptionInner list(String resourceGroupName, String provisioningServiceName) { + return listWithServiceResponseAsync(resourceGroupName, provisioningServiceName).toBlocking().single().body(); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @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(String resourceGroupName, String provisioningServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, provisioningServiceName), serviceCallback); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateListDescriptionInner object + */ + public Observable listAsync(String resourceGroupName, String provisioningServiceName) { + return listWithServiceResponseAsync(resourceGroupName, provisioningServiceName).map(new Func1, CertificateListDescriptionInner>() { + @Override + public CertificateListDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateListDescriptionInner object + */ + public Observable> listWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName 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(), resourceGroupName, provisioningServiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(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); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @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 VerificationCodeResponseInner object if successful. + */ + public VerificationCodeResponseInner generateVerificationCode(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return generateVerificationCodeWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).toBlocking().single().body(); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @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 generateVerificationCodeAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateVerificationCodeWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch), serviceCallback); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerificationCodeResponseInner object + */ + public Observable generateVerificationCodeAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return generateVerificationCodeWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).map(new Func1, VerificationCodeResponseInner>() { + @Override + public VerificationCodeResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerificationCodeResponseInner object + */ + public Observable> generateVerificationCodeWithServiceResponseAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String certificatename = null; + final byte[] certificaterawBytes = new byte[0]; + final Boolean certificateisVerified = null; + final CertificatePurpose certificatepurpose = null; + final DateTime certificatecreated = null; + final DateTime certificatelastUpdated = null; + final Boolean certificatehasPrivateKey = null; + final String certificatenonce = null; + String certificaterawBytesConverted = Base64.encodeBase64String(certificaterawBytes); + return service.generateVerificationCode(certificateName, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytesConverted, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateVerificationCodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Description mentioning the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @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 VerificationCodeResponseInner object if successful. + */ + public VerificationCodeResponseInner generateVerificationCode(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce) { + return generateVerificationCodeWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).toBlocking().single().body(); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Description mentioning the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @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 generateVerificationCodeAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateVerificationCodeWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce), serviceCallback); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Description mentioning the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerificationCodeResponseInner object + */ + public Observable generateVerificationCodeAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce) { + return generateVerificationCodeWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).map(new Func1, VerificationCodeResponseInner>() { + @Override + public VerificationCodeResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Description mentioning the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerificationCodeResponseInner object + */ + public Observable> generateVerificationCodeWithServiceResponseAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce) { + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String certificaterawBytesConverted = Base64.encodeBase64String(certificaterawBytes); + return service.generateVerificationCode(certificateName, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytesConverted, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateVerificationCodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateVerificationCodeDelegate(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); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @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 CertificateResponseInner object if successful. + */ + public CertificateResponseInner verifyCertificate(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return verifyCertificateWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).toBlocking().single().body(); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @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 verifyCertificateAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(verifyCertificateWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch), serviceCallback); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable verifyCertificateAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return verifyCertificateWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).map(new Func1, CertificateResponseInner>() { + @Override + public CertificateResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable> verifyCertificateWithServiceResponseAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String certificatename = null; + final byte[] certificaterawBytes = new byte[0]; + final Boolean certificateisVerified = null; + final CertificatePurpose certificatepurpose = null; + final DateTime certificatecreated = null; + final DateTime certificatelastUpdated = null; + final Boolean certificatehasPrivateKey = null; + final String certificatenonce = null; + final String certificate = null; + VerificationCodeRequest request = new VerificationCodeRequest(); + request.withCertificate(null); + String certificaterawBytesConverted = Base64.encodeBase64String(certificaterawBytes); + return service.verifyCertificate(certificateName, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytesConverted, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, this.client.apiVersion(), this.client.acceptLanguage(), request, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = verifyCertificateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Describe the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @param certificate base-64 representation of X509 certificate .cer file or just .pem file content. + * @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 CertificateResponseInner object if successful. + */ + public CertificateResponseInner verifyCertificate(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce, String certificate) { + return verifyCertificateWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, certificate).toBlocking().single().body(); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Describe the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @param certificate base-64 representation of X509 certificate .cer file or just .pem file content. + * @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 verifyCertificateAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce, String certificate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(verifyCertificateWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, certificate), serviceCallback); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Describe the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @param certificate base-64 representation of X509 certificate .cer file or just .pem file content. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable verifyCertificateAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce, String certificate) { + return verifyCertificateWithServiceResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, certificate).map(new Func1, CertificateResponseInner>() { + @Override + public CertificateResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Verify certificate's private key possession. + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to access. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param ifMatch ETag of the certificate. + * @param certificatename Common Name for the certificate. + * @param certificaterawBytes Raw data of certificate. + * @param certificateisVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatepurpose Describe the purpose of the certificate. Possible values include: 'clientAuthentication', 'serverAuthentication' + * @param certificatecreated Certificate creation time. + * @param certificatelastUpdated Certificate last updated time. + * @param certificatehasPrivateKey Indicates if the certificate contains private key. + * @param certificatenonce Random number generated to indicate Proof of Possession. + * @param certificate base-64 representation of X509 certificate .cer file or just .pem file content. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateResponseInner object + */ + public Observable> verifyCertificateWithServiceResponseAsync(String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch, String certificatename, byte[] certificaterawBytes, Boolean certificateisVerified, CertificatePurpose certificatepurpose, DateTime certificatecreated, DateTime certificatelastUpdated, Boolean certificatehasPrivateKey, String certificatenonce, String certificate) { + if (certificateName == null) { + throw new IllegalArgumentException("Parameter certificateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + VerificationCodeRequest request = new VerificationCodeRequest(); + request.withCertificate(certificate); + String certificaterawBytesConverted = Base64.encodeBase64String(certificaterawBytes); + return service.verifyCertificate(certificateName, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, ifMatch, certificatename, certificaterawBytesConverted, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, this.client.apiVersion(), this.client.acceptLanguage(), request, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = verifyCertificateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse verifyCertificateDelegate(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); + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsClientImpl.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsClientImpl.java new file mode 100644 index 00000000000..a7c0a4a1a43 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsClientImpl.java @@ -0,0 +1,224 @@ +/** + * 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.provisioningservices.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 IotDpsClientImpl class. + */ +public class IotDpsClientImpl 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 IotDpsClientImpl 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; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public IotDpsClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or 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 IotDpsClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets 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 IotDpsClientImpl 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 DpsCertificatesInner object to access its operations. + */ + private DpsCertificatesInner dpsCertificates; + + /** + * Gets the DpsCertificatesInner object to access its operations. + * @return the DpsCertificatesInner object. + */ + public DpsCertificatesInner dpsCertificates() { + return this.dpsCertificates; + } + + /** + * The IotDpsResourcesInner object to access its operations. + */ + private IotDpsResourcesInner iotDpsResources; + + /** + * Gets the IotDpsResourcesInner object to access its operations. + * @return the IotDpsResourcesInner object. + */ + public IotDpsResourcesInner iotDpsResources() { + return this.iotDpsResources; + } + + /** + * Initializes an instance of IotDpsClient client. + * + * @param credentials the management credentials for Azure + */ + public IotDpsClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of IotDpsClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public IotDpsClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of IotDpsClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public IotDpsClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-11-15"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.dpsCertificates = new DpsCertificatesInner(restClient().retrofit(), this); + this.iotDpsResources = new IotDpsResourcesInner(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)", super.userAgent(), "IotDpsClient", "2017-11-15"); + } +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsResourcesInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsResourcesInner.java new file mode 100644 index 00000000000..e8d75fdecbe --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsResourcesInner.java @@ -0,0 +1,2143 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.provisioningservices.ErrorDetailsException; +import com.microsoft.azure.management.provisioningservices.OperationInputs; +import com.microsoft.azure.management.provisioningservices.TagsResource; +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 java.util.Map; +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 IotDpsResources. + */ +public class IotDpsResourcesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private IotDpsResourcesService service; + /** The service client containing this operation class. */ + private IotDpsClientImpl client; + + /** + * Initializes an instance of IotDpsResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IotDpsResourcesInner(Retrofit retrofit, IotDpsClientImpl client) { + this.service = retrofit.create(IotDpsResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsResources to be + * used by Retrofit to perform actually REST calls. + */ + interface IotDpsResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.provisioningservices.IotDpsResources getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") + Observable> getByResourceGroup(@Path("provisioningServiceName") String provisioningServiceName, @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.provisioningservices.IotDpsResources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Body ProvisioningServiceDescriptionInner iotDpsDescription, @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.provisioningservices.IotDpsResources beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Body ProvisioningServiceDescriptionInner iotDpsDescription, @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.provisioningservices.IotDpsResources update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsResource provisioningServiceTags, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.provisioningservices.IotDpsResources beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsResource provisioningServiceTags, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.provisioningservices.IotDpsResources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("provisioningServiceName") String provisioningServiceName, @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.provisioningservices.IotDpsResources beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("provisioningServiceName") String provisioningServiceName, @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.provisioningservices.IotDpsResources list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices") + 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.provisioningservices.IotDpsResources listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices") + 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.provisioningservices.IotDpsResources getOperationResult" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}") + Observable> getOperationResult(@Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("provisioningServiceName") String provisioningServiceName, @Query("asyncinfo") String asyncinfo, @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.provisioningservices.IotDpsResources listValidSkus" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus") + Observable> listValidSkus(@Path("provisioningServiceName") String provisioningServiceName, @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.provisioningservices.IotDpsResources checkProvisioningServiceNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability") + Observable> checkProvisioningServiceNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body OperationInputs arguments, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.provisioningservices.IotDpsResources listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys") + Observable> listKeys(@Path("provisioningServiceName") String provisioningServiceName, @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.provisioningservices.IotDpsResources listKeysForKeyName" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys") + Observable> listKeysForKeyName(@Path("provisioningServiceName") String provisioningServiceName, @Path("keyName") String keyName, @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.provisioningservices.IotDpsResources listNext" }) + @GET + Observable> listNext(@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.provisioningservices.IotDpsResources 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.provisioningservices.IotDpsResources listValidSkusNext" }) + @GET + Observable> listValidSkusNext(@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.provisioningservices.IotDpsResources listKeysNext" }) + @GET + Observable> listKeysNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the non-security related metadata of the provisioning service. + * Get the metadata of the provisioning service without SAS keys. + * + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param resourceGroupName Resource group name. + * @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 ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner getByResourceGroup(String provisioningServiceName, String resourceGroupName) { + return getByResourceGroupWithServiceResponseAsync(provisioningServiceName, resourceGroupName).toBlocking().single().body(); + } + + /** + * Get the non-security related metadata of the provisioning service. + * Get the metadata of the provisioning service without SAS keys. + * + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param resourceGroupName Resource group name. + * @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 provisioningServiceName, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(provisioningServiceName, resourceGroupName), serviceCallback); + } + + /** + * Get the non-security related metadata of the provisioning service. + * Get the metadata of the provisioning service without SAS keys. + * + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable getByResourceGroupAsync(String provisioningServiceName, String resourceGroupName) { + return getByResourceGroupWithServiceResponseAsync(provisioningServiceName, resourceGroupName).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the non-security related metadata of the provisioning service. + * Get the metadata of the provisioning service without SAS keys. + * + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param resourceGroupName Resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String provisioningServiceName, String resourceGroupName) { + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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.getByResourceGroup(provisioningServiceName, 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 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 the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @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 ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner createOrUpdate(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).toBlocking().last().body(); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @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 provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription), serviceCallback); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (iotDpsDescription == null) { + throw new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(iotDpsDescription); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, iotDpsDescription, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @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 ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner beginCreateOrUpdate(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).toBlocking().single().body(); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription), serviceCallback); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of the provisioning service. + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve the provisioning service metadata and security metadata, and then combine them with the modified values in a new body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (iotDpsDescription == null) { + throw new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(iotDpsDescription); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, iotDpsDescription, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner update(String resourceGroupName, String provisioningServiceName) { + return updateWithServiceResponseAsync(resourceGroupName, provisioningServiceName).toBlocking().last().body(); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @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 provisioningServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, provisioningServiceName), serviceCallback); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String provisioningServiceName) { + return updateWithServiceResponseAsync(resourceGroupName, provisioningServiceName).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + TagsResource provisioningServiceTags = new TagsResource(); + provisioningServiceTags.withTags(null); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, this.client.apiVersion(), this.client.acceptLanguage(), provisioningServiceTags, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner update(String resourceGroupName, String provisioningServiceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, tags).toBlocking().last().body(); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @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 provisioningServiceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, tags), serviceCallback); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String provisioningServiceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, tags).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, Map tags) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + TagsResource provisioningServiceTags = new TagsResource(); + provisioningServiceTags.withTags(tags); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, this.client.apiVersion(), this.client.acceptLanguage(), provisioningServiceTags, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner beginUpdate(String resourceGroupName, String provisioningServiceName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName).toBlocking().single().body(); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @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 beginUpdateAsync(String resourceGroupName, String provisioningServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName), serviceCallback); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String provisioningServiceName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + TagsResource provisioningServiceTags = new TagsResource(); + provisioningServiceTags.withTags(null); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, this.client.apiVersion(), this.client.acceptLanguage(), provisioningServiceTags, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProvisioningServiceDescriptionInner object if successful. + */ + public ProvisioningServiceDescriptionInner beginUpdate(String resourceGroupName, String provisioningServiceName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, tags).toBlocking().single().body(); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @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 beginUpdateAsync(String resourceGroupName, String provisioningServiceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, tags), serviceCallback); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String provisioningServiceName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, provisioningServiceName, tags).map(new Func1, ProvisioningServiceDescriptionInner>() { + @Override + public ProvisioningServiceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing provisioning service's tags. + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProvisioningServiceDescriptionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String provisioningServiceName, Map tags) { + 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 (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + TagsResource provisioningServiceTags = new TagsResource(); + provisioningServiceTags.withTags(tags); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, provisioningServiceName, this.client.apiVersion(), this.client.acceptLanguage(), provisioningServiceTags, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @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 + */ + public void delete(String provisioningServiceName, String resourceGroupName) { + deleteWithServiceResponseAsync(provisioningServiceName, resourceGroupName).toBlocking().last().body(); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @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 provisioningServiceName, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(provisioningServiceName, resourceGroupName), serviceCallback); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String provisioningServiceName, String resourceGroupName) { + return deleteWithServiceResponseAsync(provisioningServiceName, resourceGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String provisioningServiceName, String resourceGroupName) { + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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."); + } + Observable> observable = service.delete(provisioningServiceName, this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @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 + */ + public void beginDelete(String provisioningServiceName, String resourceGroupName) { + beginDeleteWithServiceResponseAsync(provisioningServiceName, resourceGroupName).toBlocking().single().body(); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @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 beginDeleteAsync(String provisioningServiceName, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(provisioningServiceName, resourceGroupName), serviceCallback); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String provisioningServiceName, String resourceGroupName) { + return beginDeleteWithServiceResponseAsync(provisioningServiceName, resourceGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the Provisioning Service. + * Deletes the Provisioning Service. + * + * @param provisioningServiceName Name of provisioning service to delete. + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String provisioningServiceName, String resourceGroupName) { + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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.beginDelete(provisioningServiceName, 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 clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorDetailsException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(ErrorDetailsException.class) + .build(response); + } + + /** + * Get all the provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @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<ProvisioningServiceDescriptionInner> 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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProvisioningServiceDescriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProvisioningServiceDescriptionInner> 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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProvisioningServiceDescriptionInner> 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); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @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<ProvisioningServiceDescriptionInner> 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 a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @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 a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProvisioningServiceDescriptionInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProvisioningServiceDescriptionInner> 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 a list of all provisioning services in the given resource group. + * + ServiceResponse> * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProvisioningServiceDescriptionInner> 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); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long running 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 AsyncOperationResultInner object if successful. + */ + public AsyncOperationResultInner getOperationResult(String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + return getOperationResultWithServiceResponseAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).toBlocking().single().body(); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long running operation. + * @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 getOperationResultAsync(String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getOperationResultWithServiceResponseAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo), serviceCallback); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AsyncOperationResultInner object + */ + public Observable getOperationResultAsync(String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + return getOperationResultWithServiceResponseAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).map(new Func1, AsyncOperationResultInner>() { + @Override + public AsyncOperationResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AsyncOperationResultInner object + */ + public Observable> getOperationResultWithServiceResponseAsync(String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (asyncinfo == null) { + throw new IllegalArgumentException("Parameter asyncinfo 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.getOperationResult(operationId, this.client.subscriptionId(), resourceGroupName, provisioningServiceName, asyncinfo, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getOperationResultDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getOperationResultDelegate(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 the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @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<IotDpsSkuDefinitionInner> object if successful. + */ + public PagedList listValidSkus(final String provisioningServiceName, final String resourceGroupName) { + ServiceResponse> response = listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listValidSkusNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @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> listValidSkusAsync(final String provisioningServiceName, final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listValidSkusNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotDpsSkuDefinitionInner> object + */ + public Observable> listValidSkusAsync(final String provisioningServiceName, final String resourceGroupName) { + return listValidSkusWithServiceResponseAsync(provisioningServiceName, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotDpsSkuDefinitionInner> object + */ + public Observable>> listValidSkusWithServiceResponseAsync(final String provisioningServiceName, final String resourceGroupName) { + return listValidSkusSinglePageAsync(provisioningServiceName, 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(listValidSkusNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + ServiceResponse> * @param provisioningServiceName Name of provisioning service. + ServiceResponse> * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotDpsSkuDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listValidSkusSinglePageAsync(final String provisioningServiceName, final String resourceGroupName) { + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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.listValidSkus(provisioningServiceName, 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 = listValidSkusDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listValidSkusDelegate(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 provisioning service name is available. + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable. + * + * @param name The name of the Provisioning 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 NameAvailabilityInfoInner object if successful. + */ + public NameAvailabilityInfoInner checkProvisioningServiceNameAvailability(String name) { + return checkProvisioningServiceNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Check if a provisioning service name is available. + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable. + * + * @param name The name of the Provisioning 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 checkProvisioningServiceNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkProvisioningServiceNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Check if a provisioning service name is available. + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable. + * + * @param name The name of the Provisioning Service to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInfoInner object + */ + public Observable checkProvisioningServiceNameAvailabilityAsync(String name) { + return checkProvisioningServiceNameAvailabilityWithServiceResponseAsync(name).map(new Func1, NameAvailabilityInfoInner>() { + @Override + public NameAvailabilityInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check if a provisioning service name is available. + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable. + * + * @param name The name of the Provisioning Service to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInfoInner object + */ + public Observable> checkProvisioningServiceNameAvailabilityWithServiceResponseAsync(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."); + } + OperationInputs arguments = new OperationInputs(); + arguments.withName(name); + return service.checkProvisioningServiceNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), arguments, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkProvisioningServiceNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkProvisioningServiceNameAvailabilityDelegate(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 the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name + * @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<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object if successful. + */ + public PagedList listKeys(final String provisioningServiceName, final String resourceGroupName) { + ServiceResponse> response = listKeysSinglePageAsync(provisioningServiceName, resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name + * @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> listKeysAsync(final String provisioningServiceName, final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listKeysSinglePageAsync(provisioningServiceName, resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object + */ + public Observable> listKeysAsync(final String provisioningServiceName, final String resourceGroupName) { + return listKeysWithServiceResponseAsync(provisioningServiceName, resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object + */ + public Observable>> listKeysWithServiceResponseAsync(final String provisioningServiceName, final String resourceGroupName) { + return listKeysSinglePageAsync(provisioningServiceName, 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(listKeysNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + ServiceResponse> * @param provisioningServiceName The provisioning service name to get the shared access keys for. + ServiceResponse> * @param resourceGroupName resource group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listKeysSinglePageAsync(final String provisioningServiceName, final String resourceGroupName) { + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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.listKeys(provisioningServiceName, 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 = listKeysDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listKeysDelegate(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 a shared access policy by name from a provisioning service. + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning 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 SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object if successful. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner listKeysForKeyName(String provisioningServiceName, String keyName, String resourceGroupName) { + return listKeysForKeyNameWithServiceResponseAsync(provisioningServiceName, keyName, resourceGroupName).toBlocking().single().body(); + } + + /** + * Get a shared access policy by name from a provisioning service. + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning 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 listKeysForKeyNameAsync(String provisioningServiceName, String keyName, String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysForKeyNameWithServiceResponseAsync(provisioningServiceName, keyName, resourceGroupName), serviceCallback); + } + + /** + * Get a shared access policy by name from a provisioning service. + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object + */ + public Observable listKeysForKeyNameAsync(String provisioningServiceName, String keyName, String resourceGroupName) { + return listKeysForKeyNameWithServiceResponseAsync(provisioningServiceName, keyName, resourceGroupName).map(new Func1, SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner>() { + @Override + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a shared access policy by name from a provisioning service. + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object + */ + public Observable> listKeysForKeyNameWithServiceResponseAsync(String provisioningServiceName, String keyName, String resourceGroupName) { + if (provisioningServiceName == null) { + throw new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null."); + } + if (keyName == null) { + throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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.listKeysForKeyName(provisioningServiceName, keyName, 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 clientResponse = listKeysForKeyNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysForKeyNameDelegate(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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @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<ProvisioningServiceDescriptionInner> 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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @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<ProvisioningServiceDescriptionInner> 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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + * @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<ProvisioningServiceDescriptionInner> 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 provisioning services in a subscription. + * List all the provisioning services for a given subscription id. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProvisioningServiceDescriptionInner> 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); + } + + /** + * Get a list of all provisioning services in the given 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<ProvisioningServiceDescriptionInner> 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 a list of all provisioning services in the given 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 a list of all provisioning services in the given 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<ProvisioningServiceDescriptionInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get a list of all provisioning services in the given 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<ProvisioningServiceDescriptionInner> 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 a list of all provisioning services in the given 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<ProvisioningServiceDescriptionInner> 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 the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @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<IotDpsSkuDefinitionInner> object if successful. + */ + public PagedList listValidSkusNext(final String nextPageLink) { + ServiceResponse> response = listValidSkusNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listValidSkusNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @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> listValidSkusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listValidSkusNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listValidSkusNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @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<IotDpsSkuDefinitionInner> object + */ + public Observable> listValidSkusNextAsync(final String nextPageLink) { + return listValidSkusNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @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<IotDpsSkuDefinitionInner> object + */ + public Observable>> listValidSkusNextWithServiceResponseAsync(final String nextPageLink) { + return listValidSkusNextSinglePageAsync(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(listValidSkusNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of valid SKUs for a provisioning service. + * Gets the list of valid SKUs and tiers for a provisioning service. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotDpsSkuDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listValidSkusNextSinglePageAsync(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.listValidSkusNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listValidSkusNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listValidSkusNextDelegate(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 the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @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<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object if successful. + */ + public PagedList listKeysNext(final String nextPageLink) { + ServiceResponse> response = listKeysNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @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> listKeysNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listKeysNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @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<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object + */ + public Observable> listKeysNextAsync(final String nextPageLink) { + return listKeysNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + * @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<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object + */ + public Observable>> listKeysNextWithServiceResponseAsync(final String nextPageLink) { + return listKeysNextSinglePageAsync(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(listKeysNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the security metadata for a provisioning service. + * List the primary and secondary keys for a provisioning service. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listKeysNextSinglePageAsync(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.listKeysNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listKeysNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listKeysNextDelegate(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/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsSkuDefinitionInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsSkuDefinitionInner.java new file mode 100644 index 00000000000..c27b8604e67 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/IotDpsSkuDefinitionInner.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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.IotDpsSku; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Available Sku's of tier and units. + */ +public class IotDpsSkuDefinitionInner { + /** + * Sku name. Possible values include: 'S1'. + */ + @JsonProperty(value = "name") + private IotDpsSku name; + + /** + * Get the name value. + * + * @return the name value + */ + public IotDpsSku name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the IotDpsSkuDefinitionInner object itself. + */ + public IotDpsSkuDefinitionInner withName(IotDpsSku name) { + this.name = name; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/NameAvailabilityInfoInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/NameAvailabilityInfoInner.java new file mode 100644 index 00000000000..9df1fbe8f3b --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/NameAvailabilityInfoInner.java @@ -0,0 +1,97 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.NameUnavailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of name availability. + */ +public class NameAvailabilityInfoInner { + /** + * specifies if a name is available or not. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * specifies the reason a name is unavailable. Possible values include: + * 'Invalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason") + private NameUnavailabilityReason reason; + + /** + * message containing a etailed reason name is unavailable. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable value. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable value. + * + * @param nameAvailable the nameAvailable value to set + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public NameUnavailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason value. + * + * @param reason the reason value to set + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withReason(NameUnavailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationInner.java new file mode 100644 index 00000000000..0894f8d6658 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * IoT Hub REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{read | write | action | delete}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationsInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/OperationsInner.java new file mode 100644 index 00000000000..16217a0b159 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/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.provisioningservices.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.provisioningservices.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 IotDpsClientImpl 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, IotDpsClientImpl 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.provisioningservices.Operations list" }) + @GET("providers/Microsoft.Devices/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.provisioningservices.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Devices 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<OperationInner> 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 Microsoft.Devices 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 Microsoft.Devices REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> 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 Microsoft.Devices REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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 Microsoft.Devices 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<OperationInner> 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 Microsoft.Devices 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 Microsoft.Devices REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> 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 Microsoft.Devices REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> 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 Microsoft.Devices REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> 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/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/PageImpl.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/PageImpl.java new file mode 100644 index 00000000000..5cbc7efcc83 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/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.provisioningservices.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/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/ProvisioningServiceDescriptionInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/ProvisioningServiceDescriptionInner.java new file mode 100644 index 00000000000..58dd46ee73c --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/ProvisioningServiceDescriptionInner.java @@ -0,0 +1,100 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.IotDpsPropertiesDescription; +import com.microsoft.azure.management.provisioningservices.IotDpsSkuInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * The description of the provisioning service. + */ +public class ProvisioningServiceDescriptionInner 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; + + /** + * Service specific properties for a provisioning service. + */ + @JsonProperty(value = "properties", required = true) + private IotDpsPropertiesDescription properties; + + /** + * Sku info for a provisioning Service. + */ + @JsonProperty(value = "sku", required = true) + private IotDpsSkuInfo sku; + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag value. + * + * @param etag the etag value to set + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public IotDpsPropertiesDescription properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withProperties(IotDpsPropertiesDescription properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public IotDpsSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withSku(IotDpsSkuInfo sku) { + this.sku = sku; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java new file mode 100644 index 00000000000..d02b821ba68 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java @@ -0,0 +1,124 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.AccessRightsDescription; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of the shared access key. + */ +public class SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner { + /** + * Name of the key. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /** + * Primary SAS key value. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /** + * Secondary SAS key value. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /** + * Rights that this key has. Possible values include: 'ServiceConfig', + * 'EnrollmentRead', 'EnrollmentWrite', 'DeviceConnect', + * 'RegistrationStatusRead', 'RegistrationStatusWrite'. + */ + @JsonProperty(value = "rights", required = true) + private AccessRightsDescription rights; + + /** + * Get the keyName value. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName value. + * + * @param keyName the keyName value to set + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the primaryKey value. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primaryKey value. + * + * @param primaryKey the primaryKey value to set + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey value. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondaryKey value. + * + * @param secondaryKey the secondaryKey value to set + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the rights value. + * + * @return the rights value + */ + public AccessRightsDescription rights() { + return this.rights; + } + + /** + * Set the rights value. + * + * @param rights the rights value to set + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withRights(AccessRightsDescription rights) { + this.rights = rights; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/VerificationCodeResponseInner.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/VerificationCodeResponseInner.java new file mode 100644 index 00000000000..cf1b289fe35 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/VerificationCodeResponseInner.java @@ -0,0 +1,104 @@ +/** + * 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.provisioningservices.implementation; + +import com.microsoft.azure.management.provisioningservices.VerificationCodeResponseProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of the response of the verification code. + */ +public class VerificationCodeResponseInner { + /** + * Name of certificate. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Request etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * The resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private VerificationCodeResponseProperties properties; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public VerificationCodeResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the VerificationCodeResponseInner object itself. + */ + public VerificationCodeResponseInner withProperties(VerificationCodeResponseProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/package-info.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/implementation/package-info.java new file mode 100644 index 00000000000..00f25554d89 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/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 IotDpsClient. + * API for using the Azure IoT Hub Device Provisioning Service features. + */ +package com.microsoft.azure.management.provisioningservices.implementation; diff --git a/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/package-info.java b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/package-info.java new file mode 100644 index 00000000000..d7b366fa449 --- /dev/null +++ b/azure-mgmt-provisioningservices/src/main/java/com/microsoft/azure/management/provisioningservices/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 IotDpsClient. + * API for using the Azure IoT Hub Device Provisioning Service features. + */ +package com.microsoft.azure.management.provisioningservices;