From 054042e5687d427029a4fe35a1fcf3e6aa0776a3 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 29 Jun 2018 01:59:02 +0000 Subject: [PATCH] Generated from f6ed1f6c6d896acafc55aadb674846be5b47cd70 Removed extra space from pendingReplicationOperationsCount --- .../ArmDisasterRecoveryInner.java | 2 +- .../v2018_01_01_preview/EHNamespace.java | 219 ++ .../v2018_01_01_preview/IPAction.java | 41 + .../v2018_01_01_preview/IpFilterRule.java | 160 ++ .../v2018_01_01_preview/Namespaces.java | 106 + .../eventhub/v2018_01_01_preview/Sku.java | 97 + .../eventhub/v2018_01_01_preview/SkuName.java | 41 + .../eventhub/v2018_01_01_preview/SkuTier.java | 41 + .../VirtualNetworkRule.java | 90 + .../implementation/ClustersInner.java | 4 +- .../implementation/ConfigurationsInner.java | 4 +- .../implementation/EHNamespaceImpl.java | 128 + .../implementation/EHNamespaceInner.java | 233 ++ ...entHub2018PreviewManagementClientImpl.java | 238 ++ .../implementation/EventHubManager.java | 16 +- .../implementation/IpFilterRuleImpl.java | 128 + .../implementation/IpFilterRuleInner.java | 99 + .../implementation/NamespacesImpl.java | 260 ++ .../implementation/NamespacesInner.java | 2234 +++++++++++++++++ .../implementation/OperationsInner.java | 4 +- .../VirtualNetworkRuleImpl.java | 99 + .../VirtualNetworkRuleInner.java | 46 + .../implementation/package-info.java | 4 +- .../v2018_01_01_preview/package-info.java | 4 +- 24 files changed, 4285 insertions(+), 13 deletions(-) create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/EHNamespace.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IPAction.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IpFilterRule.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Sku.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuName.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuTier.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/VirtualNetworkRule.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceImpl.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceInner.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHub2018PreviewManagementClientImpl.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleImpl.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleInner.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleImpl.java create mode 100644 eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleInner.java diff --git a/eventhub/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/eventhub/v2017_04_01/implementation/ArmDisasterRecoveryInner.java b/eventhub/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/eventhub/v2017_04_01/implementation/ArmDisasterRecoveryInner.java index 5736aeeeee9a1..948f38ee1897a 100644 --- a/eventhub/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/eventhub/v2017_04_01/implementation/ArmDisasterRecoveryInner.java +++ b/eventhub/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/eventhub/v2017_04_01/implementation/ArmDisasterRecoveryInner.java @@ -51,7 +51,7 @@ public class ArmDisasterRecoveryInner extends ProxyResource { /** * Number of entities pending to be replicated. */ - @JsonProperty(value = "properties.pendingReplicationOperationsCount ", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.pendingReplicationOperationsCount", access = JsonProperty.Access.WRITE_ONLY) private Long pendingReplicationOperationsCount; /** diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/EHNamespace.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/EHNamespace.java new file mode 100644 index 0000000000000..51f2e3da2fd5e --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/EHNamespace.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhub.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.EventHubManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.EHNamespaceInner; + +/** + * Type representing EHNamespace. + */ +public interface EHNamespace extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the isAutoInflateEnabled value. + */ + Boolean isAutoInflateEnabled(); + + /** + * @return the kafkaEnabled value. + */ + Boolean kafkaEnabled(); + + /** + * @return the maximumThroughputUnits value. + */ + Integer maximumThroughputUnits(); + + /** + * @return the metricId value. + */ + String metricId(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the serviceBusEndpoint value. + */ + String serviceBusEndpoint(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the EHNamespace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of EHNamespace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a EHNamespace definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the EHNamespace definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the ehnamespace update allowing to specify IsAutoInflateEnabled. + */ + interface WithIsAutoInflateEnabled { + /** + * Specifies isAutoInflateEnabled. + */ + WithCreate withIsAutoInflateEnabled(Boolean isAutoInflateEnabled); + } + + /** + * The stage of the ehnamespace update allowing to specify KafkaEnabled. + */ + interface WithKafkaEnabled { + /** + * Specifies kafkaEnabled. + */ + WithCreate withKafkaEnabled(Boolean kafkaEnabled); + } + + /** + * The stage of the ehnamespace update allowing to specify MaximumThroughputUnits. + */ + interface WithMaximumThroughputUnits { + /** + * Specifies maximumThroughputUnits. + */ + WithCreate withMaximumThroughputUnits(Integer maximumThroughputUnits); + } + + /** + * The stage of the ehnamespace update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the ehnamespace update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.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 { + } + + /** + * Grouping of EHNamespace update stages. + */ + interface UpdateStages { + /** + * The stage of the ehnamespace {0} allowing to specify IsAutoInflateEnabled. + */ + interface WithIsAutoInflateEnabled { + /** + * Specifies isAutoInflateEnabled. + */ + Update withIsAutoInflateEnabled(Boolean isAutoInflateEnabled); + } + + /** + * The stage of the ehnamespace {0} allowing to specify KafkaEnabled. + */ + interface WithKafkaEnabled { + /** + * Specifies kafkaEnabled. + */ + Update withKafkaEnabled(Boolean kafkaEnabled); + } + + /** + * The stage of the ehnamespace {0} allowing to specify MaximumThroughputUnits. + */ + interface WithMaximumThroughputUnits { + /** + * Specifies maximumThroughputUnits. + */ + Update withMaximumThroughputUnits(Integer maximumThroughputUnits); + } + + /** + * The stage of the ehnamespace {0} allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the ehnamespace {0} allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IPAction.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IPAction.java new file mode 100644 index 0000000000000..5800d42465f91 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IPAction.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhub.v2018_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IPAction. + */ +public final class IPAction extends ExpandableStringEnum { + /** Static value Accept for IPAction. */ + public static final IPAction ACCEPT = fromString("Accept"); + + /** Static value Reject for IPAction. */ + public static final IPAction REJECT = fromString("Reject"); + + /** + * Creates or finds a IPAction from its string representation. + * @param name a name to look for + * @return the corresponding IPAction + */ + @JsonCreator + public static IPAction fromString(String name) { + return fromString(name, IPAction.class); + } + + /** + * @return known IPAction values + */ + public static Collection values() { + return values(IPAction.class); + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IpFilterRule.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IpFilterRule.java new file mode 100644 index 0000000000000..ecaeb268a1e0c --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/IpFilterRule.java @@ -0,0 +1,160 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.IpFilterRuleInner; +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.eventhub.v2018_01_01_preview.implementation.EventHubManager; + +/** + * Type representing IpFilterRule. + */ +public interface IpFilterRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the action value. + */ + IPAction action(); + + /** + * @return the filterName value. + */ + String filterName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the ipMask value. + */ + String ipMask(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the IpFilterRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of IpFilterRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a IpFilterRule definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the ipfilterrule definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the ipfilterrule definition allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + */ + WithCreate withAction(IPAction action); + } + + /** + * The stage of the ipfilterrule definition allowing to specify FilterName. + */ + interface WithFilterName { + /** + * Specifies filterName. + */ + WithCreate withFilterName(String filterName); + } + + /** + * The stage of the ipfilterrule definition allowing to specify IpMask. + */ + interface WithIpMask { + /** + * Specifies ipMask. + */ + WithCreate withIpMask(String ipMask); + } + + /** + * 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.WithAction, DefinitionStages.WithFilterName, DefinitionStages.WithIpMask { + } + } + /** + * The template for a IpFilterRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAction, UpdateStages.WithFilterName, UpdateStages.WithIpMask { + } + + /** + * Grouping of IpFilterRule update stages. + */ + interface UpdateStages { + /** + * The stage of the ipfilterrule update allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + */ + Update withAction(IPAction action); + } + + /** + * The stage of the ipfilterrule update allowing to specify FilterName. + */ + interface WithFilterName { + /** + * Specifies filterName. + */ + Update withFilterName(String filterName); + } + + /** + * The stage of the ipfilterrule update allowing to specify IpMask. + */ + interface WithIpMask { + /** + * Specifies ipMask. + */ + Update withIpMask(String ipMask); + } + + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java new file mode 100644 index 0000000000000..e0d565252a107 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java @@ -0,0 +1,106 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.NamespacesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IpFilterRule; +import rx.Completable; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.VirtualNetworkRule; + +/** + * Type representing Namespaces. + */ +public interface Namespaces extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Begins definition for a new Ipfilterrule resource. + * @param name resource name. + * @return the first stage of the new Ipfilterrule definition. + */ + IpFilterRule.DefinitionStages.Blank defineIpfilterrule(String name); + + /** + * Begins definition for a new Virtualnetworkrule resource. + * @param name resource name. + * @return the first stage of the new Virtualnetworkrule definition. + */ + VirtualNetworkRule.DefinitionStages.Blank defineVirtualnetworkrule(String name); + + /** + * Gets an IpFilterRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName); + + /** + * Gets a list of IP Filter 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 listIPFilterRulesAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName); + + /** + * Gets an VirtualNetworkRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName); + + /** + * Gets a list of VirtualNetwork 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 listVirtualNetworkRulesAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName); + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Sku.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Sku.java new file mode 100644 index 0000000000000..dde478180c504 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Sku.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhub.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU parameters supplied to the create namespace operation. + */ +public class Sku { + /** + * Name of this SKU. Possible values include: 'Basic', 'Standard'. + */ + @JsonProperty(value = "name", required = true) + private SkuName name; + + /** + * The billing tier of this particular SKU. Possible values include: + * 'Basic', 'Standard'. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /** + * The Event Hubs throughput units, vaule should be 0 to 20 throughput + * units. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get name of this SKU. Possible values include: 'Basic', 'Standard'. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set name of this SKU. Possible values include: 'Basic', 'Standard'. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Get the billing tier of this particular SKU. Possible values include: 'Basic', 'Standard'. + * + * @return the tier value + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the billing tier of this particular SKU. Possible values include: 'Basic', 'Standard'. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the Event Hubs throughput units, vaule should be 0 to 20 throughput units. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the Event Hubs throughput units, vaule should be 0 to 20 throughput units. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuName.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuName.java new file mode 100644 index 0000000000000..9b9861a371363 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuName.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhub.v2018_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuName. + */ +public final class SkuName extends ExpandableStringEnum { + /** Static value Basic for SkuName. */ + public static final SkuName BASIC = fromString("Basic"); + + /** Static value Standard for SkuName. */ + public static final SkuName STANDARD = fromString("Standard"); + + /** + * Creates or finds a SkuName from its string representation. + * @param name a name to look for + * @return the corresponding SkuName + */ + @JsonCreator + public static SkuName fromString(String name) { + return fromString(name, SkuName.class); + } + + /** + * @return known SkuName values + */ + public static Collection values() { + return values(SkuName.class); + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuTier.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuTier.java new file mode 100644 index 0000000000000..c29be1619bf0c --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/SkuTier.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.eventhub.v2018_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuTier. + */ +public final class SkuTier extends ExpandableStringEnum { + /** Static value Basic for SkuTier. */ + public static final SkuTier BASIC = fromString("Basic"); + + /** Static value Standard for SkuTier. */ + public static final SkuTier STANDARD = fromString("Standard"); + + /** + * Creates or finds a SkuTier from its string representation. + * @param name a name to look for + * @return the corresponding SkuTier + */ + @JsonCreator + public static SkuTier fromString(String name) { + return fromString(name, SkuTier.class); + } + + /** + * @return known SkuTier values + */ + public static Collection values() { + return values(SkuTier.class); + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/VirtualNetworkRule.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/VirtualNetworkRule.java new file mode 100644 index 0000000000000..4e2ae5c7673bf --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/VirtualNetworkRule.java @@ -0,0 +1,90 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.VirtualNetworkRuleInner; +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.eventhub.v2018_01_01_preview.implementation.EventHubManager; + +/** + * Type representing VirtualNetworkRule. + */ +public interface VirtualNetworkRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * The entirety of the VirtualNetworkRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of VirtualNetworkRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a VirtualNetworkRule definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the virtualnetworkrule definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * 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 VirtualNetworkRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of VirtualNetworkRule update stages. + */ + interface UpdateStages { + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ClustersInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ClustersInner.java index 4ee62e53fdb3f..427fff65d7fa5 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ClustersInner.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ClustersInner.java @@ -43,7 +43,7 @@ public class ClustersInner implements InnerSupportsGet { /** The Retrofit service to perform REST calls. */ private ClustersService service; /** The service client containing this operation class. */ - private EventHubClusterManagementClientImpl client; + private EventHub2018PreviewManagementClientImpl client; /** * Initializes an instance of ClustersInner. @@ -51,7 +51,7 @@ public class ClustersInner implements InnerSupportsGet { * @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, EventHubClusterManagementClientImpl client) { + public ClustersInner(Retrofit retrofit, EventHub2018PreviewManagementClientImpl client) { this.service = retrofit.create(ClustersService.class); this.client = client; } diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ConfigurationsInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ConfigurationsInner.java index c2af3b979a338..f510fd8f724f0 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/ConfigurationsInner.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/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 EventHubClusterManagementClientImpl client; + private EventHub2018PreviewManagementClientImpl 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, EventHubClusterManagementClientImpl client) { + public ConfigurationsInner(Retrofit retrofit, EventHub2018PreviewManagementClientImpl client) { this.service = retrofit.create(ConfigurationsService.class); this.client = client; } diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceImpl.java new file mode 100644 index 0000000000000..74b1dfcfea4d3 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceImpl.java @@ -0,0 +1,128 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.EHNamespace; +import rx.Observable; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Sku; +import org.joda.time.DateTime; + +class EHNamespaceImpl extends GroupableResourceCoreImpl implements EHNamespace, EHNamespace.Definition, EHNamespace.Update { + EHNamespaceImpl(String name, EHNamespaceInner inner, EventHubManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Boolean isAutoInflateEnabled() { + return this.inner().isAutoInflateEnabled(); + } + + @Override + public Boolean kafkaEnabled() { + return this.inner().kafkaEnabled(); + } + + @Override + public Integer maximumThroughputUnits() { + return this.inner().maximumThroughputUnits(); + } + + @Override + public String metricId() { + return this.inner().metricId(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String serviceBusEndpoint() { + return this.inner().serviceBusEndpoint(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public EHNamespaceImpl withIsAutoInflateEnabled(Boolean isAutoInflateEnabled) { + this.inner().withIsAutoInflateEnabled(isAutoInflateEnabled); + return this; + } + + @Override + public EHNamespaceImpl withKafkaEnabled(Boolean kafkaEnabled) { + this.inner().withKafkaEnabled(kafkaEnabled); + return this; + } + + @Override + public EHNamespaceImpl withMaximumThroughputUnits(Integer maximumThroughputUnits) { + this.inner().withMaximumThroughputUnits(maximumThroughputUnits); + return this; + } + + @Override + public EHNamespaceImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + + @Override + public EHNamespaceImpl withZoneRedundant(Boolean zoneRedundant) { + this.inner().withZoneRedundant(zoneRedundant); + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceInner.java new file mode 100644 index 0000000000000..43a3a5885ac0b --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EHNamespaceInner.java @@ -0,0 +1,233 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Sku; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Single Namespace item in List or Get Operation. + */ +@JsonFlatten +@SkipParentValidation +public class EHNamespaceInner extends Resource { + /** + * Properties of sku resource. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Provisioning state of the Namespace. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The time the Namespace was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The time the Namespace was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Endpoint you can use to perform Service Bus operations. + */ + @JsonProperty(value = "properties.serviceBusEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String serviceBusEndpoint; + + /** + * Identifier for Azure Insights metrics. + */ + @JsonProperty(value = "properties.metricId", access = JsonProperty.Access.WRITE_ONLY) + private String metricId; + + /** + * Value that indicates whether AutoInflate is enabled for eventhub + * namespace. + */ + @JsonProperty(value = "properties.isAutoInflateEnabled") + private Boolean isAutoInflateEnabled; + + /** + * Upper limit of throughput units when AutoInflate is enabled, vaule + * should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = + * true). + */ + @JsonProperty(value = "properties.maximumThroughputUnits") + private Integer maximumThroughputUnits; + + /** + * Value that indicates whether Kafka is enabled for eventhub namespace. + */ + @JsonProperty(value = "properties.kafkaEnabled") + private Boolean kafkaEnabled; + + /** + * Enabling this property creates a Standard Event Hubs Namespace in + * regions supported availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get properties of sku resource. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set properties of sku resource. + * + * @param sku the sku value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get provisioning state of the Namespace. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the time the Namespace was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the time the Namespace was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get endpoint you can use to perform Service Bus operations. + * + * @return the serviceBusEndpoint value + */ + public String serviceBusEndpoint() { + return this.serviceBusEndpoint; + } + + /** + * Get identifier for Azure Insights metrics. + * + * @return the metricId value + */ + public String metricId() { + return this.metricId; + } + + /** + * Get value that indicates whether AutoInflate is enabled for eventhub namespace. + * + * @return the isAutoInflateEnabled value + */ + public Boolean isAutoInflateEnabled() { + return this.isAutoInflateEnabled; + } + + /** + * Set value that indicates whether AutoInflate is enabled for eventhub namespace. + * + * @param isAutoInflateEnabled the isAutoInflateEnabled value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withIsAutoInflateEnabled(Boolean isAutoInflateEnabled) { + this.isAutoInflateEnabled = isAutoInflateEnabled; + return this; + } + + /** + * Get upper limit of throughput units when AutoInflate is enabled, vaule should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true). + * + * @return the maximumThroughputUnits value + */ + public Integer maximumThroughputUnits() { + return this.maximumThroughputUnits; + } + + /** + * Set upper limit of throughput units when AutoInflate is enabled, vaule should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true). + * + * @param maximumThroughputUnits the maximumThroughputUnits value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withMaximumThroughputUnits(Integer maximumThroughputUnits) { + this.maximumThroughputUnits = maximumThroughputUnits; + return this; + } + + /** + * Get value that indicates whether Kafka is enabled for eventhub namespace. + * + * @return the kafkaEnabled value + */ + public Boolean kafkaEnabled() { + return this.kafkaEnabled; + } + + /** + * Set value that indicates whether Kafka is enabled for eventhub namespace. + * + * @param kafkaEnabled the kafkaEnabled value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withKafkaEnabled(Boolean kafkaEnabled) { + this.kafkaEnabled = kafkaEnabled; + return this; + } + + /** + * Get enabling this property creates a Standard Event Hubs Namespace in regions supported availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set enabling this property creates a Standard Event Hubs Namespace in regions supported availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the EHNamespaceInner object itself. + */ + public EHNamespaceInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHub2018PreviewManagementClientImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHub2018PreviewManagementClientImpl.java new file mode 100644 index 0000000000000..44cfe720793bc --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHub2018PreviewManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * 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.eventhub.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 EventHub2018PreviewManagementClientImpl class. + */ +public class EventHub2018PreviewManagementClientImpl 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 EventHub2018PreviewManagementClientImpl 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; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public EventHub2018PreviewManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public EventHub2018PreviewManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public EventHub2018PreviewManagementClientImpl 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 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 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; + } + + /** + * Initializes an instance of EventHub2018PreviewManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public EventHub2018PreviewManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of EventHub2018PreviewManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public EventHub2018PreviewManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of EventHub2018PreviewManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public EventHub2018PreviewManagementClientImpl(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.clusters = new ClustersInner(restClient().retrofit(), this); + this.configurations = new ConfigurationsInner(restClient().retrofit(), this); + this.namespaces = new NamespacesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "EventHub2018PreviewManagementClient", "2018-01-01-preview"); + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHubManager.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHubManager.java index 4a9e79465e6bb..208fd4ba8626a 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHubManager.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/EventHubManager.java @@ -19,16 +19,18 @@ import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Operations; import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Clusters; import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Configurations; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Namespaces; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; /** * Entry point to Azure EventHub resource management. */ -public final class EventHubManager extends ManagerCore { +public final class EventHubManager extends ManagerCore { private Operations operations; private Clusters clusters; private Configurations configurations; + private Namespaces namespaces; /** * Get a Configurable instance that can be used to create EventHubManager with optional configuration. * @@ -106,6 +108,16 @@ public Configurations configurations() { return this.configurations; } + /** + * @return Entry point to manage Namespaces. + */ + public Namespaces namespaces() { + if (this.namespaces == null) { + this.namespaces = new NamespacesImpl(this); + } + return this.namespaces; + } + /** * The implementation for Configurable interface. */ @@ -118,6 +130,6 @@ private EventHubManager(RestClient restClient, String subscriptionId) { super( restClient, subscriptionId, - new EventHubClusterManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + new EventHub2018PreviewManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); } } diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleImpl.java new file mode 100644 index 0000000000000..d9e147ced478e --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleImpl.java @@ -0,0 +1,128 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IpFilterRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IPAction; + +class IpFilterRuleImpl extends CreatableUpdatableImpl implements IpFilterRule, IpFilterRule.Definition, IpFilterRule.Update { + private final EventHubManager manager; + private String resourceGroupName; + private String namespaceName; + private String ipFilterRuleName; + + IpFilterRuleImpl(String name, EventHubManager manager) { + super(name, new IpFilterRuleInner()); + this.manager = manager; + // Set resource name + this.ipFilterRuleName = name; + // + } + + IpFilterRuleImpl(IpFilterRuleInner inner, EventHubManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.ipFilterRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.ipFilterRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "ipfilterrules"); + // + } + + @Override + public EventHubManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateIpFilterRuleAsync(this.resourceGroupName, this.namespaceName, this.ipFilterRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateIpFilterRuleAsync(this.resourceGroupName, this.namespaceName, this.ipFilterRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getIpFilterRuleAsync(this.resourceGroupName, this.namespaceName, this.ipFilterRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public IPAction action() { + return this.inner().action(); + } + + @Override + public String filterName() { + return this.inner().filterName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String ipMask() { + return this.inner().ipMask(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public IpFilterRuleImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public IpFilterRuleImpl withAction(IPAction action) { + this.inner().withAction(action); + return this; + } + + @Override + public IpFilterRuleImpl withFilterName(String filterName) { + this.inner().withFilterName(filterName); + return this; + } + + @Override + public IpFilterRuleImpl withIpMask(String ipMask) { + this.inner().withIpMask(ipMask); + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleInner.java new file mode 100644 index 0000000000000..624a246c143ad --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/IpFilterRuleInner.java @@ -0,0 +1,99 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IPAction; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in a List or Get IpFilterRules operation. + */ +@JsonFlatten +public class IpFilterRuleInner extends ProxyResource { + /** + * IP Mask. + */ + @JsonProperty(value = "properties.ipMask") + private String ipMask; + + /** + * The IP Filter Action. Possible values include: 'Accept', 'Reject'. + */ + @JsonProperty(value = "properties.action") + private IPAction action; + + /** + * IP Filter name. + */ + @JsonProperty(value = "properties.filterName") + private String filterName; + + /** + * Get iP Mask. + * + * @return the ipMask value + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set iP Mask. + * + * @param ipMask the ipMask value to set + * @return the IpFilterRuleInner object itself. + */ + public IpFilterRuleInner withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Get the IP Filter Action. Possible values include: 'Accept', 'Reject'. + * + * @return the action value + */ + public IPAction action() { + return this.action; + } + + /** + * Set the IP Filter Action. Possible values include: 'Accept', 'Reject'. + * + * @param action the action value to set + * @return the IpFilterRuleInner object itself. + */ + public IpFilterRuleInner withAction(IPAction action) { + this.action = action; + return this; + } + + /** + * Get iP Filter name. + * + * @return the filterName value + */ + public String filterName() { + return this.filterName; + } + + /** + * Set iP Filter name. + * + * @param filterName the filterName value to set + * @return the IpFilterRuleInner object itself. + */ + public IpFilterRuleInner withFilterName(String filterName) { + this.filterName = filterName; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java new file mode 100644 index 0000000000000..43173ff8b124d --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java @@ -0,0 +1,260 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.Namespaces; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.EHNamespace; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IpFilterRule; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.VirtualNetworkRule; + +class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { + protected NamespacesImpl(EventHubManager manager) { + super(manager.inner().namespaces(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + NamespacesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + NamespacesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + NamespacesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + NamespacesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EHNamespace call(EHNamespaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + NamespacesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + NamespacesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EHNamespace call(EHNamespaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public EHNamespaceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected EHNamespaceImpl wrapModel(EHNamespaceInner inner) { + return new EHNamespaceImpl(inner.name(), inner, manager()); + } + + @Override + protected EHNamespaceImpl wrapModel(String name) { + return new EHNamespaceImpl(name, new EHNamespaceInner(), this.manager()); + } + + @Override + public IpFilterRuleImpl defineIpfilterrule(String name) { + return wrapIpfilterruleModel(name); + } + + @Override + public VirtualNetworkRuleImpl defineVirtualnetworkrule(String name) { + return wrapVirtualnetworkruleModel(name); + } + + private IpFilterRuleImpl wrapIpfilterruleModel(String name) { + return new IpFilterRuleImpl(name, this.manager()); + } + + private VirtualNetworkRuleImpl wrapVirtualnetworkruleModel(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } + + private IpFilterRuleImpl wrapIpFilterRuleModel(IpFilterRuleInner inner) { + return new IpFilterRuleImpl(inner, manager()); + } + + private VirtualNetworkRuleImpl wrapVirtualNetworkRuleModel(VirtualNetworkRuleInner inner) { + return new VirtualNetworkRuleImpl(inner, manager()); + } + + private Observable getIpFilterRuleInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String ipFilterRuleName = IdParsingUtils.getValueFromIdByName(id, "ipfilterrules"); + NamespacesInner client = this.inner(); + return client.getIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName); + } + + private Observable getVirtualNetworkRuleInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String virtualNetworkRuleName = IdParsingUtils.getValueFromIdByName(id, "virtualnetworkrules"); + NamespacesInner client = this.inner(); + return client.getVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName); + } + + @Override + public Observable getIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + NamespacesInner client = this.inner(); + return client.getIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName) + .map(new Func1() { + @Override + public IpFilterRule call(IpFilterRuleInner inner) { + return wrapIpFilterRuleModel(inner); + } + }); + } + + @Override + public Observable listIPFilterRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listIPFilterRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IpFilterRule call(IpFilterRuleInner inner) { + return wrapIpFilterRuleModel(inner); + } + }); + } + + @Override + public Completable deleteIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + NamespacesInner client = this.inner(); + return client.deleteIpFilterRuleAsync(resourceGroupName, namespaceName, ipFilterRuleName).toCompletable(); + } + + @Override + public Observable getVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + NamespacesInner client = this.inner(); + return client.getVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName) + .map(new Func1() { + @Override + public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { + return wrapVirtualNetworkRuleModel(inner); + } + }); + } + + @Override + public Observable listVirtualNetworkRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listVirtualNetworkRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .flatMap(new Func1>() { + @Override + public Observable call(IpFilterRuleInner inner) { + return getVirtualNetworkRuleInnerUsingNamespacesInnerAsync(inner.id()); + } + }) + .map(new Func1() { + @Override + public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { + return wrapVirtualNetworkRuleModel(inner); + } + }); + } + + @Override + public Completable deleteVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + NamespacesInner client = this.inner(); + return client.deleteVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).toCompletable(); + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java new file mode 100644 index 0000000000000..cec52abc0e2fc --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java @@ -0,0 +1,2234 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhub.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.PATCH; +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 Namespaces. + */ +public class NamespacesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private NamespacesService service; + /** The service client containing this operation class. */ + private EventHub2018PreviewManagementClientImpl client; + + /** + * Initializes an instance of NamespacesInner. + * + * @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) { + this.service = retrofit.create(NamespacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Namespaces to be + * 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.eventhub.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.v2018_01_01_preview.Namespaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @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.eventhub.v2018_01_01_preview.Namespaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body EHNamespaceInner 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.eventhub.v2018_01_01_preview.Namespaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body EHNamespaceInner 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.eventhub.v2018_01_01_preview.Namespaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", method = "DELETE", hasBody = true) + Observable> delete(@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.eventhub.v2018_01_01_preview.Namespaces beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.eventhub.v2018_01_01_preview.Namespaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}") + Observable> getByResourceGroup(@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.eventhub.v2018_01_01_preview.Namespaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body EHNamespaceInner 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.eventhub.v2018_01_01_preview.Namespaces listIPFilterRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules") + Observable> listIPFilterRules(@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.eventhub.v2018_01_01_preview.Namespaces createOrUpdateIpFilterRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}") + Observable> createOrUpdateIpFilterRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("ipFilterRuleName") String ipFilterRuleName, @Path("subscriptionId") String subscriptionId, @Body IpFilterRuleInner 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.eventhub.v2018_01_01_preview.Namespaces deleteIpFilterRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}", method = "DELETE", hasBody = true) + Observable> deleteIpFilterRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("ipFilterRuleName") String ipFilterRuleName, @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.eventhub.v2018_01_01_preview.Namespaces getIpFilterRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}") + Observable> getIpFilterRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("ipFilterRuleName") String ipFilterRuleName, @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.eventhub.v2018_01_01_preview.Namespaces listVirtualNetworkRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules") + Observable> listVirtualNetworkRules(@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.eventhub.v2018_01_01_preview.Namespaces createOrUpdateVirtualNetworkRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}") + Observable> createOrUpdateVirtualNetworkRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualNetworkRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.v2018_01_01_preview.Namespaces deleteVirtualNetworkRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> deleteVirtualNetworkRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.eventhub.v2018_01_01_preview.Namespaces getVirtualNetworkRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}") + Observable> getVirtualNetworkRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.eventhub.v2018_01_01_preview.Namespaces 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.eventhub.v2018_01_01_preview.Namespaces listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.v2018_01_01_preview.Namespaces listIPFilterRulesNext" }) + @GET + Observable> listIPFilterRulesNext(@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.eventhub.v2018_01_01_preview.Namespaces listVirtualNetworkRulesNext" }) + @GET + Observable> listVirtualNetworkRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * + * @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 list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EHNamespaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .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. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EHNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Namespaces within a subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EHNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws 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 resourceGroupName Name of the resource group within the Azure subscription. + * @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 listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available Namespaces within a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available Namespaces within a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EHNamespaceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available Namespaces within a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EHNamespaceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available Namespaces within a resource group. + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EHNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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.listByResourceGroup(resourceGroupName, 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 = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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 namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace 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 EHNamespaceInner object if successful. + */ + public EHNamespaceInner createOrUpdate(String resourceGroupName, String namespaceName, EHNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace 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, EHNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, EHNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, EHNamespaceInner>() { + @Override + public EHNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, EHNamespaceInner 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 (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, 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 namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace 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 EHNamespaceInner object if successful. + */ + public EHNamespaceInner beginCreateOrUpdate(String resourceGroupName, String namespaceName, EHNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace 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 beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, EHNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EHNamespaceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, EHNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, EHNamespaceInner>() { + @Override + public EHNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for creating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EHNamespaceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, EHNamespaceInner 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 (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, 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()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 + */ + public void delete(String resourceGroupName, String namespaceName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().last().body(); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 deleteAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, 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."); + } + Observable> observable = service.delete(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 + */ + public void beginDelete(String resourceGroupName, String namespaceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 beginDeleteAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String namespaceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing namespace. This operation also removes all associated resources under the 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 {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, 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.beginDelete(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 clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the description of the specified 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 EHNamespaceInner object if successful. + */ + public EHNamespaceInner getByResourceGroup(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets the description of the specified 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 getByResourceGroupAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Gets the description of the specified 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 EHNamespaceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, EHNamespaceInner>() { + @Override + public EHNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the description of the specified 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 EHNamespaceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, 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.getByResourceGroup(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 clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(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); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for updating a namespace 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 EHNamespaceInner object if successful. + */ + public EHNamespaceInner update(String resourceGroupName, String namespaceName, EHNamespaceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for updating a namespace 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 updateAsync(String resourceGroupName, String namespaceName, EHNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for updating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EHNamespaceInner object + */ + public Observable updateAsync(String resourceGroupName, String namespaceName, EHNamespaceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, EHNamespaceInner>() { + @Override + public EHNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters Parameters for updating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EHNamespaceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String namespaceName, EHNamespaceInner 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 (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.update(resourceGroupName, namespaceName, 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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of IP Filter 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 + * @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 listIPFilterRules(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listIPFilterRulesSinglePageAsync(resourceGroupName, namespaceName).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 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> listIPFilterRulesAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listIPFilterRulesSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listIPFilterRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of IP Filter 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 to the PagedList<IpFilterRuleInner> object + */ + public Observable> listIPFilterRulesAsync(final String resourceGroupName, final String namespaceName) { + return listIPFilterRulesWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of IP Filter 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 to the PagedList<IpFilterRuleInner> object + */ + public Observable>> listIPFilterRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listIPFilterRulesSinglePageAsync(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(listIPFilterRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of IP Filter rules for a Namespace. + * + 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<IpFilterRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listIPFilterRulesSinglePageAsync(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.listIPFilterRules(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 = listIPFilterRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listIPFilterRulesDelegate(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 IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @param parameters The Namespace IpFilterRule. + * @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 IpFilterRuleInner object if successful. + */ + public IpFilterRuleInner createOrUpdateIpFilterRule(String resourceGroupName, String namespaceName, String ipFilterRuleName, IpFilterRuleInner parameters) { + return createOrUpdateIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @param parameters The Namespace IpFilterRule. + * @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 createOrUpdateIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName, IpFilterRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IpFilterRuleInner object + */ + public Observable createOrUpdateIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName, IpFilterRuleInner parameters) { + return createOrUpdateIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName, parameters).map(new Func1, IpFilterRuleInner>() { + @Override + public IpFilterRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IpFilterRuleInner object + */ + public Observable> createOrUpdateIpFilterRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName, IpFilterRuleInner 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 (ipFilterRuleName == null) { + throw new IllegalArgumentException("Parameter ipFilterRuleName 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.createOrUpdateIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, 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 = createOrUpdateIpFilterRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateIpFilterRuleDelegate(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 IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter 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 deleteIpFilterRule(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + deleteIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName).toBlocking().single().body(); + } + + /** + * Deletes an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter 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 deleteIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName), serviceCallback); + } + + /** + * Deletes an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + return deleteIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an IpFilterRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteIpFilterRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + 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 (ipFilterRuleName == null) { + throw new IllegalArgumentException("Parameter ipFilterRuleName 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.deleteIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, 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 = deleteIpFilterRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteIpFilterRuleDelegate(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 IpFilterRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter 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 IpFilterRuleInner object if successful. + */ + public IpFilterRuleInner getIpFilterRule(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + return getIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName).toBlocking().single().body(); + } + + /** + * Gets an IpFilterRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter 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 getIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName), serviceCallback); + } + + /** + * Gets an IpFilterRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IpFilterRuleInner object + */ + public Observable getIpFilterRuleAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + return getIpFilterRuleWithServiceResponseAsync(resourceGroupName, namespaceName, ipFilterRuleName).map(new Func1, IpFilterRuleInner>() { + @Override + public IpFilterRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an IpFilterRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param ipFilterRuleName The IP Filter Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IpFilterRuleInner object + */ + public Observable> getIpFilterRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String ipFilterRuleName) { + 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 (ipFilterRuleName == null) { + throw new IllegalArgumentException("Parameter ipFilterRuleName 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.getIpFilterRule(resourceGroupName, namespaceName, ipFilterRuleName, 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 = getIpFilterRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getIpFilterRuleDelegate(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 VirtualNetwork 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 + * @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 listVirtualNetworkRules(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listVirtualNetworkRulesSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listVirtualNetworkRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of VirtualNetwork rules for 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> listVirtualNetworkRulesAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listVirtualNetworkRulesSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listVirtualNetworkRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of VirtualNetwork 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 to the PagedList<IpFilterRuleInner> object + */ + public Observable> listVirtualNetworkRulesAsync(final String resourceGroupName, final String namespaceName) { + return listVirtualNetworkRulesWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of VirtualNetwork 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 to the PagedList<IpFilterRuleInner> object + */ + public Observable>> listVirtualNetworkRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listVirtualNetworkRulesSinglePageAsync(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(listVirtualNetworkRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of VirtualNetwork rules for a Namespace. + * + 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<IpFilterRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listVirtualNetworkRulesSinglePageAsync(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.listVirtualNetworkRules(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 = listVirtualNetworkRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listVirtualNetworkRulesDelegate(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 VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner createOrUpdateVirtualNetworkRule(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + return createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network 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 createOrUpdateVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable createOrUpdateVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + return createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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 virtualNetworkSubnetId = null; + VirtualNetworkRuleInner parameters = new VirtualNetworkRuleInner(); + parameters.withVirtualNetworkSubnetId(null); + return service.createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, 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 = createOrUpdateVirtualNetworkRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @param virtualNetworkSubnetId ARM ID of Virtual Network Subnet + * @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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner createOrUpdateVirtualNetworkRule(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, String virtualNetworkSubnetId) { + return createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, virtualNetworkSubnetId).toBlocking().single().body(); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @param virtualNetworkSubnetId ARM ID of Virtual Network Subnet + * @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 createOrUpdateVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, String virtualNetworkSubnetId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, virtualNetworkSubnetId), serviceCallback); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @param virtualNetworkSubnetId ARM ID of Virtual Network Subnet + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable createOrUpdateVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, String virtualNetworkSubnetId) { + return createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName, virtualNetworkSubnetId).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @param virtualNetworkSubnetId ARM ID of Virtual Network Subnet + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> createOrUpdateVirtualNetworkRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, String virtualNetworkSubnetId) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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."); + } + VirtualNetworkRuleInner parameters = new VirtualNetworkRuleInner(); + parameters.withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return service.createOrUpdateVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, 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 = createOrUpdateVirtualNetworkRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateVirtualNetworkRuleDelegate(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 VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network 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 deleteVirtualNetworkRule(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + deleteVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Deletes an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network 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 deleteVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + return deleteVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an VirtualNetworkRule for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteVirtualNetworkRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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.deleteVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, 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 = deleteVirtualNetworkRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteVirtualNetworkRuleDelegate(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 VirtualNetworkRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner getVirtualNetworkRule(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + return getVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Gets an VirtualNetworkRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network 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 getVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Gets an VirtualNetworkRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable getVirtualNetworkRuleAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + return getVirtualNetworkRuleWithServiceResponseAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an VirtualNetworkRule for a Namespace by rule name. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param virtualNetworkRuleName The Virtual Network Rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> getVirtualNetworkRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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.getVirtualNetworkRule(resourceGroupName, namespaceName, virtualNetworkRuleName, 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 = getVirtualNetworkRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getVirtualNetworkRuleDelegate(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. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IpFilterRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listIPFilterRulesNextSinglePageAsync(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.listIPFilterRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listIPFilterRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listIPFilterRulesNextDelegate(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 VirtualNetwork 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 listVirtualNetworkRulesNext(final String nextPageLink) { + ServiceResponse> response = listVirtualNetworkRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listVirtualNetworkRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of VirtualNetwork 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> listVirtualNetworkRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listVirtualNetworkRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listVirtualNetworkRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of VirtualNetwork 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> listVirtualNetworkRulesNextAsync(final String nextPageLink) { + return listVirtualNetworkRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of VirtualNetwork 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>> listVirtualNetworkRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listVirtualNetworkRulesNextSinglePageAsync(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(listVirtualNetworkRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of VirtualNetwork 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<IpFilterRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listVirtualNetworkRulesNextSinglePageAsync(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.listVirtualNetworkRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listVirtualNetworkRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listVirtualNetworkRulesNextDelegate(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/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/OperationsInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/OperationsInner.java index ac4b358ff5953..adf5624e7148a 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/OperationsInner.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/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 EventHubClusterManagementClientImpl client; + private EventHub2018PreviewManagementClientImpl 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, EventHubClusterManagementClientImpl client) { + public OperationsInner(Retrofit retrofit, EventHub2018PreviewManagementClientImpl client) { this.service = retrofit.create(OperationsService.class); this.client = client; } diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 0000000000000..ce4ee0baaf28a --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,99 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.VirtualNetworkRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class VirtualNetworkRuleImpl extends CreatableUpdatableImpl implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private final EventHubManager manager; + private String resourceGroupName; + private String namespaceName; + private String virtualNetworkRuleName; + + VirtualNetworkRuleImpl(String name, EventHubManager manager) { + super(name, new VirtualNetworkRuleInner()); + this.manager = manager; + // Set resource name + this.virtualNetworkRuleName = name; + // + } + + VirtualNetworkRuleImpl(VirtualNetworkRuleInner inner, EventHubManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.virtualNetworkRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.virtualNetworkRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualnetworkrules"); + // + } + + @Override + public EventHubManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateVirtualNetworkRuleAsync(this.resourceGroupName, this.namespaceName, this.virtualNetworkRuleName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateVirtualNetworkRuleAsync(this.resourceGroupName, this.namespaceName, this.virtualNetworkRuleName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getVirtualNetworkRuleAsync(this.resourceGroupName, this.namespaceName, this.virtualNetworkRuleName); + } + + @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 String type() { + return this.inner().type(); + } + + @Override + public String virtualNetworkSubnetId() { + return this.inner().virtualNetworkSubnetId(); + } + + @Override + public VirtualNetworkRuleImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleInner.java new file mode 100644 index 0000000000000..010f8dc4205db --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/VirtualNetworkRuleInner.java @@ -0,0 +1,46 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in a List or Get VirtualNetworkRules operation. + */ +@JsonFlatten +public class VirtualNetworkRuleInner extends ProxyResource { + /** + * ARM ID of Virtual Network Subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId") + private String virtualNetworkSubnetId; + + /** + * Get aRM ID of Virtual Network Subnet. + * + * @return the virtualNetworkSubnetId value + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set aRM ID of Virtual Network Subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/package-info.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/package-info.java index 33dd9f4f68541..cea0031f4a2b9 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/package-info.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/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 EventHubClusterManagementClient. - * Azure Event Hubs Cluster client for managing Event Hubs Cluster resources. + * This package contains the implementation classes for EventHub2018PreviewManagementClient. + * Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. */ package com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation; diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/package-info.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/package-info.java index e1154dcbe587c..a8ed68f4eb2fc 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/package-info.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/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 EventHubClusterManagementClient. - * Azure Event Hubs Cluster client for managing Event Hubs Cluster resources. + * This package contains the classes for EventHub2018PreviewManagementClient. + * Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. */ package com.microsoft.azure.management.eventhub.v2018_01_01_preview;