diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/pom.xml b/sdk/eventhubs/mgmt-v2018_01_01_preview/pom.xml index d58fee6e6779..b702a03e5233 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/pom.xml +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.2.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-eventhubs @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/AccessKeys.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/AccessKeys.java new file mode 100644 index 000000000000..27e7706789bb --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/AccessKeys.java @@ -0,0 +1,55 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.AccessKeysInner; + +/** + * Type representing AccessKeys. + */ +public interface AccessKeys extends HasInner, HasManager { + /** + * @return the aliasPrimaryConnectionString value. + */ + String aliasPrimaryConnectionString(); + + /** + * @return the aliasSecondaryConnectionString value. + */ + String aliasSecondaryConnectionString(); + + /** + * @return the keyName value. + */ + String keyName(); + + /** + * @return the primaryConnectionString value. + */ + String primaryConnectionString(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryConnectionString value. + */ + String secondaryConnectionString(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/AccessRights.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/AccessRights.java new file mode 100644 index 000000000000..e2126a47c1a9 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/AccessRights.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.eventhubs.v2018_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AccessRights. + */ +public final class AccessRights extends ExpandableStringEnum { + /** Static value Manage for AccessRights. */ + public static final AccessRights MANAGE = fromString("Manage"); + + /** Static value Send for AccessRights. */ + public static final AccessRights SEND = fromString("Send"); + + /** Static value Listen for AccessRights. */ + public static final AccessRights LISTEN = fromString("Listen"); + + /** + * Creates or finds a AccessRights from its string representation. + * @param name a name to look for + * @return the corresponding AccessRights + */ + @JsonCreator + public static AccessRights fromString(String name) { + return fromString(name, AccessRights.class); + } + + /** + * @return known AccessRights values + */ + public static Collection values() { + return values(AccessRights.class); + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ArmDisasterRecovery.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ArmDisasterRecovery.java new file mode 100644 index 000000000000..f3b28131ad4e --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ArmDisasterRecovery.java @@ -0,0 +1,161 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.ArmDisasterRecoveryInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; + +/** + * Type representing ArmDisasterRecovery. + */ +public interface ArmDisasterRecovery extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the alternateName value. + */ + String alternateName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerNamespace value. + */ + String partnerNamespace(); + + /** + * @return the pendingReplicationOperationsCount value. + */ + Long pendingReplicationOperationsCount(); + + /** + * @return the provisioningState value. + */ + ProvisioningStateDR provisioningState(); + + /** + * @return the role value. + */ + RoleDisasterRecovery role(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ArmDisasterRecovery definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of ArmDisasterRecovery definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ArmDisasterRecovery definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the armdisasterrecovery definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the resource group within the Azure subscription + * @param namespaceName The Namespace name + * @return the next definition stage + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the armdisasterrecovery definition allowing to specify AlternateName. + */ + interface WithAlternateName { + /** + * Specifies alternateName. + * @param alternateName Alternate name specified when alias and namespace names are same + * @return the next definition stage + */ + WithCreate withAlternateName(String alternateName); + } + + /** + * The stage of the armdisasterrecovery definition allowing to specify PartnerNamespace. + */ + interface WithPartnerNamespace { + /** + * Specifies partnerNamespace. + * @param partnerNamespace ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + * @return the next definition stage + */ + WithCreate withPartnerNamespace(String partnerNamespace); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAlternateName, DefinitionStages.WithPartnerNamespace { + } + } + /** + * The template for a ArmDisasterRecovery update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAlternateName, UpdateStages.WithPartnerNamespace { + } + + /** + * Grouping of ArmDisasterRecovery update stages. + */ + interface UpdateStages { + /** + * The stage of the armdisasterrecovery update allowing to specify AlternateName. + */ + interface WithAlternateName { + /** + * Specifies alternateName. + * @param alternateName Alternate name specified when alias and namespace names are same + * @return the next update stage + */ + Update withAlternateName(String alternateName); + } + + /** + * The stage of the armdisasterrecovery update allowing to specify PartnerNamespace. + */ + interface WithPartnerNamespace { + /** + * Specifies partnerNamespace. + * @param partnerNamespace ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + * @return the next update stage + */ + Update withPartnerNamespace(String partnerNamespace); + } + + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CaptureDescription.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CaptureDescription.java new file mode 100644 index 000000000000..aa488dbf1914 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CaptureDescription.java @@ -0,0 +1,179 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to configure capture description for eventhub. + */ +public class CaptureDescription { + /** + * A value that indicates whether capture description is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Enumerates the possible values for the encoding format of capture + * description. Note: 'AvroDeflate' will be deprecated in New API Version. + * Possible values include: 'Avro', 'AvroDeflate'. + */ + @JsonProperty(value = "encoding") + private EncodingCaptureDescription encoding; + + /** + * The time window allows you to set the frequency with which the capture + * to Azure Blobs will happen, value should between 60 to 900 seconds. + */ + @JsonProperty(value = "intervalInSeconds") + private Integer intervalInSeconds; + + /** + * The size window defines the amount of data built up in your Event Hub + * before an capture operation, value should be between 10485760 to + * 524288000 bytes. + */ + @JsonProperty(value = "sizeLimitInBytes") + private Integer sizeLimitInBytes; + + /** + * Properties of Destination where capture will be stored. (Storage + * Account, Blob Names). + */ + @JsonProperty(value = "destination") + private Destination destination; + + /** + * A value that indicates whether to Skip Empty Archives. + */ + @JsonProperty(value = "skipEmptyArchives") + private Boolean skipEmptyArchives; + + /** + * Get a value that indicates whether capture description is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set a value that indicates whether capture description is enabled. + * + * @param enabled the enabled value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version. Possible values include: 'Avro', 'AvroDeflate'. + * + * @return the encoding value + */ + public EncodingCaptureDescription encoding() { + return this.encoding; + } + + /** + * Set enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version. Possible values include: 'Avro', 'AvroDeflate'. + * + * @param encoding the encoding value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withEncoding(EncodingCaptureDescription encoding) { + this.encoding = encoding; + return this; + } + + /** + * Get the time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. + * + * @return the intervalInSeconds value + */ + public Integer intervalInSeconds() { + return this.intervalInSeconds; + } + + /** + * Set the time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. + * + * @param intervalInSeconds the intervalInSeconds value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withIntervalInSeconds(Integer intervalInSeconds) { + this.intervalInSeconds = intervalInSeconds; + return this; + } + + /** + * Get the size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 to 524288000 bytes. + * + * @return the sizeLimitInBytes value + */ + public Integer sizeLimitInBytes() { + return this.sizeLimitInBytes; + } + + /** + * Set the size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 to 524288000 bytes. + * + * @param sizeLimitInBytes the sizeLimitInBytes value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withSizeLimitInBytes(Integer sizeLimitInBytes) { + this.sizeLimitInBytes = sizeLimitInBytes; + return this; + } + + /** + * Get properties of Destination where capture will be stored. (Storage Account, Blob Names). + * + * @return the destination value + */ + public Destination destination() { + return this.destination; + } + + /** + * Set properties of Destination where capture will be stored. (Storage Account, Blob Names). + * + * @param destination the destination value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withDestination(Destination destination) { + this.destination = destination; + return this; + } + + /** + * Get a value that indicates whether to Skip Empty Archives. + * + * @return the skipEmptyArchives value + */ + public Boolean skipEmptyArchives() { + return this.skipEmptyArchives; + } + + /** + * Set a value that indicates whether to Skip Empty Archives. + * + * @param skipEmptyArchives the skipEmptyArchives value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withSkipEmptyArchives(Boolean skipEmptyArchives) { + this.skipEmptyArchives = skipEmptyArchives; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CheckNameAvailabilityParameter.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CheckNameAvailabilityParameter.java new file mode 100644 index 000000000000..e5f0889079d5 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CheckNameAvailabilityParameter.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameter supplied to check Namespace name availability operation. + */ +public class CheckNameAvailabilityParameter { + /** + * Name to check the namespace name availability. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get name to check the namespace name availability. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name to check the namespace name availability. + * + * @param name the name value to set + * @return the CheckNameAvailabilityParameter object itself. + */ + public CheckNameAvailabilityParameter withName(String name) { + this.name = name; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CheckNameAvailabilityResult.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..6cb18f38a46e --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/CheckNameAvailabilityResult.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.CheckNameAvailabilityResultInner; + +/** + * Type representing CheckNameAvailabilityResult. + */ +public interface CheckNameAvailabilityResult extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + UnavailableReason reason(); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ConsumerGroup.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ConsumerGroup.java new file mode 100644 index 000000000000..529a130f9210 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ConsumerGroup.java @@ -0,0 +1,129 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.ConsumerGroupInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import org.joda.time.DateTime; + +/** + * Type representing ConsumerGroup. + */ +public interface ConsumerGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * @return the userMetadata value. + */ + String userMetadata(); + + /** + * The entirety of the ConsumerGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithEventhub, DefinitionStages.WithUserMetadata, DefinitionStages.WithCreate { + } + + /** + * Grouping of ConsumerGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ConsumerGroup definition. + */ + interface Blank extends WithEventhub { + } + + /** + * The stage of the consumergroup definition allowing to specify Eventhub. + */ + interface WithEventhub { + /** + * Specifies resourceGroupName, namespaceName, eventHubName. + * @param resourceGroupName Name of the resource group within the Azure subscription + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @return the next definition stage + */ + WithUserMetadata withExistingEventhub(String resourceGroupName, String namespaceName, String eventHubName); + } + + /** + * The stage of the consumergroup definition allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored + * @return the next definition stage + */ + WithCreate withUserMetadata(String userMetadata); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a ConsumerGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithUserMetadata { + } + + /** + * Grouping of ConsumerGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the consumergroup update allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored + * @return the next update stage + */ + Update withUserMetadata(String userMetadata); + } + + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ConsumerGroups.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ConsumerGroups.java new file mode 100644 index 000000000000..45df7db7d3e0 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ConsumerGroups.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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.ConsumerGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ConsumerGroups. + */ +public interface ConsumerGroups extends SupportsCreating, HasInner { + /** + * Gets a description for the specified consumer group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName); + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName); + + /** + * Deletes a consumer group from the specified Event Hub and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Destination.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Destination.java new file mode 100644 index 000000000000..c6dddb286911 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Destination.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Capture storage details for capture description. + */ +@JsonFlatten +public class Destination { + /** + * Name for capture destination. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Resource id of the storage account to be used to create the blobs. + */ + @JsonProperty(value = "properties.storageAccountResourceId") + private String storageAccountResourceId; + + /** + * Blob container Name. + */ + @JsonProperty(value = "properties.blobContainer") + private String blobContainer; + + /** + * Blob naming convention for archive, e.g. + * {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. + * Here all the parameters (Namespace,EventHub .. etc) are mandatory + * irrespective of order. + */ + @JsonProperty(value = "properties.archiveNameFormat") + private String archiveNameFormat; + + /** + * Get name for capture destination. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name for capture destination. + * + * @param name the name value to set + * @return the Destination object itself. + */ + public Destination withName(String name) { + this.name = name; + return this; + } + + /** + * Get resource id of the storage account to be used to create the blobs. + * + * @return the storageAccountResourceId value + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set resource id of the storage account to be used to create the blobs. + * + * @param storageAccountResourceId the storageAccountResourceId value to set + * @return the Destination object itself. + */ + public Destination withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get blob container Name. + * + * @return the blobContainer value + */ + public String blobContainer() { + return this.blobContainer; + } + + /** + * Set blob container Name. + * + * @param blobContainer the blobContainer value to set + * @return the Destination object itself. + */ + public Destination withBlobContainer(String blobContainer) { + this.blobContainer = blobContainer; + return this; + } + + /** + * Get blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + * + * @return the archiveNameFormat value + */ + public String archiveNameFormat() { + return this.archiveNameFormat; + } + + /** + * Set blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + * + * @param archiveNameFormat the archiveNameFormat value to set + * @return the Destination object itself. + */ + public Destination withArchiveNameFormat(String archiveNameFormat) { + this.archiveNameFormat = archiveNameFormat; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/DisasterRecoveryConfigNamespaceAuthorizationRule.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/DisasterRecoveryConfigNamespaceAuthorizationRule.java new file mode 100644 index 000000000000..84740a64eac5 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/DisasterRecoveryConfigNamespaceAuthorizationRule.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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import java.util.List; + +/** + * Type representing DisasterRecoveryConfigNamespaceAuthorizationRule. + */ +public interface DisasterRecoveryConfigNamespaceAuthorizationRule extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/DisasterRecoveryConfigs.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/DisasterRecoveryConfigs.java new file mode 100644 index 000000000000..f6b8986fa451 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/DisasterRecoveryConfigs.java @@ -0,0 +1,122 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.DisasterRecoveryConfigsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigNamespaceAuthorizationRule; + +/** + * Type representing DisasterRecoveryConfigs. + */ +public interface DisasterRecoveryConfigs extends SupportsCreating, HasInner { + /** + * Check the give Namespace name availability. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String resourceGroupName, String namespaceName, String name); + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable breakPairingAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failOverAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName); + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias); + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EHNamespace.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EHNamespace.java index 168d7ee6b9de..e3635f3c49f1 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EHNamespace.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EHNamespace.java @@ -25,11 +25,26 @@ * Type representing EHNamespace. */ public interface EHNamespace extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the clusterArmId value. + */ + String clusterArmId(); + /** * @return the createdAt value. */ DateTime createdAt(); + /** + * @return the encryption value. + */ + Encryption encryption(); + + /** + * @return the identity value. + */ + Identity identity(); + /** * @return the isAutoInflateEnabled value. */ @@ -97,6 +112,42 @@ interface Blank extends GroupableResourceCore.DefinitionWithRegion { interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { } + /** + * The stage of the ehnamespace definition allowing to specify ClusterArmId. + */ + interface WithClusterArmId { + /** + * Specifies clusterArmId. + * @param clusterArmId Cluster ARM ID of the Namespace + * @return the next definition stage + */ + WithCreate withClusterArmId(String clusterArmId); + } + + /** + * The stage of the ehnamespace definition allowing to specify Encryption. + */ + interface WithEncryption { + /** + * Specifies encryption. + * @param encryption Properties of BYOK Encryption description + * @return the next definition stage + */ + WithCreate withEncryption(Encryption encryption); + } + + /** + * The stage of the ehnamespace definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity Properties of BYOK Identity description + * @return the next definition stage + */ + WithCreate withIdentity(Identity identity); + } + /** * The stage of the ehnamespace definition allowing to specify IsAutoInflateEnabled. */ @@ -162,19 +213,55 @@ interface WithZoneRedundant { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithIsAutoInflateEnabled, DefinitionStages.WithKafkaEnabled, DefinitionStages.WithMaximumThroughputUnits, DefinitionStages.WithSku, DefinitionStages.WithZoneRedundant { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithClusterArmId, DefinitionStages.WithEncryption, DefinitionStages.WithIdentity, DefinitionStages.WithIsAutoInflateEnabled, DefinitionStages.WithKafkaEnabled, DefinitionStages.WithMaximumThroughputUnits, DefinitionStages.WithSku, DefinitionStages.WithZoneRedundant { } } /** * The template for a EHNamespace update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithIsAutoInflateEnabled, UpdateStages.WithKafkaEnabled, UpdateStages.WithMaximumThroughputUnits, UpdateStages.WithSku, UpdateStages.WithZoneRedundant { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithClusterArmId, UpdateStages.WithEncryption, UpdateStages.WithIdentity, UpdateStages.WithIsAutoInflateEnabled, UpdateStages.WithKafkaEnabled, UpdateStages.WithMaximumThroughputUnits, UpdateStages.WithSku, UpdateStages.WithZoneRedundant { } /** * Grouping of EHNamespace update stages. */ interface UpdateStages { + /** + * The stage of the ehnamespace update allowing to specify ClusterArmId. + */ + interface WithClusterArmId { + /** + * Specifies clusterArmId. + * @param clusterArmId Cluster ARM ID of the Namespace + * @return the next update stage + */ + Update withClusterArmId(String clusterArmId); + } + + /** + * The stage of the ehnamespace update allowing to specify Encryption. + */ + interface WithEncryption { + /** + * Specifies encryption. + * @param encryption Properties of BYOK Encryption description + * @return the next update stage + */ + Update withEncryption(Encryption encryption); + } + + /** + * The stage of the ehnamespace update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity Properties of BYOK Identity description + * @return the next update stage + */ + Update withIdentity(Identity identity); + } + /** * The stage of the ehnamespace update allowing to specify IsAutoInflateEnabled. */ diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EncodingCaptureDescription.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EncodingCaptureDescription.java new file mode 100644 index 000000000000..6c746391c924 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EncodingCaptureDescription.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EncodingCaptureDescription. + */ +public enum EncodingCaptureDescription { + /** Enum value Avro. */ + AVRO("Avro"), + + /** Enum value AvroDeflate. */ + AVRO_DEFLATE("AvroDeflate"); + + /** The actual serialized value for a EncodingCaptureDescription instance. */ + private String value; + + EncodingCaptureDescription(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EncodingCaptureDescription instance. + * + * @param value the serialized value to parse. + * @return the parsed EncodingCaptureDescription object, or null if unable to parse. + */ + @JsonCreator + public static EncodingCaptureDescription fromString(String value) { + EncodingCaptureDescription[] items = EncodingCaptureDescription.values(); + for (EncodingCaptureDescription item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Encryption.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Encryption.java new file mode 100644 index 000000000000..e4b5d69cfd6a --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Encryption.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to configure Encryption. + */ +public class Encryption { + /** + * Properties of KeyVault. + */ + @JsonProperty(value = "keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /** + * Enumerates the possible value of keySource for Encryption. Possible + * values include: 'Microsoft.KeyVault'. + */ + @JsonProperty(value = "keySource") + private KeySource keySource; + + /** + * Get properties of KeyVault. + * + * @return the keyVaultProperties value + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set properties of KeyVault. + * + * @param keyVaultProperties the keyVaultProperties value to set + * @return the Encryption object itself. + */ + public Encryption withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get enumerates the possible value of keySource for Encryption. Possible values include: 'Microsoft.KeyVault'. + * + * @return the keySource value + */ + public KeySource keySource() { + return this.keySource; + } + + /** + * Set enumerates the possible value of keySource for Encryption. Possible values include: 'Microsoft.KeyVault'. + * + * @param keySource the keySource value to set + * @return the Encryption object itself. + */ + public Encryption withKeySource(KeySource keySource) { + this.keySource = keySource; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EntityStatus.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EntityStatus.java new file mode 100644 index 000000000000..1824ae835b13 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EntityStatus.java @@ -0,0 +1,74 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EntityStatus. + */ +public enum EntityStatus { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Restoring. */ + RESTORING("Restoring"), + + /** Enum value SendDisabled. */ + SEND_DISABLED("SendDisabled"), + + /** Enum value ReceiveDisabled. */ + RECEIVE_DISABLED("ReceiveDisabled"), + + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Renaming. */ + RENAMING("Renaming"), + + /** Enum value Unknown. */ + UNKNOWN("Unknown"); + + /** The actual serialized value for a EntityStatus instance. */ + private String value; + + EntityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EntityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed EntityStatus object, or null if unable to parse. + */ + @JsonCreator + public static EntityStatus fromString(String value) { + EntityStatus[] items = EntityStatus.values(); + for (EntityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EventHubs.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EventHubs.java new file mode 100644 index 000000000000..9c893e7be366 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EventHubs.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventhubNamespaceAuthorizationRule; + +/** + * Type representing EventHubs. + */ +public interface EventHubs extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + EventhubNamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Gets an Event Hubs description for the specified Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName); + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes an Event Hub from the specified Namespace and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String eventHubName); + + /** + * Gets an AuthorizationRule for an Event Hub by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName); + + /** + * Gets the authorization rules for an Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String eventHubName); + + /** + * Deletes an Event Hub AuthorizationRule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName); + + /** + * Gets the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName); + + /** + * Regenerates the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/SecondaryKey). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Eventhub.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Eventhub.java new file mode 100644 index 000000000000..17cdb1bf4e7c --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Eventhub.java @@ -0,0 +1,221 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventhubInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing Eventhub. + */ +public interface Eventhub extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the captureDescription value. + */ + CaptureDescription captureDescription(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the messageRetentionInDays value. + */ + Long messageRetentionInDays(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partitionCount value. + */ + Long partitionCount(); + + /** + * @return the partitionIds value. + */ + List partitionIds(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the Eventhub definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of Eventhub definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Eventhub definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the eventhub definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the resource group within the Azure subscription + * @param namespaceName The Namespace name + * @return the next definition stage + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the eventhub definition allowing to specify CaptureDescription. + */ + interface WithCaptureDescription { + /** + * Specifies captureDescription. + * @param captureDescription Properties of capture description + * @return the next definition stage + */ + WithCreate withCaptureDescription(CaptureDescription captureDescription); + } + + /** + * The stage of the eventhub definition allowing to specify MessageRetentionInDays. + */ + interface WithMessageRetentionInDays { + /** + * Specifies messageRetentionInDays. + * @param messageRetentionInDays Number of days to retain the events for this Event Hub, value should be 1 to 7 days + * @return the next definition stage + */ + WithCreate withMessageRetentionInDays(Long messageRetentionInDays); + } + + /** + * The stage of the eventhub definition allowing to specify PartitionCount. + */ + interface WithPartitionCount { + /** + * Specifies partitionCount. + * @param partitionCount Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions + * @return the next definition stage + */ + WithCreate withPartitionCount(Long partitionCount); + } + + /** + * The stage of the eventhub definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCaptureDescription, DefinitionStages.WithMessageRetentionInDays, DefinitionStages.WithPartitionCount, DefinitionStages.WithStatus { + } + } + /** + * The template for a Eventhub update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCaptureDescription, UpdateStages.WithMessageRetentionInDays, UpdateStages.WithPartitionCount, UpdateStages.WithStatus { + } + + /** + * Grouping of Eventhub update stages. + */ + interface UpdateStages { + /** + * The stage of the eventhub update allowing to specify CaptureDescription. + */ + interface WithCaptureDescription { + /** + * Specifies captureDescription. + * @param captureDescription Properties of capture description + * @return the next update stage + */ + Update withCaptureDescription(CaptureDescription captureDescription); + } + + /** + * The stage of the eventhub update allowing to specify MessageRetentionInDays. + */ + interface WithMessageRetentionInDays { + /** + * Specifies messageRetentionInDays. + * @param messageRetentionInDays Number of days to retain the events for this Event Hub, value should be 1 to 7 days + * @return the next update stage + */ + Update withMessageRetentionInDays(Long messageRetentionInDays); + } + + /** + * The stage of the eventhub update allowing to specify PartitionCount. + */ + interface WithPartitionCount { + /** + * Specifies partitionCount. + * @param partitionCount Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions + * @return the next update stage + */ + Update withPartitionCount(Long partitionCount); + } + + /** + * The stage of the eventhub update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EventhubNamespaceAuthorizationRule.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EventhubNamespaceAuthorizationRule.java new file mode 100644 index 000000000000..5787f366c462 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/EventhubNamespaceAuthorizationRule.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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import java.util.List; + +/** + * Type representing EventhubNamespaceAuthorizationRule. + */ +public interface EventhubNamespaceAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the EventhubNamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithEventhub, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of EventhubNamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a EventhubNamespaceAuthorizationRule definition. + */ + interface Blank extends WithEventhub { + } + + /** + * The stage of the eventhubnamespaceauthorizationrule definition allowing to specify Eventhub. + */ + interface WithEventhub { + /** + * Specifies resourceGroupName, namespaceName, eventHubName. + * @param resourceGroupName Name of the resource group within the Azure subscription + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @return the next definition stage + */ + WithRights withExistingEventhub(String resourceGroupName, String namespaceName, String eventHubName); + } + + /** + * The stage of the eventhubnamespaceauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a EventhubNamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of EventhubNamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the eventhubnamespaceauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Identity.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Identity.java new file mode 100644 index 000000000000..86d459330076 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Identity.java @@ -0,0 +1,96 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to configure Identity for Bring your Own Keys. + */ +public class Identity { + /** + * ObjectId from the KeyVault. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * TenantId from the KeyVault. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Enumerates the possible value Identity type, which currently supports + * only 'SystemAssigned'. Possible values include: 'SystemAssigned'. + */ + @JsonProperty(value = "type") + private IdentityType type; + + /** + * Get objectId from the KeyVault. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set objectId from the KeyVault. + * + * @param principalId the principalId value to set + * @return the Identity object itself. + */ + public Identity withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get tenantId from the KeyVault. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set tenantId from the KeyVault. + * + * @param tenantId the tenantId value to set + * @return the Identity object itself. + */ + public Identity withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get enumerates the possible value Identity type, which currently supports only 'SystemAssigned'. Possible values include: 'SystemAssigned'. + * + * @return the type value + */ + public IdentityType type() { + return this.type; + } + + /** + * Set enumerates the possible value Identity type, which currently supports only 'SystemAssigned'. Possible values include: 'SystemAssigned'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/IdentityType.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/IdentityType.java new file mode 100644 index 000000000000..5ba624f01cc3 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/IdentityType.java @@ -0,0 +1,50 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IdentityType. + */ +public enum IdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a IdentityType instance. */ + private String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeySource.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeySource.java new file mode 100644 index 000000000000..ed68de3c2ac7 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeySource.java @@ -0,0 +1,50 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeySource. + */ +public enum KeySource { + /** Enum value Microsoft.KeyVault. */ + MICROSOFT_KEY_VAULT("Microsoft.KeyVault"); + + /** The actual serialized value for a KeySource instance. */ + private String value; + + KeySource(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeySource instance. + * + * @param value the serialized value to parse. + * @return the parsed KeySource object, or null if unable to parse. + */ + @JsonCreator + public static KeySource fromString(String value) { + KeySource[] items = KeySource.values(); + for (KeySource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeyType.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeyType.java new file mode 100644 index 000000000000..09268288fe41 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeyType.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyType. + */ +public enum KeyType { + /** Enum value PrimaryKey. */ + PRIMARY_KEY("PrimaryKey"), + + /** Enum value SecondaryKey. */ + SECONDARY_KEY("SecondaryKey"); + + /** The actual serialized value for a KeyType instance. */ + private String value; + + KeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyType object, or null if unable to parse. + */ + @JsonCreator + public static KeyType fromString(String value) { + KeyType[] items = KeyType.values(); + for (KeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeyVaultProperties.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeyVaultProperties.java new file mode 100644 index 000000000000..8815909abcd8 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/KeyVaultProperties.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to configure keyVault Properties. + */ +public class KeyVaultProperties { + /** + * Name of the Key from KeyVault. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * Uri of KeyVault. + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /** + * Get name of the Key from KeyVault. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set name of the Key from KeyVault. + * + * @param keyName the keyName value to set + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get uri of KeyVault. + * + * @return the keyVaultUri value + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set uri of KeyVault. + * + * @param keyVaultUri the keyVaultUri value to set + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/MessagingRegions.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/MessagingRegions.java new file mode 100644 index 000000000000..af41c821243e --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/MessagingRegions.java @@ -0,0 +1,51 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.MessagingRegionsInner; +import java.util.Map; + +/** + * Type representing MessagingRegions. + */ +public interface MessagingRegions extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + MessagingRegionsProperties properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/MessagingRegionsProperties.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/MessagingRegionsProperties.java new file mode 100644 index 000000000000..5b7949c93b17 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/MessagingRegionsProperties.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MessagingRegionsProperties model. + */ +public class MessagingRegionsProperties { + /** + * Region code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Full name of the region. + */ + @JsonProperty(value = "fullName", access = JsonProperty.Access.WRITE_ONLY) + private String fullName; + + /** + * Get region code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get full name of the region. + * + * @return the fullName value + */ + public String fullName() { + return this.fullName; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NamespaceAuthorizationRule.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NamespaceAuthorizationRule.java new file mode 100644 index 000000000000..7f5d49076e88 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NamespaceAuthorizationRule.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.eventhubs.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; +import java.util.List; + +/** + * Type representing NamespaceAuthorizationRule. + */ +public interface NamespaceAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the NamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of NamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NamespaceAuthorizationRule definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the namespaceauthorizationrule definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the resource group within the Azure subscription + * @param namespaceName The Namespace name + * @return the next definition stage + */ + WithRights withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the namespaceauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a NamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of NamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the namespaceauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Namespaces.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Namespaces.java index 43f0faada39a..b0a36fcf58bc 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Namespaces.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Namespaces.java @@ -20,7 +20,9 @@ import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.IpFilterRule; import rx.Completable; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.VirtualNetworkRule; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NetworkRuleSet; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.NetworkRuleSetInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NamespaceAuthorizationRule; /** * Type representing Namespaces. @@ -40,6 +42,22 @@ public interface Namespaces extends SupportsCreating checkNameAvailabilityAsync(String name); + /** * Gets an IpFilterRule for a Namespace by rule name. * @@ -104,6 +122,16 @@ public interface Namespaces extends SupportsCreating listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName); + /** * Create or update NetworkRuleSet for a Namespace. * @@ -125,4 +153,59 @@ public interface Namespaces extends SupportsCreating getNetworkRuleSetAsync(String resourceGroupName, String namespaceName); + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes an AuthorizationRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings for the specified Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters required to regenerate the connection string. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NetworkRuleSet.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NetworkRuleSet.java index 23b2e4cd1060..6a2c9861aeb8 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NetworkRuleSet.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/NetworkRuleSet.java @@ -9,9 +9,9 @@ package com.microsoft.azure.management.eventhubs.v2018_01_01_preview; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.NetworkRuleSetInner; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.EventHubsManager; -import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.NetworkRuleSetInner; import java.util.List; /** diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ProvisioningStateDR.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ProvisioningStateDR.java new file mode 100644 index 000000000000..9a3c3b44c487 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/ProvisioningStateDR.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningStateDR. + */ +public enum ProvisioningStateDR { + /** Enum value Accepted. */ + ACCEPTED("Accepted"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Failed. */ + FAILED("Failed"); + + /** The actual serialized value for a ProvisioningStateDR instance. */ + private String value; + + ProvisioningStateDR(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningStateDR instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningStateDR object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningStateDR fromString(String value) { + ProvisioningStateDR[] items = ProvisioningStateDR.values(); + for (ProvisioningStateDR item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/RegenerateAccessKeyParameters.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/RegenerateAccessKeyParameters.java new file mode 100644 index 000000000000..b9cbfbc5ebd2 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/RegenerateAccessKeyParameters.java @@ -0,0 +1,72 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the Regenerate Authorization Rule operation, + * specifies which key needs to be reset. + */ +public class RegenerateAccessKeyParameters { + /** + * The access key to regenerate. Possible values include: 'PrimaryKey', + * 'SecondaryKey'. + */ + @JsonProperty(value = "keyType", required = true) + private KeyType keyType; + + /** + * Optional, if the key value provided, is set for KeyType or autogenerated + * Key value set for keyType. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get the access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey'. + * + * @return the keyType value + */ + public KeyType keyType() { + return this.keyType; + } + + /** + * Set the access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey'. + * + * @param keyType the keyType value to set + * @return the RegenerateAccessKeyParameters object itself. + */ + public RegenerateAccessKeyParameters withKeyType(KeyType keyType) { + this.keyType = keyType; + return this; + } + + /** + * Get optional, if the key value provided, is set for KeyType or autogenerated Key value set for keyType. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set optional, if the key value provided, is set for KeyType or autogenerated Key value set for keyType. + * + * @param key the key value to set + * @return the RegenerateAccessKeyParameters object itself. + */ + public RegenerateAccessKeyParameters withKey(String key) { + this.key = key; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Regions.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Regions.java new file mode 100644 index 000000000000..e78411cb3033 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/Regions.java @@ -0,0 +1,28 @@ +/** + * 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.eventhubs.v2018_01_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation.RegionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Regions. + */ +public interface Regions extends HasInner { + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySkuAsync(final String sku); + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/RoleDisasterRecovery.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/RoleDisasterRecovery.java new file mode 100644 index 000000000000..34eec0bd0ca5 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/RoleDisasterRecovery.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RoleDisasterRecovery. + */ +public enum RoleDisasterRecovery { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value PrimaryNotReplicating. */ + PRIMARY_NOT_REPLICATING("PrimaryNotReplicating"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"); + + /** The actual serialized value for a RoleDisasterRecovery instance. */ + private String value; + + RoleDisasterRecovery(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RoleDisasterRecovery instance. + * + * @param value the serialized value to parse. + * @return the parsed RoleDisasterRecovery object, or null if unable to parse. + */ + @JsonCreator + public static RoleDisasterRecovery fromString(String value) { + RoleDisasterRecovery[] items = RoleDisasterRecovery.values(); + for (RoleDisasterRecovery item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/UnavailableReason.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/UnavailableReason.java new file mode 100644 index 000000000000..f7e7b473c019 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/UnavailableReason.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.eventhubs.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for UnavailableReason. + */ +public enum UnavailableReason { + /** Enum value None. */ + NONE("None"), + + /** Enum value InvalidName. */ + INVALID_NAME("InvalidName"), + + /** Enum value SubscriptionIsDisabled. */ + SUBSCRIPTION_IS_DISABLED("SubscriptionIsDisabled"), + + /** Enum value NameInUse. */ + NAME_IN_USE("NameInUse"), + + /** Enum value NameInLockdown. */ + NAME_IN_LOCKDOWN("NameInLockdown"), + + /** Enum value TooManyNamespaceInCurrentSubscription. */ + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION("TooManyNamespaceInCurrentSubscription"); + + /** The actual serialized value for a UnavailableReason instance. */ + private String value; + + UnavailableReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnavailableReason instance. + * + * @param value the serialized value to parse. + * @return the parsed UnavailableReason object, or null if unable to parse. + */ + @JsonCreator + public static UnavailableReason fromString(String value) { + UnavailableReason[] items = UnavailableReason.values(); + for (UnavailableReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AccessKeysImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AccessKeysImpl.java new file mode 100644 index 000000000000..65464fcafe86 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AccessKeysImpl.java @@ -0,0 +1,61 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AccessKeysImpl extends WrapperImpl implements AccessKeys { + private final EventHubsManager manager; + AccessKeysImpl(AccessKeysInner inner, EventHubsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public String aliasPrimaryConnectionString() { + return this.inner().aliasPrimaryConnectionString(); + } + + @Override + public String aliasSecondaryConnectionString() { + return this.inner().aliasSecondaryConnectionString(); + } + + @Override + public String keyName() { + return this.inner().keyName(); + } + + @Override + public String primaryConnectionString() { + return this.inner().primaryConnectionString(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryConnectionString() { + return this.inner().secondaryConnectionString(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AccessKeysInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AccessKeysInner.java new file mode 100644 index 000000000000..4d6a1262db2a --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AccessKeysInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Namespace/EventHub Connection String. + */ +public class AccessKeysInner { + /** + * Primary connection string of the created namespace AuthorizationRule. + */ + @JsonProperty(value = "primaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String primaryConnectionString; + + /** + * Secondary connection string of the created namespace AuthorizationRule. + */ + @JsonProperty(value = "secondaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryConnectionString; + + /** + * Primary connection string of the alias if GEO DR is enabled. + */ + @JsonProperty(value = "aliasPrimaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String aliasPrimaryConnectionString; + + /** + * Secondary connection string of the alias if GEO DR is enabled. + */ + @JsonProperty(value = "aliasSecondaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String aliasSecondaryConnectionString; + + /** + * A base64-encoded 256-bit primary key for signing and validating the SAS + * token. + */ + @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryKey; + + /** + * A base64-encoded 256-bit primary key for signing and validating the SAS + * token. + */ + @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryKey; + + /** + * A string that describes the AuthorizationRule. + */ + @JsonProperty(value = "keyName", access = JsonProperty.Access.WRITE_ONLY) + private String keyName; + + /** + * Get primary connection string of the created namespace AuthorizationRule. + * + * @return the primaryConnectionString value + */ + public String primaryConnectionString() { + return this.primaryConnectionString; + } + + /** + * Get secondary connection string of the created namespace AuthorizationRule. + * + * @return the secondaryConnectionString value + */ + public String secondaryConnectionString() { + return this.secondaryConnectionString; + } + + /** + * Get primary connection string of the alias if GEO DR is enabled. + * + * @return the aliasPrimaryConnectionString value + */ + public String aliasPrimaryConnectionString() { + return this.aliasPrimaryConnectionString; + } + + /** + * Get secondary connection string of the alias if GEO DR is enabled. + * + * @return the aliasSecondaryConnectionString value + */ + public String aliasSecondaryConnectionString() { + return this.aliasSecondaryConnectionString; + } + + /** + * Get a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Get a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Get a string that describes the AuthorizationRule. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ArmDisasterRecoveryImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ArmDisasterRecoveryImpl.java new file mode 100644 index 000000000000..54b4eb34296d --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ArmDisasterRecoveryImpl.java @@ -0,0 +1,133 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ArmDisasterRecovery; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ProvisioningStateDR; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.RoleDisasterRecovery; + +class ArmDisasterRecoveryImpl extends CreatableUpdatableImpl implements ArmDisasterRecovery, ArmDisasterRecovery.Definition, ArmDisasterRecovery.Update { + private final EventHubsManager manager; + private String resourceGroupName; + private String namespaceName; + private String alias; + + ArmDisasterRecoveryImpl(String name, EventHubsManager manager) { + super(name, new ArmDisasterRecoveryInner()); + this.manager = manager; + // Set resource name + this.alias = name; + // + } + + ArmDisasterRecoveryImpl(ArmDisasterRecoveryInner inner, EventHubsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.alias = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.alias = IdParsingUtils.getValueFromIdByName(inner.id(), "disasterRecoveryConfigs"); + // + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.alias, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.alias, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.alias); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String alternateName() { + return this.inner().alternateName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerNamespace() { + return this.inner().partnerNamespace(); + } + + @Override + public Long pendingReplicationOperationsCount() { + return this.inner().pendingReplicationOperationsCount(); + } + + @Override + public ProvisioningStateDR provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public RoleDisasterRecovery role() { + return this.inner().role(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ArmDisasterRecoveryImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public ArmDisasterRecoveryImpl withAlternateName(String alternateName) { + this.inner().withAlternateName(alternateName); + return this; + } + + @Override + public ArmDisasterRecoveryImpl withPartnerNamespace(String partnerNamespace) { + this.inner().withPartnerNamespace(partnerNamespace); + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ArmDisasterRecoveryInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ArmDisasterRecoveryInner.java new file mode 100644 index 000000000000..4be691fac4e7 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ArmDisasterRecoveryInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ProvisioningStateDR; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.RoleDisasterRecovery; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in List or Get Alias(Disaster Recovery configuration) operation. + */ +@JsonFlatten +public class ArmDisasterRecoveryInner extends ProxyResource { + /** + * Provisioning state of the Alias(Disaster Recovery configuration) - + * possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values + * include: 'Accepted', 'Succeeded', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningStateDR provisioningState; + + /** + * ARM Id of the Primary/Secondary eventhub namespace name, which is part + * of GEO DR pairing. + */ + @JsonProperty(value = "properties.partnerNamespace") + private String partnerNamespace; + + /** + * Alternate name specified when alias and namespace names are same. + */ + @JsonProperty(value = "properties.alternateName") + private String alternateName; + + /** + * role of namespace in GEO DR - possible values 'Primary' or + * 'PrimaryNotReplicating' or 'Secondary'. Possible values include: + * 'Primary', 'PrimaryNotReplicating', 'Secondary'. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private RoleDisasterRecovery role; + + /** + * Number of entities pending to be replicated. + */ + @JsonProperty(value = "properties.pendingReplicationOperationsCount", access = JsonProperty.Access.WRITE_ONLY) + private Long pendingReplicationOperationsCount; + + /** + * Get provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: 'Accepted', 'Succeeded', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningStateDR provisioningState() { + return this.provisioningState; + } + + /** + * Get aRM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. + * + * @return the partnerNamespace value + */ + public String partnerNamespace() { + return this.partnerNamespace; + } + + /** + * Set aRM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. + * + * @param partnerNamespace the partnerNamespace value to set + * @return the ArmDisasterRecoveryInner object itself. + */ + public ArmDisasterRecoveryInner withPartnerNamespace(String partnerNamespace) { + this.partnerNamespace = partnerNamespace; + return this; + } + + /** + * Get alternate name specified when alias and namespace names are same. + * + * @return the alternateName value + */ + public String alternateName() { + return this.alternateName; + } + + /** + * Set alternate name specified when alias and namespace names are same. + * + * @param alternateName the alternateName value to set + * @return the ArmDisasterRecoveryInner object itself. + */ + public ArmDisasterRecoveryInner withAlternateName(String alternateName) { + this.alternateName = alternateName; + return this; + } + + /** + * Get role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: 'Primary', 'PrimaryNotReplicating', 'Secondary'. + * + * @return the role value + */ + public RoleDisasterRecovery role() { + return this.role; + } + + /** + * Get number of entities pending to be replicated. + * + * @return the pendingReplicationOperationsCount value + */ + public Long pendingReplicationOperationsCount() { + return this.pendingReplicationOperationsCount; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AuthorizationRuleInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AuthorizationRuleInner.java new file mode 100644 index 000000000000..56280715edb3 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/AuthorizationRuleInner.java @@ -0,0 +1,48 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessRights; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in a List or Get AuthorizationRule operation. + */ +@JsonFlatten +public class AuthorizationRuleInner extends ProxyResource { + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "properties.rights", required = true) + private List rights; + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the AuthorizationRuleInner object itself. + */ + public AuthorizationRuleInner withRights(List rights) { + this.rights = rights; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/CheckNameAvailabilityResultImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..c5f722730bec --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CheckNameAvailabilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.UnavailableReason; + +class CheckNameAvailabilityResultImpl extends WrapperImpl implements CheckNameAvailabilityResult { + private final EventHubsManager manager; + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner inner, EventHubsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public UnavailableReason reason() { + return this.inner().reason(); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/CheckNameAvailabilityResultInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..14eb267e7a71 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/CheckNameAvailabilityResultInner.java @@ -0,0 +1,88 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.UnavailableReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Result of the CheckNameAvailability operation. + */ +public class CheckNameAvailabilityResultInner { + /** + * The detailed info regarding the reason associated with the Namespace. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Value indicating Namespace is availability, true if the Namespace is + * available; otherwise, false. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * The reason for unavailability of a Namespace. Possible values include: + * 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', + * 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + */ + @JsonProperty(value = "reason") + private UnavailableReason reason; + + /** + * Get the detailed info regarding the reason associated with the Namespace. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get value indicating Namespace is availability, true if the Namespace is available; otherwise, false. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set value indicating Namespace is availability, true if the Namespace is available; otherwise, false. + * + * @param nameAvailable the nameAvailable value to set + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason for unavailability of a Namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + * + * @return the reason value + */ + public UnavailableReason reason() { + return this.reason; + } + + /** + * Set the reason for unavailability of a Namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + * + * @param reason the reason value to set + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withReason(UnavailableReason reason) { + this.reason = reason; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ClustersInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ClustersInner.java index 0c6cf586b7b8..652aa71dca49 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ClustersInner.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ClustersInner.java @@ -46,7 +46,7 @@ public class ClustersInner implements InnerSupportsGet, InnerSuppo /** The Retrofit service to perform REST calls. */ private ClustersService service; /** The service client containing this operation class. */ - private EventHub2018PreviewManagementClientImpl client; + private EventHubManagementClientImpl client; /** * Initializes an instance of ClustersInner. @@ -54,7 +54,7 @@ public class ClustersInner implements InnerSupportsGet, InnerSuppo * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ClustersInner(Retrofit retrofit, EventHub2018PreviewManagementClientImpl client) { + public ClustersInner(Retrofit retrofit, EventHubManagementClientImpl client) { this.service = retrofit.create(ClustersService.class); this.client = client; } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConfigurationsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConfigurationsInner.java index c9a6e319f164..bf24f8ccebb4 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConfigurationsInner.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConfigurationsInner.java @@ -37,7 +37,7 @@ public class ConfigurationsInner { /** The Retrofit service to perform REST calls. */ private ConfigurationsService service; /** The service client containing this operation class. */ - private EventHub2018PreviewManagementClientImpl client; + private EventHubManagementClientImpl client; /** * Initializes an instance of ConfigurationsInner. @@ -45,7 +45,7 @@ public class ConfigurationsInner { * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ConfigurationsInner(Retrofit retrofit, EventHub2018PreviewManagementClientImpl client) { + public ConfigurationsInner(Retrofit retrofit, EventHubManagementClientImpl client) { this.service = retrofit.create(ConfigurationsService.class); this.client = client; } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupImpl.java new file mode 100644 index 000000000000..5c70c31eb78c --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupImpl.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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ConsumerGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ConsumerGroupImpl extends CreatableUpdatableImpl implements ConsumerGroup, ConsumerGroup.Definition, ConsumerGroup.Update { + private final EventHubsManager manager; + private String resourceGroupName; + private String namespaceName; + private String eventHubName; + private String consumerGroupName; + private String cuserMetadata; + private String uuserMetadata; + + ConsumerGroupImpl(String name, EventHubsManager manager) { + super(name, new ConsumerGroupInner()); + this.manager = manager; + // Set resource name + this.consumerGroupName = name; + // + } + + ConsumerGroupImpl(ConsumerGroupInner inner, EventHubsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.consumerGroupName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.eventHubName = IdParsingUtils.getValueFromIdByName(inner.id(), "eventhubs"); + this.consumerGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "consumergroups"); + // + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ConsumerGroupsInner client = this.manager().inner().consumerGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.consumerGroupName, this.cuserMetadata) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ConsumerGroupsInner client = this.manager().inner().consumerGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.consumerGroupName, this.uuserMetadata) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ConsumerGroupsInner client = this.manager().inner().consumerGroups(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.consumerGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public String userMetadata() { + return this.inner().userMetadata(); + } + + @Override + public ConsumerGroupImpl withExistingEventhub(String resourceGroupName, String namespaceName, String eventHubName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.eventHubName = eventHubName; + return this; + } + + @Override + public ConsumerGroupImpl withUserMetadata(String userMetadata) { + if (isInCreateMode()) { + this.cuserMetadata = userMetadata; + } else { + this.uuserMetadata = userMetadata; + } + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupInner.java new file mode 100644 index 000000000000..5e5dd9c4af0e --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupInner.java @@ -0,0 +1,80 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in List or Get Consumer group operation. + */ +@JsonFlatten +public class ConsumerGroupInner extends ProxyResource { + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * User Metadata is a placeholder to store user-defined string data with + * maximum length 1024. e.g. it can be used to store descriptive data, such + * as list of teams and their contact information also user-defined + * configuration settings can be stored. + */ + @JsonProperty(value = "properties.userMetadata") + private String userMetadata; + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get user Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * + * @return the userMetadata value + */ + public String userMetadata() { + return this.userMetadata; + } + + /** + * Set user Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * + * @param userMetadata the userMetadata value to set + * @return the ConsumerGroupInner object itself. + */ + public ConsumerGroupInner withUserMetadata(String userMetadata) { + this.userMetadata = userMetadata; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupsImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupsImpl.java new file mode 100644 index 000000000000..9a6fa3de80e6 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupsImpl.java @@ -0,0 +1,85 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ConsumerGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ConsumerGroup; + +class ConsumerGroupsImpl extends WrapperImpl implements ConsumerGroups { + private final EventHubsManager manager; + + ConsumerGroupsImpl(EventHubsManager manager) { + super(manager.inner().consumerGroups()); + this.manager = manager; + } + + public EventHubsManager manager() { + return this.manager; + } + + @Override + public ConsumerGroupImpl define(String name) { + return wrapModel(name); + } + + private ConsumerGroupImpl wrapModel(ConsumerGroupInner inner) { + return new ConsumerGroupImpl(inner, manager()); + } + + private ConsumerGroupImpl wrapModel(String name) { + return new ConsumerGroupImpl(name, this.manager()); + } + + @Override + public Observable listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + ConsumerGroupsInner client = this.inner(); + return client.listByEventHubAsync(resourceGroupName, namespaceName, eventHubName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ConsumerGroup call(ConsumerGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + ConsumerGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName) + .flatMap(new Func1>() { + @Override + public Observable call(ConsumerGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ConsumerGroup)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + ConsumerGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).toCompletable(); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupsInner.java new file mode 100644 index 000000000000..db06a055f098 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/ConsumerGroupsInner.java @@ -0,0 +1,865 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ErrorResponseException; +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 java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ConsumerGroups. + */ +public class ConsumerGroupsInner { + /** The Retrofit service to perform REST calls. */ + private ConsumerGroupsService service; + /** The service client containing this operation class. */ + private EventHubManagementClientImpl client; + + /** + * Initializes an instance of ConsumerGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ConsumerGroupsInner(Retrofit retrofit, EventHubManagementClientImpl client) { + this.service = retrofit.create(ConsumerGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ConsumerGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ConsumerGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ConsumerGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("consumerGroupName") String consumerGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ConsumerGroupInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ConsumerGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("consumerGroupName") String consumerGroupName, @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.eventhubs.v2018_01_01_preview.ConsumerGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("consumerGroupName") String consumerGroupName, @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.eventhubs.v2018_01_01_preview.ConsumerGroups listByEventHub" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups") + Observable> listByEventHub(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.eventhubs.v2018_01_01_preview.ConsumerGroups listByEventHubNext" }) + @GET + Observable> listByEventHubNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConsumerGroupInner object if successful. + */ + public ConsumerGroupInner createOrUpdate(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).toBlocking().single().body(); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName), serviceCallback); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConsumerGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).map(new Func1, ConsumerGroupInner>() { + @Override + public ConsumerGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConsumerGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (consumerGroupName == null) { + throw new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String userMetadata = null; + ConsumerGroupInner parameters = new ConsumerGroupInner(); + parameters.withUserMetadata(null); + return service.createOrUpdate(resourceGroupName, namespaceName, eventHubName, consumerGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param userMetadata User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConsumerGroupInner object if successful. + */ + public ConsumerGroupInner createOrUpdate(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName, String userMetadata) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName, userMetadata).toBlocking().single().body(); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param userMetadata User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * @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 namespaceName, String eventHubName, String consumerGroupName, String userMetadata, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName, userMetadata), serviceCallback); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param userMetadata User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConsumerGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName, String userMetadata) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName, userMetadata).map(new Func1, ConsumerGroupInner>() { + @Override + public ConsumerGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param userMetadata User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConsumerGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName, String userMetadata) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (consumerGroupName == null) { + throw new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + ConsumerGroupInner parameters = new ConsumerGroupInner(); + parameters.withUserMetadata(userMetadata); + return service.createOrUpdate(resourceGroupName, namespaceName, eventHubName, consumerGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a consumer group from the specified Event Hub and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 namespaceName, String eventHubName, String consumerGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).toBlocking().single().body(); + } + + /** + * Deletes a consumer group from the specified Event Hub and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName), serviceCallback); + } + + /** + * Deletes a consumer group from the specified Event Hub and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a consumer group from the specified Event Hub and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (consumerGroupName == null) { + throw new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, eventHubName, consumerGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a description for the specified consumer group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConsumerGroupInner object if successful. + */ + public ConsumerGroupInner get(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).toBlocking().single().body(); + } + + /** + * Gets a description for the specified consumer group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName), serviceCallback); + } + + /** + * Gets a description for the specified consumer group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConsumerGroupInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).map(new Func1, ConsumerGroupInner>() { + @Override + public ConsumerGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a description for the specified consumer group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param consumerGroupName The consumer group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConsumerGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (consumerGroupName == null) { + throw new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, eventHubName, consumerGroupName, this.client.subscriptionId(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ConsumerGroupInner> object if successful. + */ + public PagedList listByEventHub(final String resourceGroupName, final String namespaceName, final String eventHubName) { + ServiceResponse> response = listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConsumerGroupInner> object + */ + public Observable> listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + return listByEventHubWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConsumerGroupInner> object + */ + public Observable>> listByEventHubWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + return listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName) + .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(listByEventHubNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConsumerGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEventHubSinglePageAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer skip = null; + final Integer top = null; + return service.listByEventHub(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEventHubDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ConsumerGroupInner> object if successful. + */ + public PagedList listByEventHub(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + ServiceResponse> response = listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @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> listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConsumerGroupInner> object + */ + public Observable> listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + return listByEventHubWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConsumerGroupInner> object + */ + public Observable>> listByEventHubWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + return listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top) + .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(listByEventHubNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name + ServiceResponse> * @param eventHubName The Event Hub name + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConsumerGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEventHubSinglePageAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByEventHub(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEventHubDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEventHubDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ConsumerGroupInner> object if successful. + */ + public PagedList listByEventHubNext(final String nextPageLink) { + ServiceResponse> response = listByEventHubNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @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> listByEventHubNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEventHubNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @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<ConsumerGroupInner> object + */ + public Observable> listByEventHubNextAsync(final String nextPageLink) { + return listByEventHubNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @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<ConsumerGroupInner> object + */ + public Observable>> listByEventHubNextWithServiceResponseAsync(final String nextPageLink) { + return listByEventHubNextSinglePageAsync(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(listByEventHubNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConsumerGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEventHubNextSinglePageAsync(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.listByEventHubNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEventHubNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEventHubNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigNamespaceAuthorizationRuleImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigNamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..c0f9d6fc3d25 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigNamespaceAuthorizationRuleImpl.java @@ -0,0 +1,67 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigNamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessRights; + +class DisasterRecoveryConfigNamespaceAuthorizationRuleImpl extends IndexableRefreshableWrapperImpl implements DisasterRecoveryConfigNamespaceAuthorizationRule { + private final EventHubsManager manager; + private String resourceGroupName; + private String namespaceName; + private String alias; + private String authorizationRuleName; + + DisasterRecoveryConfigNamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, EventHubsManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.alias = IdParsingUtils.getValueFromIdByName(inner.id(), "disasterRecoveryConfigs"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "AuthorizationRules"); + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.alias, this.authorizationRuleName); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigsImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigsImpl.java new file mode 100644 index 000000000000..6fd15a52741a --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigsImpl.java @@ -0,0 +1,171 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CheckNameAvailabilityResult; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ArmDisasterRecovery; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigNamespaceAuthorizationRule; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessKeys; + +class DisasterRecoveryConfigsImpl extends WrapperImpl implements DisasterRecoveryConfigs { + private final EventHubsManager manager; + + DisasterRecoveryConfigsImpl(EventHubsManager manager) { + super(manager.inner().disasterRecoveryConfigs()); + this.manager = manager; + } + + public EventHubsManager manager() { + return this.manager; + } + + @Override + public ArmDisasterRecoveryImpl define(String name) { + return wrapModel(name); + } + + private ArmDisasterRecoveryImpl wrapModel(ArmDisasterRecoveryInner inner) { + return new ArmDisasterRecoveryImpl(inner, manager()); + } + + private ArmDisasterRecoveryImpl wrapModel(String name) { + return new ArmDisasterRecoveryImpl(name, this.manager()); + } + + @Override + public Observable checkNameAvailabilityAsync(String resourceGroupName, String namespaceName, String name) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.checkNameAvailabilityAsync(resourceGroupName, namespaceName, name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResult call(CheckNameAvailabilityResultInner inner) { + return new CheckNameAvailabilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable breakPairingAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.breakPairingAsync(resourceGroupName, namespaceName, alias).toCompletable(); + } + + @Override + public Completable failOverAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.failOverAsync(resourceGroupName, namespaceName, alias).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String namespaceName) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.listAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ArmDisasterRecovery call(ArmDisasterRecoveryInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, alias) + .flatMap(new Func1>() { + @Override + public Observable call(ArmDisasterRecoveryInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ArmDisasterRecovery)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, alias).toCompletable(); + } + + private DisasterRecoveryConfigNamespaceAuthorizationRuleImpl wrapDisasterRecoveryConfigNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new DisasterRecoveryConfigNamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingDisasterRecoveryConfigsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String alias = IdParsingUtils.getValueFromIdByName(id, "disasterRecoveryConfigs"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "AuthorizationRules"); + DisasterRecoveryConfigsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, alias, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, alias, authorizationRuleName) + .flatMap(new Func1>() { + @Override + public Observable call(AuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DisasterRecoveryConfigNamespaceAuthorizationRule)wrapDisasterRecoveryConfigNamespaceAuthorizationRuleModel(inner)); + } + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, alias) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DisasterRecoveryConfigNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapDisasterRecoveryConfigNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, alias, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigsInner.java new file mode 100644 index 000000000000..28f95a8eff19 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/DisasterRecoveryConfigsInner.java @@ -0,0 +1,1446 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CheckNameAvailabilityParameter; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.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 DisasterRecoveryConfigs. + */ +public class DisasterRecoveryConfigsInner { + /** The Retrofit service to perform REST calls. */ + private DisasterRecoveryConfigsService service; + /** The service client containing this operation class. */ + private EventHubManagementClientImpl client; + + /** + * Initializes an instance of DisasterRecoveryConfigsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DisasterRecoveryConfigsInner(Retrofit retrofit, EventHubManagementClientImpl client) { + this.service = retrofit.create(DisasterRecoveryConfigsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DisasterRecoveryConfigs to be + * used by Retrofit to perform actually REST calls. + */ + interface DisasterRecoveryConfigsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityParameter parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Body ArmDisasterRecoveryInner parameters, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Body ArmDisasterRecoveryInner parameters, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs breakPairing" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") + Observable> breakPairing(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs failOver" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") + Observable> failOver(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs 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.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the give Namespace name availability. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailability(String resourceGroupName, String namespaceName, String name) { + return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, namespaceName, name).toBlocking().single().body(); + } + + /** + * Check the give Namespace name availability. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param name Name to check the namespace name availability + * @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 resourceGroupName, String namespaceName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, namespaceName, name), serviceCallback); + } + + /** + * Check the give Namespace name availability. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityAsync(String resourceGroupName, String namespaceName, String name) { + return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, namespaceName, name).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check the give Namespace name availability. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String resourceGroupName, String namespaceName, 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 (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName 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."); + } + CheckNameAvailabilityParameter parameters = new CheckNameAvailabilityParameter(); + parameters.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), resourceGroupName, namespaceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ArmDisasterRecoveryInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmDisasterRecoveryInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String namespaceName) { + return listWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmDisasterRecoveryInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listSinglePageAsync(resourceGroupName, namespaceName) + .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)); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmDisasterRecoveryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, namespaceName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArmDisasterRecoveryInner object if successful. + */ + public ArmDisasterRecoveryInner createOrUpdate(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @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 namespaceName, String alias, ArmDisasterRecoveryInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters), serviceCallback); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters).map(new Func1, ArmDisasterRecoveryInner>() { + @Override + public ArmDisasterRecoveryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArmDisasterRecoveryInner object if successful. + */ + public ArmDisasterRecoveryInner beginCreateOrUpdate(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @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 namespaceName, String alias, ArmDisasterRecoveryInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters), serviceCallback); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters).map(new Func1, ArmDisasterRecoveryInner>() { + @Override + public ArmDisasterRecoveryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.beginCreateOrUpdate(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 namespaceName, String alias) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String alias) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArmDisasterRecoveryInner object if successful. + */ + public ArmDisasterRecoveryInner get(String resourceGroupName, String namespaceName, String alias) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String alias) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, ArmDisasterRecoveryInner>() { + @Override + public ArmDisasterRecoveryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void breakPairing(String resourceGroupName, String namespaceName, String alias) { + breakPairingWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture breakPairingAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(breakPairingWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable breakPairingAsync(String resourceGroupName, String namespaceName, String alias) { + return breakPairingWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> breakPairingWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.breakPairing(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = breakPairingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse breakPairingDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void failOver(String resourceGroupName, String namespaceName, String alias) { + failOverWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failOverAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failOverWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable failOverAsync(String resourceGroupName, String namespaceName, String alias) { + return failOverWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> failOverWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.failOver(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = failOverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse failOverDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String alias) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, alias).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, alias), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, alias) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String alias) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, alias) + .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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name + ServiceResponse> * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, alias, 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 = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName), serviceCallback); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, alias, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, alias, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ArmDisasterRecoveryInner> 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(); + } + }; + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @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); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @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<ArmDisasterRecoveryInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @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<ArmDisasterRecoveryInner> 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)); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmDisasterRecoveryInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @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> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @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<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @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<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(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.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceImpl.java index fc32754d967b..e35bd131044d 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceImpl.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceImpl.java @@ -13,6 +13,8 @@ import rx.Observable; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Sku; import org.joda.time.DateTime; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Identity; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Encryption; class EHNamespaceImpl extends GroupableResourceCoreImpl implements EHNamespace, EHNamespace.Definition, EHNamespace.Update { EHNamespaceImpl(String name, EHNamespaceInner inner, EventHubsManager manager) { @@ -45,11 +47,26 @@ public boolean isInCreateMode() { } + @Override + public String clusterArmId() { + return this.inner().clusterArmId(); + } + @Override public DateTime createdAt() { return this.inner().createdAt(); } + @Override + public Encryption encryption() { + return this.inner().encryption(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + @Override public Boolean isAutoInflateEnabled() { return this.inner().isAutoInflateEnabled(); @@ -95,6 +112,24 @@ public Boolean zoneRedundant() { return this.inner().zoneRedundant(); } + @Override + public EHNamespaceImpl withClusterArmId(String clusterArmId) { + this.inner().withClusterArmId(clusterArmId); + return this; + } + + @Override + public EHNamespaceImpl withEncryption(Encryption encryption) { + this.inner().withEncryption(encryption); + return this; + } + + @Override + public EHNamespaceImpl withIdentity(Identity identity) { + this.inner().withIdentity(identity); + return this; + } + @Override public EHNamespaceImpl withIsAutoInflateEnabled(Boolean isAutoInflateEnabled) { this.inner().withIsAutoInflateEnabled(isAutoInflateEnabled); diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceInner.java index 75928021004f..da2cdc0baeeb 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceInner.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EHNamespaceInner.java @@ -10,6 +10,8 @@ import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Sku; import org.joda.time.DateTime; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Identity; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Encryption; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -51,6 +53,12 @@ public class EHNamespaceInner extends Resource { @JsonProperty(value = "properties.serviceBusEndpoint", access = JsonProperty.Access.WRITE_ONLY) private String serviceBusEndpoint; + /** + * Cluster ARM ID of the Namespace. + */ + @JsonProperty(value = "properties.clusterArmId") + private String clusterArmId; + /** * Identifier for Azure Insights metrics. */ @@ -85,6 +93,18 @@ public class EHNamespaceInner extends Resource { @JsonProperty(value = "properties.zoneRedundant") private Boolean zoneRedundant; + /** + * Properties of BYOK Identity description. + */ + @JsonProperty(value = "properties.identity") + private Identity identity; + + /** + * Properties of BYOK Encryption description. + */ + @JsonProperty(value = "properties.encryption") + private Encryption encryption; + /** * Get properties of sku resource. * @@ -141,6 +161,26 @@ public String serviceBusEndpoint() { return this.serviceBusEndpoint; } + /** + * Get cluster ARM ID of the Namespace. + * + * @return the clusterArmId value + */ + public String clusterArmId() { + return this.clusterArmId; + } + + /** + * Set cluster ARM ID of the Namespace. + * + * @param clusterArmId the clusterArmId value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withClusterArmId(String clusterArmId) { + this.clusterArmId = clusterArmId; + return this; + } + /** * Get identifier for Azure Insights metrics. * @@ -230,4 +270,44 @@ public EHNamespaceInner withZoneRedundant(Boolean zoneRedundant) { return this; } + /** + * Get properties of BYOK Identity description. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set properties of BYOK Identity description. + * + * @param identity the identity value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get properties of BYOK Encryption description. + * + * @return the encryption value + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Set properties of BYOK Encryption description. + * + * @param encryption the encryption value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withEncryption(Encryption encryption) { + this.encryption = encryption; + return this; + } + } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubManagementClientImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubManagementClientImpl.java new file mode 100644 index 000000000000..dd9f6d13310a --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubManagementClientImpl.java @@ -0,0 +1,294 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the EventHubManagementClientImpl class. + */ +public class EventHubManagementClientImpl 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; + } + + /** Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public EventHubManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client API version. */ + private String apiVersion; + + /** + * Gets Client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public EventHubManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public EventHubManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public EventHubManagementClientImpl 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 NamespacesInner object to access its operations. + */ + private NamespacesInner namespaces; + + /** + * Gets the NamespacesInner object to access its operations. + * @return the NamespacesInner object. + */ + public NamespacesInner namespaces() { + return this.namespaces; + } + + /** + * The ClustersInner object to access its operations. + */ + private ClustersInner clusters; + + /** + * Gets the ClustersInner object to access its operations. + * @return the ClustersInner object. + */ + public ClustersInner clusters() { + return this.clusters; + } + + /** + * The ConfigurationsInner object to access its operations. + */ + private ConfigurationsInner configurations; + + /** + * Gets the ConfigurationsInner object to access its operations. + * @return the ConfigurationsInner object. + */ + public ConfigurationsInner configurations() { + return this.configurations; + } + + /** + * The DisasterRecoveryConfigsInner object to access its operations. + */ + private DisasterRecoveryConfigsInner disasterRecoveryConfigs; + + /** + * Gets the DisasterRecoveryConfigsInner object to access its operations. + * @return the DisasterRecoveryConfigsInner object. + */ + public DisasterRecoveryConfigsInner disasterRecoveryConfigs() { + return this.disasterRecoveryConfigs; + } + + /** + * The EventHubsInner object to access its operations. + */ + private EventHubsInner eventHubs; + + /** + * Gets the EventHubsInner object to access its operations. + * @return the EventHubsInner object. + */ + public EventHubsInner eventHubs() { + return this.eventHubs; + } + + /** + * The ConsumerGroupsInner object to access its operations. + */ + private ConsumerGroupsInner consumerGroups; + + /** + * Gets the ConsumerGroupsInner object to access its operations. + * @return the ConsumerGroupsInner object. + */ + public ConsumerGroupsInner consumerGroups() { + return this.consumerGroups; + } + + /** + * The RegionsInner object to access its operations. + */ + private RegionsInner regions; + + /** + * Gets the RegionsInner object to access its operations. + * @return the RegionsInner object. + */ + public RegionsInner regions() { + return this.regions; + } + + /** + * Initializes an instance of EventHubManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public EventHubManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of EventHubManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public EventHubManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of EventHubManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public EventHubManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-01-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.namespaces = new NamespacesInner(restClient().retrofit(), this); + this.clusters = new ClustersInner(restClient().retrofit(), this); + this.configurations = new ConfigurationsInner(restClient().retrofit(), this); + this.disasterRecoveryConfigs = new DisasterRecoveryConfigsInner(restClient().retrofit(), this); + this.eventHubs = new EventHubsInner(restClient().retrofit(), this); + this.consumerGroups = new ConsumerGroupsInner(restClient().retrofit(), this); + this.regions = new RegionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "EventHubManagementClient", "2018-01-01-preview"); + } +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsImpl.java new file mode 100644 index 000000000000..29be3a5576b7 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsImpl.java @@ -0,0 +1,174 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventHubs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Eventhub; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventhubNamespaceAuthorizationRule; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessKeys; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.RegenerateAccessKeyParameters; + +class EventHubsImpl extends WrapperImpl implements EventHubs { + private final EventHubsManager manager; + + EventHubsImpl(EventHubsManager manager) { + super(manager.inner().eventHubs()); + this.manager = manager; + } + + public EventHubsManager manager() { + return this.manager; + } + + @Override + public EventhubImpl define(String name) { + return wrapModel(name); + } + + private EventhubImpl wrapModel(EventhubInner inner) { + return new EventhubImpl(inner, manager()); + } + + private EventhubImpl wrapModel(String name) { + return new EventhubImpl(name, this.manager()); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + EventHubsInner client = this.inner(); + return client.listByNamespaceAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Eventhub call(EventhubInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName) { + EventHubsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, eventHubName) + .flatMap(new Func1>() { + @Override + public Observable call(EventhubInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Eventhub)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String eventHubName) { + EventHubsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, eventHubName).toCompletable(); + } + + @Override + public EventhubNamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private EventhubNamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new EventhubNamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private EventhubNamespaceAuthorizationRuleImpl wrapEventhubNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new EventhubNamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingEventHubsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String eventHubName = IdParsingUtils.getValueFromIdByName(id, "eventhubs"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + EventHubsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + EventHubsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + .flatMap(new Func1>() { + @Override + public Observable call(AuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((EventhubNamespaceAuthorizationRule)wrapEventhubNamespaceAuthorizationRuleModel(inner)); + } + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + EventHubsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, eventHubName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EventhubNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapEventhubNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + EventHubsInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + EventHubsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + EventHubsInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsInner.java new file mode 100644 index 000000000000..3eb69d914669 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsInner.java @@ -0,0 +1,1526 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessRights; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ErrorResponseException; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.RegenerateAccessKeyParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.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 EventHubs. + */ +public class EventHubsInner { + /** The Retrofit service to perform REST calls. */ + private EventHubsService service; + /** The service client containing this operation class. */ + private EventHubManagementClientImpl client; + + /** + * Initializes an instance of EventHubsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EventHubsInner(Retrofit retrofit, EventHubManagementClientImpl client) { + this.service = retrofit.create(EventHubsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EventHubs to be + * used by Retrofit to perform actually REST calls. + */ + interface EventHubsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventHubs listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs") + Observable> listByNamespace(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.eventhubs.v2018_01_01_preview.EventHubs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("subscriptionId") String subscriptionId, @Body EventhubInner parameters, @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.eventhubs.v2018_01_01_preview.EventHubs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @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.eventhubs.v2018_01_01_preview.EventHubs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @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.eventhubs.v2018_01_01_preview.EventHubs listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @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.eventhubs.v2018_01_01_preview.EventHubs createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventHubs getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.EventHubs deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.EventHubs listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.EventHubs regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body RegenerateAccessKeyParameters parameters, @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.eventhubs.v2018_01_01_preview.EventHubs listByNamespaceNext" }) + @GET + Observable> listByNamespaceNext(@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.eventhubs.v2018_01_01_preview.EventHubs listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EventhubInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName) + .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(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventhubInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer skip = null; + final Integer top = null; + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EventhubInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @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> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top) + .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(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventhubInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a new Event Hub as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param parameters Parameters supplied to create an Event Hub resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EventhubInner object if successful. + */ + public EventhubInner createOrUpdate(String resourceGroupName, String namespaceName, String eventHubName, EventhubInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a new Event Hub as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param parameters Parameters supplied to create an Event Hub resource. + * @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 namespaceName, String eventHubName, EventhubInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, parameters), serviceCallback); + } + + /** + * Creates or updates a new Event Hub as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param parameters Parameters supplied to create an Event Hub resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventhubInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String eventHubName, EventhubInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, parameters).map(new Func1, EventhubInner>() { + @Override + public EventhubInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a new Event Hub as a nested resource within a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param parameters Parameters supplied to create an Event Hub resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventhubInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, EventhubInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an Event Hub from the specified Namespace and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 namespaceName, String eventHubName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName).toBlocking().single().body(); + } + + /** + * Deletes an Event Hub from the specified Namespace and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String eventHubName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName), serviceCallback); + } + + /** + * Deletes an Event Hub from the specified Namespace and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String eventHubName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an Event Hub from the specified Namespace and resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an Event Hubs description for the specified Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EventhubInner object if successful. + */ + public EventhubInner get(String resourceGroupName, String namespaceName, String eventHubName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName).toBlocking().single().body(); + } + + /** + * Gets an Event Hubs description for the specified Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String eventHubName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName), serviceCallback); + } + + /** + * Gets an Event Hubs description for the specified Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventhubInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName).map(new Func1, EventhubInner>() { + @Override + public EventhubInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an Event Hubs description for the specified Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventhubInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the authorization rules for an Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String eventHubName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, eventHubName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization rules for an Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, eventHubName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for an Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for an Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, eventHubName) + .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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization rules for an Event Hub. + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name + ServiceResponse> * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, eventHubName, 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 = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @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 createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, List rights) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an AuthorizationRule for an Event Hub by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an AuthorizationRule for an Event Hub by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an AuthorizationRule for an Event Hub by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an AuthorizationRule for an Event Hub by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an Event Hub AuthorizationRule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes an Event Hub AuthorizationRule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes an Event Hub AuthorizationRule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an Event Hub AuthorizationRule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName), serviceCallback); + } + + /** + * Gets the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/SecondaryKey). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/SecondaryKey). + * @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 regenerateKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/SecondaryKey). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the ACS and SAS connection strings for the Event Hub. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/SecondaryKey). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.regenerateKeys(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EventhubInner> object if successful. + */ + public PagedList listByNamespaceNext(final String nextPageLink) { + ServiceResponse> response = listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @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> listByNamespaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @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<EventhubInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @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<EventhubInner> object + */ + public Observable>> listByNamespaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByNamespaceNextSinglePageAsync(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(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventhubInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceNextSinglePageAsync(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.listByNamespaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the authorization rules for an Event Hub. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization rules for an Event 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> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for an Event 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<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for an Event 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<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization rules for an Event 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<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(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.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsManager.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsManager.java index ed42a636acaa..6311a87fd8a1 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsManager.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventHubsManager.java @@ -17,20 +17,28 @@ import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Operations; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Namespaces; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Clusters; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Configurations; -import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Namespaces; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DisasterRecoveryConfigs; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventHubs; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ConsumerGroups; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Regions; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; /** * Entry point to Azure EventHubs resource management. */ -public final class EventHubsManager extends ManagerCore { +public final class EventHubsManager extends ManagerCore { private Operations operations; + private Namespaces namespaces; private Clusters clusters; private Configurations configurations; - private Namespaces namespaces; + private DisasterRecoveryConfigs disasterRecoveryConfigs; + private EventHubs eventHubs; + private ConsumerGroups consumerGroups; + private Regions regions; /** * Get a Configurable instance that can be used to create EventHubsManager with optional configuration. * @@ -88,6 +96,16 @@ public Operations operations() { return this.operations; } + /** + * @return Entry point to manage Namespaces. + */ + public Namespaces namespaces() { + if (this.namespaces == null) { + this.namespaces = new NamespacesImpl(this); + } + return this.namespaces; + } + /** * @return Entry point to manage Clusters. */ @@ -109,13 +127,43 @@ public Configurations configurations() { } /** - * @return Entry point to manage Namespaces. + * @return Entry point to manage DisasterRecoveryConfigs. */ - public Namespaces namespaces() { - if (this.namespaces == null) { - this.namespaces = new NamespacesImpl(this); + public DisasterRecoveryConfigs disasterRecoveryConfigs() { + if (this.disasterRecoveryConfigs == null) { + this.disasterRecoveryConfigs = new DisasterRecoveryConfigsImpl(this); } - return this.namespaces; + return this.disasterRecoveryConfigs; + } + + /** + * @return Entry point to manage EventHubs. + */ + public EventHubs eventHubs() { + if (this.eventHubs == null) { + this.eventHubs = new EventHubsImpl(this); + } + return this.eventHubs; + } + + /** + * @return Entry point to manage ConsumerGroups. + */ + public ConsumerGroups consumerGroups() { + if (this.consumerGroups == null) { + this.consumerGroups = new ConsumerGroupsImpl(this); + } + return this.consumerGroups; + } + + /** + * @return Entry point to manage Regions. + */ + public Regions regions() { + if (this.regions == null) { + this.regions = new RegionsImpl(this); + } + return this.regions; } /** @@ -130,6 +178,6 @@ private EventHubsManager(RestClient restClient, String subscriptionId) { super( restClient, subscriptionId, - new EventHub2018PreviewManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + new EventHubManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); } } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubImpl.java new file mode 100644 index 000000000000..bd8e17213453 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubImpl.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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Eventhub; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EntityStatus; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CaptureDescription; + +class EventhubImpl extends CreatableUpdatableImpl implements Eventhub, Eventhub.Definition, Eventhub.Update { + private final EventHubsManager manager; + private String resourceGroupName; + private String namespaceName; + private String eventHubName; + + EventhubImpl(String name, EventHubsManager manager) { + super(name, new EventhubInner()); + this.manager = manager; + // Set resource name + this.eventHubName = name; + // + } + + EventhubImpl(EventhubInner inner, EventHubsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.eventHubName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.eventHubName = IdParsingUtils.getValueFromIdByName(inner.id(), "eventhubs"); + // + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + EventHubsInner client = this.manager().inner().eventHubs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + EventHubsInner client = this.manager().inner().eventHubs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + EventHubsInner client = this.manager().inner().eventHubs(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.eventHubName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public CaptureDescription captureDescription() { + return this.inner().captureDescription(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Long messageRetentionInDays() { + return this.inner().messageRetentionInDays(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Long partitionCount() { + return this.inner().partitionCount(); + } + + @Override + public List partitionIds() { + return this.inner().partitionIds(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public EventhubImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public EventhubImpl withCaptureDescription(CaptureDescription captureDescription) { + this.inner().withCaptureDescription(captureDescription); + return this; + } + + @Override + public EventhubImpl withMessageRetentionInDays(Long messageRetentionInDays) { + this.inner().withMessageRetentionInDays(messageRetentionInDays); + return this; + } + + @Override + public EventhubImpl withPartitionCount(Long partitionCount) { + this.inner().withPartitionCount(partitionCount); + return this; + } + + @Override + public EventhubImpl withStatus(EntityStatus status) { + this.inner().withStatus(status); + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubInner.java new file mode 100644 index 000000000000..10d8e091b577 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubInner.java @@ -0,0 +1,177 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EntityStatus; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CaptureDescription; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in List or Get Event Hub operation. + */ +@JsonFlatten +public class EventhubInner extends ProxyResource { + /** + * Current number of shards on the Event Hub. + */ + @JsonProperty(value = "properties.partitionIds", access = JsonProperty.Access.WRITE_ONLY) + private List partitionIds; + + /** + * Exact time the Event Hub was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Number of days to retain the events for this Event Hub, value should be + * 1 to 7 days. + */ + @JsonProperty(value = "properties.messageRetentionInDays") + private Long messageRetentionInDays; + + /** + * Number of partitions created for the Event Hub, allowed values are from + * 1 to 32 partitions. + */ + @JsonProperty(value = "properties.partitionCount") + private Long partitionCount; + + /** + * Enumerates the possible values for the status of the Event Hub. Possible + * values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', + * 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Properties of capture description. + */ + @JsonProperty(value = "properties.captureDescription") + private CaptureDescription captureDescription; + + /** + * Get current number of shards on the Event Hub. + * + * @return the partitionIds value + */ + public List partitionIds() { + return this.partitionIds; + } + + /** + * Get exact time the Event Hub was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get number of days to retain the events for this Event Hub, value should be 1 to 7 days. + * + * @return the messageRetentionInDays value + */ + public Long messageRetentionInDays() { + return this.messageRetentionInDays; + } + + /** + * Set number of days to retain the events for this Event Hub, value should be 1 to 7 days. + * + * @param messageRetentionInDays the messageRetentionInDays value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withMessageRetentionInDays(Long messageRetentionInDays) { + this.messageRetentionInDays = messageRetentionInDays; + return this; + } + + /** + * Get number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. + * + * @return the partitionCount value + */ + public Long partitionCount() { + return this.partitionCount; + } + + /** + * Set number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. + * + * @param partitionCount the partitionCount value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withPartitionCount(Long partitionCount) { + this.partitionCount = partitionCount; + return this; + } + + /** + * Get enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @param status the status value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get properties of capture description. + * + * @return the captureDescription value + */ + public CaptureDescription captureDescription() { + return this.captureDescription; + } + + /** + * Set properties of capture description. + * + * @param captureDescription the captureDescription value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withCaptureDescription(CaptureDescription captureDescription) { + this.captureDescription = captureDescription; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubNamespaceAuthorizationRuleImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubNamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..abb79921f021 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/EventhubNamespaceAuthorizationRuleImpl.java @@ -0,0 +1,116 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.EventhubNamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessRights; + +class EventhubNamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements EventhubNamespaceAuthorizationRule, EventhubNamespaceAuthorizationRule.Definition, EventhubNamespaceAuthorizationRule.Update { + private final EventHubsManager manager; + private String resourceGroupName; + private String namespaceName; + private String eventHubName; + private String authorizationRuleName; + private List crights; + private List urights; + + EventhubNamespaceAuthorizationRuleImpl(String name, EventHubsManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + EventhubNamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, EventHubsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.eventHubName = IdParsingUtils.getValueFromIdByName(inner.id(), "eventhubs"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + EventHubsInner client = this.manager().inner().eventHubs(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + EventHubsInner client = this.manager().inner().eventHubs(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + EventHubsInner client = this.manager().inner().eventHubs(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.eventHubName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public EventhubNamespaceAuthorizationRuleImpl withExistingEventhub(String resourceGroupName, String namespaceName, String eventHubName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.eventHubName = eventHubName; + return this; + } + + @Override + public EventhubNamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/MessagingRegionsImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/MessagingRegionsImpl.java new file mode 100644 index 000000000000..2193844eb250 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/MessagingRegionsImpl.java @@ -0,0 +1,58 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.MessagingRegions; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.MessagingRegionsProperties; +import java.util.Map; + +class MessagingRegionsImpl extends WrapperImpl implements MessagingRegions { + private final EventHubsManager manager; + MessagingRegionsImpl(MessagingRegionsInner inner, EventHubsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public MessagingRegionsProperties properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/MessagingRegionsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/MessagingRegionsInner.java new file mode 100644 index 000000000000..57112347e56f --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/MessagingRegionsInner.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.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.MessagingRegionsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Messaging Region. + */ +@SkipParentValidation +public class MessagingRegionsInner extends Resource { + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private MessagingRegionsProperties properties; + + /** + * Get the properties value. + * + * @return the properties value + */ + public MessagingRegionsProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the MessagingRegionsInner object itself. + */ + public MessagingRegionsInner withProperties(MessagingRegionsProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespaceAuthorizationRuleImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..5694b8390b18 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespaceAuthorizationRuleImpl.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessRights; + +class NamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements NamespaceAuthorizationRule, NamespaceAuthorizationRule.Definition, NamespaceAuthorizationRule.Update { + private final EventHubsManager manager; + private String resourceGroupName; + private String namespaceName; + private String authorizationRuleName; + private List crights; + private List urights; + + NamespaceAuthorizationRuleImpl(String name, EventHubsManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + NamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, EventHubsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "AuthorizationRules"); + // + } + + @Override + public EventHubsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public NamespaceAuthorizationRuleImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public NamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesImpl.java index 0482ce8b03ff..aad59b453be7 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesImpl.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesImpl.java @@ -22,9 +22,13 @@ import rx.functions.Func1; import com.microsoft.azure.PagedList; import com.microsoft.azure.Page; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CheckNameAvailabilityResult; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.IpFilterRule; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.VirtualNetworkRule; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NetworkRuleSet; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NamespaceAuthorizationRule; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessKeys; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.RegenerateAccessKeyParameters; class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { protected NamespacesImpl(EventHubsManager manager) { @@ -128,6 +132,18 @@ public EHNamespaceImpl define(String name) { return wrapModel(name); } + @Override + public Observable checkNameAvailabilityAsync(String name) { + NamespacesInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResult call(CheckNameAvailabilityResultInner inner) { + return new CheckNameAvailabilityResultImpl(inner, manager()); + } + }); + } + @Override protected EHNamespaceImpl wrapModel(EHNamespaceInner inner) { return new EHNamespaceImpl(inner.name(), inner, manager()); @@ -148,6 +164,11 @@ public VirtualNetworkRuleImpl defineVirtualnetworkrule(String name) { return wrapVirtualnetworkruleModel(name); } + @Override + public NamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + private IpFilterRuleImpl wrapIpfilterruleModel(String name) { return new IpFilterRuleImpl(name, this.manager()); } @@ -156,6 +177,10 @@ private VirtualNetworkRuleImpl wrapVirtualnetworkruleModel(String name) { return new VirtualNetworkRuleImpl(name, this.manager()); } + private NamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new NamespaceAuthorizationRuleImpl(name, this.manager()); + } + private IpFilterRuleImpl wrapIpFilterRuleModel(IpFilterRuleInner inner) { return new IpFilterRuleImpl(inner, manager()); } @@ -164,6 +189,14 @@ private VirtualNetworkRuleImpl wrapVirtualNetworkRuleModel(VirtualNetworkRuleInn return new VirtualNetworkRuleImpl(inner, manager()); } + private NetworkRuleSetImpl wrapNetworkRuleSetModel(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + + private NamespaceAuthorizationRuleImpl wrapNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + private Observable getIpFilterRuleInnerUsingNamespacesInnerAsync(String id) { String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); @@ -180,14 +213,26 @@ private Observable getVirtualNetworkRuleInnerUsingNames return client.getVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName); } + private Observable getAuthorizationRuleInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "AuthorizationRules"); + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName); + } + @Override public Observable getIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { NamespacesInner client = this.inner(); return client.getIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public IpFilterRule call(IpFilterRuleInner inner) { - return wrapIpFilterRuleModel(inner); + public Observable call(IpFilterRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((IpFilterRule)wrapIpFilterRuleModel(inner)); + } } }); } @@ -220,10 +265,14 @@ public Completable deleteIpFilterRuleAsync(String resourceGroupName, String name public Observable getVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { NamespacesInner client = this.inner(); return client.getVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { - return wrapVirtualNetworkRuleModel(inner); + public Observable call(VirtualNetworkRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((VirtualNetworkRule)wrapVirtualNetworkRuleModel(inner)); + } } }); } @@ -252,6 +301,24 @@ public Completable deleteVirtualNetworkRuleAsync(String resourceGroupName, Strin return client.deleteVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).toCompletable(); } + @Override + public Observable listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listNetworkRuleSetsAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NetworkRuleSet call(NetworkRuleSetInner inner) { + return wrapNetworkRuleSetModel(inner); + } + }); + } + @Override public Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { NamespacesInner client = this.inner(); @@ -276,4 +343,68 @@ public NetworkRuleSet call(NetworkRuleSetInner inner) { }); } + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) + .flatMap(new Func1>() { + @Override + public Observable call(AuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((NamespaceAuthorizationRule)wrapNamespaceAuthorizationRuleModel(inner)); + } + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + NamespacesInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesInner.java index a8879fd6c3b9..5883232f9426 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesInner.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NamespacesInner.java @@ -15,7 +15,10 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.AccessRights; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.CheckNameAvailabilityParameter; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ErrorResponseException; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.RegenerateAccessKeyParameters; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -32,6 +35,7 @@ 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; @@ -47,7 +51,7 @@ public class NamespacesInner implements InnerSupportsGet, Inne /** The Retrofit service to perform REST calls. */ private NamespacesService service; /** The service client containing this operation class. */ - private EventHub2018PreviewManagementClientImpl client; + private EventHubManagementClientImpl client; /** * Initializes an instance of NamespacesInner. @@ -55,7 +59,7 @@ public class NamespacesInner implements InnerSupportsGet, Inne * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public NamespacesInner(Retrofit retrofit, EventHub2018PreviewManagementClientImpl client) { + public NamespacesInner(Retrofit retrofit, EventHubManagementClientImpl client) { this.service = retrofit.create(NamespacesService.class); this.client = client; } @@ -65,6 +69,10 @@ public NamespacesInner(Retrofit retrofit, EventHub2018PreviewManagementClientImp * used by Retrofit to perform actually REST calls. */ interface NamespacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Namespaces checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.EventHub/CheckNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityParameter parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Namespaces list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -137,6 +145,34 @@ interface NamespacesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default") Observable> getNetworkRuleSet(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @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.eventhubs.v2018_01_01_preview.Namespaces listNetworkRuleSets" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets") + Observable> listNetworkRuleSets(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @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.eventhubs.v2018_01_01_preview.Namespaces listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @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.eventhubs.v2018_01_01_preview.Namespaces createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Namespaces deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.Namespaces getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.Namespaces listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @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.eventhubs.v2018_01_01_preview.Namespaces regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body RegenerateAccessKeyParameters parameters, @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.eventhubs.v2018_01_01_preview.Namespaces listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -153,6 +189,95 @@ interface NamespacesService { @GET Observable> listVirtualNetworkRulesNext(@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.eventhubs.v2018_01_01_preview.Namespaces listNetworkRuleSetsNext" }) + @GET + Observable> listNetworkRuleSetsNext(@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.eventhubs.v2018_01_01_preview.Namespaces listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the give Namespace name availability. + * + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Check the give Namespace name availability. + * + * @param name Name to check the namespace name availability + * @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 the give Namespace name availability. + * + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check the give Namespace name availability. + * + * @param name Name to check the namespace name availability + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner 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."); + } + CheckNameAvailabilityParameter parameters = new CheckNameAvailabilityParameter(); + parameters.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); } /** @@ -1976,102 +2101,114 @@ private ServiceResponse getNetworkRuleSetDelegate(Response< } /** - * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * Gets list of NetworkRuleSet for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException 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<EHNamespaceInner> object if successful. + * @return the PagedList<NetworkRuleSetInner> object if successful. */ - public PagedList listNext(final String nextPageLink) { - ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList listNetworkRuleSets(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listNetworkRuleSetsSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + public Page nextPage(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** - * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * Gets list of NetworkRuleSet for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listNextSinglePageAsync(nextPageLink), - new Func1>>>() { + listNetworkRuleSetsSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink); + public Observable>> call(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** - * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * Gets list of NetworkRuleSet for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<EHNamespaceInner> object + * @return the observable to the PagedList<NetworkRuleSetInner> object */ - public Observable> listNextAsync(final String nextPageLink) { - return listNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { + public Observable> listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName) { + return listNetworkRuleSetsWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); } /** - * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * Gets list of NetworkRuleSet for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<EHNamespaceInner> object + * @return the observable to the PagedList<NetworkRuleSetInner> object */ - public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { - return listNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { + public Observable>> listNetworkRuleSetsWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listNetworkRuleSetsSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listNetworkRuleSetsNextWithServiceResponseAsync(nextPageLink)); } }); } /** - * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * Gets list of NetworkRuleSet for a Namespace. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<EHNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<NetworkRuleSetInner> 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."); + public Observable>> listNetworkRuleSetsSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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>>>() { + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listNetworkRuleSets(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listNetworkRuleSetsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2079,110 +2216,122 @@ public Observable>> call(Response> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNetworkRuleSetsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } /** - * Lists the available Namespaces within a resource group. + * Gets a list of authorization rules for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException 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<EHNamespaceInner> object if successful. + * @return the PagedList<AuthorizationRuleInner> object if successful. */ - public PagedList listByResourceGroupNext(final String nextPageLink) { - ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** - * Lists the available Namespaces within a resource group. + * Gets a list of authorization rules for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByResourceGroupNextSinglePageAsync(nextPageLink), - new Func1>>>() { + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink); + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** - * Lists the available Namespaces within a resource group. + * Gets a list of authorization rules for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<EHNamespaceInner> object + * @return the observable to the PagedList<AuthorizationRuleInner> object */ - public Observable> listByResourceGroupNextAsync(final String nextPageLink) { - return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); } /** - * Lists the available Namespaces within a resource group. + * Gets a list of authorization rules for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<EHNamespaceInner> object + * @return the observable to the PagedList<AuthorizationRuleInner> object */ - public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { - return listByResourceGroupNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); } }); } /** - * Lists the available Namespaces within a resource group. + * Gets a list of authorization rules for a Namespace. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace name * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<EHNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<AuthorizationRuleInner> 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."); + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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>>>() { + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -2190,90 +2339,795 @@ public Observable>> call(Response> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } /** - * Gets a list of IP Filter rules for a Namespace. + * Creates or updates an AuthorizationRule for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException 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<IpFilterRuleInner> object if successful. + * @return the AuthorizationRuleInner object if successful. */ - public PagedList listIPFilterRulesNext(final String nextPageLink) { - ServiceResponse> response = listIPFilterRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listIPFilterRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights).toBlocking().single().body(); } /** - * Gets a list of IP Filter rules for a Namespace. + * Creates or updates an AuthorizationRule for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. * @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> listIPFilterRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listIPFilterRulesNextSinglePageAsync(nextPageLink), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listIPFilterRulesNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights), serviceCallback); } /** - * Gets a list of IP Filter rules for a Namespace. + * Creates or updates an AuthorizationRule for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<IpFilterRuleInner> object + * @return the observable to the AuthorizationRuleInner object */ - public Observable> listIPFilterRulesNextAsync(final String nextPageLink) { - return listIPFilterRulesNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); } /** - * Gets a list of IP Filter rules for a Namespace. + * Creates or updates an AuthorizationRule for a Namespace. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<IpFilterRuleInner> object + * @return the observable to the AuthorizationRuleInner object */ - public Observable>> listIPFilterRulesNextWithServiceResponseAsync(final String nextPageLink) { - return listIPFilterRulesNextSinglePageAsync(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(listIPFilterRulesNextWithServiceResponseAsync(nextPageLink)); - } - }); - } + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an AuthorizationRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes an AuthorizationRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes an AuthorizationRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an AuthorizationRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an AuthorizationRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates the primary or secondary connection strings for the specified Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters required to regenerate the connection string. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings for the specified Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters required to regenerate the connection string. + * @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 regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings for the specified Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters required to regenerate the connection string. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings for the specified Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters required to regenerate the connection string. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EHNamespaceInner> 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 the available Namespaces within a subscription, irrespective of the resource groups. + * + * @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 the available Namespaces within a subscription, irrespective of the resource groups. + * + * @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<EHNamespaceInner> 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 the available Namespaces within a subscription, irrespective of the resource groups. + * + * @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<EHNamespaceInner> 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 the available Namespaces within a subscription, irrespective of the resource groups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EHNamespaceInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the available Namespaces within a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EHNamespaceInner> 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(); + } + }; + } + + /** + * Lists the available Namespaces within 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); + } + + /** + * Lists the available Namespaces within 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<EHNamespaceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available Namespaces within 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<EHNamespaceInner> 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)); + } + }); + } + + /** + * Lists the available Namespaces within 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<EHNamespaceInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of IP Filter rules for a Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IpFilterRuleInner> object if successful. + */ + public PagedList listIPFilterRulesNext(final String nextPageLink) { + ServiceResponse> response = listIPFilterRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listIPFilterRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of IP Filter rules for a Namespace. + * + * @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> listIPFilterRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listIPFilterRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listIPFilterRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of IP Filter rules for a Namespace. + * + * @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<IpFilterRuleInner> object + */ + public Observable> listIPFilterRulesNextAsync(final String nextPageLink) { + return listIPFilterRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of IP Filter rules for a Namespace. + * + * @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<IpFilterRuleInner> object + */ + public Observable>> listIPFilterRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listIPFilterRulesNextSinglePageAsync(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(listIPFilterRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } /** * Gets a list of IP Filter rules for a Namespace. @@ -2419,4 +3273,226 @@ private ServiceResponse> listVirtualNetworkRul .build(response); } + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NetworkRuleSetInner> object if successful. + */ + public PagedList listNetworkRuleSetsNext(final String nextPageLink) { + ServiceResponse> response = listNetworkRuleSetsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @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> listNetworkRuleSetsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNetworkRuleSetsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @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<NetworkRuleSetInner> object + */ + public Observable> listNetworkRuleSetsNextAsync(final String nextPageLink) { + return listNetworkRuleSetsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @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<NetworkRuleSetInner> object + */ + public Observable>> listNetworkRuleSetsNextWithServiceResponseAsync(final String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(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(listNetworkRuleSetsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NetworkRuleSetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNetworkRuleSetsNextSinglePageAsync(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.listNetworkRuleSetsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNetworkRuleSetsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNetworkRuleSetsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @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> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @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<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + * @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<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of authorization rules for a Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(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.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java index 9bc3e6b106f8..f9567f2e5def 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NetworkRuleSet; import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.DefaultAction; import java.util.List; import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.NWRuleSetIpRules; @@ -17,7 +18,8 @@ class NetworkRuleSetImpl extends WrapperImpl implements NetworkRuleSet { private final EventHubsManager manager; - NetworkRuleSetImpl(NetworkRuleSetInner inner, EventHubsManager manager) { + + NetworkRuleSetImpl(NetworkRuleSetInner inner, EventHubsManager manager) { super(inner); this.manager = manager; } @@ -27,6 +29,8 @@ public EventHubsManager manager() { return this.manager; } + + @Override public DefaultAction defaultAction() { return this.inner().defaultAction(); diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/OperationsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/OperationsInner.java index 64e9ba017ed8..98410493bf87 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/OperationsInner.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/OperationsInner.java @@ -37,7 +37,7 @@ public class OperationsInner { /** The Retrofit service to perform REST calls. */ private OperationsService service; /** The service client containing this operation class. */ - private EventHub2018PreviewManagementClientImpl client; + private EventHubManagementClientImpl client; /** * Initializes an instance of OperationsInner. @@ -45,7 +45,7 @@ public class 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, EventHub2018PreviewManagementClientImpl client) { + public OperationsInner(Retrofit retrofit, EventHubManagementClientImpl client) { this.service = retrofit.create(OperationsService.class); this.client = client; } diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/RegionsImpl.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/RegionsImpl.java new file mode 100644 index 000000000000..508dde7cb3a5 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/RegionsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Regions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.MessagingRegions; + +class RegionsImpl extends WrapperImpl implements Regions { + private final EventHubsManager manager; + + RegionsImpl(EventHubsManager manager) { + super(manager.inner().regions()); + this.manager = manager; + } + + public EventHubsManager manager() { + return this.manager; + } + + @Override + public Observable listBySkuAsync(final String sku) { + RegionsInner client = this.inner(); + return client.listBySkuAsync(sku) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public MessagingRegions call(MessagingRegionsInner inner) { + return new MessagingRegionsImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/RegionsInner.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/RegionsInner.java new file mode 100644 index 000000000000..ab333e38ecf8 --- /dev/null +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/RegionsInner.java @@ -0,0 +1,295 @@ +/** + * 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.eventhubs.v2018_01_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhubs.v2018_01_01_preview.ErrorResponseException; +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.Path; +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 Regions. + */ +public class RegionsInner { + /** The Retrofit service to perform REST calls. */ + private RegionsService service; + /** The service client containing this operation class. */ + private EventHubManagementClientImpl client; + + /** + * Initializes an instance of RegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegionsInner(Retrofit retrofit, EventHubManagementClientImpl client) { + this.service = retrofit.create(RegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Regions to be + * used by Retrofit to perform actually REST calls. + */ + interface RegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhubs.v2018_01_01_preview.Regions listBySku" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions") + Observable> listBySku(@Path("subscriptionId") String subscriptionId, @Path("sku") String sku, @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.eventhubs.v2018_01_01_preview.Regions listBySkuNext" }) + @GET + Observable> listBySkuNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MessagingRegionsInner> object if successful. + */ + public PagedList listBySku(final String sku) { + ServiceResponse> response = listBySkuSinglePageAsync(sku).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @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> listBySkuAsync(final String sku, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySkuSinglePageAsync(sku), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MessagingRegionsInner> object + */ + public Observable> listBySkuAsync(final String sku) { + return listBySkuWithServiceResponseAsync(sku) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MessagingRegionsInner> object + */ + public Observable>> listBySkuWithServiceResponseAsync(final String sku) { + return listBySkuSinglePageAsync(sku) + .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(listBySkuNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + ServiceResponse> * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MessagingRegionsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySkuSinglePageAsync(final String sku) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (sku == null) { + throw new IllegalArgumentException("Parameter sku 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.listBySku(this.client.subscriptionId(), sku, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySkuDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySkuDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the available Regions for a given sku. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MessagingRegionsInner> object if successful. + */ + public PagedList listBySkuNext(final String nextPageLink) { + ServiceResponse> response = listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available Regions for a given sku. + * + * @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> listBySkuNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySkuNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available Regions for a given sku. + * + * @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<MessagingRegionsInner> object + */ + public Observable> listBySkuNextAsync(final String nextPageLink) { + return listBySkuNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + * @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<MessagingRegionsInner> object + */ + public Observable>> listBySkuNextWithServiceResponseAsync(final String nextPageLink) { + return listBySkuNextSinglePageAsync(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(listBySkuNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MessagingRegionsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySkuNextSinglePageAsync(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.listBySkuNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySkuNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySkuNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/package-info.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/package-info.java index 445f6fb491aa..a62c63e83a4b 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/package-info.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/implementation/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementation classes for EventHub2018PreviewManagementClient. + * This package contains the implementation classes for EventHubManagementClient. * Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. */ package com.microsoft.azure.management.eventhubs.v2018_01_01_preview.implementation; diff --git a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/package-info.java b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/package-info.java index 3378feeb457b..831c495ad4bc 100644 --- a/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/package-info.java +++ b/sdk/eventhubs/mgmt-v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhubs/v2018_01_01_preview/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for EventHub2018PreviewManagementClient. + * This package contains the classes for EventHubManagementClient. * Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. */ package com.microsoft.azure.management.eventhubs.v2018_01_01_preview;