diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/AccessRights.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/AccessRights.java new file mode 100644 index 00000000000..77e92904302 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/AccessRights.java @@ -0,0 +1,92 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AccessRights. + */ +public enum AccessRights { + /** Enum value RegistryRead. */ + REGISTRY_READ("RegistryRead"), + + /** Enum value RegistryWrite. */ + REGISTRY_WRITE("RegistryWrite"), + + /** Enum value ServiceConnect. */ + SERVICE_CONNECT("ServiceConnect"), + + /** Enum value DeviceConnect. */ + DEVICE_CONNECT("DeviceConnect"), + + /** Enum value RegistryRead, RegistryWrite. */ + REGISTRY_READ_REGISTRY_WRITE("RegistryRead, RegistryWrite"), + + /** Enum value RegistryRead, ServiceConnect. */ + REGISTRY_READ_SERVICE_CONNECT("RegistryRead, ServiceConnect"), + + /** Enum value RegistryRead, DeviceConnect. */ + REGISTRY_READ_DEVICE_CONNECT("RegistryRead, DeviceConnect"), + + /** Enum value RegistryWrite, ServiceConnect. */ + REGISTRY_WRITE_SERVICE_CONNECT("RegistryWrite, ServiceConnect"), + + /** Enum value RegistryWrite, DeviceConnect. */ + REGISTRY_WRITE_DEVICE_CONNECT("RegistryWrite, DeviceConnect"), + + /** Enum value ServiceConnect, DeviceConnect. */ + SERVICE_CONNECT_DEVICE_CONNECT("ServiceConnect, DeviceConnect"), + + /** Enum value RegistryRead, RegistryWrite, ServiceConnect. */ + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT("RegistryRead, RegistryWrite, ServiceConnect"), + + /** Enum value RegistryRead, RegistryWrite, DeviceConnect. */ + REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT("RegistryRead, RegistryWrite, DeviceConnect"), + + /** Enum value RegistryRead, ServiceConnect, DeviceConnect. */ + REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT("RegistryRead, ServiceConnect, DeviceConnect"), + + /** Enum value RegistryWrite, ServiceConnect, DeviceConnect. */ + REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT("RegistryWrite, ServiceConnect, DeviceConnect"), + + /** Enum value RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect. */ + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT("RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"); + + /** The actual serialized value for a AccessRights instance. */ + private String value; + + AccessRights(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessRights instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessRights object, or null if unable to parse. + */ + @JsonCreator + public static AccessRights fromString(String value) { + AccessRights[] items = AccessRights.values(); + for (AccessRights item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/Capabilities.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/Capabilities.java new file mode 100644 index 00000000000..f66735cfb26 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/Capabilities.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.iothub; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Capabilities. + */ +public final class Capabilities extends ExpandableStringEnum { + /** Static value None for Capabilities. */ + public static final Capabilities NONE = fromString("None"); + + /** Static value DeviceManagement for Capabilities. */ + public static final Capabilities DEVICE_MANAGEMENT = fromString("DeviceManagement"); + + /** + * Creates or finds a Capabilities from its string representation. + * @param name a name to look for + * @return the corresponding Capabilities + */ + @JsonCreator + public static Capabilities fromString(String name) { + return fromString(name, Capabilities.class); + } + + /** + * @return known Capabilities values + */ + public static Collection values() { + return values(Capabilities.class); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateBodyDescription.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateBodyDescription.java new file mode 100644 index 00000000000..76e3802c2a7 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub; + +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-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateProperties.java new file mode 100644 index 00000000000..30a14fda0d7 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub; + +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 create 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-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificatePropertiesWithNonce.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificatePropertiesWithNonce.java new file mode 100644 index 00000000000..674a4b08077 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificatePropertiesWithNonce.java @@ -0,0 +1,135 @@ +/** + * 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.iothub; + +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The description of an X509 CA Certificate including the challenge nonce + * issued for the Proof-Of-Possession flow. + */ +public class CertificatePropertiesWithNonce { + /** + * 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 create 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; + + /** + * The certificate's verification code that will be used for proof of + * possession. + */ + @JsonProperty(value = "verificationCode", access = JsonProperty.Access.WRITE_ONLY) + private String verificationCode; + + /** + * 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(); + } + + /** + * Get the verificationCode value. + * + * @return the verificationCode value + */ + public String verificationCode() { + return this.verificationCode; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateVerificationDescription.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateVerificationDescription.java new file mode 100644 index 00000000000..146c8cc8c20 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CertificateVerificationDescription.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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The JSON-serialized leaf certificate. + */ +public class CertificateVerificationDescription { + /** + * 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 CertificateVerificationDescription object itself. + */ + public CertificateVerificationDescription withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CloudToDeviceProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CloudToDeviceProperties.java new file mode 100644 index 00000000000..60b7a19ffd6 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/CloudToDeviceProperties.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.iothub; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The IoT hub cloud-to-device messaging properties. + */ +public class CloudToDeviceProperties { + /** + * The max delivery count for cloud-to-device messages in the device queue. + * See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * The default time to live for cloud-to-device messages in the device + * queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "defaultTtlAsIso8601") + private Period defaultTtlAsIso8601; + + /** + * The feedback property. + */ + @JsonProperty(value = "feedback") + private FeedbackProperties feedback; + + /** + * Get the maxDeliveryCount value. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maxDeliveryCount value. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the CloudToDeviceProperties object itself. + */ + public CloudToDeviceProperties withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get the defaultTtlAsIso8601 value. + * + * @return the defaultTtlAsIso8601 value + */ + public Period defaultTtlAsIso8601() { + return this.defaultTtlAsIso8601; + } + + /** + * Set the defaultTtlAsIso8601 value. + * + * @param defaultTtlAsIso8601 the defaultTtlAsIso8601 value to set + * @return the CloudToDeviceProperties object itself. + */ + public CloudToDeviceProperties withDefaultTtlAsIso8601(Period defaultTtlAsIso8601) { + this.defaultTtlAsIso8601 = defaultTtlAsIso8601; + return this; + } + + /** + * Get the feedback value. + * + * @return the feedback value + */ + public FeedbackProperties feedback() { + return this.feedback; + } + + /** + * Set the feedback value. + * + * @param feedback the feedback value to set + * @return the CloudToDeviceProperties object itself. + */ + public CloudToDeviceProperties withFeedback(FeedbackProperties feedback) { + this.feedback = feedback; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/EventHubProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/EventHubProperties.java new file mode 100644 index 00000000000..259851a48ca --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/EventHubProperties.java @@ -0,0 +1,119 @@ +/** + * 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.iothub; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the provisioned Event Hub-compatible endpoint used by the + * IoT hub. + */ +public class EventHubProperties { + /** + * The retention time for device-to-cloud messages in days. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + */ + @JsonProperty(value = "retentionTimeInDays") + private Long retentionTimeInDays; + + /** + * The number of partitions for receiving device-to-cloud messages in the + * Event Hub-compatible endpoint. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + */ + @JsonProperty(value = "partitionCount") + private Integer partitionCount; + + /** + * The partition ids in the Event Hub-compatible endpoint. + */ + @JsonProperty(value = "partitionIds", access = JsonProperty.Access.WRITE_ONLY) + private List partitionIds; + + /** + * The Event Hub-compatible name. + */ + @JsonProperty(value = "path", access = JsonProperty.Access.WRITE_ONLY) + private String path; + + /** + * The Event Hub-compatible endpoint. + */ + @JsonProperty(value = "endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /** + * Get the retentionTimeInDays value. + * + * @return the retentionTimeInDays value + */ + public Long retentionTimeInDays() { + return this.retentionTimeInDays; + } + + /** + * Set the retentionTimeInDays value. + * + * @param retentionTimeInDays the retentionTimeInDays value to set + * @return the EventHubProperties object itself. + */ + public EventHubProperties withRetentionTimeInDays(Long retentionTimeInDays) { + this.retentionTimeInDays = retentionTimeInDays; + return this; + } + + /** + * Get the partitionCount value. + * + * @return the partitionCount value + */ + public Integer partitionCount() { + return this.partitionCount; + } + + /** + * Set the partitionCount value. + * + * @param partitionCount the partitionCount value to set + * @return the EventHubProperties object itself. + */ + public EventHubProperties withPartitionCount(Integer partitionCount) { + this.partitionCount = partitionCount; + return this; + } + + /** + * Get the partitionIds value. + * + * @return the partitionIds value + */ + public List partitionIds() { + return this.partitionIds; + } + + /** + * Get the path value. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Get the endpoint value. + * + * @return the endpoint value + */ + public String endpoint() { + return this.endpoint; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/FallbackRouteProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/FallbackRouteProperties.java new file mode 100644 index 00000000000..5780e6763da --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/FallbackRouteProperties.java @@ -0,0 +1,163 @@ +/** + * 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.iothub; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the fallback route. IoT Hub uses these properties when it + * routes messages to the fallback endpoint. + */ +public class FallbackRouteProperties { + /** + * The name of the route. The name can only include alphanumeric + * characters, periods, underscores, hyphens, has a maximum length of 64 + * characters, and must be unique. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The source to which the routing rule is to be applied to. For example, + * DeviceMessages. + */ + @JsonProperty(value = "source", required = true) + private String source; + + /** + * The condition which is evaluated in order to apply the fallback route. + * If the condition is not provided it will evaluate to true by default. + * For grammar, See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + */ + @JsonProperty(value = "condition") + private String condition; + + /** + * The list of endpoints to which the messages that satisfy the condition + * are routed to. Currently only 1 endpoint is allowed. + */ + @JsonProperty(value = "endpointNames", required = true) + private List endpointNames; + + /** + * Used to specify whether the fallback route is enabled. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /** + * Creates an instance of FallbackRouteProperties class. + */ + public FallbackRouteProperties() { + source = "DeviceMessages"; + } + + /** + * 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 FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the source value. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set the source value. + * + * @param source the source value to set + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the condition value. + * + * @return the condition value + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition value. + * + * @param condition the condition value to set + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the endpointNames value. + * + * @return the endpointNames value + */ + public List endpointNames() { + return this.endpointNames; + } + + /** + * Set the endpointNames value. + * + * @param endpointNames the endpointNames value to set + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withEndpointNames(List endpointNames) { + this.endpointNames = endpointNames; + return this; + } + + /** + * Get the isEnabled value. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled value. + * + * @param isEnabled the isEnabled value to set + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/FeedbackProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/FeedbackProperties.java new file mode 100644 index 00000000000..05949377c7f --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/FeedbackProperties.java @@ -0,0 +1,101 @@ +/** + * 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.iothub; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the feedback queue for cloud-to-device messages. + */ +public class FeedbackProperties { + /** + * The lock duration for the feedback queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "lockDurationAsIso8601") + private Period lockDurationAsIso8601; + + /** + * The period of time for which a message is available to consume before it + * is expired by the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "ttlAsIso8601") + private Period ttlAsIso8601; + + /** + * The number of times the IoT hub attempts to deliver a message on the + * feedback queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Get the lockDurationAsIso8601 value. + * + * @return the lockDurationAsIso8601 value + */ + public Period lockDurationAsIso8601() { + return this.lockDurationAsIso8601; + } + + /** + * Set the lockDurationAsIso8601 value. + * + * @param lockDurationAsIso8601 the lockDurationAsIso8601 value to set + * @return the FeedbackProperties object itself. + */ + public FeedbackProperties withLockDurationAsIso8601(Period lockDurationAsIso8601) { + this.lockDurationAsIso8601 = lockDurationAsIso8601; + return this; + } + + /** + * Get the ttlAsIso8601 value. + * + * @return the ttlAsIso8601 value + */ + public Period ttlAsIso8601() { + return this.ttlAsIso8601; + } + + /** + * Set the ttlAsIso8601 value. + * + * @param ttlAsIso8601 the ttlAsIso8601 value to set + * @return the FeedbackProperties object itself. + */ + public FeedbackProperties withTtlAsIso8601(Period ttlAsIso8601) { + this.ttlAsIso8601 = ttlAsIso8601; + return this; + } + + /** + * Get the maxDeliveryCount value. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maxDeliveryCount value. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the FeedbackProperties object itself. + */ + public FeedbackProperties withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubCapacity.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubCapacity.java new file mode 100644 index 00000000000..68f9cc70026 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubCapacity.java @@ -0,0 +1,78 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * IoT Hub capacity information. + */ +public class IotHubCapacity { + /** + * The minimum number of units. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Long minimum; + + /** + * The maximum number of units. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Long maximum; + + /** + * The default number of units. + */ + @JsonProperty(value = "default", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultProperty; + + /** + * The type of the scaling enabled. Possible values include: 'Automatic', + * 'Manual', 'None'. + */ + @JsonProperty(value = "scaleType", access = JsonProperty.Access.WRITE_ONLY) + private IotHubScaleType scaleType; + + /** + * Get the minimum value. + * + * @return the minimum value + */ + public Long minimum() { + return this.minimum; + } + + /** + * Get the maximum value. + * + * @return the maximum value + */ + public Long maximum() { + return this.maximum; + } + + /** + * Get the defaultProperty value. + * + * @return the defaultProperty value + */ + public Long defaultProperty() { + return this.defaultProperty; + } + + /** + * Get the scaleType value. + * + * @return the scaleType value + */ + public IotHubScaleType scaleType() { + return this.scaleType; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubNameUnavailabilityReason.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubNameUnavailabilityReason.java new file mode 100644 index 00000000000..34c2fc6eccc --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubNameUnavailabilityReason.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.iothub; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IotHubNameUnavailabilityReason. + */ +public enum IotHubNameUnavailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a IotHubNameUnavailabilityReason instance. */ + private String value; + + IotHubNameUnavailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IotHubNameUnavailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed IotHubNameUnavailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static IotHubNameUnavailabilityReason fromString(String value) { + IotHubNameUnavailabilityReason[] items = IotHubNameUnavailabilityReason.values(); + for (IotHubNameUnavailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubProperties.java new file mode 100644 index 00000000000..b93c9229a61 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubProperties.java @@ -0,0 +1,362 @@ +/** + * 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.iothub; + +import java.util.List; +import com.microsoft.azure.management.iothub.implementation.SharedAccessSignatureAuthorizationRuleInner; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of an IoT hub. + */ +public class IotHubProperties { + /** + * The shared access policies you can use to secure a connection to the IoT + * hub. + */ + @JsonProperty(value = "authorizationPolicies") + private List authorizationPolicies; + + /** + * The IP filter rules. + */ + @JsonProperty(value = "ipFilterRules") + private List ipFilterRules; + + /** + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Thehub state state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The name of the host. + */ + @JsonProperty(value = "hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostName; + + /** + * The Event Hub-compatible endpoint properties. The possible keys to this + * dictionary are events and operationsMonitoringEvents. Both of these keys + * have to be present in the dictionary while making create or update calls + * for the IoT hub. + */ + @JsonProperty(value = "eventHubEndpoints") + private Map eventHubEndpoints; + + /** + * The routing property. + */ + @JsonProperty(value = "routing") + private RoutingProperties routing; + + /** + * The list of Azure Storage endpoints where you can upload files. + * Currently you can configure only one Azure Storage account and that MUST + * have its key as $default. Specifying more than one storage account + * causes an error to be thrown. Not specifying a value for this property + * when the enableFileUploadNotifications property is set to True, causes + * an error to be thrown. + */ + @JsonProperty(value = "storageEndpoints") + private Map storageEndpoints; + + /** + * The messaging endpoint properties for the file upload notification + * queue. + */ + @JsonProperty(value = "messagingEndpoints") + private Map messagingEndpoints; + + /** + * If True, file upload notifications are enabled. + */ + @JsonProperty(value = "enableFileUploadNotifications") + private Boolean enableFileUploadNotifications; + + /** + * The cloudToDevice property. + */ + @JsonProperty(value = "cloudToDevice") + private CloudToDeviceProperties cloudToDevice; + + /** + * IoT hub comments. + */ + @JsonProperty(value = "comments") + private String comments; + + /** + * The operationsMonitoringProperties property. + */ + @JsonProperty(value = "operationsMonitoringProperties") + private OperationsMonitoringProperties operationsMonitoringProperties; + + /** + * The capabilities and features enabled for the IoT hub. Possible values + * include: 'None', 'DeviceManagement'. + */ + @JsonProperty(value = "features") + private Capabilities features; + + /** + * 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 IotHubProperties object itself. + */ + public IotHubProperties withAuthorizationPolicies(List authorizationPolicies) { + this.authorizationPolicies = authorizationPolicies; + return this; + } + + /** + * Get the ipFilterRules value. + * + * @return the ipFilterRules value + */ + public List ipFilterRules() { + return this.ipFilterRules; + } + + /** + * Set the ipFilterRules value. + * + * @param ipFilterRules the ipFilterRules value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withIpFilterRules(List ipFilterRules) { + this.ipFilterRules = ipFilterRules; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the state value. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Get the eventHubEndpoints value. + * + * @return the eventHubEndpoints value + */ + public Map eventHubEndpoints() { + return this.eventHubEndpoints; + } + + /** + * Set the eventHubEndpoints value. + * + * @param eventHubEndpoints the eventHubEndpoints value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withEventHubEndpoints(Map eventHubEndpoints) { + this.eventHubEndpoints = eventHubEndpoints; + return this; + } + + /** + * Get the routing value. + * + * @return the routing value + */ + public RoutingProperties routing() { + return this.routing; + } + + /** + * Set the routing value. + * + * @param routing the routing value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withRouting(RoutingProperties routing) { + this.routing = routing; + return this; + } + + /** + * Get the storageEndpoints value. + * + * @return the storageEndpoints value + */ + public Map storageEndpoints() { + return this.storageEndpoints; + } + + /** + * Set the storageEndpoints value. + * + * @param storageEndpoints the storageEndpoints value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withStorageEndpoints(Map storageEndpoints) { + this.storageEndpoints = storageEndpoints; + return this; + } + + /** + * Get the messagingEndpoints value. + * + * @return the messagingEndpoints value + */ + public Map messagingEndpoints() { + return this.messagingEndpoints; + } + + /** + * Set the messagingEndpoints value. + * + * @param messagingEndpoints the messagingEndpoints value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withMessagingEndpoints(Map messagingEndpoints) { + this.messagingEndpoints = messagingEndpoints; + return this; + } + + /** + * Get the enableFileUploadNotifications value. + * + * @return the enableFileUploadNotifications value + */ + public Boolean enableFileUploadNotifications() { + return this.enableFileUploadNotifications; + } + + /** + * Set the enableFileUploadNotifications value. + * + * @param enableFileUploadNotifications the enableFileUploadNotifications value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withEnableFileUploadNotifications(Boolean enableFileUploadNotifications) { + this.enableFileUploadNotifications = enableFileUploadNotifications; + return this; + } + + /** + * Get the cloudToDevice value. + * + * @return the cloudToDevice value + */ + public CloudToDeviceProperties cloudToDevice() { + return this.cloudToDevice; + } + + /** + * Set the cloudToDevice value. + * + * @param cloudToDevice the cloudToDevice value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withCloudToDevice(CloudToDeviceProperties cloudToDevice) { + this.cloudToDevice = cloudToDevice; + return this; + } + + /** + * Get the comments value. + * + * @return the comments value + */ + public String comments() { + return this.comments; + } + + /** + * Set the comments value. + * + * @param comments the comments value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withComments(String comments) { + this.comments = comments; + return this; + } + + /** + * Get the operationsMonitoringProperties value. + * + * @return the operationsMonitoringProperties value + */ + public OperationsMonitoringProperties operationsMonitoringProperties() { + return this.operationsMonitoringProperties; + } + + /** + * Set the operationsMonitoringProperties value. + * + * @param operationsMonitoringProperties the operationsMonitoringProperties value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withOperationsMonitoringProperties(OperationsMonitoringProperties operationsMonitoringProperties) { + this.operationsMonitoringProperties = operationsMonitoringProperties; + return this; + } + + /** + * Get the features value. + * + * @return the features value + */ + public Capabilities features() { + return this.features; + } + + /** + * Set the features value. + * + * @param features the features value to set + * @return the IotHubProperties object itself. + */ + public IotHubProperties withFeatures(Capabilities features) { + this.features = features; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubScaleType.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubScaleType.java new file mode 100644 index 00000000000..756012c7af2 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubScaleType.java @@ -0,0 +1,56 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IotHubScaleType. + */ +public enum IotHubScaleType { + /** Enum value Automatic. */ + AUTOMATIC("Automatic"), + + /** Enum value Manual. */ + MANUAL("Manual"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a IotHubScaleType instance. */ + private String value; + + IotHubScaleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IotHubScaleType instance. + * + * @param value the serialized value to parse. + * @return the parsed IotHubScaleType object, or null if unable to parse. + */ + @JsonCreator + public static IotHubScaleType fromString(String value) { + IotHubScaleType[] items = IotHubScaleType.values(); + for (IotHubScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSku.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSku.java new file mode 100644 index 00000000000..00d938a5b66 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSku.java @@ -0,0 +1,47 @@ +/** + * 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.iothub; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IotHubSku. + */ +public final class IotHubSku extends ExpandableStringEnum { + /** Static value F1 for IotHubSku. */ + public static final IotHubSku F1 = fromString("F1"); + + /** Static value S1 for IotHubSku. */ + public static final IotHubSku S1 = fromString("S1"); + + /** Static value S2 for IotHubSku. */ + public static final IotHubSku S2 = fromString("S2"); + + /** Static value S3 for IotHubSku. */ + public static final IotHubSku S3 = fromString("S3"); + + /** + * Creates or finds a IotHubSku from its string representation. + * @param name a name to look for + * @return the corresponding IotHubSku + */ + @JsonCreator + public static IotHubSku fromString(String name) { + return fromString(name, IotHubSku.class); + } + + /** + * @return known IotHubSku values + */ + public static Collection values() { + return values(IotHubSku.class); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSkuInfo.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSkuInfo.java new file mode 100644 index 00000000000..d83a215bd62 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSkuInfo.java @@ -0,0 +1,86 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about the SKU of the IoT hub. + */ +public class IotHubSkuInfo { + /** + * The name of the SKU. Possible values include: 'F1', 'S1', 'S2', 'S3'. + */ + @JsonProperty(value = "name", required = true) + private IotHubSku name; + + /** + * The billing tier for the IoT hub. Possible values include: 'Free', + * 'Standard'. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private IotHubSkuTier tier; + + /** + * The number of provisioned IoT Hub units. See: + * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name value. + * + * @return the name value + */ + public IotHubSku name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the IotHubSkuInfo object itself. + */ + public IotHubSkuInfo withName(IotHubSku name) { + this.name = name; + return this; + } + + /** + * Get the tier value. + * + * @return the tier value + */ + public IotHubSkuTier 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 IotHubSkuInfo object itself. + */ + public IotHubSkuInfo withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSkuTier.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSkuTier.java new file mode 100644 index 00000000000..f45635df1a3 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IotHubSkuTier.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.iothub; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IotHubSkuTier. + */ +public enum IotHubSkuTier { + /** Enum value Free. */ + FREE("Free"), + + /** Enum value Standard. */ + STANDARD("Standard"); + + /** The actual serialized value for a IotHubSkuTier instance. */ + private String value; + + IotHubSkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IotHubSkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed IotHubSkuTier object, or null if unable to parse. + */ + @JsonCreator + public static IotHubSkuTier fromString(String value) { + IotHubSkuTier[] items = IotHubSkuTier.values(); + for (IotHubSkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IpFilterActionType.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IpFilterActionType.java new file mode 100644 index 00000000000..6833e309d2d --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IpFilterActionType.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.iothub; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IpFilterActionType. + */ +public enum IpFilterActionType { + /** Enum value Accept. */ + ACCEPT("Accept"), + + /** Enum value Reject. */ + REJECT("Reject"); + + /** The actual serialized value for a IpFilterActionType instance. */ + private String value; + + IpFilterActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IpFilterActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed IpFilterActionType object, or null if unable to parse. + */ + @JsonCreator + public static IpFilterActionType fromString(String value) { + IpFilterActionType[] items = IpFilterActionType.values(); + for (IpFilterActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IpFilterRule.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IpFilterRule.java new file mode 100644 index 00000000000..9cd81244c38 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/IpFilterRule.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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The IP filter rules for the IoT hub. + */ +public class IpFilterRule { + /** + * The name of the IP filter rule. + */ + @JsonProperty(value = "filterName", required = true) + private String filterName; + + /** + * The desired action for requests captured by this rule. Possible values + * include: 'Accept', 'Reject'. + */ + @JsonProperty(value = "action", required = true) + private IpFilterActionType action; + + /** + * A string that contains the IP address range in CIDR notation for the + * rule. + */ + @JsonProperty(value = "ipMask", required = true) + private String ipMask; + + /** + * Get the filterName value. + * + * @return the filterName value + */ + public String filterName() { + return this.filterName; + } + + /** + * Set the filterName value. + * + * @param filterName the filterName value to set + * @return the IpFilterRule object itself. + */ + public IpFilterRule withFilterName(String filterName) { + this.filterName = filterName; + return this; + } + + /** + * Get the action value. + * + * @return the action value + */ + public IpFilterActionType action() { + return this.action; + } + + /** + * Set the action value. + * + * @param action the action value to set + * @return the IpFilterRule object itself. + */ + public IpFilterRule withAction(IpFilterActionType action) { + this.action = action; + return this; + } + + /** + * Get the ipMask value. + * + * @return the ipMask value + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set the ipMask value. + * + * @param ipMask the ipMask value to set + * @return the IpFilterRule object itself. + */ + public IpFilterRule withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/JobStatus.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/JobStatus.java new file mode 100644 index 00000000000..b10bfb3eb66 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/JobStatus.java @@ -0,0 +1,65 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobStatus. + */ +public enum JobStatus { + /** Enum value unknown. */ + UNKNOWN("unknown"), + + /** Enum value enqueued. */ + ENQUEUED("enqueued"), + + /** Enum value running. */ + RUNNING("running"), + + /** Enum value completed. */ + COMPLETED("completed"), + + /** Enum value failed. */ + FAILED("failed"), + + /** Enum value cancelled. */ + CANCELLED("cancelled"); + + /** The actual serialized value for a JobStatus instance. */ + private String value; + + JobStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed JobStatus object, or null if unable to parse. + */ + @JsonCreator + public static JobStatus fromString(String value) { + JobStatus[] items = JobStatus.values(); + for (JobStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/JobType.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/JobType.java new file mode 100644 index 00000000000..2a06f6c989f --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/JobType.java @@ -0,0 +1,65 @@ +/** + * 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.iothub; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobType. + */ +public final class JobType extends ExpandableStringEnum { + /** Static value unknown for JobType. */ + public static final JobType UNKNOWN = fromString("unknown"); + + /** Static value export for JobType. */ + public static final JobType EXPORT = fromString("export"); + + /** Static value import for JobType. */ + public static final JobType IMPORT = fromString("import"); + + /** Static value backup for JobType. */ + public static final JobType BACKUP = fromString("backup"); + + /** Static value readDeviceProperties for JobType. */ + public static final JobType READ_DEVICE_PROPERTIES = fromString("readDeviceProperties"); + + /** Static value writeDeviceProperties for JobType. */ + public static final JobType WRITE_DEVICE_PROPERTIES = fromString("writeDeviceProperties"); + + /** Static value updateDeviceConfiguration for JobType. */ + public static final JobType UPDATE_DEVICE_CONFIGURATION = fromString("updateDeviceConfiguration"); + + /** Static value rebootDevice for JobType. */ + public static final JobType REBOOT_DEVICE = fromString("rebootDevice"); + + /** Static value factoryResetDevice for JobType. */ + public static final JobType FACTORY_RESET_DEVICE = fromString("factoryResetDevice"); + + /** Static value firmwareUpdate for JobType. */ + public static final JobType FIRMWARE_UPDATE = fromString("firmwareUpdate"); + + /** + * Creates or finds a JobType from its string representation. + * @param name a name to look for + * @return the corresponding JobType + */ + @JsonCreator + public static JobType fromString(String name) { + return fromString(name, JobType.class); + } + + /** + * @return known JobType values + */ + public static Collection values() { + return values(JobType.class); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/MessagingEndpointProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/MessagingEndpointProperties.java new file mode 100644 index 00000000000..0d272d98f86 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/MessagingEndpointProperties.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.iothub; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the messaging endpoints used by this IoT hub. + */ +public class MessagingEndpointProperties { + /** + * The lock duration. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + */ + @JsonProperty(value = "lockDurationAsIso8601") + private Period lockDurationAsIso8601; + + /** + * The period of time for which a message is available to consume before it + * is expired by the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + */ + @JsonProperty(value = "ttlAsIso8601") + private Period ttlAsIso8601; + + /** + * The number of times the IoT hub attempts to deliver a message. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + */ + @JsonProperty(value = "maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Get the lockDurationAsIso8601 value. + * + * @return the lockDurationAsIso8601 value + */ + public Period lockDurationAsIso8601() { + return this.lockDurationAsIso8601; + } + + /** + * Set the lockDurationAsIso8601 value. + * + * @param lockDurationAsIso8601 the lockDurationAsIso8601 value to set + * @return the MessagingEndpointProperties object itself. + */ + public MessagingEndpointProperties withLockDurationAsIso8601(Period lockDurationAsIso8601) { + this.lockDurationAsIso8601 = lockDurationAsIso8601; + return this; + } + + /** + * Get the ttlAsIso8601 value. + * + * @return the ttlAsIso8601 value + */ + public Period ttlAsIso8601() { + return this.ttlAsIso8601; + } + + /** + * Set the ttlAsIso8601 value. + * + * @param ttlAsIso8601 the ttlAsIso8601 value to set + * @return the MessagingEndpointProperties object itself. + */ + public MessagingEndpointProperties withTtlAsIso8601(Period ttlAsIso8601) { + this.ttlAsIso8601 = ttlAsIso8601; + return this; + } + + /** + * Get the maxDeliveryCount value. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maxDeliveryCount value. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the MessagingEndpointProperties object itself. + */ + public MessagingEndpointProperties withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationDisplay.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationDisplay.java new file mode 100644 index 00000000000..5ff96970d58 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub; + +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: IotHubs. + */ + @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-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationInputs.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationInputs.java new file mode 100644 index 00000000000..df9a9efc263 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input values. + */ +public class OperationInputs { + /** + * The name of the IoT hub 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-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationMonitoringLevel.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationMonitoringLevel.java new file mode 100644 index 00000000000..ac929223910 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationMonitoringLevel.java @@ -0,0 +1,47 @@ +/** + * 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.iothub; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperationMonitoringLevel. + */ +public final class OperationMonitoringLevel extends ExpandableStringEnum { + /** Static value None for OperationMonitoringLevel. */ + public static final OperationMonitoringLevel NONE = fromString("None"); + + /** Static value Error for OperationMonitoringLevel. */ + public static final OperationMonitoringLevel ERROR = fromString("Error"); + + /** Static value Information for OperationMonitoringLevel. */ + public static final OperationMonitoringLevel INFORMATION = fromString("Information"); + + /** Static value Error, Information for OperationMonitoringLevel. */ + public static final OperationMonitoringLevel ERROR_INFORMATION = fromString("Error, Information"); + + /** + * Creates or finds a OperationMonitoringLevel from its string representation. + * @param name a name to look for + * @return the corresponding OperationMonitoringLevel + */ + @JsonCreator + public static OperationMonitoringLevel fromString(String name) { + return fromString(name, OperationMonitoringLevel.class); + } + + /** + * @return known OperationMonitoringLevel values + */ + public static Collection values() { + return values(OperationMonitoringLevel.class); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationsMonitoringProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationsMonitoringProperties.java new file mode 100644 index 00000000000..a4a6226a9e6 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/OperationsMonitoringProperties.java @@ -0,0 +1,47 @@ +/** + * 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.iothub; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operations monitoring properties for the IoT hub. The possible keys to + * the dictionary are Connections, DeviceTelemetry, C2DCommands, + * DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, + * C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. + */ +public class OperationsMonitoringProperties { + /** + * The events property. + */ + @JsonProperty(value = "events") + private Map events; + + /** + * Get the events value. + * + * @return the events value + */ + public Map events() { + return this.events; + } + + /** + * Set the events value. + * + * @param events the events value to set + * @return the OperationsMonitoringProperties object itself. + */ + public OperationsMonitoringProperties withEvents(Map events) { + this.events = events; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RouteProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RouteProperties.java new file mode 100644 index 00000000000..bc7153a5838 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RouteProperties.java @@ -0,0 +1,157 @@ +/** + * 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.iothub; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a routing rule that your IoT hub uses to route messages to + * endpoints. + */ +public class RouteProperties { + /** + * The name of the route. The name can only include alphanumeric + * characters, periods, underscores, hyphens, has a maximum length of 64 + * characters, and must be unique. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The source that the routing rule is to be applied to, such as + * DeviceMessages. Possible values include: 'DeviceMessages', + * 'TwinChangeEvents', 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents'. + */ + @JsonProperty(value = "source", required = true) + private RoutingSource source; + + /** + * The condition that is evaluated to apply the routing rule. If no + * condition is provided, it evaluates to true by default. For grammar, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + */ + @JsonProperty(value = "condition") + private String condition; + + /** + * The list of endpoints to which messages that satisfy the condition are + * routed. Currently only one endpoint is allowed. + */ + @JsonProperty(value = "endpointNames", required = true) + private List endpointNames; + + /** + * Used to specify whether a route is enabled. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /** + * 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 RouteProperties object itself. + */ + public RouteProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the source value. + * + * @return the source value + */ + public RoutingSource source() { + return this.source; + } + + /** + * Set the source value. + * + * @param source the source value to set + * @return the RouteProperties object itself. + */ + public RouteProperties withSource(RoutingSource source) { + this.source = source; + return this; + } + + /** + * Get the condition value. + * + * @return the condition value + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition value. + * + * @param condition the condition value to set + * @return the RouteProperties object itself. + */ + public RouteProperties withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the endpointNames value. + * + * @return the endpointNames value + */ + public List endpointNames() { + return this.endpointNames; + } + + /** + * Set the endpointNames value. + * + * @param endpointNames the endpointNames value to set + * @return the RouteProperties object itself. + */ + public RouteProperties withEndpointNames(List endpointNames) { + this.endpointNames = endpointNames; + return this; + } + + /** + * Get the isEnabled value. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled value. + * + * @param isEnabled the isEnabled value to set + * @return the RouteProperties object itself. + */ + public RouteProperties withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingEndpoints.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingEndpoints.java new file mode 100644 index 00000000000..66a00cb8398 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingEndpoints.java @@ -0,0 +1,130 @@ +/** + * 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.iothub; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties related to the custom endpoints to which your IoT hub routes + * messages based on the routing rules. A maximum of 10 custom endpoints are + * allowed across all endpoint types for paid hubs and only 1 custom endpoint + * is allowed across all endpoint types for free hubs. + */ +public class RoutingEndpoints { + /** + * The list of Service Bus queue endpoints that IoT hub routes the messages + * to, based on the routing rules. + */ + @JsonProperty(value = "serviceBusQueues") + private List serviceBusQueues; + + /** + * The list of Service Bus topic endpoints that the IoT hub routes the + * messages to, based on the routing rules. + */ + @JsonProperty(value = "serviceBusTopics") + private List serviceBusTopics; + + /** + * The list of Event Hubs endpoints that IoT hub routes messages to, based + * on the routing rules. This list does not include the built-in Event Hubs + * endpoint. + */ + @JsonProperty(value = "eventHubs") + private List eventHubs; + + /** + * The list of storage container endpoints that IoT hub routes messages to, + * based on the routing rules. + */ + @JsonProperty(value = "storageContainers") + private List storageContainers; + + /** + * Get the serviceBusQueues value. + * + * @return the serviceBusQueues value + */ + public List serviceBusQueues() { + return this.serviceBusQueues; + } + + /** + * Set the serviceBusQueues value. + * + * @param serviceBusQueues the serviceBusQueues value to set + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withServiceBusQueues(List serviceBusQueues) { + this.serviceBusQueues = serviceBusQueues; + return this; + } + + /** + * Get the serviceBusTopics value. + * + * @return the serviceBusTopics value + */ + public List serviceBusTopics() { + return this.serviceBusTopics; + } + + /** + * Set the serviceBusTopics value. + * + * @param serviceBusTopics the serviceBusTopics value to set + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withServiceBusTopics(List serviceBusTopics) { + this.serviceBusTopics = serviceBusTopics; + return this; + } + + /** + * Get the eventHubs value. + * + * @return the eventHubs value + */ + public List eventHubs() { + return this.eventHubs; + } + + /** + * Set the eventHubs value. + * + * @param eventHubs the eventHubs value to set + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withEventHubs(List eventHubs) { + this.eventHubs = eventHubs; + return this; + } + + /** + * Get the storageContainers value. + * + * @return the storageContainers value + */ + public List storageContainers() { + return this.storageContainers; + } + + /** + * Set the storageContainers value. + * + * @param storageContainers the storageContainers value to set + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withStorageContainers(List storageContainers) { + this.storageContainers = storageContainers; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingEventHubProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingEventHubProperties.java new file mode 100644 index 00000000000..d9e8be4c01b --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingEventHubProperties.java @@ -0,0 +1,125 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties related to an event hub endpoint. + */ +public class RoutingEventHubProperties { + /** + * The connection string of the event hub endpoint. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * operationsMonitoringEvents, fileNotifications, $default. Endpoint names + * must be unique across endpoint types. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The subscription identifier of the event hub endpoint. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * The name of the resource group of the event hub endpoint. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * 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 RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * 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 RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId value. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId value. + * + * @param subscriptionId the subscriptionId value to set + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup value. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup value. + * + * @param resourceGroup the resourceGroup value to set + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingProperties.java new file mode 100644 index 00000000000..e240b1d7405 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingProperties.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.iothub; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The routing related properties of the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + */ +public class RoutingProperties { + /** + * The endpoints property. + */ + @JsonProperty(value = "endpoints") + private RoutingEndpoints endpoints; + + /** + * The list of user-provided routing rules that the IoT hub uses to route + * messages to built-in and custom endpoints. A maximum of 100 routing + * rules are allowed for paid hubs and a maximum of 5 routing rules are + * allowed for free hubs. + */ + @JsonProperty(value = "routes") + private List routes; + + /** + * The properties of the route that is used as a fall-back route when none + * of the conditions specified in the 'routes' section are met. This is an + * optional parameter. When this property is not set, the messages which do + * not meet any of the conditions specified in the 'routes' section get + * routed to the built-in eventhub endpoint. + */ + @JsonProperty(value = "fallbackRoute") + private FallbackRouteProperties fallbackRoute; + + /** + * Get the endpoints value. + * + * @return the endpoints value + */ + public RoutingEndpoints endpoints() { + return this.endpoints; + } + + /** + * Set the endpoints value. + * + * @param endpoints the endpoints value to set + * @return the RoutingProperties object itself. + */ + public RoutingProperties withEndpoints(RoutingEndpoints endpoints) { + this.endpoints = endpoints; + return this; + } + + /** + * Get the routes value. + * + * @return the routes value + */ + public List routes() { + return this.routes; + } + + /** + * Set the routes value. + * + * @param routes the routes value to set + * @return the RoutingProperties object itself. + */ + public RoutingProperties withRoutes(List routes) { + this.routes = routes; + return this; + } + + /** + * Get the fallbackRoute value. + * + * @return the fallbackRoute value + */ + public FallbackRouteProperties fallbackRoute() { + return this.fallbackRoute; + } + + /** + * Set the fallbackRoute value. + * + * @param fallbackRoute the fallbackRoute value to set + * @return the RoutingProperties object itself. + */ + public RoutingProperties withFallbackRoute(FallbackRouteProperties fallbackRoute) { + this.fallbackRoute = fallbackRoute; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingServiceBusQueueEndpointProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingServiceBusQueueEndpointProperties.java new file mode 100644 index 00000000000..86d27084042 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingServiceBusQueueEndpointProperties.java @@ -0,0 +1,126 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties related to service bus queue endpoint types. + */ +public class RoutingServiceBusQueueEndpointProperties { + /** + * The connection string of the service bus queue endpoint. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * operationsMonitoringEvents, fileNotifications, $default. Endpoint names + * must be unique across endpoint types. The name need not be the same as + * the actual queue name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The subscription identifier of the service bus queue endpoint. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * The name of the resource group of the service bus queue endpoint. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * 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 RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * 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 RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId value. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId value. + * + * @param subscriptionId the subscriptionId value to set + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup value. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup value. + * + * @param resourceGroup the resourceGroup value to set + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingServiceBusTopicEndpointProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingServiceBusTopicEndpointProperties.java new file mode 100644 index 00000000000..72f08838ef7 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingServiceBusTopicEndpointProperties.java @@ -0,0 +1,126 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties related to service bus topic endpoint types. + */ +public class RoutingServiceBusTopicEndpointProperties { + /** + * The connection string of the service bus topic endpoint. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * operationsMonitoringEvents, fileNotifications, $default. Endpoint names + * must be unique across endpoint types. The name need not be the same as + * the actual topic name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The subscription identifier of the service bus topic endpoint. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * The name of the resource group of the service bus topic endpoint. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * 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 RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * 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 RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId value. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId value. + * + * @param subscriptionId the subscriptionId value to set + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup value. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup value. + * + * @param resourceGroup the resourceGroup value to set + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingSource.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingSource.java new file mode 100644 index 00000000000..6715265c034 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingSource.java @@ -0,0 +1,47 @@ +/** + * 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.iothub; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for RoutingSource. + */ +public final class RoutingSource extends ExpandableStringEnum { + /** Static value DeviceMessages for RoutingSource. */ + public static final RoutingSource DEVICE_MESSAGES = fromString("DeviceMessages"); + + /** Static value TwinChangeEvents for RoutingSource. */ + public static final RoutingSource TWIN_CHANGE_EVENTS = fromString("TwinChangeEvents"); + + /** Static value DeviceLifecycleEvents for RoutingSource. */ + public static final RoutingSource DEVICE_LIFECYCLE_EVENTS = fromString("DeviceLifecycleEvents"); + + /** Static value DeviceJobLifecycleEvents for RoutingSource. */ + public static final RoutingSource DEVICE_JOB_LIFECYCLE_EVENTS = fromString("DeviceJobLifecycleEvents"); + + /** + * Creates or finds a RoutingSource from its string representation. + * @param name a name to look for + * @return the corresponding RoutingSource + */ + @JsonCreator + public static RoutingSource fromString(String name) { + return fromString(name, RoutingSource.class); + } + + /** + * @return known RoutingSource values + */ + public static Collection values() { + return values(RoutingSource.class); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingStorageContainerProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingStorageContainerProperties.java new file mode 100644 index 00000000000..8b3d830ab22 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/RoutingStorageContainerProperties.java @@ -0,0 +1,261 @@ +/** + * 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.iothub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties related to a storage container endpoint. + */ +public class RoutingStorageContainerProperties { + /** + * The connection string of the storage account. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * operationsMonitoringEvents, fileNotifications, $default. Endpoint names + * must be unique across endpoint types. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The subscription identifier of the storage account. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * The name of the resource group of the storage account. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * The name of storage container in the storage account. + */ + @JsonProperty(value = "containerName", required = true) + private String containerName; + + /** + * File name format for the blob. Default format is + * {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are + * mandatory but can be reordered. + */ + @JsonProperty(value = "fileNameFormat") + private String fileNameFormat; + + /** + * Time interval at which blobs are written to storage. Value should be + * between 60 and 720 seconds. Default value is 300 seconds. + */ + @JsonProperty(value = "batchFrequencyInSeconds") + private Integer batchFrequencyInSeconds; + + /** + * Maximum number of bytes for each blob written to storage. Value should + * be between 10485760(10MB) and 524288000(500MB). Default value is + * 314572800(300MB). + */ + @JsonProperty(value = "maxChunkSizeInBytes") + private Integer maxChunkSizeInBytes; + + /** + * Encoding that is used to serialize messages to blobs. Supported values + * are 'avro' and 'avrodeflate'. Default value is 'avro'. + */ + @JsonProperty(value = "encoding") + private String encoding; + + /** + * 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 RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * 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 RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId value. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId value. + * + * @param subscriptionId the subscriptionId value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup value. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup value. + * + * @param resourceGroup the resourceGroup value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the containerName value. + * + * @return the containerName value + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName value. + * + * @param containerName the containerName value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the fileNameFormat value. + * + * @return the fileNameFormat value + */ + public String fileNameFormat() { + return this.fileNameFormat; + } + + /** + * Set the fileNameFormat value. + * + * @param fileNameFormat the fileNameFormat value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withFileNameFormat(String fileNameFormat) { + this.fileNameFormat = fileNameFormat; + return this; + } + + /** + * Get the batchFrequencyInSeconds value. + * + * @return the batchFrequencyInSeconds value + */ + public Integer batchFrequencyInSeconds() { + return this.batchFrequencyInSeconds; + } + + /** + * Set the batchFrequencyInSeconds value. + * + * @param batchFrequencyInSeconds the batchFrequencyInSeconds value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withBatchFrequencyInSeconds(Integer batchFrequencyInSeconds) { + this.batchFrequencyInSeconds = batchFrequencyInSeconds; + return this; + } + + /** + * Get the maxChunkSizeInBytes value. + * + * @return the maxChunkSizeInBytes value + */ + public Integer maxChunkSizeInBytes() { + return this.maxChunkSizeInBytes; + } + + /** + * Set the maxChunkSizeInBytes value. + * + * @param maxChunkSizeInBytes the maxChunkSizeInBytes value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withMaxChunkSizeInBytes(Integer maxChunkSizeInBytes) { + this.maxChunkSizeInBytes = maxChunkSizeInBytes; + return this; + } + + /** + * Get the encoding value. + * + * @return the encoding value + */ + public String encoding() { + return this.encoding; + } + + /** + * Set the encoding value. + * + * @param encoding the encoding value to set + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withEncoding(String encoding) { + this.encoding = encoding; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/StorageEndpointProperties.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/StorageEndpointProperties.java new file mode 100644 index 00000000000..3464faeeab3 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/StorageEndpointProperties.java @@ -0,0 +1,101 @@ +/** + * 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.iothub; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the Azure Storage endpoint for file upload. + */ +public class StorageEndpointProperties { + /** + * The period of time for which the the SAS URI generated by IoT Hub for + * file upload is valid. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + */ + @JsonProperty(value = "sasTtlAsIso8601") + private Period sasTtlAsIso8601; + + /** + * The connection string for the Azure Storage account to which files are + * uploaded. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * The name of the root container where you upload files. The container + * need not exist but should be creatable using the connectionString + * specified. + */ + @JsonProperty(value = "containerName", required = true) + private String containerName; + + /** + * Get the sasTtlAsIso8601 value. + * + * @return the sasTtlAsIso8601 value + */ + public Period sasTtlAsIso8601() { + return this.sasTtlAsIso8601; + } + + /** + * Set the sasTtlAsIso8601 value. + * + * @param sasTtlAsIso8601 the sasTtlAsIso8601 value to set + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withSasTtlAsIso8601(Period sasTtlAsIso8601) { + this.sasTtlAsIso8601 = sasTtlAsIso8601; + return this; + } + + /** + * 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 StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the containerName value. + * + * @return the containerName value + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName value. + * + * @param containerName the containerName value to set + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withContainerName(String containerName) { + this.containerName = containerName; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/TagsResource.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/TagsResource.java new file mode 100644 index 00000000000..51eaddbcbad --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub; + +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 an IoT Hub 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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateDescriptionInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateDescriptionInner.java new file mode 100644 index 00000000000..25813682ee0 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateDescriptionInner.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.iothub.implementation; + +import com.microsoft.azure.management.iothub.CertificateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The X509 Certificate. + */ +public class CertificateDescriptionInner { + /** + * The properties property. + */ + @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 CertificateDescriptionInner object itself. + */ + public CertificateDescriptionInner 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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateListDescriptionInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateListDescriptionInner.java new file mode 100644 index 00000000000..d0254ca041c --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub.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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateWithNonceDescriptionInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateWithNonceDescriptionInner.java new file mode 100644 index 00000000000..d6cd4818bf0 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificateWithNonceDescriptionInner.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.iothub.implementation; + +import com.microsoft.azure.management.iothub.CertificatePropertiesWithNonce; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The X509 Certificate. + */ +public class CertificateWithNonceDescriptionInner { + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private CertificatePropertiesWithNonce 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 CertificatePropertiesWithNonce properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the CertificateWithNonceDescriptionInner object itself. + */ + public CertificateWithNonceDescriptionInner withProperties(CertificatePropertiesWithNonce 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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificatesInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificatesInner.java new file mode 100644 index 00000000000..2fee8829460 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/CertificatesInner.java @@ -0,0 +1,893 @@ +/** + * 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.iothub.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.iothub.CertificateBodyDescription; +import com.microsoft.azure.management.iothub.CertificateVerificationDescription; +import com.microsoft.azure.management.iothub.ErrorDetailsInnerException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +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.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 Certificates. + */ +public class CertificatesInner { + /** The Retrofit service to perform REST calls. */ + private CertificatesService service; + /** The service client containing this operation class. */ + private IotHubClientImpl client; + + /** + * Initializes an instance of CertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CertificatesInner(Retrofit retrofit, IotHubClientImpl client) { + this.service = retrofit.create(CertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Certificates to be + * used by Retrofit to perform actually REST calls. + */ + interface CertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.Certificates listByIotHub" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates") + Observable> listByIotHub(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.Certificates get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("certificateName") String certificateName, @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.iothub.Certificates createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.Certificates delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("certificateName") String certificateName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.Certificates generateVerificationCode" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode") + Observable> generateVerificationCode(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("certificateName") String certificateName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.Certificates verify" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify") + Observable> verify(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("certificateName") String certificateName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body CertificateVerificationDescription certificateVerificationBody, @Header("User-Agent") String userAgent); + + } + + /** + * Get the certificate list. + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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 listByIotHub(String resourceGroupName, String resourceName) { + return listByIotHubWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Get the certificate list. + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 listByIotHubAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByIotHubWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Get the certificate list. + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateListDescriptionInner object + */ + public Observable listByIotHubAsync(String resourceGroupName, String resourceName) { + return listByIotHubWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, CertificateListDescriptionInner>() { + @Override + public CertificateListDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the certificate list. + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateListDescriptionInner object + */ + public Observable> listByIotHubWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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.listByIotHub(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByIotHubDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByIotHubDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the certificate. + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateDescriptionInner object if successful. + */ + public CertificateDescriptionInner get(String resourceGroupName, String resourceName, String certificateName) { + return getWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).toBlocking().single().body(); + } + + /** + * Get the certificate. + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name 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 resourceGroupName, String resourceName, String certificateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceName, certificateName), serviceCallback); + } + + /** + * Get the certificate. + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateDescriptionInner object + */ + public Observable getAsync(String resourceGroupName, String resourceName, String certificateName) { + return getWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1, CertificateDescriptionInner>() { + @Override + public CertificateDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the certificate. + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateDescriptionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateDescriptionInner object if successful. + */ + public CertificateDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, String certificateName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).toBlocking().single().body(); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name 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 createOrUpdateAsync(String resourceGroupName, String resourceName, String certificateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName), serviceCallback); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateDescriptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, String certificateName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1, CertificateDescriptionInner>() { + @Override + public CertificateDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateDescriptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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, resourceName, 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 IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing 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 ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateDescriptionInner object if successful. + */ + public CertificateDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, String certificateName, String ifMatch, String certificate) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificate).toBlocking().single().body(); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing 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 resourceName, String certificateName, String ifMatch, String certificate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificate), serviceCallback); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing 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 CertificateDescriptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch, String certificate) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificate).map(new Func1, CertificateDescriptionInner>() { + @Override + public CertificateDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upload the certificate to the IoT hub. + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing 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 CertificateDescriptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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, resourceName, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Delete an X509 certificate. + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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 resourceName, String certificateName, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).toBlocking().single().body(); + } + + /** + * Delete an X509 certificate. + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @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 resourceName, String certificateName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch), serviceCallback); + } + + /** + * Delete an X509 certificate. + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @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 resourceName, String certificateName, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an X509 certificate. + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @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 resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, this.client.apiVersion(), ifMatch, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Generate verification code for proof of possession flow. + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateWithNonceDescriptionInner object if successful. + */ + public CertificateWithNonceDescriptionInner generateVerificationCode(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return generateVerificationCodeWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).toBlocking().single().body(); + } + + /** + * Generate verification code for proof of possession flow. + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @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 generateVerificationCodeAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateVerificationCodeWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch), serviceCallback); + } + + /** + * Generate verification code for proof of possession flow. + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateWithNonceDescriptionInner object + */ + public Observable generateVerificationCodeAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return generateVerificationCodeWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).map(new Func1, CertificateWithNonceDescriptionInner>() { + @Override + public CertificateWithNonceDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generate verification code for proof of possession flow. + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateWithNonceDescriptionInner object + */ + public Observable> generateVerificationCodeWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + return service.generateVerificationCode(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, this.client.apiVersion(), ifMatch, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateDescriptionInner object if successful. + */ + public CertificateDescriptionInner verify(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return verifyWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @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 verifyAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(verifyWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateDescriptionInner object + */ + public Observable verifyAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return verifyWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).map(new Func1, CertificateDescriptionInner>() { + @Override + public CertificateDescriptionInner 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateDescriptionInner object + */ + public Observable> verifyWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + final String certificate = null; + CertificateVerificationDescription certificateVerificationBody = new CertificateVerificationDescription(); + certificateVerificationBody.withCertificate(null); + return service.verify(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), certificateVerificationBody, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = verifyDelegate(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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @param certificate base-64 representation of X509 certificate .cer file or just .pem file content. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateDescriptionInner object if successful. + */ + public CertificateDescriptionInner verify(String resourceGroupName, String resourceName, String certificateName, String ifMatch, String certificate) { + return verifyWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @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 verifyAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch, String certificate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(verifyWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @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 CertificateDescriptionInner object + */ + public Observable verifyAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch, String certificate) { + return verifyWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificate).map(new Func1, CertificateDescriptionInner>() { + @Override + public CertificateDescriptionInner 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate + * @param ifMatch ETag of the Certificate. + * @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 CertificateDescriptionInner object + */ + public Observable> verifyWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + CertificateVerificationDescription certificateVerificationBody = new CertificateVerificationDescription(); + certificateVerificationBody.withCertificate(certificate); + return service.verify(this.client.subscriptionId(), resourceGroupName, resourceName, certificateName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), certificateVerificationBody, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = verifyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse verifyDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ErrorDetailsInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ErrorDetailsInner.java new file mode 100644 index 00000000000..992481a9286 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ErrorDetailsInner.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.iothub.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + */ +public class ErrorDetailsInner { + /** + * 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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ErrorDetailsInnerException.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ErrorDetailsInnerException.java new file mode 100644 index 00000000000..36573e6b16a --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ErrorDetailsInnerException.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.iothub.implementation; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorDetailsInner information. + */ +public class ErrorDetailsInnerException extends RestException { + /** + * Initializes a new instance of the ErrorDetailsInnerException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorDetailsInnerException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorDetailsInnerException 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 ErrorDetailsInnerException(final String message, final Response response, final ErrorDetailsInner body) { + super(message, response, body); + } + + @Override + public ErrorDetailsInner body() { + return (ErrorDetailsInner) super.body(); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/EventHubConsumerGroupInfoInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/EventHubConsumerGroupInfoInner.java new file mode 100644 index 00000000000..44f263d37e7 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/EventHubConsumerGroupInfoInner.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.iothub.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the EventHubConsumerGroupInfo object. + */ +public class EventHubConsumerGroupInfoInner { + /** + * The tags. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * The Event Hub-compatible consumer group identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The Event Hub-compatible consumer group name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * the resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the properties value. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the EventHubConsumerGroupInfoInner object itself. + */ + public EventHubConsumerGroupInfoInner withProperties(Map 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 type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ExportDevicesRequestInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ExportDevicesRequestInner.java new file mode 100644 index 00000000000..6b6ce24a78c --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ExportDevicesRequestInner.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.iothub.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Use to provide parameters when requesting an export of all devices in the + * IoT hub. + */ +public class ExportDevicesRequestInner { + /** + * The export blob container URI. + */ + @JsonProperty(value = "exportBlobContainerUri", required = true) + private String exportBlobContainerUri; + + /** + * The value indicating whether keys should be excluded during export. + */ + @JsonProperty(value = "excludeKeys", required = true) + private boolean excludeKeys; + + /** + * Get the exportBlobContainerUri value. + * + * @return the exportBlobContainerUri value + */ + public String exportBlobContainerUri() { + return this.exportBlobContainerUri; + } + + /** + * Set the exportBlobContainerUri value. + * + * @param exportBlobContainerUri the exportBlobContainerUri value to set + * @return the ExportDevicesRequestInner object itself. + */ + public ExportDevicesRequestInner withExportBlobContainerUri(String exportBlobContainerUri) { + this.exportBlobContainerUri = exportBlobContainerUri; + return this; + } + + /** + * Get the excludeKeys value. + * + * @return the excludeKeys value + */ + public boolean excludeKeys() { + return this.excludeKeys; + } + + /** + * Set the excludeKeys value. + * + * @param excludeKeys the excludeKeys value to set + * @return the ExportDevicesRequestInner object itself. + */ + public ExportDevicesRequestInner withExcludeKeys(boolean excludeKeys) { + this.excludeKeys = excludeKeys; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ImportDevicesRequestInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ImportDevicesRequestInner.java new file mode 100644 index 00000000000..3533ee3512d --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/ImportDevicesRequestInner.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.iothub.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Use to provide parameters when requesting an import of all devices in the + * hub. + */ +public class ImportDevicesRequestInner { + /** + * The input blob container URI. + */ + @JsonProperty(value = "inputBlobContainerUri", required = true) + private String inputBlobContainerUri; + + /** + * The output blob container URI. + */ + @JsonProperty(value = "outputBlobContainerUri", required = true) + private String outputBlobContainerUri; + + /** + * Get the inputBlobContainerUri value. + * + * @return the inputBlobContainerUri value + */ + public String inputBlobContainerUri() { + return this.inputBlobContainerUri; + } + + /** + * Set the inputBlobContainerUri value. + * + * @param inputBlobContainerUri the inputBlobContainerUri value to set + * @return the ImportDevicesRequestInner object itself. + */ + public ImportDevicesRequestInner withInputBlobContainerUri(String inputBlobContainerUri) { + this.inputBlobContainerUri = inputBlobContainerUri; + return this; + } + + /** + * Get the outputBlobContainerUri value. + * + * @return the outputBlobContainerUri value + */ + public String outputBlobContainerUri() { + return this.outputBlobContainerUri; + } + + /** + * Set the outputBlobContainerUri value. + * + * @param outputBlobContainerUri the outputBlobContainerUri value to set + * @return the ImportDevicesRequestInner object itself. + */ + public ImportDevicesRequestInner withOutputBlobContainerUri(String outputBlobContainerUri) { + this.outputBlobContainerUri = outputBlobContainerUri; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubClientImpl.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubClientImpl.java new file mode 100644 index 00000000000..4f16ab1b64b --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubClientImpl.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.iothub.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 IotHubClientImpl class. + */ +public class IotHubClientImpl 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 IotHubClientImpl 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 IotHubClientImpl 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 IotHubClientImpl 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 IotHubClientImpl 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 IotHubResourcesInner object to access its operations. + */ + private IotHubResourcesInner iotHubResources; + + /** + * Gets the IotHubResourcesInner object to access its operations. + * @return the IotHubResourcesInner object. + */ + public IotHubResourcesInner iotHubResources() { + return this.iotHubResources; + } + + /** + * The CertificatesInner object to access its operations. + */ + private CertificatesInner certificates; + + /** + * Gets the CertificatesInner object to access its operations. + * @return the CertificatesInner object. + */ + public CertificatesInner certificates() { + return this.certificates; + } + + /** + * Initializes an instance of IotHubClient client. + * + * @param credentials the management credentials for Azure + */ + public IotHubClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of IotHubClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public IotHubClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of IotHubClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public IotHubClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-01-22"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.iotHubResources = new IotHubResourcesInner(restClient().retrofit(), this); + this.certificates = new CertificatesInner(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(), "IotHubClient", "2018-01-22"); + } +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubDescriptionInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubDescriptionInner.java new file mode 100644 index 00000000000..264f0732211 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubDescriptionInner.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.iothub.implementation; + +import com.microsoft.azure.management.iothub.IotHubProperties; +import com.microsoft.azure.management.iothub.IotHubSkuInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * The description of the IoT hub. + */ +public class IotHubDescriptionInner 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; + + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private IotHubProperties properties; + + /** + * The sku property. + */ + @JsonProperty(value = "sku", required = true) + private IotHubSkuInfo 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 IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public IotHubProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withProperties(IotHubProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public IotHubSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withSku(IotHubSkuInfo sku) { + this.sku = sku; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubNameAvailabilityInfoInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubNameAvailabilityInfoInner.java new file mode 100644 index 00000000000..cae25d19803 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubNameAvailabilityInfoInner.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.iothub.implementation; + +import com.microsoft.azure.management.iothub.IotHubNameUnavailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties indicating whether a given IoT hub name is available. + */ +public class IotHubNameAvailabilityInfoInner { + /** + * The value which indicates whether the provided name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /** + * The reason for unavailability. Possible values include: 'Invalid', + * 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private IotHubNameUnavailabilityReason reason; + + /** + * The detailed reason message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable value. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public IotHubNameUnavailabilityReason reason() { + return this.reason; + } + + /** + * 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 IotHubNameAvailabilityInfoInner object itself. + */ + public IotHubNameAvailabilityInfoInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubQuotaMetricInfoInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubQuotaMetricInfoInner.java new file mode 100644 index 00000000000..0a190a30a1c --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubQuotaMetricInfoInner.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.iothub.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Quota metrics properties. + */ +public class IotHubQuotaMetricInfoInner { + /** + * The name of the quota metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The current value for the quota metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Long currentValue; + + /** + * The maximum value of the quota metric. + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private Long maxValue; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the currentValue value. + * + * @return the currentValue value + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Get the maxValue value. + * + * @return the maxValue value + */ + public Long maxValue() { + return this.maxValue; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubResourcesInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubResourcesInner.java new file mode 100644 index 00000000000..b5b6bfbd337 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubResourcesInner.java @@ -0,0 +1,3718 @@ +/** + * 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.iothub.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.iothub.ErrorDetailsInnerException; +import com.microsoft.azure.management.iothub.OperationInputs; +import com.microsoft.azure.management.iothub.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 IotHubResources. + */ +public class IotHubResourcesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private IotHubResourcesService service; + /** The service client containing this operation class. */ + private IotHubClientImpl client; + + /** + * Initializes an instance of IotHubResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IotHubResourcesInner(Retrofit retrofit, IotHubClientImpl client) { + this.service = retrofit.create(IotHubResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for IotHubResources to be + * used by Retrofit to perform actually REST calls. + */ + interface IotHubResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.IotHubResources getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IotHubDescriptionInner iotHubDescription, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.IotHubResources beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IotHubDescriptionInner iotHubDescription, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.IotHubResources update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsResource iotHubTags, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.IotHubResources beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsResource iotHubTags, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.IotHubResources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs") + 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.iothub.IotHubResources listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs") + 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.iothub.IotHubResources getStats" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats") + Observable> getStats(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources getValidSkus" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus") + Observable> getValidSkus(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources listEventHubConsumerGroups" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups") + Observable> listEventHubConsumerGroups(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("eventHubEndpointName") String eventHubEndpointName, @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.iothub.IotHubResources getEventHubConsumerGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") + Observable> getEventHubConsumerGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("eventHubEndpointName") String eventHubEndpointName, @Path("name") String name, @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.iothub.IotHubResources createEventHubConsumerGroup" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") + Observable> createEventHubConsumerGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("eventHubEndpointName") String eventHubEndpointName, @Path("name") String name, @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.iothub.IotHubResources deleteEventHubConsumerGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", method = "DELETE", hasBody = true) + Observable> deleteEventHubConsumerGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("eventHubEndpointName") String eventHubEndpointName, @Path("name") String name, @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.iothub.IotHubResources listJobs" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs") + Observable> listJobs(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources getJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}") + Observable> getJob(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("jobId") String jobId, @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.iothub.IotHubResources getQuotaMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics") + Observable> getQuotaMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body OperationInputs operationInputs, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.iothub.IotHubResources listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys") + Observable> listKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @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.iothub.IotHubResources getKeysForKeyName" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys") + Observable> getKeysForKeyName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("keyName") String keyName, @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.iothub.IotHubResources exportDevices" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices") + Observable> exportDevices(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ExportDevicesRequestInner exportDevicesParameters, @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.iothub.IotHubResources importDevices" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices") + Observable> importDevices(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ImportDevicesRequestInner importDevicesParameters, @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.iothub.IotHubResources 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.iothub.IotHubResources 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.iothub.IotHubResources getValidSkusNext" }) + @GET + Observable> getValidSkusNext(@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.iothub.IotHubResources listEventHubConsumerGroupsNext" }) + @GET + Observable> listEventHubConsumerGroupsNext(@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.iothub.IotHubResources listJobsNext" }) + @GET + Observable> listJobsNext(@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.iothub.IotHubResources getQuotaMetricsNext" }) + @GET + Observable> getQuotaMetricsNext(@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.iothub.IotHubResources listKeysNext" }) + @GET + Observable> listKeysNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the non-security related metadata of an IoT hub. + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Get the non-security related metadata of an IoT hub. + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Get the non-security related metadata of an IoT hub. + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the non-security related metadata of an IoT hub. + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, resourceName, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).toBlocking().last().body(); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription), serviceCallback); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (iotHubDescription == null) { + throw new IllegalArgumentException("Parameter iotHubDescription is required and cannot be null."); + } + Validator.validate(iotHubDescription); + final String ifMatch = null; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), iotHubDescription, ifMatch, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).toBlocking().last().body(); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @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 resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch), serviceCallback); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (iotHubDescription == null) { + throw new IllegalArgumentException("Parameter iotHubDescription is required and cannot be null."); + } + Validator.validate(iotHubDescription); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), iotHubDescription, ifMatch, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner beginCreateOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).toBlocking().single().body(); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription), serviceCallback); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (iotHubDescription == null) { + throw new IllegalArgumentException("Parameter iotHubDescription is required and cannot be null."); + } + Validator.validate(iotHubDescription); + final String ifMatch = null; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), iotHubDescription, ifMatch, 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); + } + } + }); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner beginCreateOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).toBlocking().single().body(); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @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 resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch), serviceCallback); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the metadata of an IoT hub. + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (iotHubDescription == null) { + throw new IllegalArgumentException("Parameter iotHubDescription is required and cannot be null."); + } + Validator.validate(iotHubDescription); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), iotHubDescription, ifMatch, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner update(String resourceGroupName, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 iotHubTags = new TagsResource(); + iotHubTags.withTags(null); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), iotHubTags, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner update(String resourceGroupName, String resourceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, tags).toBlocking().last().body(); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 resourceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceName, tags), serviceCallback); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 resourceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, tags).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 iotHubTags = new TagsResource(); + iotHubTags.withTags(tags); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), iotHubTags, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner beginUpdate(String resourceGroupName, String resourceName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String resourceName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 iotHubTags = new TagsResource(); + iotHubTags.withTags(null); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), iotHubTags, 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 IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 IotHubDescriptionInner object if successful. + */ + public IotHubDescriptionInner beginUpdate(String resourceGroupName, String resourceName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, tags).toBlocking().single().body(); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to 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 resourceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, tags), serviceCallback); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String resourceName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, tags).map(new Func1, IotHubDescriptionInner>() { + @Override + public IotHubDescriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing IoT Hubs tags. + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubDescriptionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 iotHubTags = new TagsResource(); + iotHubTags.withTags(tags); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), iotHubTags, 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 an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object delete(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginDelete(String resourceGroupName, String resourceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginDeleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an IoT hub. + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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(this.client.subscriptionId(), resourceGroupName, resourceName, 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 ErrorDetailsInnerException, 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(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubDescriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubDescriptionInner> 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubDescriptionInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubDescriptionInner> 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the statistics from an IoT hub. + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryStatisticsInner object if successful. + */ + public RegistryStatisticsInner getStats(String resourceGroupName, String resourceName) { + return getStatsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Get the statistics from an IoT hub. + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 getStatsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getStatsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Get the statistics from an IoT hub. + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryStatisticsInner object + */ + public Observable getStatsAsync(String resourceGroupName, String resourceName) { + return getStatsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, RegistryStatisticsInner>() { + @Override + public RegistryStatisticsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the statistics from an IoT hub. + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryStatisticsInner object + */ + public Observable> getStatsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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.getStats(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getStatsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getStatsDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubSkuDescriptionInner> object if successful. + */ + public PagedList getValidSkus(final String resourceGroupName, final String resourceName) { + ServiceResponse> response = getValidSkusSinglePageAsync(resourceGroupName, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getValidSkusNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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> getValidSkusAsync(final String resourceGroupName, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getValidSkusSinglePageAsync(resourceGroupName, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getValidSkusNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubSkuDescriptionInner> object + */ + public Observable> getValidSkusAsync(final String resourceGroupName, final String resourceName) { + return getValidSkusWithServiceResponseAsync(resourceGroupName, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubSkuDescriptionInner> object + */ + public Observable>> getValidSkusWithServiceResponseAsync(final String resourceGroupName, final String resourceName) { + return getValidSkusSinglePageAsync(resourceGroupName, resourceName) + .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(getValidSkusNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the IoT hub. + ServiceResponse> * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubSkuDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getValidSkusSinglePageAsync(final String resourceGroupName, final String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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.getValidSkus(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getValidSkusDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getValidSkusDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<EventHubConsumerGroupInfoInner> object if successful. + */ + public PagedList listEventHubConsumerGroups(final String resourceGroupName, final String resourceName, final String eventHubEndpointName) { + ServiceResponse> response = listEventHubConsumerGroupsSinglePageAsync(resourceGroupName, resourceName, eventHubEndpointName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listEventHubConsumerGroupsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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> listEventHubConsumerGroupsAsync(final String resourceGroupName, final String resourceName, final String eventHubEndpointName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listEventHubConsumerGroupsSinglePageAsync(resourceGroupName, resourceName, eventHubEndpointName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listEventHubConsumerGroupsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventHubConsumerGroupInfoInner> object + */ + public Observable> listEventHubConsumerGroupsAsync(final String resourceGroupName, final String resourceName, final String eventHubEndpointName) { + return listEventHubConsumerGroupsWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventHubConsumerGroupInfoInner> object + */ + public Observable>> listEventHubConsumerGroupsWithServiceResponseAsync(final String resourceGroupName, final String resourceName, final String eventHubEndpointName) { + return listEventHubConsumerGroupsSinglePageAsync(resourceGroupName, resourceName, eventHubEndpointName) + .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(listEventHubConsumerGroupsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the IoT hub. + ServiceResponse> * @param resourceName The name of the IoT hub. + ServiceResponse> * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventHubConsumerGroupInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listEventHubConsumerGroupsSinglePageAsync(final String resourceGroupName, final String resourceName, final String eventHubEndpointName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (eventHubEndpointName == null) { + throw new IllegalArgumentException("Parameter eventHubEndpointName 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.listEventHubConsumerGroups(this.client.subscriptionId(), resourceGroupName, resourceName, eventHubEndpointName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listEventHubConsumerGroupsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listEventHubConsumerGroupsDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EventHubConsumerGroupInfoInner object if successful. + */ + public EventHubConsumerGroupInfoInner getEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return getEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @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 getEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name), serviceCallback); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventHubConsumerGroupInfoInner object + */ + public Observable getEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return getEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1, EventHubConsumerGroupInfoInner>() { + @Override + public EventHubConsumerGroupInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventHubConsumerGroupInfoInner object + */ + public Observable> getEventHubConsumerGroupWithServiceResponseAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (eventHubEndpointName == null) { + throw new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name 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.getEventHubConsumerGroup(this.client.subscriptionId(), resourceGroupName, resourceName, eventHubEndpointName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getEventHubConsumerGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getEventHubConsumerGroupDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EventHubConsumerGroupInfoInner object if successful. + */ + public EventHubConsumerGroupInfoInner createEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @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 createEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name), serviceCallback); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventHubConsumerGroupInfoInner object + */ + public Observable createEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1, EventHubConsumerGroupInfoInner>() { + @Override + public EventHubConsumerGroupInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventHubConsumerGroupInfoInner object + */ + public Observable> createEventHubConsumerGroupWithServiceResponseAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (eventHubEndpointName == null) { + throw new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name 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.createEventHubConsumerGroup(this.client.subscriptionId(), resourceGroupName, resourceName, eventHubEndpointName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createEventHubConsumerGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createEventHubConsumerGroupDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @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 deleteEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name), serviceCallback); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteEventHubConsumerGroupWithServiceResponseAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (eventHubEndpointName == null) { + throw new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name 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.deleteEventHubConsumerGroup(this.client.subscriptionId(), resourceGroupName, resourceName, eventHubEndpointName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteEventHubConsumerGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteEventHubConsumerGroupDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<JobResponseInner> object if successful. + */ + public PagedList listJobs(final String resourceGroupName, final String resourceName) { + ServiceResponse> response = listJobsSinglePageAsync(resourceGroupName, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listJobsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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> listJobsAsync(final String resourceGroupName, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listJobsSinglePageAsync(resourceGroupName, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listJobsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobResponseInner> object + */ + public Observable> listJobsAsync(final String resourceGroupName, final String resourceName) { + return listJobsWithServiceResponseAsync(resourceGroupName, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobResponseInner> object + */ + public Observable>> listJobsWithServiceResponseAsync(final String resourceGroupName, final String resourceName) { + return listJobsSinglePageAsync(resourceGroupName, resourceName) + .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(listJobsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the IoT hub. + ServiceResponse> * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobResponseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listJobsSinglePageAsync(final String resourceGroupName, final String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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.listJobs(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listJobsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listJobsDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobResponseInner object if successful. + */ + public JobResponseInner getJob(String resourceGroupName, String resourceName, String jobId) { + return getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId).toBlocking().single().body(); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job 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 getJobAsync(String resourceGroupName, String resourceName, String jobId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId), serviceCallback); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobResponseInner object + */ + public Observable getJobAsync(String resourceGroupName, String resourceName, String jobId) { + return getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId).map(new Func1, JobResponseInner>() { + @Override + public JobResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobResponseInner object + */ + public Observable> getJobWithServiceResponseAsync(String resourceGroupName, String resourceName, String jobId) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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.getJob(this.client.subscriptionId(), resourceGroupName, resourceName, jobId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getJobDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getJobDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubQuotaMetricInfoInner> object if successful. + */ + public PagedList getQuotaMetrics(final String resourceGroupName, final String resourceName) { + ServiceResponse> response = getQuotaMetricsSinglePageAsync(resourceGroupName, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getQuotaMetricsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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> getQuotaMetricsAsync(final String resourceGroupName, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getQuotaMetricsSinglePageAsync(resourceGroupName, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getQuotaMetricsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubQuotaMetricInfoInner> object + */ + public Observable> getQuotaMetricsAsync(final String resourceGroupName, final String resourceName) { + return getQuotaMetricsWithServiceResponseAsync(resourceGroupName, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubQuotaMetricInfoInner> object + */ + public Observable>> getQuotaMetricsWithServiceResponseAsync(final String resourceGroupName, final String resourceName) { + return getQuotaMetricsSinglePageAsync(resourceGroupName, resourceName) + .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(getQuotaMetricsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the IoT hub. + ServiceResponse> * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubQuotaMetricInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getQuotaMetricsSinglePageAsync(final String resourceGroupName, final String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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.getQuotaMetrics(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getQuotaMetricsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getQuotaMetricsDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Check if an IoT hub name is available. + * Check if an IoT hub name is available. + * + * @param name The name of the IoT hub to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IotHubNameAvailabilityInfoInner object if successful. + */ + public IotHubNameAvailabilityInfoInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Check if an IoT hub name is available. + * Check if an IoT hub name is available. + * + * @param name The name of the IoT hub to check. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Check if an IoT hub name is available. + * Check if an IoT hub name is available. + * + * @param name The name of the IoT hub to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubNameAvailabilityInfoInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, IotHubNameAvailabilityInfoInner>() { + @Override + public IotHubNameAvailabilityInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check if an IoT hub name is available. + * Check if an IoT hub name is available. + * + * @param name The name of the IoT hub to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IotHubNameAvailabilityInfoInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(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 operationInputs = new OperationInputs(); + operationInputs.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), operationInputs, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<SharedAccessSignatureAuthorizationRuleInner> object if successful. + */ + public PagedList listKeys(final String resourceGroupName, final String resourceName) { + ServiceResponse> response = listKeysSinglePageAsync(resourceGroupName, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 resourceGroupName, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listKeysSinglePageAsync(resourceGroupName, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessSignatureAuthorizationRuleInner> object + */ + public Observable> listKeysAsync(final String resourceGroupName, final String resourceName) { + return listKeysWithServiceResponseAsync(resourceGroupName, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessSignatureAuthorizationRuleInner> object + */ + public Observable>> listKeysWithServiceResponseAsync(final String resourceGroupName, final String resourceName) { + return listKeysSinglePageAsync(resourceGroupName, resourceName) + .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 an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the IoT hub. + ServiceResponse> * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessSignatureAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listKeysSinglePageAsync(final String resourceGroupName, final String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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(this.client.subscriptionId(), resourceGroupName, resourceName, 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessSignatureAuthorizationRuleInner object if successful. + */ + public SharedAccessSignatureAuthorizationRuleInner getKeysForKeyName(String resourceGroupName, String resourceName, String keyName) { + return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).toBlocking().single().body(); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @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 getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName), serviceCallback); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessSignatureAuthorizationRuleInner object + */ + public Observable getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName) { + return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).map(new Func1, SharedAccessSignatureAuthorizationRuleInner>() { + @Override + public SharedAccessSignatureAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessSignatureAuthorizationRuleInner object + */ + public Observable> getKeysForKeyNameWithServiceResponseAsync(String resourceGroupName, String resourceName, String keyName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (keyName == null) { + throw new IllegalArgumentException("Parameter keyName 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.getKeysForKeyName(this.client.subscriptionId(), resourceGroupName, resourceName, keyName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getKeysForKeyNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getKeysForKeyNameDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobResponseInner object if successful. + */ + public JobResponseInner exportDevices(String resourceGroupName, String resourceName, ExportDevicesRequestInner exportDevicesParameters) { + return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).toBlocking().single().body(); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices 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 exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequestInner exportDevicesParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters), serviceCallback); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobResponseInner object + */ + public Observable exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequestInner exportDevicesParameters) { + return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).map(new Func1, JobResponseInner>() { + @Override + public JobResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobResponseInner object + */ + public Observable> exportDevicesWithServiceResponseAsync(String resourceGroupName, String resourceName, ExportDevicesRequestInner exportDevicesParameters) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (exportDevicesParameters == null) { + throw new IllegalArgumentException("Parameter exportDevicesParameters is required and cannot be null."); + } + Validator.validate(exportDevicesParameters); + return service.exportDevices(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), exportDevicesParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportDevicesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDevicesDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobResponseInner object if successful. + */ + public JobResponseInner importDevices(String resourceGroupName, String resourceName, ImportDevicesRequestInner importDevicesParameters) { + return importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters).toBlocking().single().body(); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices 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 importDevicesAsync(String resourceGroupName, String resourceName, ImportDevicesRequestInner importDevicesParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters), serviceCallback); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobResponseInner object + */ + public Observable importDevicesAsync(String resourceGroupName, String resourceName, ImportDevicesRequestInner importDevicesParameters) { + return importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters).map(new Func1, JobResponseInner>() { + @Override + public JobResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobResponseInner object + */ + public Observable> importDevicesWithServiceResponseAsync(String resourceGroupName, String resourceName, ImportDevicesRequestInner importDevicesParameters) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (importDevicesParameters == null) { + throw new IllegalArgumentException("Parameter importDevicesParameters is required and cannot be null."); + } + Validator.validate(importDevicesParameters); + return service.importDevices(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), importDevicesParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = importDevicesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse importDevicesDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubDescriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a subscription. + * Get all the IoT hubs in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubDescriptionInner> 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubDescriptionInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IotHubDescriptionInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the IoT hubs in a resource group. + * Get all the IoT hubs in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubDescriptionInner> 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubSkuDescriptionInner> object if successful. + */ + public PagedList getValidSkusNext(final String nextPageLink) { + ServiceResponse> response = getValidSkusNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getValidSkusNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @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> getValidSkusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getValidSkusNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getValidSkusNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @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<IotHubSkuDescriptionInner> object + */ + public Observable> getValidSkusNextAsync(final String nextPageLink) { + return getValidSkusNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + * @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<IotHubSkuDescriptionInner> object + */ + public Observable>> getValidSkusNextWithServiceResponseAsync(final String nextPageLink) { + return getValidSkusNextSinglePageAsync(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(getValidSkusNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * Get the list of valid SKUs for an IoT hub. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubSkuDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getValidSkusNextSinglePageAsync(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.getValidSkusNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getValidSkusNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getValidSkusNextDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<EventHubConsumerGroupInfoInner> object if successful. + */ + public PagedList listEventHubConsumerGroupsNext(final String nextPageLink) { + ServiceResponse> response = listEventHubConsumerGroupsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listEventHubConsumerGroupsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @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> listEventHubConsumerGroupsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listEventHubConsumerGroupsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listEventHubConsumerGroupsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @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<EventHubConsumerGroupInfoInner> object + */ + public Observable> listEventHubConsumerGroupsNextAsync(final String nextPageLink) { + return listEventHubConsumerGroupsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @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<EventHubConsumerGroupInfoInner> object + */ + public Observable>> listEventHubConsumerGroupsNextWithServiceResponseAsync(final String nextPageLink) { + return listEventHubConsumerGroupsNextSinglePageAsync(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(listEventHubConsumerGroupsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventHubConsumerGroupInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listEventHubConsumerGroupsNextSinglePageAsync(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.listEventHubConsumerGroupsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listEventHubConsumerGroupsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listEventHubConsumerGroupsNextDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<JobResponseInner> object if successful. + */ + public PagedList listJobsNext(final String nextPageLink) { + ServiceResponse> response = listJobsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listJobsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @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> listJobsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listJobsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listJobsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @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<JobResponseInner> object + */ + public Observable> listJobsNextAsync(final String nextPageLink) { + return listJobsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @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<JobResponseInner> object + */ + public Observable>> listJobsNextWithServiceResponseAsync(final String nextPageLink) { + return listJobsNextSinglePageAsync(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(listJobsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobResponseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listJobsNextSinglePageAsync(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.listJobsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listJobsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listJobsNextDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<IotHubQuotaMetricInfoInner> object if successful. + */ + public PagedList getQuotaMetricsNext(final String nextPageLink) { + ServiceResponse> response = getQuotaMetricsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getQuotaMetricsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @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> getQuotaMetricsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getQuotaMetricsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getQuotaMetricsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @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<IotHubQuotaMetricInfoInner> object + */ + public Observable> getQuotaMetricsNextAsync(final String nextPageLink) { + return getQuotaMetricsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + * @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<IotHubQuotaMetricInfoInner> object + */ + public Observable>> getQuotaMetricsNextWithServiceResponseAsync(final String nextPageLink) { + return getQuotaMetricsNextSinglePageAsync(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(getQuotaMetricsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the quota metrics for an IoT hub. + * Get the quota metrics for an IoT hub. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IotHubQuotaMetricInfoInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getQuotaMetricsNextSinglePageAsync(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.getQuotaMetricsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getQuotaMetricsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getQuotaMetricsNextDelegate(Response response) throws ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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<SharedAccessSignatureAuthorizationRuleInner> 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 an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @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 an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @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<SharedAccessSignatureAuthorizationRuleInner> 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 an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @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<SharedAccessSignatureAuthorizationRuleInner> 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 an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessSignatureAuthorizationRuleInner> 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubSkuDescriptionInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubSkuDescriptionInner.java new file mode 100644 index 00000000000..75bf11a1c4e --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/IotHubSkuDescriptionInner.java @@ -0,0 +1,86 @@ +/** + * 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.iothub.implementation; + +import com.microsoft.azure.management.iothub.IotHubSkuInfo; +import com.microsoft.azure.management.iothub.IotHubCapacity; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU properties. + */ +public class IotHubSkuDescriptionInner { + /** + * The type of the resource. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /** + * The type of the resource. + */ + @JsonProperty(value = "sku", required = true) + private IotHubSkuInfo sku; + + /** + * The capacity property. + */ + @JsonProperty(value = "capacity", required = true) + private IotHubCapacity capacity; + + /** + * Get the resourceType value. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public IotHubSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the IotHubSkuDescriptionInner object itself. + */ + public IotHubSkuDescriptionInner withSku(IotHubSkuInfo sku) { + this.sku = sku; + return this; + } + + /** + * Get the capacity value. + * + * @return the capacity value + */ + public IotHubCapacity capacity() { + return this.capacity; + } + + /** + * Set the capacity value. + * + * @param capacity the capacity value to set + * @return the IotHubSkuDescriptionInner object itself. + */ + public IotHubSkuDescriptionInner withCapacity(IotHubCapacity capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/JobResponseInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/JobResponseInner.java new file mode 100644 index 00000000000..4604ac71464 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/JobResponseInner.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.iothub.implementation; + +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.microsoft.azure.management.iothub.JobType; +import com.microsoft.azure.management.iothub.JobStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the Job Response object. + */ +public class JobResponseInner { + /** + * The job identifier. + */ + @JsonProperty(value = "jobId", access = JsonProperty.Access.WRITE_ONLY) + private String jobId; + + /** + * The start time of the job. + */ + @JsonProperty(value = "startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 startTimeUtc; + + /** + * The time the job stopped processing. + */ + @JsonProperty(value = "endTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 endTimeUtc; + + /** + * The type of the job. Possible values include: 'unknown', 'export', + * 'import', 'backup', 'readDeviceProperties', 'writeDeviceProperties', + * 'updateDeviceConfiguration', 'rebootDevice', 'factoryResetDevice', + * 'firmwareUpdate'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private JobType type; + + /** + * The status of the job. Possible values include: 'unknown', 'enqueued', + * 'running', 'completed', 'failed', 'cancelled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private JobStatus status; + + /** + * If status == failed, this string containing the reason for the failure. + */ + @JsonProperty(value = "failureReason", access = JsonProperty.Access.WRITE_ONLY) + private String failureReason; + + /** + * The status message for the job. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private String statusMessage; + + /** + * The job identifier of the parent job, if any. + */ + @JsonProperty(value = "parentJobId", access = JsonProperty.Access.WRITE_ONLY) + private String parentJobId; + + /** + * Get the jobId value. + * + * @return the jobId value + */ + public String jobId() { + return this.jobId; + } + + /** + * Get the startTimeUtc value. + * + * @return the startTimeUtc value + */ + public DateTime startTimeUtc() { + if (this.startTimeUtc == null) { + return null; + } + return this.startTimeUtc.dateTime(); + } + + /** + * Get the endTimeUtc value. + * + * @return the endTimeUtc value + */ + public DateTime endTimeUtc() { + if (this.endTimeUtc == null) { + return null; + } + return this.endTimeUtc.dateTime(); + } + + /** + * Get the type value. + * + * @return the type value + */ + public JobType type() { + return this.type; + } + + /** + * Get the status value. + * + * @return the status value + */ + public JobStatus status() { + return this.status; + } + + /** + * Get the failureReason value. + * + * @return the failureReason value + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Get the statusMessage value. + * + * @return the statusMessage value + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Get the parentJobId value. + * + * @return the parentJobId value + */ + public String parentJobId() { + return this.parentJobId; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/OperationInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/OperationInner.java new file mode 100644 index 00000000000..995f205bae7 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub.implementation; + +import com.microsoft.azure.management.iothub.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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/OperationsInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/OperationsInner.java new file mode 100644 index 00000000000..d85e112b740 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub.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.iothub.ErrorDetailsInnerException; +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 IotHubClientImpl 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, IotHubClientImpl 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.iothub.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.iothub.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available IoT Hub REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + + /** + * Lists all of the available IoT Hub REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorDetailsInnerException 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 ErrorDetailsInnerException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorDetailsInnerException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorDetailsInnerException.class) + .build(response); + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/PageImpl.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/PageImpl.java new file mode 100644 index 00000000000..f81223ba029 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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.iothub.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-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/RegistryStatisticsInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/RegistryStatisticsInner.java new file mode 100644 index 00000000000..753359f194f --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/RegistryStatisticsInner.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.iothub.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity registry statistics. + */ +public class RegistryStatisticsInner { + /** + * The total count of devices in the identity registry. + */ + @JsonProperty(value = "totalDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long totalDeviceCount; + + /** + * The count of enabled devices in the identity registry. + */ + @JsonProperty(value = "enabledDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long enabledDeviceCount; + + /** + * The count of disabled devices in the identity registry. + */ + @JsonProperty(value = "disabledDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long disabledDeviceCount; + + /** + * Get the totalDeviceCount value. + * + * @return the totalDeviceCount value + */ + public Long totalDeviceCount() { + return this.totalDeviceCount; + } + + /** + * Get the enabledDeviceCount value. + * + * @return the enabledDeviceCount value + */ + public Long enabledDeviceCount() { + return this.enabledDeviceCount; + } + + /** + * Get the disabledDeviceCount value. + * + * @return the disabledDeviceCount value + */ + public Long disabledDeviceCount() { + return this.disabledDeviceCount; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/SharedAccessSignatureAuthorizationRuleInner.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/SharedAccessSignatureAuthorizationRuleInner.java new file mode 100644 index 00000000000..f30616676a4 --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/SharedAccessSignatureAuthorizationRuleInner.java @@ -0,0 +1,131 @@ +/** + * 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.iothub.implementation; + +import com.microsoft.azure.management.iothub.AccessRights; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of an IoT hub shared access policy. + */ +public class SharedAccessSignatureAuthorizationRuleInner { + /** + * The name of the shared access policy. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /** + * The primary key. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /** + * The secondary key. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /** + * The permissions assigned to the shared access policy. Possible values + * include: 'RegistryRead', 'RegistryWrite', 'ServiceConnect', + * 'DeviceConnect', 'RegistryRead, RegistryWrite', 'RegistryRead, + * ServiceConnect', 'RegistryRead, DeviceConnect', 'RegistryWrite, + * ServiceConnect', 'RegistryWrite, DeviceConnect', 'ServiceConnect, + * DeviceConnect', 'RegistryRead, RegistryWrite, ServiceConnect', + * 'RegistryRead, RegistryWrite, DeviceConnect', 'RegistryRead, + * ServiceConnect, DeviceConnect', 'RegistryWrite, ServiceConnect, + * DeviceConnect', 'RegistryRead, RegistryWrite, ServiceConnect, + * DeviceConnect'. + */ + @JsonProperty(value = "rights", required = true) + private AccessRights 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 SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner 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 SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner 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 SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the rights value. + * + * @return the rights value + */ + public AccessRights rights() { + return this.rights; + } + + /** + * Set the rights value. + * + * @param rights the rights value to set + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withRights(AccessRights rights) { + this.rights = rights; + return this; + } + +} diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/package-info.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/implementation/package-info.java new file mode 100644 index 00000000000..34bd7a6fcdc --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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 IotHubClient. + * Use this API to manage the IoT hubs in your Azure subscription. + */ +package com.microsoft.azure.management.iothub.implementation; diff --git a/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/package-info.java b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/package-info.java new file mode 100644 index 00000000000..54643943eac --- /dev/null +++ b/azure-mgmt-iothub/src/main/java/com/microsoft/azure/management/iothub/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 IotHubClient. + * Use this API to manage the IoT hubs in your Azure subscription. + */ +package com.microsoft.azure.management.iothub;