diff --git a/servicebus/resource-manager/v2015_08_01/pom.xml b/servicebus/resource-manager/v2015_08_01/pom.xml new file mode 100644 index 000000000000..30dde111dfbf --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.servicebus.v2015_08_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-servicebus + 1.0.0-beta + jar + Microsoft Azure SDK for ServiceBus Management + This package contains Microsoft ServiceBus Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/AccessRights.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/AccessRights.java new file mode 100644 index 000000000000..251738871a8a --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/AccessRights.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AccessRights. + */ +public enum AccessRights { + /** Enum value Manage. */ + MANAGE("Manage"), + + /** Enum value Send. */ + SEND("Send"), + + /** Enum value Listen. */ + LISTEN("Listen"); + + /** The actual serialized value for a AccessRights instance. */ + private String value; + + AccessRights(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessRights instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessRights object, or null if unable to parse. + */ + @JsonCreator + public static AccessRights fromString(String value) { + AccessRights[] items = AccessRights.values(); + for (AccessRights item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/CheckNameAvailability.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/CheckNameAvailability.java new file mode 100644 index 000000000000..abc67f1f3b22 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/CheckNameAvailability.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of a Check Name availability request properties. + */ +public class CheckNameAvailability { + /** + * The Name to check the namespace name availability and The namespace name + * can contain only letters, numbers, and hyphens. The namespace must start + * with a letter, and it must end with a letter or number. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * + * @param name the name value to set + * @return the CheckNameAvailability object itself. + */ + public CheckNameAvailability withName(String name) { + this.name = name; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/CheckNameAvailabilityResult.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..109bccdc673c --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/CheckNameAvailabilityResult.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.CheckNameAvailabilityResultInner; + +/** + * Type representing CheckNameAvailabilityResult. + */ +public interface CheckNameAvailabilityResult extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + UnavailableReason reason(); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/EntityAvailabilityStatus.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/EntityAvailabilityStatus.java new file mode 100644 index 000000000000..e7c03b35ae58 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/EntityAvailabilityStatus.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EntityAvailabilityStatus. + */ +public enum EntityAvailabilityStatus { + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Limited. */ + LIMITED("Limited"), + + /** Enum value Renaming. */ + RENAMING("Renaming"), + + /** Enum value Restoring. */ + RESTORING("Restoring"), + + /** Enum value Unknown. */ + UNKNOWN("Unknown"); + + /** The actual serialized value for a EntityAvailabilityStatus instance. */ + private String value; + + EntityAvailabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EntityAvailabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed EntityAvailabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static EntityAvailabilityStatus fromString(String value) { + EntityAvailabilityStatus[] items = EntityAvailabilityStatus.values(); + for (EntityAvailabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/EntityStatus.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/EntityStatus.java new file mode 100644 index 000000000000..da50cb609fe0 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/EntityStatus.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EntityStatus. + */ +public enum EntityStatus { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value ReceiveDisabled. */ + RECEIVE_DISABLED("ReceiveDisabled"), + + /** Enum value Renaming. */ + RENAMING("Renaming"), + + /** Enum value Restoring. */ + RESTORING("Restoring"), + + /** Enum value SendDisabled. */ + SEND_DISABLED("SendDisabled"), + + /** Enum value Unknown. */ + UNKNOWN("Unknown"); + + /** The actual serialized value for a EntityStatus instance. */ + private String value; + + EntityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EntityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed EntityStatus object, or null if unable to parse. + */ + @JsonCreator + public static EntityStatus fromString(String value) { + EntityStatus[] items = EntityStatus.values(); + for (EntityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/MessageCountDetails.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/MessageCountDetails.java new file mode 100644 index 000000000000..b04d52375986 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/MessageCountDetails.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Message Count Details. + */ +public class MessageCountDetails { + /** + * Number of active messages in the queue, topic, or subscription. + */ + @JsonProperty(value = "activeMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long activeMessageCount; + + /** + * Number of messages that are dead lettered. + */ + @JsonProperty(value = "deadLetterMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long deadLetterMessageCount; + + /** + * Number of scheduled messages. + */ + @JsonProperty(value = "scheduledMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long scheduledMessageCount; + + /** + * Number of messages transferred into dead letters. + */ + @JsonProperty(value = "transferDeadLetterMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long transferDeadLetterMessageCount; + + /** + * Number of messages transferred to another queue, topic, or subscription. + */ + @JsonProperty(value = "transferMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long transferMessageCount; + + /** + * Get number of active messages in the queue, topic, or subscription. + * + * @return the activeMessageCount value + */ + public Long activeMessageCount() { + return this.activeMessageCount; + } + + /** + * Get number of messages that are dead lettered. + * + * @return the deadLetterMessageCount value + */ + public Long deadLetterMessageCount() { + return this.deadLetterMessageCount; + } + + /** + * Get number of scheduled messages. + * + * @return the scheduledMessageCount value + */ + public Long scheduledMessageCount() { + return this.scheduledMessageCount; + } + + /** + * Get number of messages transferred into dead letters. + * + * @return the transferDeadLetterMessageCount value + */ + public Long transferDeadLetterMessageCount() { + return this.transferDeadLetterMessageCount; + } + + /** + * Get number of messages transferred to another queue, topic, or subscription. + * + * @return the transferMessageCount value + */ + public Long transferMessageCount() { + return this.transferMessageCount; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceCreateOrUpdateParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceCreateOrUpdateParameters.java new file mode 100644 index 000000000000..5ce98bc638d1 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceCreateOrUpdateParameters.java @@ -0,0 +1,239 @@ +/** + * 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.servicebus.v2015_08_01; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create Or Update Namespace operation. + */ +@JsonFlatten +public class NamespaceCreateOrUpdateParameters { + /** + * Namespace location. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Namespace tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Provisioning state of the namespace. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * State of the namespace. Possible values include: 'Unknown', 'Creating', + * 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', + * 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed'. + */ + @JsonProperty(value = "properties.status") + private NamespaceState status; + + /** + * 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; + + /** + * Indicates whether to create an ACS namespace. + */ + @JsonProperty(value = "properties.createACSNamespace") + private Boolean createACSNamespace; + + /** + * Specifies whether this instance is enabled. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get namespace location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set namespace location. + * + * @param location the location value to set + * @return the NamespaceCreateOrUpdateParameters object itself. + */ + public NamespaceCreateOrUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the NamespaceCreateOrUpdateParameters object itself. + */ + public NamespaceCreateOrUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get namespace tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set namespace tags. + * + * @param tags the tags value to set + * @return the NamespaceCreateOrUpdateParameters object itself. + */ + public NamespaceCreateOrUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get provisioning state of the namespace. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get state of the namespace. Possible values include: 'Unknown', 'Creating', 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed'. + * + * @return the status value + */ + public NamespaceState status() { + return this.status; + } + + /** + * Set state of the namespace. Possible values include: 'Unknown', 'Creating', 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed'. + * + * @param status the status value to set + * @return the NamespaceCreateOrUpdateParameters object itself. + */ + public NamespaceCreateOrUpdateParameters withStatus(NamespaceState status) { + this.status = status; + return this; + } + + /** + * 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 indicates whether to create an ACS namespace. + * + * @return the createACSNamespace value + */ + public Boolean createACSNamespace() { + return this.createACSNamespace; + } + + /** + * Set indicates whether to create an ACS namespace. + * + * @param createACSNamespace the createACSNamespace value to set + * @return the NamespaceCreateOrUpdateParameters object itself. + */ + public NamespaceCreateOrUpdateParameters withCreateACSNamespace(Boolean createACSNamespace) { + this.createACSNamespace = createACSNamespace; + return this; + } + + /** + * Get specifies whether this instance is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set specifies whether this instance is enabled. + * + * @param enabled the enabled value to set + * @return the NamespaceCreateOrUpdateParameters object itself. + */ + public NamespaceCreateOrUpdateParameters withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceResource.java new file mode 100644 index 000000000000..271893b2c7b1 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceResource.java @@ -0,0 +1,169 @@ +/** + * 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.servicebus.v2015_08_01; + +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.NamespaceResourceInner; + +/** + * Type representing NamespaceResource. + */ +public interface NamespaceResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the createACSNamespace value. + */ + Boolean createACSNamespace(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the serviceBusEndpoint value. + */ + String serviceBusEndpoint(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the status value. + */ + NamespaceState status(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the NamespaceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of NamespaceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NamespaceResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the NamespaceResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the namespaceresource definition allowing to specify CreateACSNamespace. + */ + interface WithCreateACSNamespace { + /** + * Specifies createACSNamespace. + * @param createACSNamespace Indicates whether to create an ACS namespace + * @return the next definition stage + */ + WithCreate withCreateACSNamespace(Boolean createACSNamespace); + } + + /** + * The stage of the namespaceresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Specifies whether this instance is enabled + * @return the next definition stage + */ + WithCreate withEnabled(Boolean enabled); + } + + /** + * The stage of the namespaceresource definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku the sku parameter value + * @return the next definition stage + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the namespaceresource definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status State of the namespace. Possible values include: 'Unknown', 'Creating', 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed' + * @return the next definition stage + */ + WithCreate withStatus(NamespaceState status); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithCreateACSNamespace, DefinitionStages.WithEnabled, DefinitionStages.WithSku, DefinitionStages.WithStatus { + } + } + /** + * The template for a NamespaceResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku { + } + + /** + * Grouping of NamespaceResource update stages. + */ + interface UpdateStages { + /** + * The stage of the namespaceresource update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The sku of the created namespace + * @return the next update stage + */ + Update withSku(Sku sku); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceSharedAccessAuthorizationRuleResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceSharedAccessAuthorizationRuleResource.java new file mode 100644 index 000000000000..15fcc32653d6 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceSharedAccessAuthorizationRuleResource.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.SharedAccessAuthorizationRuleResourceInner; +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing NamespaceSharedAccessAuthorizationRuleResource. + */ +public interface NamespaceSharedAccessAuthorizationRuleResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the NamespaceSharedAccessAuthorizationRuleResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of NamespaceSharedAccessAuthorizationRuleResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NamespaceSharedAccessAuthorizationRuleResource definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the namespacesharedaccessauthorizationruleresource definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithRights withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the namespacesharedaccessauthorizationruleresource definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the namespacesharedaccessauthorizationruleresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location data center location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the namespacesharedaccessauthorizationruleresource definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Name of the authorization rule + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * 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.WithLocation, DefinitionStages.WithName { + } + } + /** + * The template for a NamespaceSharedAccessAuthorizationRuleResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithName { + } + + /** + * Grouping of NamespaceSharedAccessAuthorizationRuleResource update stages. + */ + interface UpdateStages { + /** + * The stage of the namespacesharedaccessauthorizationruleresource update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location data center location + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the namespacesharedaccessauthorizationruleresource update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Name of the authorization rule + * @return the next update stage + */ + Update withName(String name); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceState.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceState.java new file mode 100644 index 000000000000..487b1d7d64f8 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceState.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for NamespaceState. + */ +public enum NamespaceState { + /** Enum value Unknown. */ + UNKNOWN("Unknown"), + + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Created. */ + CREATED("Created"), + + /** Enum value Activating. */ + ACTIVATING("Activating"), + + /** Enum value Enabling. */ + ENABLING("Enabling"), + + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Disabling. */ + DISABLING("Disabling"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value SoftDeleting. */ + SOFT_DELETING("SoftDeleting"), + + /** Enum value SoftDeleted. */ + SOFT_DELETED("SoftDeleted"), + + /** Enum value Removing. */ + REMOVING("Removing"), + + /** Enum value Removed. */ + REMOVED("Removed"), + + /** Enum value Failed. */ + FAILED("Failed"); + + /** The actual serialized value for a NamespaceState instance. */ + private String value; + + NamespaceState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NamespaceState instance. + * + * @param value the serialized value to parse. + * @return the parsed NamespaceState object, or null if unable to parse. + */ + @JsonCreator + public static NamespaceState fromString(String value) { + NamespaceState[] items = NamespaceState.values(); + for (NamespaceState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceUpdateParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceUpdateParameters.java new file mode 100644 index 000000000000..41e16306e6c3 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/NamespaceUpdateParameters.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the Patch Namespace operation. + */ +public class NamespaceUpdateParameters { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The sku of the created namespace. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the NamespaceUpdateParameters object itself. + */ + public NamespaceUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku of the created namespace. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku of the created namespace. + * + * @param sku the sku value to set + * @return the NamespaceUpdateParameters object itself. + */ + public NamespaceUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Namespaces.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Namespaces.java new file mode 100644 index 000000000000..630bf48e94b6 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Namespaces.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.servicebus.v2015_08_01; + +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.servicebus.v2015_08_01.implementation.NamespacesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceSharedAccessAuthorizationRuleResource; +import rx.Completable; + +/** + * Type representing Namespaces. + */ +public interface Namespaces extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + NamespaceSharedAccessAuthorizationRuleResource.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityMethodAsync(String name); + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Operation.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Operation.java new file mode 100644 index 000000000000..23cafb001f1b --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/OperationDisplay.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/OperationDisplay.java new file mode 100644 index 000000000000..2bf09b0f2449 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.ServiceBus. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: Invoice, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.ServiceBus. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: Invoice, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Operations.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Operations.java new file mode 100644 index 000000000000..48b8c8d40a9b --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Policykey.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Policykey.java new file mode 100644 index 000000000000..c2675507abc1 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Policykey.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Policykey. + */ +public enum Policykey { + /** Enum value PrimaryKey. */ + PRIMARY_KEY("PrimaryKey"), + + /** Enum value SecondaryKey. */ + SECONDARY_KEY("SecondaryKey"); + + /** The actual serialized value for a Policykey instance. */ + private String value; + + Policykey(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Policykey instance. + * + * @param value the serialized value to parse. + * @return the parsed Policykey object, or null if unable to parse. + */ + @JsonCreator + public static Policykey fromString(String value) { + Policykey[] items = Policykey.values(); + for (Policykey item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueCreateOrUpdateParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueCreateOrUpdateParameters.java new file mode 100644 index 000000000000..c481872eaef9 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueCreateOrUpdateParameters.java @@ -0,0 +1,597 @@ +/** + * 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.servicebus.v2015_08_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create Or Update Queue operation. + */ +@JsonFlatten +public class QueueCreateOrUpdateParameters { + /** + * Queue name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The duration of a peek-lock; that is, the amount of time that the + * message is locked for other receivers. The maximum value for + * LockDuration is 5 minutes; the default value is 1 minute. + */ + @JsonProperty(value = "properties.lockDuration") + private String lockDuration; + + /** + * Last time a message was sent, or the last time there was a receive + * request to this queue. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * the TimeSpan idle interval after which the queue is automatically + * deleted. The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private String autoDeleteOnIdle; + + /** + * Entity availability status for the queue. Possible values include: + * 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + */ + @JsonProperty(value = "properties.entityAvailabilityStatus") + private EntityAvailabilityStatus entityAvailabilityStatus; + + /** + * The exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The default message time to live value. This is the duration after which + * the message expires, starting from when the message is sent to Service + * Bus. This is the default value used when TimeToLive is not set on a + * message itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private String defaultMessageTimeToLive; + + /** + * TimeSpan structure that defines the duration of the duplicate detection + * history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private String duplicateDetectionHistoryTimeWindow; + + /** + * A value that indicates whether server-side batched operations are + * enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * A value that indicates whether this queue has dead letter support when a + * message expires. + */ + @JsonProperty(value = "properties.deadLetteringOnMessageExpiration") + private Boolean deadLetteringOnMessageExpiration; + + /** + * A value that indicates whether Express Entities are enabled. An express + * queue holds a message in memory temporarily before writing it to + * persistent storage. + */ + @JsonProperty(value = "properties.enableExpress") + private Boolean enableExpress; + + /** + * A value that indicates whether the queue is to be partitioned across + * multiple message brokers. + */ + @JsonProperty(value = "properties.enablePartitioning") + private Boolean enablePartitioning; + + /** + * A value that indicates whether the message is accessible anonymously. + */ + @JsonProperty(value = "properties.isAnonymousAccessible") + private Boolean isAnonymousAccessible; + + /** + * The maximum delivery count. A message is automatically deadlettered + * after this number of deliveries. + */ + @JsonProperty(value = "properties.maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * The maximum size of the queue in megabytes, which is the size of memory + * allocated for the queue. + */ + @JsonProperty(value = "properties.maxSizeInMegabytes") + private Long maxSizeInMegabytes; + + /** + * The number of messages in the queue. + */ + @JsonProperty(value = "properties.messageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long messageCount; + + /** + * The countDetails property. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * A value indicating if this queue requires duplicate detection. + */ + @JsonProperty(value = "properties.requiresDuplicateDetection") + private Boolean requiresDuplicateDetection; + + /** + * A value that indicates whether the queue supports the concept of + * sessions. + */ + @JsonProperty(value = "properties.requiresSession") + private Boolean requiresSession; + + /** + * The size of the queue, in bytes. + */ + @JsonProperty(value = "properties.sizeInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long sizeInBytes; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', + * 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * A value that indicates whether the queue supports ordering. + */ + @JsonProperty(value = "properties.supportOrdering") + private Boolean supportOrdering; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Get queue name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set queue name. + * + * @param name the name value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the resource. + * + * @param location the location value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + * + * @return the lockDuration value + */ + public String lockDuration() { + return this.lockDuration; + } + + /** + * Set the duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + * + * @param lockDuration the lockDuration value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withLockDuration(String lockDuration) { + this.lockDuration = lockDuration; + return this; + } + + /** + * Get last time a message was sent, or the last time there was a receive request to this queue. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get the TimeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public String autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set the TimeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get entity availability status for the queue. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @return the entityAvailabilityStatus value + */ + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.entityAvailabilityStatus; + } + + /** + * Set entity availability status for the queue. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @param entityAvailabilityStatus the entityAvailabilityStatus value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.entityAvailabilityStatus = entityAvailabilityStatus; + return this; + } + + /** + * Get the exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public String defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set the default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public String duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get a value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set a value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get a value that indicates whether this queue has dead letter support when a message expires. + * + * @return the deadLetteringOnMessageExpiration value + */ + public Boolean deadLetteringOnMessageExpiration() { + return this.deadLetteringOnMessageExpiration; + } + + /** + * Set a value that indicates whether this queue has dead letter support when a message expires. + * + * @param deadLetteringOnMessageExpiration the deadLetteringOnMessageExpiration value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.deadLetteringOnMessageExpiration = deadLetteringOnMessageExpiration; + return this; + } + + /** + * Get a value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + * + * @return the enableExpress value + */ + public Boolean enableExpress() { + return this.enableExpress; + } + + /** + * Set a value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + * + * @param enableExpress the enableExpress value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withEnableExpress(Boolean enableExpress) { + this.enableExpress = enableExpress; + return this; + } + + /** + * Get a value that indicates whether the queue is to be partitioned across multiple message brokers. + * + * @return the enablePartitioning value + */ + public Boolean enablePartitioning() { + return this.enablePartitioning; + } + + /** + * Set a value that indicates whether the queue is to be partitioned across multiple message brokers. + * + * @param enablePartitioning the enablePartitioning value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withEnablePartitioning(Boolean enablePartitioning) { + this.enablePartitioning = enablePartitioning; + return this; + } + + /** + * Get a value that indicates whether the message is accessible anonymously. + * + * @return the isAnonymousAccessible value + */ + public Boolean isAnonymousAccessible() { + return this.isAnonymousAccessible; + } + + /** + * Set a value that indicates whether the message is accessible anonymously. + * + * @param isAnonymousAccessible the isAnonymousAccessible value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withIsAnonymousAccessible(Boolean isAnonymousAccessible) { + this.isAnonymousAccessible = isAnonymousAccessible; + return this; + } + + /** + * Get the maximum delivery count. A message is automatically deadlettered after this number of deliveries. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maximum delivery count. A message is automatically deadlettered after this number of deliveries. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get the maximum size of the queue in megabytes, which is the size of memory allocated for the queue. + * + * @return the maxSizeInMegabytes value + */ + public Long maxSizeInMegabytes() { + return this.maxSizeInMegabytes; + } + + /** + * Set the maximum size of the queue in megabytes, which is the size of memory allocated for the queue. + * + * @param maxSizeInMegabytes the maxSizeInMegabytes value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withMaxSizeInMegabytes(Long maxSizeInMegabytes) { + this.maxSizeInMegabytes = maxSizeInMegabytes; + return this; + } + + /** + * Get the number of messages in the queue. + * + * @return the messageCount value + */ + public Long messageCount() { + return this.messageCount; + } + + /** + * Get the countDetails value. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get a value indicating if this queue requires duplicate detection. + * + * @return the requiresDuplicateDetection value + */ + public Boolean requiresDuplicateDetection() { + return this.requiresDuplicateDetection; + } + + /** + * Set a value indicating if this queue requires duplicate detection. + * + * @param requiresDuplicateDetection the requiresDuplicateDetection value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.requiresDuplicateDetection = requiresDuplicateDetection; + return this; + } + + /** + * Get a value that indicates whether the queue supports the concept of sessions. + * + * @return the requiresSession value + */ + public Boolean requiresSession() { + return this.requiresSession; + } + + /** + * Set a value that indicates whether the queue supports the concept of sessions. + * + * @param requiresSession the requiresSession value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withRequiresSession(Boolean requiresSession) { + this.requiresSession = requiresSession; + return this; + } + + /** + * Get the size of the queue, in bytes. + * + * @return the sizeInBytes value + */ + public Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @param status the status value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get a value that indicates whether the queue supports ordering. + * + * @return the supportOrdering value + */ + public Boolean supportOrdering() { + return this.supportOrdering; + } + + /** + * Set a value that indicates whether the queue supports ordering. + * + * @param supportOrdering the supportOrdering value to set + * @return the QueueCreateOrUpdateParameters object itself. + */ + public QueueCreateOrUpdateParameters withSupportOrdering(Boolean supportOrdering) { + this.supportOrdering = supportOrdering; + return this; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueNamespaceSharedAccessAuthorizationRuleResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueNamespaceSharedAccessAuthorizationRuleResource.java new file mode 100644 index 000000000000..a8e168782fc1 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueNamespaceSharedAccessAuthorizationRuleResource.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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.SharedAccessAuthorizationRuleResourceInner; +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing QueueNamespaceSharedAccessAuthorizationRuleResource. + */ +public interface QueueNamespaceSharedAccessAuthorizationRuleResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the QueueNamespaceSharedAccessAuthorizationRuleResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithQueue, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of QueueNamespaceSharedAccessAuthorizationRuleResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a QueueNamespaceSharedAccessAuthorizationRuleResource definition. + */ + interface Blank extends WithQueue { + } + + /** + * The stage of the queuenamespacesharedaccessauthorizationruleresource definition allowing to specify Queue. + */ + interface WithQueue { + /** + * Specifies resourceGroupName, namespaceName, queueName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param queueName The queue name + * @return the next definition stage + */ + WithRights withExistingQueue(String resourceGroupName, String namespaceName, String queueName); + } + + /** + * The stage of the queuenamespacesharedaccessauthorizationruleresource definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the queuenamespacesharedaccessauthorizationruleresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location data center location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the queuenamespacesharedaccessauthorizationruleresource definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Name of the authorization rule + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * 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.WithLocation, DefinitionStages.WithName { + } + } + /** + * The template for a QueueNamespaceSharedAccessAuthorizationRuleResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithName { + } + + /** + * Grouping of QueueNamespaceSharedAccessAuthorizationRuleResource update stages. + */ + interface UpdateStages { + /** + * The stage of the queuenamespacesharedaccessauthorizationruleresource update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location data center location + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the queuenamespacesharedaccessauthorizationruleresource update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Name of the authorization rule + * @return the next update stage + */ + Update withName(String name); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueResource.java new file mode 100644 index 000000000000..fc25c05c290b --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/QueueResource.java @@ -0,0 +1,624 @@ +/** + * 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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.QueueResourceInner; +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; + +/** + * Type representing QueueResource. + */ +public interface QueueResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the accessedAt value. + */ + DateTime accessedAt(); + + /** + * @return the autoDeleteOnIdle value. + */ + String autoDeleteOnIdle(); + + /** + * @return the countDetails value. + */ + MessageCountDetails countDetails(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the deadLetteringOnMessageExpiration value. + */ + Boolean deadLetteringOnMessageExpiration(); + + /** + * @return the defaultMessageTimeToLive value. + */ + String defaultMessageTimeToLive(); + + /** + * @return the duplicateDetectionHistoryTimeWindow value. + */ + String duplicateDetectionHistoryTimeWindow(); + + /** + * @return the enableBatchedOperations value. + */ + Boolean enableBatchedOperations(); + + /** + * @return the enableExpress value. + */ + Boolean enableExpress(); + + /** + * @return the enablePartitioning value. + */ + Boolean enablePartitioning(); + + /** + * @return the entityAvailabilityStatus value. + */ + EntityAvailabilityStatus entityAvailabilityStatus(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAnonymousAccessible value. + */ + Boolean isAnonymousAccessible(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the lockDuration value. + */ + String lockDuration(); + + /** + * @return the maxDeliveryCount value. + */ + Integer maxDeliveryCount(); + + /** + * @return the maxSizeInMegabytes value. + */ + Long maxSizeInMegabytes(); + + /** + * @return the messageCount value. + */ + Long messageCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresDuplicateDetection value. + */ + Boolean requiresDuplicateDetection(); + + /** + * @return the requiresSession value. + */ + Boolean requiresSession(); + + /** + * @return the sizeInBytes value. + */ + Long sizeInBytes(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the supportOrdering value. + */ + Boolean supportOrdering(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the QueueResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of QueueResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a QueueResource definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the queueresource definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithLocation withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the queueresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the queueresource definition allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle the TimeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes + * @return the next definition stage + */ + WithCreate withAutoDeleteOnIdle(String autoDeleteOnIdle); + } + + /** + * The stage of the queueresource definition allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration A value that indicates whether this queue has dead letter support when a message expires + * @return the next definition stage + */ + WithCreate withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the queueresource definition allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive The default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next definition stage + */ + WithCreate withDefaultMessageTimeToLive(String defaultMessageTimeToLive); + } + + /** + * The stage of the queueresource definition allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow TimeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next definition stage + */ + WithCreate withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the queueresource definition allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations A value that indicates whether server-side batched operations are enabled + * @return the next definition stage + */ + WithCreate withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the queueresource definition allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage + * @return the next definition stage + */ + WithCreate withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the queueresource definition allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning A value that indicates whether the queue is to be partitioned across multiple message brokers + * @return the next definition stage + */ + WithCreate withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the queueresource definition allowing to specify EntityAvailabilityStatus. + */ + interface WithEntityAvailabilityStatus { + /** + * Specifies entityAvailabilityStatus. + * @param entityAvailabilityStatus Entity availability status for the queue. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown' + * @return the next definition stage + */ + WithCreate withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus); + } + + /** + * The stage of the queueresource definition allowing to specify IsAnonymousAccessible. + */ + interface WithIsAnonymousAccessible { + /** + * Specifies isAnonymousAccessible. + * @param isAnonymousAccessible A value that indicates whether the message is accessible anonymously + * @return the next definition stage + */ + WithCreate withIsAnonymousAccessible(Boolean isAnonymousAccessible); + } + + /** + * The stage of the queueresource definition allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration The duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute + * @return the next definition stage + */ + WithCreate withLockDuration(String lockDuration); + } + + /** + * The stage of the queueresource definition allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount The maximum delivery count. A message is automatically deadlettered after this number of deliveries + * @return the next definition stage + */ + WithCreate withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the queueresource definition allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes The maximum size of the queue in megabytes, which is the size of memory allocated for the queue + * @return the next definition stage + */ + WithCreate withMaxSizeInMegabytes(Long maxSizeInMegabytes); + } + + /** + * The stage of the queueresource definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Queue name + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * The stage of the queueresource definition allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection A value indicating if this queue requires duplicate detection + * @return the next definition stage + */ + WithCreate withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the queueresource definition allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession A value that indicates whether the queue supports the concept of sessions + * @return the next definition stage + */ + WithCreate withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the queueresource definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the queueresource definition allowing to specify SupportOrdering. + */ + interface WithSupportOrdering { + /** + * Specifies supportOrdering. + * @param supportOrdering A value that indicates whether the queue supports ordering + * @return the next definition stage + */ + WithCreate withSupportOrdering(Boolean supportOrdering); + } + + /** + * 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.WithAutoDeleteOnIdle, DefinitionStages.WithDeadLetteringOnMessageExpiration, DefinitionStages.WithDefaultMessageTimeToLive, DefinitionStages.WithDuplicateDetectionHistoryTimeWindow, DefinitionStages.WithEnableBatchedOperations, DefinitionStages.WithEnableExpress, DefinitionStages.WithEnablePartitioning, DefinitionStages.WithEntityAvailabilityStatus, DefinitionStages.WithIsAnonymousAccessible, DefinitionStages.WithLockDuration, DefinitionStages.WithMaxDeliveryCount, DefinitionStages.WithMaxSizeInMegabytes, DefinitionStages.WithName, DefinitionStages.WithRequiresDuplicateDetection, DefinitionStages.WithRequiresSession, DefinitionStages.WithStatus, DefinitionStages.WithSupportOrdering { + } + } + /** + * The template for a QueueResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoDeleteOnIdle, UpdateStages.WithDeadLetteringOnMessageExpiration, UpdateStages.WithDefaultMessageTimeToLive, UpdateStages.WithDuplicateDetectionHistoryTimeWindow, UpdateStages.WithEnableBatchedOperations, UpdateStages.WithEnableExpress, UpdateStages.WithEnablePartitioning, UpdateStages.WithEntityAvailabilityStatus, UpdateStages.WithIsAnonymousAccessible, UpdateStages.WithLockDuration, UpdateStages.WithMaxDeliveryCount, UpdateStages.WithMaxSizeInMegabytes, UpdateStages.WithName, UpdateStages.WithRequiresDuplicateDetection, UpdateStages.WithRequiresSession, UpdateStages.WithStatus, UpdateStages.WithSupportOrdering { + } + + /** + * Grouping of QueueResource update stages. + */ + interface UpdateStages { + /** + * The stage of the queueresource update allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle the TimeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes + * @return the next update stage + */ + Update withAutoDeleteOnIdle(String autoDeleteOnIdle); + } + + /** + * The stage of the queueresource update allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration A value that indicates whether this queue has dead letter support when a message expires + * @return the next update stage + */ + Update withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the queueresource update allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive The default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next update stage + */ + Update withDefaultMessageTimeToLive(String defaultMessageTimeToLive); + } + + /** + * The stage of the queueresource update allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow TimeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next update stage + */ + Update withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the queueresource update allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations A value that indicates whether server-side batched operations are enabled + * @return the next update stage + */ + Update withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the queueresource update allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage + * @return the next update stage + */ + Update withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the queueresource update allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning A value that indicates whether the queue is to be partitioned across multiple message brokers + * @return the next update stage + */ + Update withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the queueresource update allowing to specify EntityAvailabilityStatus. + */ + interface WithEntityAvailabilityStatus { + /** + * Specifies entityAvailabilityStatus. + * @param entityAvailabilityStatus Entity availability status for the queue. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown' + * @return the next update stage + */ + Update withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus); + } + + /** + * The stage of the queueresource update allowing to specify IsAnonymousAccessible. + */ + interface WithIsAnonymousAccessible { + /** + * Specifies isAnonymousAccessible. + * @param isAnonymousAccessible A value that indicates whether the message is accessible anonymously + * @return the next update stage + */ + Update withIsAnonymousAccessible(Boolean isAnonymousAccessible); + } + + /** + * The stage of the queueresource update allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration The duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute + * @return the next update stage + */ + Update withLockDuration(String lockDuration); + } + + /** + * The stage of the queueresource update allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount The maximum delivery count. A message is automatically deadlettered after this number of deliveries + * @return the next update stage + */ + Update withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the queueresource update allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes The maximum size of the queue in megabytes, which is the size of memory allocated for the queue + * @return the next update stage + */ + Update withMaxSizeInMegabytes(Long maxSizeInMegabytes); + } + + /** + * The stage of the queueresource update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Queue name + * @return the next update stage + */ + Update withName(String name); + } + + /** + * The stage of the queueresource update allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection A value indicating if this queue requires duplicate detection + * @return the next update stage + */ + Update withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the queueresource update allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession A value that indicates whether the queue supports the concept of sessions + * @return the next update stage + */ + Update withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the queueresource update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + /** + * The stage of the queueresource update allowing to specify SupportOrdering. + */ + interface WithSupportOrdering { + /** + * Specifies supportOrdering. + * @param supportOrdering A value that indicates whether the queue supports ordering + * @return the next update stage + */ + Update withSupportOrdering(Boolean supportOrdering); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Queues.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Queues.java new file mode 100644 index 000000000000..5a6bad92b011 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Queues.java @@ -0,0 +1,132 @@ +/** + * 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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.QueuesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueNamespaceSharedAccessAuthorizationRuleResource; + +/** + * Type representing Queues. + */ +public interface Queues extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + QueueNamespaceSharedAccessAuthorizationRuleResource.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String queueName); + + /** + * Gets the queues within 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 listAllAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String queueName); + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName); + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/RegenerateKeysParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/RegenerateKeysParameters.java new file mode 100644 index 000000000000..028ac0cd186c --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/RegenerateKeysParameters.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the Regenerate Authorization Rule operation. + */ +public class RegenerateKeysParameters { + /** + * Key that needs to be regenerated. Possible values include: 'PrimaryKey', + * 'SecondaryKey'. + */ + @JsonProperty(value = "Policykey") + private Policykey policykey; + + /** + * Get key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey'. + * + * @return the policykey value + */ + public Policykey policykey() { + return this.policykey; + } + + /** + * Set key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey'. + * + * @param policykey the policykey value to set + * @return the RegenerateKeysParameters object itself. + */ + public RegenerateKeysParameters withPolicykey(Policykey policykey) { + this.policykey = policykey; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/ResourceListKeys.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/ResourceListKeys.java new file mode 100644 index 000000000000..e6c299c59b9c --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/ResourceListKeys.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.ResourceListKeysInner; + +/** + * Type representing ResourceListKeys. + */ +public interface ResourceListKeys extends HasInner, HasManager { + /** + * @return the keyName value. + */ + String keyName(); + + /** + * @return the primaryConnectionString value. + */ + String primaryConnectionString(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryConnectionString value. + */ + String secondaryConnectionString(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SharedAccessAuthorizationRuleCreateOrUpdateParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SharedAccessAuthorizationRuleCreateOrUpdateParameters.java new file mode 100644 index 000000000000..4ee173899a5a --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SharedAccessAuthorizationRuleCreateOrUpdateParameters.java @@ -0,0 +1,98 @@ +/** + * 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.servicebus.v2015_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create Or Update Authorization Rules operation. + */ +@JsonFlatten +public class SharedAccessAuthorizationRuleCreateOrUpdateParameters { + /** + * data center location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Name of the authorization rule. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "properties.rights", required = true) + private List rights; + + /** + * Get data center location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set data center location. + * + * @param location the location value to set + * @return the SharedAccessAuthorizationRuleCreateOrUpdateParameters object itself. + */ + public SharedAccessAuthorizationRuleCreateOrUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get name of the authorization rule. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the authorization rule. + * + * @param name the name value to set + * @return the SharedAccessAuthorizationRuleCreateOrUpdateParameters object itself. + */ + public SharedAccessAuthorizationRuleCreateOrUpdateParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the SharedAccessAuthorizationRuleCreateOrUpdateParameters object itself. + */ + public SharedAccessAuthorizationRuleCreateOrUpdateParameters withRights(List rights) { + this.rights = rights; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Sku.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Sku.java new file mode 100644 index 000000000000..58c5c89c8f13 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/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.servicebus.v2015_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU of the namespace. + */ +public class Sku { + /** + * Name of this SKU. Possible values include: 'Basic', 'Standard', + * 'Premium'. + */ + @JsonProperty(value = "name") + private SkuName name; + + /** + * The billing tier of this particular SKU. Possible values include: + * 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "tier", required = true) + private SkuTier tier; + + /** + * The specified messaging units for the tier. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get name of this SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set name of this SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @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', 'Premium'. + * + * @return the tier value + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the billing tier of this particular SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the specified messaging units for the tier. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the specified messaging units for the tier. + * + * @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/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SkuName.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SkuName.java new file mode 100644 index 000000000000..47fb99beee79 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SkuName.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +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"); + + /** Static value Premium for SkuName. */ + public static final SkuName PREMIUM = fromString("Premium"); + + /** + * 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/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SkuTier.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SkuTier.java new file mode 100644 index 000000000000..e574ce11f524 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SkuTier.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +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"); + + /** Static value Premium for SkuTier. */ + public static final SkuTier PREMIUM = fromString("Premium"); + + /** + * 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/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SubscriptionCreateOrUpdateParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SubscriptionCreateOrUpdateParameters.java new file mode 100644 index 000000000000..b0f4af1e84ee --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SubscriptionCreateOrUpdateParameters.java @@ -0,0 +1,442 @@ +/** + * 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.servicebus.v2015_08_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create Or Update Subscription operation. + */ +@JsonFlatten +public class SubscriptionCreateOrUpdateParameters { + /** + * Subscription data center location. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Resource manager type of the resource. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Last time there was a receive request to this subscription. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * TimeSpan idle interval after which the topic is automatically deleted. + * The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private String autoDeleteOnIdle; + + /** + * The countDetails property. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * Default message time to live value. This is the duration after which the + * message expires, starting from when the message is sent to Service Bus. + * This is the default value used when TimeToLive is not set on a message + * itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private String defaultMessageTimeToLive; + + /** + * Value that indicates whether a subscription has dead letter support on + * filter evaluation exceptions. + */ + @JsonProperty(value = "properties.deadLetteringOnFilterEvaluationExceptions") + private Boolean deadLetteringOnFilterEvaluationExceptions; + + /** + * Value that indicates whether a subscription has dead letter support when + * a message expires. + */ + @JsonProperty(value = "properties.deadLetteringOnMessageExpiration") + private Boolean deadLetteringOnMessageExpiration; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * Entity availability status for the topic. Possible values include: + * 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + */ + @JsonProperty(value = "properties.entityAvailabilityStatus") + private EntityAvailabilityStatus entityAvailabilityStatus; + + /** + * Value that indicates whether the entity description is read-only. + */ + @JsonProperty(value = "properties.isReadOnly") + private Boolean isReadOnly; + + /** + * The lock duration time span for the subscription. + */ + @JsonProperty(value = "properties.lockDuration") + private String lockDuration; + + /** + * Number of maximum deliveries. + */ + @JsonProperty(value = "properties.maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Number of messages. + */ + @JsonProperty(value = "properties.messageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long messageCount; + + /** + * Value indicating if a subscription supports the concept of sessions. + */ + @JsonProperty(value = "properties.requiresSession") + private Boolean requiresSession; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', + * 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Get subscription data center location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set subscription data center location. + * + * @param location the location value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource manager type of the resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set resource manager type of the resource. + * + * @param type the type value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Get last time there was a receive request to this subscription. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public String autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get the countDetails value. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public String defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + * + * @return the deadLetteringOnFilterEvaluationExceptions value + */ + public Boolean deadLetteringOnFilterEvaluationExceptions() { + return this.deadLetteringOnFilterEvaluationExceptions; + } + + /** + * Set value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + * + * @param deadLetteringOnFilterEvaluationExceptions the deadLetteringOnFilterEvaluationExceptions value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions) { + this.deadLetteringOnFilterEvaluationExceptions = deadLetteringOnFilterEvaluationExceptions; + return this; + } + + /** + * Get value that indicates whether a subscription has dead letter support when a message expires. + * + * @return the deadLetteringOnMessageExpiration value + */ + public Boolean deadLetteringOnMessageExpiration() { + return this.deadLetteringOnMessageExpiration; + } + + /** + * Set value that indicates whether a subscription has dead letter support when a message expires. + * + * @param deadLetteringOnMessageExpiration the deadLetteringOnMessageExpiration value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.deadLetteringOnMessageExpiration = deadLetteringOnMessageExpiration; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @return the entityAvailabilityStatus value + */ + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.entityAvailabilityStatus; + } + + /** + * Set entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @param entityAvailabilityStatus the entityAvailabilityStatus value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.entityAvailabilityStatus = entityAvailabilityStatus; + return this; + } + + /** + * Get value that indicates whether the entity description is read-only. + * + * @return the isReadOnly value + */ + public Boolean isReadOnly() { + return this.isReadOnly; + } + + /** + * Set value that indicates whether the entity description is read-only. + * + * @param isReadOnly the isReadOnly value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withIsReadOnly(Boolean isReadOnly) { + this.isReadOnly = isReadOnly; + return this; + } + + /** + * Get the lock duration time span for the subscription. + * + * @return the lockDuration value + */ + public String lockDuration() { + return this.lockDuration; + } + + /** + * Set the lock duration time span for the subscription. + * + * @param lockDuration the lockDuration value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withLockDuration(String lockDuration) { + this.lockDuration = lockDuration; + return this; + } + + /** + * Get number of maximum deliveries. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set number of maximum deliveries. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get number of messages. + * + * @return the messageCount value + */ + public Long messageCount() { + return this.messageCount; + } + + /** + * Get value indicating if a subscription supports the concept of sessions. + * + * @return the requiresSession value + */ + public Boolean requiresSession() { + return this.requiresSession; + } + + /** + * Set value indicating if a subscription supports the concept of sessions. + * + * @param requiresSession the requiresSession value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withRequiresSession(Boolean requiresSession) { + this.requiresSession = requiresSession; + return this; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @param status the status value to set + * @return the SubscriptionCreateOrUpdateParameters object itself. + */ + public SubscriptionCreateOrUpdateParameters withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SubscriptionResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SubscriptionResource.java new file mode 100644 index 000000000000..76215024f7bf --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/SubscriptionResource.java @@ -0,0 +1,475 @@ +/** + * 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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.SubscriptionResourceInner; +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; + +/** + * Type representing SubscriptionResource. + */ +public interface SubscriptionResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the accessedAt value. + */ + DateTime accessedAt(); + + /** + * @return the autoDeleteOnIdle value. + */ + String autoDeleteOnIdle(); + + /** + * @return the countDetails value. + */ + MessageCountDetails countDetails(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the deadLetteringOnFilterEvaluationExceptions value. + */ + Boolean deadLetteringOnFilterEvaluationExceptions(); + + /** + * @return the deadLetteringOnMessageExpiration value. + */ + Boolean deadLetteringOnMessageExpiration(); + + /** + * @return the defaultMessageTimeToLive value. + */ + String defaultMessageTimeToLive(); + + /** + * @return the enableBatchedOperations value. + */ + Boolean enableBatchedOperations(); + + /** + * @return the entityAvailabilityStatus value. + */ + EntityAvailabilityStatus entityAvailabilityStatus(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isReadOnly value. + */ + Boolean isReadOnly(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the lockDuration value. + */ + String lockDuration(); + + /** + * @return the maxDeliveryCount value. + */ + Integer maxDeliveryCount(); + + /** + * @return the messageCount value. + */ + Long messageCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresSession value. + */ + Boolean requiresSession(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the SubscriptionResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithTopic, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of SubscriptionResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SubscriptionResource definition. + */ + interface Blank extends WithTopic { + } + + /** + * The stage of the subscriptionresource definition allowing to specify Topic. + */ + interface WithTopic { + /** + * Specifies resourceGroupName, namespaceName, topicName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param topicName The topic name + * @return the next definition stage + */ + WithLocation withExistingTopic(String resourceGroupName, String namespaceName, String topicName); + } + + /** + * The stage of the subscriptionresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Subscription data center location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the subscriptionresource definition allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle TimeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next definition stage + */ + WithCreate withAutoDeleteOnIdle(String autoDeleteOnIdle); + } + + /** + * The stage of the subscriptionresource definition allowing to specify DeadLetteringOnFilterEvaluationExceptions. + */ + interface WithDeadLetteringOnFilterEvaluationExceptions { + /** + * Specifies deadLetteringOnFilterEvaluationExceptions. + * @param deadLetteringOnFilterEvaluationExceptions Value that indicates whether a subscription has dead letter support on filter evaluation exceptions + * @return the next definition stage + */ + WithCreate withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions); + } + + /** + * The stage of the subscriptionresource definition allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration Value that indicates whether a subscription has dead letter support when a message expires + * @return the next definition stage + */ + WithCreate withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the subscriptionresource definition allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive Default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next definition stage + */ + WithCreate withDefaultMessageTimeToLive(String defaultMessageTimeToLive); + } + + /** + * The stage of the subscriptionresource definition allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next definition stage + */ + WithCreate withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the subscriptionresource definition allowing to specify EntityAvailabilityStatus. + */ + interface WithEntityAvailabilityStatus { + /** + * Specifies entityAvailabilityStatus. + * @param entityAvailabilityStatus Entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown' + * @return the next definition stage + */ + WithCreate withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus); + } + + /** + * The stage of the subscriptionresource definition allowing to specify IsReadOnly. + */ + interface WithIsReadOnly { + /** + * Specifies isReadOnly. + * @param isReadOnly Value that indicates whether the entity description is read-only + * @return the next definition stage + */ + WithCreate withIsReadOnly(Boolean isReadOnly); + } + + /** + * The stage of the subscriptionresource definition allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration The lock duration time span for the subscription + * @return the next definition stage + */ + WithCreate withLockDuration(String lockDuration); + } + + /** + * The stage of the subscriptionresource definition allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount Number of maximum deliveries + * @return the next definition stage + */ + WithCreate withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the subscriptionresource definition allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession Value indicating if a subscription supports the concept of sessions + * @return the next definition stage + */ + WithCreate withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the subscriptionresource definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the subscriptionresource definition allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + * @param type Resource manager type of the resource + * @return the next definition stage + */ + WithCreate withType(String type); + } + + /** + * 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.WithAutoDeleteOnIdle, DefinitionStages.WithDeadLetteringOnFilterEvaluationExceptions, DefinitionStages.WithDeadLetteringOnMessageExpiration, DefinitionStages.WithDefaultMessageTimeToLive, DefinitionStages.WithEnableBatchedOperations, DefinitionStages.WithEntityAvailabilityStatus, DefinitionStages.WithIsReadOnly, DefinitionStages.WithLockDuration, DefinitionStages.WithMaxDeliveryCount, DefinitionStages.WithRequiresSession, DefinitionStages.WithStatus, DefinitionStages.WithType { + } + } + /** + * The template for a SubscriptionResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoDeleteOnIdle, UpdateStages.WithDeadLetteringOnFilterEvaluationExceptions, UpdateStages.WithDeadLetteringOnMessageExpiration, UpdateStages.WithDefaultMessageTimeToLive, UpdateStages.WithEnableBatchedOperations, UpdateStages.WithEntityAvailabilityStatus, UpdateStages.WithIsReadOnly, UpdateStages.WithLockDuration, UpdateStages.WithMaxDeliveryCount, UpdateStages.WithRequiresSession, UpdateStages.WithStatus, UpdateStages.WithType { + } + + /** + * Grouping of SubscriptionResource update stages. + */ + interface UpdateStages { + /** + * The stage of the subscriptionresource update allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle TimeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next update stage + */ + Update withAutoDeleteOnIdle(String autoDeleteOnIdle); + } + + /** + * The stage of the subscriptionresource update allowing to specify DeadLetteringOnFilterEvaluationExceptions. + */ + interface WithDeadLetteringOnFilterEvaluationExceptions { + /** + * Specifies deadLetteringOnFilterEvaluationExceptions. + * @param deadLetteringOnFilterEvaluationExceptions Value that indicates whether a subscription has dead letter support on filter evaluation exceptions + * @return the next update stage + */ + Update withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions); + } + + /** + * The stage of the subscriptionresource update allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration Value that indicates whether a subscription has dead letter support when a message expires + * @return the next update stage + */ + Update withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the subscriptionresource update allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive Default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next update stage + */ + Update withDefaultMessageTimeToLive(String defaultMessageTimeToLive); + } + + /** + * The stage of the subscriptionresource update allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next update stage + */ + Update withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the subscriptionresource update allowing to specify EntityAvailabilityStatus. + */ + interface WithEntityAvailabilityStatus { + /** + * Specifies entityAvailabilityStatus. + * @param entityAvailabilityStatus Entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown' + * @return the next update stage + */ + Update withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus); + } + + /** + * The stage of the subscriptionresource update allowing to specify IsReadOnly. + */ + interface WithIsReadOnly { + /** + * Specifies isReadOnly. + * @param isReadOnly Value that indicates whether the entity description is read-only + * @return the next update stage + */ + Update withIsReadOnly(Boolean isReadOnly); + } + + /** + * The stage of the subscriptionresource update allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration The lock duration time span for the subscription + * @return the next update stage + */ + Update withLockDuration(String lockDuration); + } + + /** + * The stage of the subscriptionresource update allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount Number of maximum deliveries + * @return the next update stage + */ + Update withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the subscriptionresource update allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession Value indicating if a subscription supports the concept of sessions + * @return the next update stage + */ + Update withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the subscriptionresource update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + /** + * The stage of the subscriptionresource update allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + * @param type Resource manager type of the resource + * @return the next update stage + */ + Update withType(String type); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Subscriptions.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Subscriptions.java new file mode 100644 index 000000000000..9e0e20929642 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Subscriptions.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions extends SupportsCreating, HasInner { + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName); + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAllAsync(final String resourceGroupName, final String namespaceName, final String topicName); + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicCreateOrUpdateParameters.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicCreateOrUpdateParameters.java new file mode 100644 index 000000000000..359b7a77d5a7 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicCreateOrUpdateParameters.java @@ -0,0 +1,539 @@ +/** + * 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.servicebus.v2015_08_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create Or Update Topic operation. + */ +@JsonFlatten +public class TopicCreateOrUpdateParameters { + /** + * Topic name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Last time the message was sent, or a request was received, for this + * topic. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * TimeSpan idle interval after which the topic is automatically deleted. + * The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private String autoDeleteOnIdle; + + /** + * Entity availability status for the topic. Possible values include: + * 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + */ + @JsonProperty(value = "properties.entityAvailabilityStatus") + private EntityAvailabilityStatus entityAvailabilityStatus; + + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The countDetails property. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * Default message time to live value. This is the duration after which the + * message expires, starting from when the message is sent to Service Bus. + * This is the default value used when TimeToLive is not set on a message + * itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private String defaultMessageTimeToLive; + + /** + * TimeSpan structure that defines the duration of the duplicate detection + * history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private String duplicateDetectionHistoryTimeWindow; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * Value that indicates whether Express Entities are enabled. An express + * topic holds a message in memory temporarily before writing it to + * persistent storage. + */ + @JsonProperty(value = "properties.enableExpress") + private Boolean enableExpress; + + /** + * Value that indicates whether the topic to be partitioned across multiple + * message brokers is enabled. + */ + @JsonProperty(value = "properties.enablePartitioning") + private Boolean enablePartitioning; + + /** + * Whether messages should be filtered before publishing. + */ + @JsonProperty(value = "properties.filteringMessagesBeforePublishing") + private Boolean filteringMessagesBeforePublishing; + + /** + * Value that indicates whether the message is accessible anonymously. + */ + @JsonProperty(value = "properties.isAnonymousAccessible") + private Boolean isAnonymousAccessible; + + /** + * The isExpress property. + */ + @JsonProperty(value = "properties.isExpress") + private Boolean isExpress; + + /** + * Maximum size of the topic in megabytes, which is the size of the memory + * allocated for the topic. + */ + @JsonProperty(value = "properties.maxSizeInMegabytes") + private Long maxSizeInMegabytes; + + /** + * Value indicating if this topic requires duplicate detection. + */ + @JsonProperty(value = "properties.requiresDuplicateDetection") + private Boolean requiresDuplicateDetection; + + /** + * Size of the topic, in bytes. + */ + @JsonProperty(value = "properties.sizeInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long sizeInBytes; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', + * 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Number of subscriptions. + */ + @JsonProperty(value = "properties.subscriptionCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer subscriptionCount; + + /** + * Value that indicates whether the topic supports ordering. + */ + @JsonProperty(value = "properties.supportOrdering") + private Boolean supportOrdering; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Get topic name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set topic name. + * + * @param name the name value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the resource. + * + * @param location the location value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get last time the message was sent, or a request was received, for this topic. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public String autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @return the entityAvailabilityStatus value + */ + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.entityAvailabilityStatus; + } + + /** + * Set entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @param entityAvailabilityStatus the entityAvailabilityStatus value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.entityAvailabilityStatus = entityAvailabilityStatus; + return this; + } + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the countDetails value. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public String defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public String duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + * + * @return the enableExpress value + */ + public Boolean enableExpress() { + return this.enableExpress; + } + + /** + * Set value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + * + * @param enableExpress the enableExpress value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withEnableExpress(Boolean enableExpress) { + this.enableExpress = enableExpress; + return this; + } + + /** + * Get value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + * + * @return the enablePartitioning value + */ + public Boolean enablePartitioning() { + return this.enablePartitioning; + } + + /** + * Set value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + * + * @param enablePartitioning the enablePartitioning value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withEnablePartitioning(Boolean enablePartitioning) { + this.enablePartitioning = enablePartitioning; + return this; + } + + /** + * Get whether messages should be filtered before publishing. + * + * @return the filteringMessagesBeforePublishing value + */ + public Boolean filteringMessagesBeforePublishing() { + return this.filteringMessagesBeforePublishing; + } + + /** + * Set whether messages should be filtered before publishing. + * + * @param filteringMessagesBeforePublishing the filteringMessagesBeforePublishing value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withFilteringMessagesBeforePublishing(Boolean filteringMessagesBeforePublishing) { + this.filteringMessagesBeforePublishing = filteringMessagesBeforePublishing; + return this; + } + + /** + * Get value that indicates whether the message is accessible anonymously. + * + * @return the isAnonymousAccessible value + */ + public Boolean isAnonymousAccessible() { + return this.isAnonymousAccessible; + } + + /** + * Set value that indicates whether the message is accessible anonymously. + * + * @param isAnonymousAccessible the isAnonymousAccessible value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withIsAnonymousAccessible(Boolean isAnonymousAccessible) { + this.isAnonymousAccessible = isAnonymousAccessible; + return this; + } + + /** + * Get the isExpress value. + * + * @return the isExpress value + */ + public Boolean isExpress() { + return this.isExpress; + } + + /** + * Set the isExpress value. + * + * @param isExpress the isExpress value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withIsExpress(Boolean isExpress) { + this.isExpress = isExpress; + return this; + } + + /** + * Get maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. + * + * @return the maxSizeInMegabytes value + */ + public Long maxSizeInMegabytes() { + return this.maxSizeInMegabytes; + } + + /** + * Set maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. + * + * @param maxSizeInMegabytes the maxSizeInMegabytes value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withMaxSizeInMegabytes(Long maxSizeInMegabytes) { + this.maxSizeInMegabytes = maxSizeInMegabytes; + return this; + } + + /** + * Get value indicating if this topic requires duplicate detection. + * + * @return the requiresDuplicateDetection value + */ + public Boolean requiresDuplicateDetection() { + return this.requiresDuplicateDetection; + } + + /** + * Set value indicating if this topic requires duplicate detection. + * + * @param requiresDuplicateDetection the requiresDuplicateDetection value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.requiresDuplicateDetection = requiresDuplicateDetection; + return this; + } + + /** + * Get size of the topic, in bytes. + * + * @return the sizeInBytes value + */ + public Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @param status the status value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get number of subscriptions. + * + * @return the subscriptionCount value + */ + public Integer subscriptionCount() { + return this.subscriptionCount; + } + + /** + * Get value that indicates whether the topic supports ordering. + * + * @return the supportOrdering value + */ + public Boolean supportOrdering() { + return this.supportOrdering; + } + + /** + * Set value that indicates whether the topic supports ordering. + * + * @param supportOrdering the supportOrdering value to set + * @return the TopicCreateOrUpdateParameters object itself. + */ + public TopicCreateOrUpdateParameters withSupportOrdering(Boolean supportOrdering) { + this.supportOrdering = supportOrdering; + return this; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicNamespaceSharedAccessAuthorizationRuleResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicNamespaceSharedAccessAuthorizationRuleResource.java new file mode 100644 index 000000000000..bcacfff43d97 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicNamespaceSharedAccessAuthorizationRuleResource.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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.SharedAccessAuthorizationRuleResourceInner; +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing TopicNamespaceSharedAccessAuthorizationRuleResource. + */ +public interface TopicNamespaceSharedAccessAuthorizationRuleResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the TopicNamespaceSharedAccessAuthorizationRuleResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithTopic, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of TopicNamespaceSharedAccessAuthorizationRuleResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TopicNamespaceSharedAccessAuthorizationRuleResource definition. + */ + interface Blank extends WithTopic { + } + + /** + * The stage of the topicnamespacesharedaccessauthorizationruleresource definition allowing to specify Topic. + */ + interface WithTopic { + /** + * Specifies resourceGroupName, namespaceName, topicName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param topicName The topic name + * @return the next definition stage + */ + WithRights withExistingTopic(String resourceGroupName, String namespaceName, String topicName); + } + + /** + * The stage of the topicnamespacesharedaccessauthorizationruleresource definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the topicnamespacesharedaccessauthorizationruleresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location data center location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the topicnamespacesharedaccessauthorizationruleresource definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Name of the authorization rule + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * 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.WithLocation, DefinitionStages.WithName { + } + } + /** + * The template for a TopicNamespaceSharedAccessAuthorizationRuleResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithName { + } + + /** + * Grouping of TopicNamespaceSharedAccessAuthorizationRuleResource update stages. + */ + interface UpdateStages { + /** + * The stage of the topicnamespacesharedaccessauthorizationruleresource update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location data center location + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the topicnamespacesharedaccessauthorizationruleresource update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Name of the authorization rule + * @return the next update stage + */ + Update withName(String name); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicResource.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicResource.java new file mode 100644 index 000000000000..6d31969f5b55 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/TopicResource.java @@ -0,0 +1,566 @@ +/** + * 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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.TopicResourceInner; +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.servicebus.v2015_08_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; + +/** + * Type representing TopicResource. + */ +public interface TopicResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the accessedAt value. + */ + DateTime accessedAt(); + + /** + * @return the autoDeleteOnIdle value. + */ + String autoDeleteOnIdle(); + + /** + * @return the countDetails value. + */ + MessageCountDetails countDetails(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the defaultMessageTimeToLive value. + */ + String defaultMessageTimeToLive(); + + /** + * @return the duplicateDetectionHistoryTimeWindow value. + */ + String duplicateDetectionHistoryTimeWindow(); + + /** + * @return the enableBatchedOperations value. + */ + Boolean enableBatchedOperations(); + + /** + * @return the enableExpress value. + */ + Boolean enableExpress(); + + /** + * @return the enablePartitioning value. + */ + Boolean enablePartitioning(); + + /** + * @return the entityAvailabilityStatus value. + */ + EntityAvailabilityStatus entityAvailabilityStatus(); + + /** + * @return the filteringMessagesBeforePublishing value. + */ + Boolean filteringMessagesBeforePublishing(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAnonymousAccessible value. + */ + Boolean isAnonymousAccessible(); + + /** + * @return the isExpress value. + */ + Boolean isExpress(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeInMegabytes value. + */ + Long maxSizeInMegabytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresDuplicateDetection value. + */ + Boolean requiresDuplicateDetection(); + + /** + * @return the sizeInBytes value. + */ + Long sizeInBytes(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the subscriptionCount value. + */ + Integer subscriptionCount(); + + /** + * @return the supportOrdering value. + */ + Boolean supportOrdering(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the TopicResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of TopicResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TopicResource definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the topicresource definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithLocation withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the topicresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the topicresource definition allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle TimeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next definition stage + */ + WithCreate withAutoDeleteOnIdle(String autoDeleteOnIdle); + } + + /** + * The stage of the topicresource definition allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive Default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next definition stage + */ + WithCreate withDefaultMessageTimeToLive(String defaultMessageTimeToLive); + } + + /** + * The stage of the topicresource definition allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow TimeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next definition stage + */ + WithCreate withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the topicresource definition allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next definition stage + */ + WithCreate withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the topicresource definition allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage + * @return the next definition stage + */ + WithCreate withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the topicresource definition allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning Value that indicates whether the topic to be partitioned across multiple message brokers is enabled + * @return the next definition stage + */ + WithCreate withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the topicresource definition allowing to specify EntityAvailabilityStatus. + */ + interface WithEntityAvailabilityStatus { + /** + * Specifies entityAvailabilityStatus. + * @param entityAvailabilityStatus Entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown' + * @return the next definition stage + */ + WithCreate withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus); + } + + /** + * The stage of the topicresource definition allowing to specify FilteringMessagesBeforePublishing. + */ + interface WithFilteringMessagesBeforePublishing { + /** + * Specifies filteringMessagesBeforePublishing. + * @param filteringMessagesBeforePublishing Whether messages should be filtered before publishing + * @return the next definition stage + */ + WithCreate withFilteringMessagesBeforePublishing(Boolean filteringMessagesBeforePublishing); + } + + /** + * The stage of the topicresource definition allowing to specify IsAnonymousAccessible. + */ + interface WithIsAnonymousAccessible { + /** + * Specifies isAnonymousAccessible. + * @param isAnonymousAccessible Value that indicates whether the message is accessible anonymously + * @return the next definition stage + */ + WithCreate withIsAnonymousAccessible(Boolean isAnonymousAccessible); + } + + /** + * The stage of the topicresource definition allowing to specify IsExpress. + */ + interface WithIsExpress { + /** + * Specifies isExpress. + * @param isExpress the isExpress parameter value + * @return the next definition stage + */ + WithCreate withIsExpress(Boolean isExpress); + } + + /** + * The stage of the topicresource definition allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic + * @return the next definition stage + */ + WithCreate withMaxSizeInMegabytes(Long maxSizeInMegabytes); + } + + /** + * The stage of the topicresource definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Topic name + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * The stage of the topicresource definition allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection Value indicating if this topic requires duplicate detection + * @return the next definition stage + */ + WithCreate withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the topicresource definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the topicresource definition allowing to specify SupportOrdering. + */ + interface WithSupportOrdering { + /** + * Specifies supportOrdering. + * @param supportOrdering Value that indicates whether the topic supports ordering + * @return the next definition stage + */ + WithCreate withSupportOrdering(Boolean supportOrdering); + } + + /** + * 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.WithAutoDeleteOnIdle, DefinitionStages.WithDefaultMessageTimeToLive, DefinitionStages.WithDuplicateDetectionHistoryTimeWindow, DefinitionStages.WithEnableBatchedOperations, DefinitionStages.WithEnableExpress, DefinitionStages.WithEnablePartitioning, DefinitionStages.WithEntityAvailabilityStatus, DefinitionStages.WithFilteringMessagesBeforePublishing, DefinitionStages.WithIsAnonymousAccessible, DefinitionStages.WithIsExpress, DefinitionStages.WithMaxSizeInMegabytes, DefinitionStages.WithName, DefinitionStages.WithRequiresDuplicateDetection, DefinitionStages.WithStatus, DefinitionStages.WithSupportOrdering { + } + } + /** + * The template for a TopicResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoDeleteOnIdle, UpdateStages.WithDefaultMessageTimeToLive, UpdateStages.WithDuplicateDetectionHistoryTimeWindow, UpdateStages.WithEnableBatchedOperations, UpdateStages.WithEnableExpress, UpdateStages.WithEnablePartitioning, UpdateStages.WithEntityAvailabilityStatus, UpdateStages.WithFilteringMessagesBeforePublishing, UpdateStages.WithIsAnonymousAccessible, UpdateStages.WithIsExpress, UpdateStages.WithMaxSizeInMegabytes, UpdateStages.WithName, UpdateStages.WithRequiresDuplicateDetection, UpdateStages.WithStatus, UpdateStages.WithSupportOrdering { + } + + /** + * Grouping of TopicResource update stages. + */ + interface UpdateStages { + /** + * The stage of the topicresource update allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle TimeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next update stage + */ + Update withAutoDeleteOnIdle(String autoDeleteOnIdle); + } + + /** + * The stage of the topicresource update allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive Default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next update stage + */ + Update withDefaultMessageTimeToLive(String defaultMessageTimeToLive); + } + + /** + * The stage of the topicresource update allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow TimeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next update stage + */ + Update withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the topicresource update allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next update stage + */ + Update withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the topicresource update allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage + * @return the next update stage + */ + Update withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the topicresource update allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning Value that indicates whether the topic to be partitioned across multiple message brokers is enabled + * @return the next update stage + */ + Update withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the topicresource update allowing to specify EntityAvailabilityStatus. + */ + interface WithEntityAvailabilityStatus { + /** + * Specifies entityAvailabilityStatus. + * @param entityAvailabilityStatus Entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown' + * @return the next update stage + */ + Update withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus); + } + + /** + * The stage of the topicresource update allowing to specify FilteringMessagesBeforePublishing. + */ + interface WithFilteringMessagesBeforePublishing { + /** + * Specifies filteringMessagesBeforePublishing. + * @param filteringMessagesBeforePublishing Whether messages should be filtered before publishing + * @return the next update stage + */ + Update withFilteringMessagesBeforePublishing(Boolean filteringMessagesBeforePublishing); + } + + /** + * The stage of the topicresource update allowing to specify IsAnonymousAccessible. + */ + interface WithIsAnonymousAccessible { + /** + * Specifies isAnonymousAccessible. + * @param isAnonymousAccessible Value that indicates whether the message is accessible anonymously + * @return the next update stage + */ + Update withIsAnonymousAccessible(Boolean isAnonymousAccessible); + } + + /** + * The stage of the topicresource update allowing to specify IsExpress. + */ + interface WithIsExpress { + /** + * Specifies isExpress. + * @param isExpress the isExpress parameter value + * @return the next update stage + */ + Update withIsExpress(Boolean isExpress); + } + + /** + * The stage of the topicresource update allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic + * @return the next update stage + */ + Update withMaxSizeInMegabytes(Long maxSizeInMegabytes); + } + + /** + * The stage of the topicresource update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Topic name + * @return the next update stage + */ + Update withName(String name); + } + + /** + * The stage of the topicresource update allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection Value indicating if this topic requires duplicate detection + * @return the next update stage + */ + Update withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the topicresource update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + /** + * The stage of the topicresource update allowing to specify SupportOrdering. + */ + interface WithSupportOrdering { + /** + * Specifies supportOrdering. + * @param supportOrdering Value that indicates whether the topic supports ordering + * @return the next update stage + */ + Update withSupportOrdering(Boolean supportOrdering); + } + + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Topics.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Topics.java new file mode 100644 index 000000000000..d6d455f5d3bb --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/Topics.java @@ -0,0 +1,132 @@ +/** + * 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.servicebus.v2015_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.implementation.TopicsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicNamespaceSharedAccessAuthorizationRuleResource; + +/** + * Type representing Topics. + */ +public interface Topics extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + TopicNamespaceSharedAccessAuthorizationRuleResource.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String topicName); + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAllAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName); + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName); + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/UnavailableReason.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/UnavailableReason.java new file mode 100644 index 000000000000..f42ad1f4295c --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/UnavailableReason.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnavailableReason. + */ +public final class UnavailableReason extends ExpandableStringEnum { + /** Static value None for UnavailableReason. */ + public static final UnavailableReason NONE = fromString("None"); + + /** Static value InvalidName for UnavailableReason. */ + public static final UnavailableReason INVALID_NAME = fromString("InvalidName"); + + /** Static value SubscriptionIsDisabled for UnavailableReason. */ + public static final UnavailableReason SUBSCRIPTION_IS_DISABLED = fromString("SubscriptionIsDisabled"); + + /** Static value NameInUse for UnavailableReason. */ + public static final UnavailableReason NAME_IN_USE = fromString("NameInUse"); + + /** Static value NameInLockdown for UnavailableReason. */ + public static final UnavailableReason NAME_IN_LOCKDOWN = fromString("NameInLockdown"); + + /** Static value TooManyNamespaceInCurrentSubscription for UnavailableReason. */ + public static final UnavailableReason TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = fromString("TooManyNamespaceInCurrentSubscription"); + + /** + * Creates or finds a UnavailableReason from its string representation. + * @param name a name to look for + * @return the corresponding UnavailableReason + */ + @JsonCreator + public static UnavailableReason fromString(String name) { + return fromString(name, UnavailableReason.class); + } + + /** + * @return known UnavailableReason values + */ + public static Collection values() { + return values(UnavailableReason.class); + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/CheckNameAvailabilityResultImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..47b6377d4d9c --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.CheckNameAvailabilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.UnavailableReason; + +class CheckNameAvailabilityResultImpl extends WrapperImpl implements CheckNameAvailabilityResult { + private final ServiceBusManager manager; + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public UnavailableReason reason() { + return this.inner().reason(); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/CheckNameAvailabilityResultInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..aff0e8239859 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/CheckNameAvailabilityResultInner.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.UnavailableReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of a Check Name availability request properties. + */ +public class CheckNameAvailabilityResultInner { + /** + * Value indicating namespace is availability, true if the namespace is + * available; otherwise, false. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * The reason for unavailability of a namespace. Possible values include: + * 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', + * 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + */ + @JsonProperty(value = "reason") + private UnavailableReason reason; + + /** + * The detailed info regarding the reason associated with the namespace. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get value indicating namespace is availability, true if the namespace is available; otherwise, false. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set value indicating namespace is availability, true if the namespace is available; otherwise, false. + * + * @param nameAvailable the nameAvailable value to set + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason for unavailability of a namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + * + * @return the reason value + */ + public UnavailableReason reason() { + return this.reason; + } + + /** + * Set the reason for unavailability of a namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + * + * @param reason the reason value to set + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withReason(UnavailableReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the detailed info regarding the reason associated with the namespace. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/IdParsingUtils.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..e3e27a45f47e --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceResourceImpl.java new file mode 100644 index 000000000000..13f3eab3e2c5 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceResourceImpl.java @@ -0,0 +1,144 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceResource; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceUpdateParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceCreateOrUpdateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.Sku; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceState; +import rx.functions.Func1; + +class NamespaceResourceImpl extends GroupableResourceCoreImpl implements NamespaceResource, NamespaceResource.Definition, NamespaceResource.Update { + private NamespaceCreateOrUpdateParameters createParameter; + private NamespaceUpdateParameters updateParameter; + NamespaceResourceImpl(String name, NamespaceResourceInner inner, ServiceBusManager manager) { + super(name, inner, manager); + this.createParameter = new NamespaceCreateOrUpdateParameters(); + this.updateParameter = new NamespaceUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + this.createParameter.withLocation(inner().location()); + this.createParameter.withTags(inner().getTags()); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.createParameter) + .map(new Func1() { + @Override + public NamespaceResourceInner call(NamespaceResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public NamespaceResourceInner call(NamespaceResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .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; + } + + private void resetCreateUpdateParameters() { + this.createParameter = new NamespaceCreateOrUpdateParameters(); + this.updateParameter = new NamespaceUpdateParameters(); + } + + @Override + public Boolean createACSNamespace() { + return this.inner().createACSNamespace(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @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 NamespaceState status() { + return this.inner().status(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public NamespaceResourceImpl withCreateACSNamespace(Boolean createACSNamespace) { + this.createParameter.withCreateACSNamespace(createACSNamespace); + return this; + } + + @Override + public NamespaceResourceImpl withEnabled(Boolean enabled) { + this.createParameter.withEnabled(enabled); + return this; + } + + @Override + public NamespaceResourceImpl withStatus(NamespaceState status) { + this.createParameter.withStatus(status); + return this; + } + + @Override + public NamespaceResourceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.createParameter.withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceResourceInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceResourceInner.java new file mode 100644 index 000000000000..7b9d927e687f --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceResourceInner.java @@ -0,0 +1,191 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.Sku; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceState; +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; + +/** + * Description of a namespace resource. + */ +@JsonFlatten +@SkipParentValidation +public class NamespaceResourceInner extends Resource { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Provisioning state of the namespace. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * State of the namespace. Possible values include: 'Unknown', 'Creating', + * 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', + * 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed'. + */ + @JsonProperty(value = "properties.status") + private NamespaceState status; + + /** + * 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; + + /** + * Indicates whether to create an ACS namespace. + */ + @JsonProperty(value = "properties.createACSNamespace") + private Boolean createACSNamespace; + + /** + * Specifies whether this instance is enabled. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the NamespaceResourceInner object itself. + */ + public NamespaceResourceInner 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 state of the namespace. Possible values include: 'Unknown', 'Creating', 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed'. + * + * @return the status value + */ + public NamespaceState status() { + return this.status; + } + + /** + * Set state of the namespace. Possible values include: 'Unknown', 'Creating', 'Created', 'Activating', 'Enabling', 'Active', 'Disabling', 'Disabled', 'SoftDeleting', 'SoftDeleted', 'Removing', 'Removed', 'Failed'. + * + * @param status the status value to set + * @return the NamespaceResourceInner object itself. + */ + public NamespaceResourceInner withStatus(NamespaceState status) { + this.status = status; + return this; + } + + /** + * 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 indicates whether to create an ACS namespace. + * + * @return the createACSNamespace value + */ + public Boolean createACSNamespace() { + return this.createACSNamespace; + } + + /** + * Set indicates whether to create an ACS namespace. + * + * @param createACSNamespace the createACSNamespace value to set + * @return the NamespaceResourceInner object itself. + */ + public NamespaceResourceInner withCreateACSNamespace(Boolean createACSNamespace) { + this.createACSNamespace = createACSNamespace; + return this; + } + + /** + * Get specifies whether this instance is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set specifies whether this instance is enabled. + * + * @param enabled the enabled value to set + * @return the NamespaceResourceInner object itself. + */ + public NamespaceResourceInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceSharedAccessAuthorizationRuleResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceSharedAccessAuthorizationRuleResourceImpl.java new file mode 100644 index 000000000000..abe6d2757db3 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespaceSharedAccessAuthorizationRuleResourceImpl.java @@ -0,0 +1,146 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2015_08_01.AccessRights; +import rx.functions.Func1; + +class NamespaceSharedAccessAuthorizationRuleResourceImpl extends CreatableUpdatableImpl implements NamespaceSharedAccessAuthorizationRuleResource, NamespaceSharedAccessAuthorizationRuleResource.Definition, NamespaceSharedAccessAuthorizationRuleResource.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String authorizationRuleName; + private SharedAccessAuthorizationRuleCreateOrUpdateParameters createOrUpdateParameter; + + NamespaceSharedAccessAuthorizationRuleResourceImpl(String name, ServiceBusManager manager) { + super(name, new SharedAccessAuthorizationRuleResourceInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + NamespaceSharedAccessAuthorizationRuleResourceImpl(SharedAccessAuthorizationRuleResourceInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "AuthorizationRules"); + // + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(SharedAccessAuthorizationRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(SharedAccessAuthorizationRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public NamespaceSharedAccessAuthorizationRuleResourceImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public NamespaceSharedAccessAuthorizationRuleResourceImpl withRights(List rights) { + this.createOrUpdateParameter.withRights(rights); + return this; + } + + @Override + public NamespaceSharedAccessAuthorizationRuleResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public NamespaceSharedAccessAuthorizationRuleResourceImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespacesImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespacesImpl.java new file mode 100644 index 000000000000..91ec2e3ca1b0 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespacesImpl.java @@ -0,0 +1,234 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceResource; +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.servicebus.v2015_08_01.CheckNameAvailabilityResult; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.ResourceListKeys; + +class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { + protected NamespacesImpl(ServiceBusManager 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 NamespaceResource call(NamespaceResourceInner 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 NamespaceResource call(NamespaceResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public NamespaceResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable checkNameAvailabilityMethodAsync(String name) { + NamespacesInner client = this.inner(); + return client.checkNameAvailabilityMethodAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResult call(CheckNameAvailabilityResultInner inner) { + return new CheckNameAvailabilityResultImpl(inner, manager()); + } + }); + } + + @Override + protected NamespaceResourceImpl wrapModel(NamespaceResourceInner inner) { + return new NamespaceResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected NamespaceResourceImpl wrapModel(String name) { + return new NamespaceResourceImpl(name, new NamespaceResourceInner(), this.manager()); + } + + @Override + public NamespaceSharedAccessAuthorizationRuleResourceImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private NamespaceSharedAccessAuthorizationRuleResourceImpl wrapAuthorizationRuleModel(String name) { + return new NamespaceSharedAccessAuthorizationRuleResourceImpl(name, this.manager()); + } + + private NamespaceSharedAccessAuthorizationRuleResourceImpl wrapNamespaceSharedAccessAuthorizationRuleResourceModel(SharedAccessAuthorizationRuleResourceInner inner) { + return new NamespaceSharedAccessAuthorizationRuleResourceImpl(inner, manager()); + } + + private Observable getSharedAccessAuthorizationRuleResourceInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "AuthorizationRules"); + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return wrapNamespaceSharedAccessAuthorizationRuleResourceModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return wrapNamespaceSharedAccessAuthorizationRuleResourceModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public ResourceListKeys call(ResourceListKeysInner inner) { + return new ResourceListKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public ResourceListKeys call(ResourceListKeysInner inner) { + return new ResourceListKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespacesInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespacesInner.java new file mode 100644 index 000000000000..16a689077d2f --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/NamespacesInner.java @@ -0,0 +1,1986 @@ +/** + * 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.servicebus.v2015_08_01.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.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2015_08_01.CheckNameAvailability; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceCreateOrUpdateParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceUpdateParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.Policykey; +import com.microsoft.azure.management.servicebus.v2015_08_01.RegenerateKeysParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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 ServiceBusManagementClientImpl 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, ServiceBusManagementClientImpl 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.servicebus.v2015_08_01.Namespaces checkNameAvailabilityMethod" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + Observable> checkNameAvailabilityMethod(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailability parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/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.servicebus.v2015_08_01.Namespaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2015_08_01.Namespaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body NamespaceCreateOrUpdateParameters 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.servicebus.v2015_08_01.Namespaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body NamespaceCreateOrUpdateParameters 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.servicebus.v2015_08_01.Namespaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2015_08_01.Namespaces beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2015_08_01.Namespaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2015_08_01.Namespaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body NamespaceUpdateParameters 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.servicebus.v2015_08_01.Namespaces listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body SharedAccessAuthorizationRuleCreateOrUpdateParameters 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.servicebus.v2015_08_01.Namespaces deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeysParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.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.servicebus.v2015_08_01.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.servicebus.v2015_08_01.Namespaces listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailabilityMethod(String name) { + return checkNameAvailabilityMethodWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @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 checkNameAvailabilityMethodAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityMethodWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityMethodAsync(String name) { + return checkNameAvailabilityMethodWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable> checkNameAvailabilityMethodWithServiceResponseAsync(String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailability parameters = new CheckNameAvailability(); + parameters.withName(name); + return service.checkNameAvailabilityMethod(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 = checkNameAvailabilityMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityMethodDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<NamespaceResourceInner> 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(); + } + }; + } + + /** + * Gets all the available namespaces within the 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); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NamespaceResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NamespaceResourceInner> 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)); + } + }); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NamespaceResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<NamespaceResourceInner> 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(); + } + }; + } + + /** + * Gets 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); + } + + /** + * Gets 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<NamespaceResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets 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<NamespaceResourceInner> 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)); + } + }); + } + + /** + * Gets 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<NamespaceResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NamespaceResourceInner object if successful. + */ + public NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a service 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 supplied to create 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, NamespaceCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, NamespaceResourceInner>() { + @Override + public NamespaceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters 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 service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NamespaceResourceInner object if successful. + */ + public NamespaceResourceInner beginCreateOrUpdate(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a service 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 supplied to create 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, NamespaceCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NamespaceResourceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, NamespaceResourceInner>() { + @Override + public NamespaceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NamespaceResourceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters 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 CloudException, 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(CloudException.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 CloudException 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 CloudException 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 CloudException, 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(CloudException.class) + .build(response); + } + + /** + * Gets a description for 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NamespaceResourceInner object if successful. + */ + public NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets a description for 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 a description for 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 NamespaceResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, NamespaceResourceInner>() { + @Override + public NamespaceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a description for 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 NamespaceResourceInner 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a service 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 supplied to update a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NamespaceResourceInner object if successful. + */ + public NamespaceResourceInner update(String resourceGroupName, String namespaceName, NamespaceUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Updates a service 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 supplied to update 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, NamespaceUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Updates a service 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 supplied to update a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NamespaceResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String namespaceName, NamespaceUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, NamespaceResourceInner>() { + @Override + public NamespaceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a service 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 supplied to update a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NamespaceResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String namespaceName, NamespaceUpdateParameters 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 CloudException, 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(CloudException.class) + .build(response); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization 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> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listAuthorizationRulesSinglePageAsync(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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization 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<SharedAccessAuthorizationRuleResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(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.listAuthorizationRules(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Policykey policykey = null; + RegenerateKeysParameters parameters = new RegenerateKeysParameters(); + parameters.withPolicykey(null); + return service.regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, Policykey policykey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, policykey).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, Policykey policykey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, policykey), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, Policykey policykey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, policykey).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, Policykey policykey) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + RegenerateKeysParameters parameters = new RegenerateKeysParameters(); + parameters.withPolicykey(policykey); + return service.regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the available namespaces within the 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<NamespaceResourceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the available namespaces within the 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); + } + + /** + * Gets all the available namespaces within the 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<NamespaceResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the available namespaces within the 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<NamespaceResourceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the available namespaces within the 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<NamespaceResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<NamespaceResourceInner> 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(); + } + }; + } + + /** + * Gets 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); + } + + /** + * Gets 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<NamespaceResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets 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<NamespaceResourceInner> 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)); + } + }); + } + + /** + * Gets 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<NamespaceResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for 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<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization rules for 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<SharedAccessAuthorizationRuleResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..2b264d4467e1 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ServiceBusManager manager; + OperationImpl(OperationInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationInner.java new file mode 100644 index 000000000000..9b27780b2b57 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A ServiceBus REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationsImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..7b624eeebb37 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2015_08_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ServiceBusManager manager; + + OperationsImpl(ServiceBusManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationsInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..1bc31988356e --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Operations list" }) + @GET("providers/Microsoft.ServiceBus/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/PageImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/PageImpl.java new file mode 100644 index 000000000000..47ea2862980c --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueNamespaceSharedAccessAuthorizationRuleResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueNamespaceSharedAccessAuthorizationRuleResourceImpl.java new file mode 100644 index 000000000000..6668b14432de --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueNamespaceSharedAccessAuthorizationRuleResourceImpl.java @@ -0,0 +1,149 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueNamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2015_08_01.AccessRights; +import rx.functions.Func1; + +class QueueNamespaceSharedAccessAuthorizationRuleResourceImpl extends CreatableUpdatableImpl implements QueueNamespaceSharedAccessAuthorizationRuleResource, QueueNamespaceSharedAccessAuthorizationRuleResource.Definition, QueueNamespaceSharedAccessAuthorizationRuleResource.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String queueName; + private String authorizationRuleName; + private SharedAccessAuthorizationRuleCreateOrUpdateParameters createOrUpdateParameter; + + QueueNamespaceSharedAccessAuthorizationRuleResourceImpl(String name, ServiceBusManager manager) { + super(name, new SharedAccessAuthorizationRuleResourceInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + QueueNamespaceSharedAccessAuthorizationRuleResourceImpl(SharedAccessAuthorizationRuleResourceInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.queueName = IdParsingUtils.getValueFromIdByName(inner.id(), "queues"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.authorizationRuleName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(SharedAccessAuthorizationRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.authorizationRuleName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(SharedAccessAuthorizationRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResourceImpl withExistingQueue(String resourceGroupName, String namespaceName, String queueName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.queueName = queueName; + return this; + } + + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResourceImpl withRights(List rights) { + this.createOrUpdateParameter.withRights(rights); + return this; + } + + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResourceImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueResourceImpl.java new file mode 100644 index 000000000000..c9d5097381d6 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueResourceImpl.java @@ -0,0 +1,343 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueCreateOrUpdateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.MessageCountDetails; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityAvailabilityStatus; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityStatus; +import rx.functions.Func1; + +class QueueResourceImpl extends CreatableUpdatableImpl implements QueueResource, QueueResource.Definition, QueueResource.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String queueName; + private QueueCreateOrUpdateParameters createOrUpdateParameter; + + QueueResourceImpl(String name, ServiceBusManager manager) { + super(name, new QueueResourceInner()); + this.manager = manager; + // Set resource name + this.queueName = name; + // + this.createOrUpdateParameter = new QueueCreateOrUpdateParameters(); + } + + QueueResourceImpl(QueueResourceInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.queueName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.queueName = IdParsingUtils.getValueFromIdByName(inner.id(), "queues"); + // + this.createOrUpdateParameter = new QueueCreateOrUpdateParameters(); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public QueueResourceInner call(QueueResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public QueueResourceInner call(QueueResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.queueName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new QueueCreateOrUpdateParameters(); + } + + @Override + public DateTime accessedAt() { + return this.inner().accessedAt(); + } + + @Override + public String autoDeleteOnIdle() { + return this.inner().autoDeleteOnIdle(); + } + + @Override + public MessageCountDetails countDetails() { + return this.inner().countDetails(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Boolean deadLetteringOnMessageExpiration() { + return this.inner().deadLetteringOnMessageExpiration(); + } + + @Override + public String defaultMessageTimeToLive() { + return this.inner().defaultMessageTimeToLive(); + } + + @Override + public String duplicateDetectionHistoryTimeWindow() { + return this.inner().duplicateDetectionHistoryTimeWindow(); + } + + @Override + public Boolean enableBatchedOperations() { + return this.inner().enableBatchedOperations(); + } + + @Override + public Boolean enableExpress() { + return this.inner().enableExpress(); + } + + @Override + public Boolean enablePartitioning() { + return this.inner().enablePartitioning(); + } + + @Override + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.inner().entityAvailabilityStatus(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAnonymousAccessible() { + return this.inner().isAnonymousAccessible(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String lockDuration() { + return this.inner().lockDuration(); + } + + @Override + public Integer maxDeliveryCount() { + return this.inner().maxDeliveryCount(); + } + + @Override + public Long maxSizeInMegabytes() { + return this.inner().maxSizeInMegabytes(); + } + + @Override + public Long messageCount() { + return this.inner().messageCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresDuplicateDetection() { + return this.inner().requiresDuplicateDetection(); + } + + @Override + public Boolean requiresSession() { + return this.inner().requiresSession(); + } + + @Override + public Long sizeInBytes() { + return this.inner().sizeInBytes(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public Boolean supportOrdering() { + return this.inner().supportOrdering(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public QueueResourceImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public QueueResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public QueueResourceImpl withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.createOrUpdateParameter.withAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + @Override + public QueueResourceImpl withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.createOrUpdateParameter.withDeadLetteringOnMessageExpiration(deadLetteringOnMessageExpiration); + return this; + } + + @Override + public QueueResourceImpl withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.createOrUpdateParameter.withDefaultMessageTimeToLive(defaultMessageTimeToLive); + return this; + } + + @Override + public QueueResourceImpl withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow) { + this.createOrUpdateParameter.withDuplicateDetectionHistoryTimeWindow(duplicateDetectionHistoryTimeWindow); + return this; + } + + @Override + public QueueResourceImpl withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.createOrUpdateParameter.withEnableBatchedOperations(enableBatchedOperations); + return this; + } + + @Override + public QueueResourceImpl withEnableExpress(Boolean enableExpress) { + this.createOrUpdateParameter.withEnableExpress(enableExpress); + return this; + } + + @Override + public QueueResourceImpl withEnablePartitioning(Boolean enablePartitioning) { + this.createOrUpdateParameter.withEnablePartitioning(enablePartitioning); + return this; + } + + @Override + public QueueResourceImpl withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.createOrUpdateParameter.withEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + @Override + public QueueResourceImpl withIsAnonymousAccessible(Boolean isAnonymousAccessible) { + this.createOrUpdateParameter.withIsAnonymousAccessible(isAnonymousAccessible); + return this; + } + + @Override + public QueueResourceImpl withLockDuration(String lockDuration) { + this.createOrUpdateParameter.withLockDuration(lockDuration); + return this; + } + + @Override + public QueueResourceImpl withMaxDeliveryCount(Integer maxDeliveryCount) { + this.createOrUpdateParameter.withMaxDeliveryCount(maxDeliveryCount); + return this; + } + + @Override + public QueueResourceImpl withMaxSizeInMegabytes(Long maxSizeInMegabytes) { + this.createOrUpdateParameter.withMaxSizeInMegabytes(maxSizeInMegabytes); + return this; + } + + @Override + public QueueResourceImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + + @Override + public QueueResourceImpl withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.createOrUpdateParameter.withRequiresDuplicateDetection(requiresDuplicateDetection); + return this; + } + + @Override + public QueueResourceImpl withRequiresSession(Boolean requiresSession) { + this.createOrUpdateParameter.withRequiresSession(requiresSession); + return this; + } + + @Override + public QueueResourceImpl withStatus(EntityStatus status) { + this.createOrUpdateParameter.withStatus(status); + return this; + } + + @Override + public QueueResourceImpl withSupportOrdering(Boolean supportOrdering) { + this.createOrUpdateParameter.withSupportOrdering(supportOrdering); + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueResourceInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueResourceInner.java new file mode 100644 index 000000000000..540f628ddbfc --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueueResourceInner.java @@ -0,0 +1,575 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityAvailabilityStatus; +import com.microsoft.azure.management.servicebus.v2015_08_01.MessageCountDetails; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of queue Resource. + */ +@JsonFlatten +public class QueueResourceInner extends ProxyResource { + /** + * The duration of a peek-lock; that is, the amount of time that the + * message is locked for other receivers. The maximum value for + * LockDuration is 5 minutes; the default value is 1 minute. + */ + @JsonProperty(value = "properties.lockDuration") + private String lockDuration; + + /** + * Last time a message was sent, or the last time there was a receive + * request to this queue. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * the TimeSpan idle interval after which the queue is automatically + * deleted. The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private String autoDeleteOnIdle; + + /** + * Entity availability status for the queue. Possible values include: + * 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + */ + @JsonProperty(value = "properties.entityAvailabilityStatus") + private EntityAvailabilityStatus entityAvailabilityStatus; + + /** + * The exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The default message time to live value. This is the duration after which + * the message expires, starting from when the message is sent to Service + * Bus. This is the default value used when TimeToLive is not set on a + * message itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private String defaultMessageTimeToLive; + + /** + * TimeSpan structure that defines the duration of the duplicate detection + * history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private String duplicateDetectionHistoryTimeWindow; + + /** + * A value that indicates whether server-side batched operations are + * enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * A value that indicates whether this queue has dead letter support when a + * message expires. + */ + @JsonProperty(value = "properties.deadLetteringOnMessageExpiration") + private Boolean deadLetteringOnMessageExpiration; + + /** + * A value that indicates whether Express Entities are enabled. An express + * queue holds a message in memory temporarily before writing it to + * persistent storage. + */ + @JsonProperty(value = "properties.enableExpress") + private Boolean enableExpress; + + /** + * A value that indicates whether the queue is to be partitioned across + * multiple message brokers. + */ + @JsonProperty(value = "properties.enablePartitioning") + private Boolean enablePartitioning; + + /** + * A value that indicates whether the message is accessible anonymously. + */ + @JsonProperty(value = "properties.isAnonymousAccessible") + private Boolean isAnonymousAccessible; + + /** + * The maximum delivery count. A message is automatically deadlettered + * after this number of deliveries. + */ + @JsonProperty(value = "properties.maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * The maximum size of the queue in megabytes, which is the size of memory + * allocated for the queue. + */ + @JsonProperty(value = "properties.maxSizeInMegabytes") + private Long maxSizeInMegabytes; + + /** + * The number of messages in the queue. + */ + @JsonProperty(value = "properties.messageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long messageCount; + + /** + * The countDetails property. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * A value indicating if this queue requires duplicate detection. + */ + @JsonProperty(value = "properties.requiresDuplicateDetection") + private Boolean requiresDuplicateDetection; + + /** + * A value that indicates whether the queue supports the concept of + * sessions. + */ + @JsonProperty(value = "properties.requiresSession") + private Boolean requiresSession; + + /** + * The size of the queue, in bytes. + */ + @JsonProperty(value = "properties.sizeInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long sizeInBytes; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', + * 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * A value that indicates whether the queue supports ordering. + */ + @JsonProperty(value = "properties.supportOrdering") + private Boolean supportOrdering; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + * + * @return the lockDuration value + */ + public String lockDuration() { + return this.lockDuration; + } + + /** + * Set the duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + * + * @param lockDuration the lockDuration value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withLockDuration(String lockDuration) { + this.lockDuration = lockDuration; + return this; + } + + /** + * Get last time a message was sent, or the last time there was a receive request to this queue. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get the TimeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public String autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set the TimeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get entity availability status for the queue. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @return the entityAvailabilityStatus value + */ + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.entityAvailabilityStatus; + } + + /** + * Set entity availability status for the queue. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @param entityAvailabilityStatus the entityAvailabilityStatus value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.entityAvailabilityStatus = entityAvailabilityStatus; + return this; + } + + /** + * Get the exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public String defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set the default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public String duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get a value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set a value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get a value that indicates whether this queue has dead letter support when a message expires. + * + * @return the deadLetteringOnMessageExpiration value + */ + public Boolean deadLetteringOnMessageExpiration() { + return this.deadLetteringOnMessageExpiration; + } + + /** + * Set a value that indicates whether this queue has dead letter support when a message expires. + * + * @param deadLetteringOnMessageExpiration the deadLetteringOnMessageExpiration value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.deadLetteringOnMessageExpiration = deadLetteringOnMessageExpiration; + return this; + } + + /** + * Get a value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + * + * @return the enableExpress value + */ + public Boolean enableExpress() { + return this.enableExpress; + } + + /** + * Set a value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + * + * @param enableExpress the enableExpress value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withEnableExpress(Boolean enableExpress) { + this.enableExpress = enableExpress; + return this; + } + + /** + * Get a value that indicates whether the queue is to be partitioned across multiple message brokers. + * + * @return the enablePartitioning value + */ + public Boolean enablePartitioning() { + return this.enablePartitioning; + } + + /** + * Set a value that indicates whether the queue is to be partitioned across multiple message brokers. + * + * @param enablePartitioning the enablePartitioning value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withEnablePartitioning(Boolean enablePartitioning) { + this.enablePartitioning = enablePartitioning; + return this; + } + + /** + * Get a value that indicates whether the message is accessible anonymously. + * + * @return the isAnonymousAccessible value + */ + public Boolean isAnonymousAccessible() { + return this.isAnonymousAccessible; + } + + /** + * Set a value that indicates whether the message is accessible anonymously. + * + * @param isAnonymousAccessible the isAnonymousAccessible value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withIsAnonymousAccessible(Boolean isAnonymousAccessible) { + this.isAnonymousAccessible = isAnonymousAccessible; + return this; + } + + /** + * Get the maximum delivery count. A message is automatically deadlettered after this number of deliveries. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maximum delivery count. A message is automatically deadlettered after this number of deliveries. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get the maximum size of the queue in megabytes, which is the size of memory allocated for the queue. + * + * @return the maxSizeInMegabytes value + */ + public Long maxSizeInMegabytes() { + return this.maxSizeInMegabytes; + } + + /** + * Set the maximum size of the queue in megabytes, which is the size of memory allocated for the queue. + * + * @param maxSizeInMegabytes the maxSizeInMegabytes value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withMaxSizeInMegabytes(Long maxSizeInMegabytes) { + this.maxSizeInMegabytes = maxSizeInMegabytes; + return this; + } + + /** + * Get the number of messages in the queue. + * + * @return the messageCount value + */ + public Long messageCount() { + return this.messageCount; + } + + /** + * Get the countDetails value. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get a value indicating if this queue requires duplicate detection. + * + * @return the requiresDuplicateDetection value + */ + public Boolean requiresDuplicateDetection() { + return this.requiresDuplicateDetection; + } + + /** + * Set a value indicating if this queue requires duplicate detection. + * + * @param requiresDuplicateDetection the requiresDuplicateDetection value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.requiresDuplicateDetection = requiresDuplicateDetection; + return this; + } + + /** + * Get a value that indicates whether the queue supports the concept of sessions. + * + * @return the requiresSession value + */ + public Boolean requiresSession() { + return this.requiresSession; + } + + /** + * Set a value that indicates whether the queue supports the concept of sessions. + * + * @param requiresSession the requiresSession value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withRequiresSession(Boolean requiresSession) { + this.requiresSession = requiresSession; + return this; + } + + /** + * Get the size of the queue, in bytes. + * + * @return the sizeInBytes value + */ + public Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @param status the status value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get a value that indicates whether the queue supports ordering. + * + * @return the supportOrdering value + */ + public Boolean supportOrdering() { + return this.supportOrdering; + } + + /** + * Set a value that indicates whether the queue supports ordering. + * + * @param supportOrdering the supportOrdering value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withSupportOrdering(Boolean supportOrdering) { + this.supportOrdering = supportOrdering; + return this; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the QueueResourceInner object itself. + */ + public QueueResourceInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueuesImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueuesImpl.java new file mode 100644 index 000000000000..d97578a9894f --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueuesImpl.java @@ -0,0 +1,178 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.Queues; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueNamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.ResourceListKeys; + +class QueuesImpl extends WrapperImpl implements Queues { + private final ServiceBusManager manager; + + QueuesImpl(ServiceBusManager manager) { + super(manager.inner().queues()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public QueueResourceImpl define(String name) { + return wrapModel(name); + } + + private QueueResourceImpl wrapModel(QueueResourceInner inner) { + return new QueueResourceImpl(inner, manager()); + } + + private QueueResourceImpl wrapModel(String name) { + return new QueueResourceImpl(name, this.manager()); + } + + @Override + public Observable listAllAsync(final String resourceGroupName, final String namespaceName) { + QueuesInner client = this.inner(); + return client.listAllAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public QueueResource call(QueueResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String queueName) { + QueuesInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, queueName) + .map(new Func1() { + @Override + public QueueResource call(QueueResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String queueName) { + QueuesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, queueName).toCompletable(); + } + + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResourceImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private QueueNamespaceSharedAccessAuthorizationRuleResourceImpl wrapAuthorizationRuleModel(String name) { + return new QueueNamespaceSharedAccessAuthorizationRuleResourceImpl(name, this.manager()); + } + + private QueueNamespaceSharedAccessAuthorizationRuleResourceImpl wrapQueueNamespaceSharedAccessAuthorizationRuleResourceModel(SharedAccessAuthorizationRuleResourceInner inner) { + return new QueueNamespaceSharedAccessAuthorizationRuleResourceImpl(inner, manager()); + } + + private Observable getSharedAccessAuthorizationRuleResourceInnerUsingQueuesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String queueName = IdParsingUtils.getValueFromIdByName(id, "queues"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + QueuesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) + .map(new Func1() { + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return wrapQueueNamespaceSharedAccessAuthorizationRuleResourceModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + QueuesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, queueName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public QueueNamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return wrapQueueNamespaceSharedAccessAuthorizationRuleResourceModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.postAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return new NamespaceSharedAccessAuthorizationRuleResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) + .map(new Func1() { + @Override + public ResourceListKeys call(ResourceListKeysInner inner) { + return new ResourceListKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) + .map(new Func1() { + @Override + public ResourceListKeys call(ResourceListKeysInner inner) { + return new ResourceListKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueuesInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueuesInner.java new file mode 100644 index 000000000000..2a266c3c2ee3 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/QueuesInner.java @@ -0,0 +1,1596 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2015_08_01.Policykey; +import com.microsoft.azure.management.servicebus.v2015_08_01.QueueCreateOrUpdateParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.RegenerateKeysParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Queues. + */ +public class QueuesInner { + /** The Retrofit service to perform REST calls. */ + private QueuesService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of QueuesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueuesInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(QueuesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Queues to be + * used by Retrofit to perform actually REST calls. + */ + interface QueuesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Queues listAll" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") + Observable> listAll(@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.servicebus.v2015_08_01.Queues createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("subscriptionId") String subscriptionId, @Body QueueCreateOrUpdateParameters 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.servicebus.v2015_08_01.Queues delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @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.servicebus.v2015_08_01.Queues get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @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.servicebus.v2015_08_01.Queues listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @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.servicebus.v2015_08_01.Queues createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body SharedAccessAuthorizationRuleCreateOrUpdateParameters 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.servicebus.v2015_08_01.Queues postAuthorizationRule" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") + Observable> postAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Queues deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Queues getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Queues listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Queues regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeysParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Queues listAllNext" }) + @GET + Observable> listAllNext(@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.servicebus.v2015_08_01.Queues listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the queues within 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<QueueResourceInner> object if successful. + */ + public PagedList listAll(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listAllSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the queues within 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> listAllAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAllSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the queues within 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<QueueResourceInner> object + */ + public Observable> listAllAsync(final String resourceGroupName, final String namespaceName) { + return listAllWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the queues within 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<QueueResourceInner> object + */ + public Observable>> listAllWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listAllSinglePageAsync(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(listAllNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the queues within 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<QueueResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAllSinglePageAsync(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.listAll(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 = listAllDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAllDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QueueResourceInner object if successful. + */ + public QueueResourceInner createOrUpdate(String resourceGroupName, String namespaceName, String queueName, QueueCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String queueName, QueueCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters), serviceCallback); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueueResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String queueName, QueueCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters).map(new Func1, QueueResourceInner>() { + @Override + public QueueResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueueResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, QueueCreateOrUpdateParameters 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String queueName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).toBlocking().single().body(); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String queueName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName), serviceCallback); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String queueName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QueueResourceInner object if successful. + */ + public QueueResourceInner get(String resourceGroupName, String namespaceName, String queueName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).toBlocking().single().body(); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String queueName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName), serviceCallback); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueueResourceInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String queueName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).map(new Func1, QueueResourceInner>() { + @Override + public QueueResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueueResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String queueName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, queueName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner postAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> postAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.postAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = postAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse postAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Policykey policykey = null; + RegenerateKeysParameters parameters = new RegenerateKeysParameters(); + parameters.withPolicykey(null); + return service.regenerateKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, policykey).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, policykey), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, policykey).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + RegenerateKeysParameters parameters = new RegenerateKeysParameters(); + parameters.withPolicykey(policykey); + return service.regenerateKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the queues within a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<QueueResourceInner> object if successful. + */ + public PagedList listAllNext(final String nextPageLink) { + ServiceResponse> response = listAllNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the queues within 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> listAllNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAllNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the queues within 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<QueueResourceInner> object + */ + public Observable> listAllNextAsync(final String nextPageLink) { + return listAllNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the queues within 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<QueueResourceInner> object + */ + public Observable>> listAllNextWithServiceResponseAsync(final String nextPageLink) { + return listAllNextSinglePageAsync(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(listAllNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the queues within 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<QueueResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAllNextSinglePageAsync(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.listAllNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAllNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAllNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all authorization rules for a queue. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all authorization rules for a queue. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all authorization rules for a queue. + * + * @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<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + * @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<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ResourceListKeysImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ResourceListKeysImpl.java new file mode 100644 index 000000000000..e4ca12f72695 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ResourceListKeysImpl.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.ResourceListKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class ResourceListKeysImpl extends WrapperImpl implements ResourceListKeys { + private final ServiceBusManager manager; + ResourceListKeysImpl(ResourceListKeysInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public String keyName() { + return this.inner().keyName(); + } + + @Override + public String primaryConnectionString() { + return this.inner().primaryConnectionString(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryConnectionString() { + return this.inner().secondaryConnectionString(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ResourceListKeysInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ResourceListKeysInner.java new file mode 100644 index 000000000000..cb947fa7784a --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ResourceListKeysInner.java @@ -0,0 +1,149 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Namespace/ServiceBus Connection String. + */ +public class ResourceListKeysInner { + /** + * Primary connection string of the created namespace authorization rule. + */ + @JsonProperty(value = "primaryConnectionString") + private String primaryConnectionString; + + /** + * Secondary connection string of the created namespace authorization rule. + */ + @JsonProperty(value = "secondaryConnectionString") + private String secondaryConnectionString; + + /** + * A base64-encoded 256-bit primary key for signing and validating the SAS + * token. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /** + * A base64-encoded 256-bit primary key for signing and validating the SAS + * token. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /** + * A string that describes the authorization rule. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * Get primary connection string of the created namespace authorization rule. + * + * @return the primaryConnectionString value + */ + public String primaryConnectionString() { + return this.primaryConnectionString; + } + + /** + * Set primary connection string of the created namespace authorization rule. + * + * @param primaryConnectionString the primaryConnectionString value to set + * @return the ResourceListKeysInner object itself. + */ + public ResourceListKeysInner withPrimaryConnectionString(String primaryConnectionString) { + this.primaryConnectionString = primaryConnectionString; + return this; + } + + /** + * Get secondary connection string of the created namespace authorization rule. + * + * @return the secondaryConnectionString value + */ + public String secondaryConnectionString() { + return this.secondaryConnectionString; + } + + /** + * Set secondary connection string of the created namespace authorization rule. + * + * @param secondaryConnectionString the secondaryConnectionString value to set + * @return the ResourceListKeysInner object itself. + */ + public ResourceListKeysInner withSecondaryConnectionString(String secondaryConnectionString) { + this.secondaryConnectionString = secondaryConnectionString; + return this; + } + + /** + * Get a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @param primaryKey the primaryKey value to set + * @return the ResourceListKeysInner object itself. + */ + public ResourceListKeysInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @param secondaryKey the secondaryKey value to set + * @return the ResourceListKeysInner object itself. + */ + public ResourceListKeysInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get a string that describes the authorization rule. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set a string that describes the authorization rule. + * + * @param keyName the keyName value to set + * @return the ResourceListKeysInner object itself. + */ + public ResourceListKeysInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ServiceBusManagementClientImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ServiceBusManagementClientImpl.java new file mode 100644 index 000000000000..c11e57d65029 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ServiceBusManagementClientImpl.java @@ -0,0 +1,252 @@ +/** + * 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.servicebus.v2015_08_01.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 ServiceBusManagementClientImpl class. + */ +public class ServiceBusManagementClientImpl 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 ServiceBusManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client API version. */ + private String apiVersion; + + /** + * Gets Client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ServiceBusManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ServiceBusManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ServiceBusManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The NamespacesInner object to access its operations. + */ + private NamespacesInner namespaces; + + /** + * Gets the NamespacesInner object to access its operations. + * @return the NamespacesInner object. + */ + public NamespacesInner namespaces() { + return this.namespaces; + } + + /** + * The QueuesInner object to access its operations. + */ + private QueuesInner queues; + + /** + * Gets the QueuesInner object to access its operations. + * @return the QueuesInner object. + */ + public QueuesInner queues() { + return this.queues; + } + + /** + * The TopicsInner object to access its operations. + */ + private TopicsInner topics; + + /** + * Gets the TopicsInner object to access its operations. + * @return the TopicsInner object. + */ + public TopicsInner topics() { + return this.topics; + } + + /** + * The SubscriptionsInner object to access its operations. + */ + private SubscriptionsInner subscriptions; + + /** + * Gets the SubscriptionsInner object to access its operations. + * @return the SubscriptionsInner object. + */ + public SubscriptionsInner subscriptions() { + return this.subscriptions; + } + + /** + * Initializes an instance of ServiceBusManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ServiceBusManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ServiceBusManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ServiceBusManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ServiceBusManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ServiceBusManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-08-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.namespaces = new NamespacesInner(restClient().retrofit(), this); + this.queues = new QueuesInner(restClient().retrofit(), this); + this.topics = new TopicsInner(restClient().retrofit(), this); + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ServiceBusManagementClient", "2015-08-01"); + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ServiceBusManager.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ServiceBusManager.java new file mode 100644 index 000000000000..502d8a76260a --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/ServiceBusManager.java @@ -0,0 +1,147 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.servicebus.v2015_08_01.Operations; +import com.microsoft.azure.management.servicebus.v2015_08_01.Namespaces; +import com.microsoft.azure.management.servicebus.v2015_08_01.Queues; +import com.microsoft.azure.management.servicebus.v2015_08_01.Topics; +import com.microsoft.azure.management.servicebus.v2015_08_01.Subscriptions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure ServiceBus resource management. + */ +public final class ServiceBusManager extends ManagerCore { + private Operations operations; + private Namespaces namespaces; + private Queues queues; + private Topics topics; + private Subscriptions subscriptions; + /** + * Get a Configurable instance that can be used to create ServiceBusManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ServiceBusManager.ConfigurableImpl(); + } + /** + * Creates an instance of ServiceBusManager that exposes ServiceBus resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ServiceBusManager + */ + public static ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ServiceBusManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of ServiceBusManager that exposes ServiceBus resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ServiceBusManager + */ + public static ServiceBusManager authenticate(RestClient restClient, String subscriptionId) { + return new ServiceBusManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ServiceBusManager that exposes ServiceBus management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing ServiceBus management API entry points that work across subscriptions + */ + ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Namespaces. + */ + public Namespaces namespaces() { + if (this.namespaces == null) { + this.namespaces = new NamespacesImpl(this); + } + return this.namespaces; + } + + /** + * @return Entry point to manage Queues. + */ + public Queues queues() { + if (this.queues == null) { + this.queues = new QueuesImpl(this); + } + return this.queues; + } + + /** + * @return Entry point to manage Topics. + */ + public Topics topics() { + if (this.topics == null) { + this.topics = new TopicsImpl(this); + } + return this.topics; + } + + /** + * @return Entry point to manage Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ServiceBusManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ServiceBusManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ServiceBusManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SharedAccessAuthorizationRuleResourceInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SharedAccessAuthorizationRuleResourceInner.java new file mode 100644 index 000000000000..065f970232e6 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SharedAccessAuthorizationRuleResourceInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.servicebus.v2015_08_01.AccessRights; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of a namespace authorization rule. + */ +@JsonFlatten +public class SharedAccessAuthorizationRuleResourceInner extends ProxyResource { + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "properties.rights", required = true) + private List rights; + + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the SharedAccessAuthorizationRuleResourceInner object itself. + */ + public SharedAccessAuthorizationRuleResourceInner withRights(List rights) { + this.rights = rights; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the SharedAccessAuthorizationRuleResourceInner object itself. + */ + public SharedAccessAuthorizationRuleResourceInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionResourceImpl.java new file mode 100644 index 000000000000..9a551725c3d8 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionResourceImpl.java @@ -0,0 +1,286 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.SubscriptionResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.SubscriptionCreateOrUpdateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.MessageCountDetails; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityAvailabilityStatus; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityStatus; +import rx.functions.Func1; + +class SubscriptionResourceImpl extends CreatableUpdatableImpl implements SubscriptionResource, SubscriptionResource.Definition, SubscriptionResource.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + private String subscriptionName; + private SubscriptionCreateOrUpdateParameters createOrUpdateParameter; + + SubscriptionResourceImpl(String name, ServiceBusManager manager) { + super(name, new SubscriptionResourceInner()); + this.manager = manager; + // Set resource name + this.subscriptionName = name; + // + this.createOrUpdateParameter = new SubscriptionCreateOrUpdateParameters(); + } + + SubscriptionResourceImpl(SubscriptionResourceInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.subscriptionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + this.subscriptionName = IdParsingUtils.getValueFromIdByName(inner.id(), "subscriptions"); + // + this.createOrUpdateParameter = new SubscriptionCreateOrUpdateParameters(); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SubscriptionResourceInner call(SubscriptionResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SubscriptionResourceInner call(SubscriptionResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SubscriptionCreateOrUpdateParameters(); + } + + @Override + public DateTime accessedAt() { + return this.inner().accessedAt(); + } + + @Override + public String autoDeleteOnIdle() { + return this.inner().autoDeleteOnIdle(); + } + + @Override + public MessageCountDetails countDetails() { + return this.inner().countDetails(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Boolean deadLetteringOnFilterEvaluationExceptions() { + return this.inner().deadLetteringOnFilterEvaluationExceptions(); + } + + @Override + public Boolean deadLetteringOnMessageExpiration() { + return this.inner().deadLetteringOnMessageExpiration(); + } + + @Override + public String defaultMessageTimeToLive() { + return this.inner().defaultMessageTimeToLive(); + } + + @Override + public Boolean enableBatchedOperations() { + return this.inner().enableBatchedOperations(); + } + + @Override + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.inner().entityAvailabilityStatus(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isReadOnly() { + return this.inner().isReadOnly(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String lockDuration() { + return this.inner().lockDuration(); + } + + @Override + public Integer maxDeliveryCount() { + return this.inner().maxDeliveryCount(); + } + + @Override + public Long messageCount() { + return this.inner().messageCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresSession() { + return this.inner().requiresSession(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public SubscriptionResourceImpl withExistingTopic(String resourceGroupName, String namespaceName, String topicName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.topicName = topicName; + return this; + } + + @Override + public SubscriptionResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SubscriptionResourceImpl withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.createOrUpdateParameter.withAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + @Override + public SubscriptionResourceImpl withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions) { + this.createOrUpdateParameter.withDeadLetteringOnFilterEvaluationExceptions(deadLetteringOnFilterEvaluationExceptions); + return this; + } + + @Override + public SubscriptionResourceImpl withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.createOrUpdateParameter.withDeadLetteringOnMessageExpiration(deadLetteringOnMessageExpiration); + return this; + } + + @Override + public SubscriptionResourceImpl withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.createOrUpdateParameter.withDefaultMessageTimeToLive(defaultMessageTimeToLive); + return this; + } + + @Override + public SubscriptionResourceImpl withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.createOrUpdateParameter.withEnableBatchedOperations(enableBatchedOperations); + return this; + } + + @Override + public SubscriptionResourceImpl withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.createOrUpdateParameter.withEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + @Override + public SubscriptionResourceImpl withIsReadOnly(Boolean isReadOnly) { + this.createOrUpdateParameter.withIsReadOnly(isReadOnly); + return this; + } + + @Override + public SubscriptionResourceImpl withLockDuration(String lockDuration) { + this.createOrUpdateParameter.withLockDuration(lockDuration); + return this; + } + + @Override + public SubscriptionResourceImpl withMaxDeliveryCount(Integer maxDeliveryCount) { + this.createOrUpdateParameter.withMaxDeliveryCount(maxDeliveryCount); + return this; + } + + @Override + public SubscriptionResourceImpl withRequiresSession(Boolean requiresSession) { + this.createOrUpdateParameter.withRequiresSession(requiresSession); + return this; + } + + @Override + public SubscriptionResourceImpl withStatus(EntityStatus status) { + this.createOrUpdateParameter.withStatus(status); + return this; + } + + @Override + public SubscriptionResourceImpl withType(String type) { + this.createOrUpdateParameter.withType(type); + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionResourceInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionResourceInner.java new file mode 100644 index 000000000000..8b7d81425fbd --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionResourceInner.java @@ -0,0 +1,420 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.MessageCountDetails; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityAvailabilityStatus; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of subscription resource. + */ +@JsonFlatten +public class SubscriptionResourceInner extends ProxyResource { + /** + * Last time there was a receive request to this subscription. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * TimeSpan idle interval after which the topic is automatically deleted. + * The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private String autoDeleteOnIdle; + + /** + * The countDetails property. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * Default message time to live value. This is the duration after which the + * message expires, starting from when the message is sent to Service Bus. + * This is the default value used when TimeToLive is not set on a message + * itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private String defaultMessageTimeToLive; + + /** + * Value that indicates whether a subscription has dead letter support on + * filter evaluation exceptions. + */ + @JsonProperty(value = "properties.deadLetteringOnFilterEvaluationExceptions") + private Boolean deadLetteringOnFilterEvaluationExceptions; + + /** + * Value that indicates whether a subscription has dead letter support when + * a message expires. + */ + @JsonProperty(value = "properties.deadLetteringOnMessageExpiration") + private Boolean deadLetteringOnMessageExpiration; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * Entity availability status for the topic. Possible values include: + * 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + */ + @JsonProperty(value = "properties.entityAvailabilityStatus") + private EntityAvailabilityStatus entityAvailabilityStatus; + + /** + * Value that indicates whether the entity description is read-only. + */ + @JsonProperty(value = "properties.isReadOnly") + private Boolean isReadOnly; + + /** + * The lock duration time span for the subscription. + */ + @JsonProperty(value = "properties.lockDuration") + private String lockDuration; + + /** + * Number of maximum deliveries. + */ + @JsonProperty(value = "properties.maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Number of messages. + */ + @JsonProperty(value = "properties.messageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long messageCount; + + /** + * Value indicating if a subscription supports the concept of sessions. + */ + @JsonProperty(value = "properties.requiresSession") + private Boolean requiresSession; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', + * 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get last time there was a receive request to this subscription. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public String autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get the countDetails value. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public String defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + * + * @return the deadLetteringOnFilterEvaluationExceptions value + */ + public Boolean deadLetteringOnFilterEvaluationExceptions() { + return this.deadLetteringOnFilterEvaluationExceptions; + } + + /** + * Set value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + * + * @param deadLetteringOnFilterEvaluationExceptions the deadLetteringOnFilterEvaluationExceptions value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions) { + this.deadLetteringOnFilterEvaluationExceptions = deadLetteringOnFilterEvaluationExceptions; + return this; + } + + /** + * Get value that indicates whether a subscription has dead letter support when a message expires. + * + * @return the deadLetteringOnMessageExpiration value + */ + public Boolean deadLetteringOnMessageExpiration() { + return this.deadLetteringOnMessageExpiration; + } + + /** + * Set value that indicates whether a subscription has dead letter support when a message expires. + * + * @param deadLetteringOnMessageExpiration the deadLetteringOnMessageExpiration value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.deadLetteringOnMessageExpiration = deadLetteringOnMessageExpiration; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @return the entityAvailabilityStatus value + */ + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.entityAvailabilityStatus; + } + + /** + * Set entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @param entityAvailabilityStatus the entityAvailabilityStatus value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.entityAvailabilityStatus = entityAvailabilityStatus; + return this; + } + + /** + * Get value that indicates whether the entity description is read-only. + * + * @return the isReadOnly value + */ + public Boolean isReadOnly() { + return this.isReadOnly; + } + + /** + * Set value that indicates whether the entity description is read-only. + * + * @param isReadOnly the isReadOnly value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withIsReadOnly(Boolean isReadOnly) { + this.isReadOnly = isReadOnly; + return this; + } + + /** + * Get the lock duration time span for the subscription. + * + * @return the lockDuration value + */ + public String lockDuration() { + return this.lockDuration; + } + + /** + * Set the lock duration time span for the subscription. + * + * @param lockDuration the lockDuration value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withLockDuration(String lockDuration) { + this.lockDuration = lockDuration; + return this; + } + + /** + * Get number of maximum deliveries. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set number of maximum deliveries. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get number of messages. + * + * @return the messageCount value + */ + public Long messageCount() { + return this.messageCount; + } + + /** + * Get value indicating if a subscription supports the concept of sessions. + * + * @return the requiresSession value + */ + public Boolean requiresSession() { + return this.requiresSession; + } + + /** + * Set value indicating if a subscription supports the concept of sessions. + * + * @param requiresSession the requiresSession value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withRequiresSession(Boolean requiresSession) { + this.requiresSession = requiresSession; + return this; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @param status the status value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionsImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionsImpl.java new file mode 100644 index 000000000000..a503c57b1b09 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.Subscriptions; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2015_08_01.SubscriptionResource; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final ServiceBusManager manager; + + SubscriptionsImpl(ServiceBusManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public SubscriptionResourceImpl define(String name) { + return wrapModel(name); + } + + private SubscriptionResourceImpl wrapModel(SubscriptionResourceInner inner) { + return new SubscriptionResourceImpl(inner, manager()); + } + + private SubscriptionResourceImpl wrapModel(String name) { + return new SubscriptionResourceImpl(name, this.manager()); + } + + @Override + public Observable listAllAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + SubscriptionsInner client = this.inner(); + return client.listAllAsync(resourceGroupName, namespaceName, topicName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SubscriptionResource call(SubscriptionResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + SubscriptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, topicName, subscriptionName) + .map(new Func1() { + @Override + public SubscriptionResource call(SubscriptionResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + SubscriptionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toCompletable(); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionsInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionsInner.java new file mode 100644 index 000000000000..cf16a5fa4ef7 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/SubscriptionsInner.java @@ -0,0 +1,637 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2015_08_01.SubscriptionCreateOrUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.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 Subscriptions. + */ +public class SubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(SubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Subscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Subscriptions listAll" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") + Observable> listAll(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2015_08_01.Subscriptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @Path("subscriptionId") String subscriptionId, @Body SubscriptionCreateOrUpdateParameters 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.servicebus.v2015_08_01.Subscriptions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @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.servicebus.v2015_08_01.Subscriptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @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.servicebus.v2015_08_01.Subscriptions listAllNext" }) + @GET + Observable> listAllNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SubscriptionResourceInner> object if successful. + */ + public PagedList listAll(final String resourceGroupName, final String namespaceName, final String topicName) { + ServiceResponse> response = listAllSinglePageAsync(resourceGroupName, namespaceName, topicName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic 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> listAllAsync(final String resourceGroupName, final String namespaceName, final String topicName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAllSinglePageAsync(resourceGroupName, namespaceName, topicName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionResourceInner> object + */ + public Observable> listAllAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listAllWithServiceResponseAsync(resourceGroupName, namespaceName, topicName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionResourceInner> object + */ + public Observable>> listAllWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listAllSinglePageAsync(resourceGroupName, namespaceName, topicName) + .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(listAllNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAllSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName 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.listAll(resourceGroupName, namespaceName, topicName, 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 = listAllDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAllDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionResourceInner object if successful. + */ + public SubscriptionResourceInner createOrUpdate(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SubscriptionCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SubscriptionCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, parameters), serviceCallback); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SubscriptionCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, parameters).map(new Func1, SubscriptionResourceInner>() { + @Override + public SubscriptionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SubscriptionCreateOrUpdateParameters 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toBlocking().single().body(); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName), serviceCallback); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionResourceInner object if successful. + */ + public SubscriptionResourceInner get(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toBlocking().single().body(); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName), serviceCallback); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionResourceInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).map(new Func1, SubscriptionResourceInner>() { + @Override + public SubscriptionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SubscriptionResourceInner> object if successful. + */ + public PagedList listAllNext(final String nextPageLink) { + ServiceResponse> response = listAllNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the subscriptions under a specified topic. + * + * @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> listAllNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAllNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the subscriptions under a specified topic. + * + * @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<SubscriptionResourceInner> object + */ + public Observable> listAllNextAsync(final String nextPageLink) { + return listAllNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @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<SubscriptionResourceInner> object + */ + public Observable>> listAllNextWithServiceResponseAsync(final String nextPageLink) { + return listAllNextSinglePageAsync(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(listAllNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAllNextSinglePageAsync(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.listAllNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAllNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAllNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicNamespaceSharedAccessAuthorizationRuleResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicNamespaceSharedAccessAuthorizationRuleResourceImpl.java new file mode 100644 index 000000000000..ce470f54a6c1 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicNamespaceSharedAccessAuthorizationRuleResourceImpl.java @@ -0,0 +1,149 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicNamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2015_08_01.AccessRights; +import rx.functions.Func1; + +class TopicNamespaceSharedAccessAuthorizationRuleResourceImpl extends CreatableUpdatableImpl implements TopicNamespaceSharedAccessAuthorizationRuleResource, TopicNamespaceSharedAccessAuthorizationRuleResource.Definition, TopicNamespaceSharedAccessAuthorizationRuleResource.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + private String authorizationRuleName; + private SharedAccessAuthorizationRuleCreateOrUpdateParameters createOrUpdateParameter; + + TopicNamespaceSharedAccessAuthorizationRuleResourceImpl(String name, ServiceBusManager manager) { + super(name, new SharedAccessAuthorizationRuleResourceInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + TopicNamespaceSharedAccessAuthorizationRuleResourceImpl(SharedAccessAuthorizationRuleResourceInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.authorizationRuleName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(SharedAccessAuthorizationRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.authorizationRuleName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(SharedAccessAuthorizationRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResourceImpl withExistingTopic(String resourceGroupName, String namespaceName, String topicName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.topicName = topicName; + return this; + } + + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResourceImpl withRights(List rights) { + this.createOrUpdateParameter.withRights(rights); + return this; + } + + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResourceImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicResourceImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicResourceImpl.java new file mode 100644 index 000000000000..37a13ae03dbe --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicResourceImpl.java @@ -0,0 +1,321 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicCreateOrUpdateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.MessageCountDetails; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityAvailabilityStatus; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityStatus; +import rx.functions.Func1; + +class TopicResourceImpl extends CreatableUpdatableImpl implements TopicResource, TopicResource.Definition, TopicResource.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + private TopicCreateOrUpdateParameters createOrUpdateParameter; + + TopicResourceImpl(String name, ServiceBusManager manager) { + super(name, new TopicResourceInner()); + this.manager = manager; + // Set resource name + this.topicName = name; + // + this.createOrUpdateParameter = new TopicCreateOrUpdateParameters(); + } + + TopicResourceImpl(TopicResourceInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.topicName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + // + this.createOrUpdateParameter = new TopicCreateOrUpdateParameters(); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public TopicResourceInner call(TopicResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public TopicResourceInner call(TopicResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.topicName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new TopicCreateOrUpdateParameters(); + } + + @Override + public DateTime accessedAt() { + return this.inner().accessedAt(); + } + + @Override + public String autoDeleteOnIdle() { + return this.inner().autoDeleteOnIdle(); + } + + @Override + public MessageCountDetails countDetails() { + return this.inner().countDetails(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String defaultMessageTimeToLive() { + return this.inner().defaultMessageTimeToLive(); + } + + @Override + public String duplicateDetectionHistoryTimeWindow() { + return this.inner().duplicateDetectionHistoryTimeWindow(); + } + + @Override + public Boolean enableBatchedOperations() { + return this.inner().enableBatchedOperations(); + } + + @Override + public Boolean enableExpress() { + return this.inner().enableExpress(); + } + + @Override + public Boolean enablePartitioning() { + return this.inner().enablePartitioning(); + } + + @Override + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.inner().entityAvailabilityStatus(); + } + + @Override + public Boolean filteringMessagesBeforePublishing() { + return this.inner().filteringMessagesBeforePublishing(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAnonymousAccessible() { + return this.inner().isAnonymousAccessible(); + } + + @Override + public Boolean isExpress() { + return this.inner().isExpress(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Long maxSizeInMegabytes() { + return this.inner().maxSizeInMegabytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresDuplicateDetection() { + return this.inner().requiresDuplicateDetection(); + } + + @Override + public Long sizeInBytes() { + return this.inner().sizeInBytes(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public Integer subscriptionCount() { + return this.inner().subscriptionCount(); + } + + @Override + public Boolean supportOrdering() { + return this.inner().supportOrdering(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public TopicResourceImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public TopicResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public TopicResourceImpl withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.createOrUpdateParameter.withAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + @Override + public TopicResourceImpl withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.createOrUpdateParameter.withDefaultMessageTimeToLive(defaultMessageTimeToLive); + return this; + } + + @Override + public TopicResourceImpl withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow) { + this.createOrUpdateParameter.withDuplicateDetectionHistoryTimeWindow(duplicateDetectionHistoryTimeWindow); + return this; + } + + @Override + public TopicResourceImpl withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.createOrUpdateParameter.withEnableBatchedOperations(enableBatchedOperations); + return this; + } + + @Override + public TopicResourceImpl withEnableExpress(Boolean enableExpress) { + this.createOrUpdateParameter.withEnableExpress(enableExpress); + return this; + } + + @Override + public TopicResourceImpl withEnablePartitioning(Boolean enablePartitioning) { + this.createOrUpdateParameter.withEnablePartitioning(enablePartitioning); + return this; + } + + @Override + public TopicResourceImpl withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.createOrUpdateParameter.withEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + @Override + public TopicResourceImpl withFilteringMessagesBeforePublishing(Boolean filteringMessagesBeforePublishing) { + this.createOrUpdateParameter.withFilteringMessagesBeforePublishing(filteringMessagesBeforePublishing); + return this; + } + + @Override + public TopicResourceImpl withIsAnonymousAccessible(Boolean isAnonymousAccessible) { + this.createOrUpdateParameter.withIsAnonymousAccessible(isAnonymousAccessible); + return this; + } + + @Override + public TopicResourceImpl withIsExpress(Boolean isExpress) { + this.createOrUpdateParameter.withIsExpress(isExpress); + return this; + } + + @Override + public TopicResourceImpl withMaxSizeInMegabytes(Long maxSizeInMegabytes) { + this.createOrUpdateParameter.withMaxSizeInMegabytes(maxSizeInMegabytes); + return this; + } + + @Override + public TopicResourceImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + + @Override + public TopicResourceImpl withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.createOrUpdateParameter.withRequiresDuplicateDetection(requiresDuplicateDetection); + return this; + } + + @Override + public TopicResourceImpl withStatus(EntityStatus status) { + this.createOrUpdateParameter.withStatus(status); + return this; + } + + @Override + public TopicResourceImpl withSupportOrdering(Boolean supportOrdering) { + this.createOrUpdateParameter.withSupportOrdering(supportOrdering); + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicResourceInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicResourceInner.java new file mode 100644 index 000000000000..3f6f80716d2d --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicResourceInner.java @@ -0,0 +1,517 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityAvailabilityStatus; +import com.microsoft.azure.management.servicebus.v2015_08_01.MessageCountDetails; +import com.microsoft.azure.management.servicebus.v2015_08_01.EntityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of topic resource. + */ +@JsonFlatten +public class TopicResourceInner extends ProxyResource { + /** + * Last time the message was sent, or a request was received, for this + * topic. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * TimeSpan idle interval after which the topic is automatically deleted. + * The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private String autoDeleteOnIdle; + + /** + * Entity availability status for the topic. Possible values include: + * 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + */ + @JsonProperty(value = "properties.entityAvailabilityStatus") + private EntityAvailabilityStatus entityAvailabilityStatus; + + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The countDetails property. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * Default message time to live value. This is the duration after which the + * message expires, starting from when the message is sent to Service Bus. + * This is the default value used when TimeToLive is not set on a message + * itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private String defaultMessageTimeToLive; + + /** + * TimeSpan structure that defines the duration of the duplicate detection + * history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private String duplicateDetectionHistoryTimeWindow; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * Value that indicates whether Express Entities are enabled. An express + * topic holds a message in memory temporarily before writing it to + * persistent storage. + */ + @JsonProperty(value = "properties.enableExpress") + private Boolean enableExpress; + + /** + * Value that indicates whether the topic to be partitioned across multiple + * message brokers is enabled. + */ + @JsonProperty(value = "properties.enablePartitioning") + private Boolean enablePartitioning; + + /** + * Whether messages should be filtered before publishing. + */ + @JsonProperty(value = "properties.filteringMessagesBeforePublishing") + private Boolean filteringMessagesBeforePublishing; + + /** + * Value that indicates whether the message is accessible anonymously. + */ + @JsonProperty(value = "properties.isAnonymousAccessible") + private Boolean isAnonymousAccessible; + + /** + * The isExpress property. + */ + @JsonProperty(value = "properties.isExpress") + private Boolean isExpress; + + /** + * Maximum size of the topic in megabytes, which is the size of the memory + * allocated for the topic. + */ + @JsonProperty(value = "properties.maxSizeInMegabytes") + private Long maxSizeInMegabytes; + + /** + * Value indicating if this topic requires duplicate detection. + */ + @JsonProperty(value = "properties.requiresDuplicateDetection") + private Boolean requiresDuplicateDetection; + + /** + * Size of the topic, in bytes. + */ + @JsonProperty(value = "properties.sizeInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long sizeInBytes; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', + * 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Number of subscriptions. + */ + @JsonProperty(value = "properties.subscriptionCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer subscriptionCount; + + /** + * Value that indicates whether the topic supports ordering. + */ + @JsonProperty(value = "properties.supportOrdering") + private Boolean supportOrdering; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get last time the message was sent, or a request was received, for this topic. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public String autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withAutoDeleteOnIdle(String autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @return the entityAvailabilityStatus value + */ + public EntityAvailabilityStatus entityAvailabilityStatus() { + return this.entityAvailabilityStatus; + } + + /** + * Set entity availability status for the topic. Possible values include: 'Available', 'Limited', 'Renaming', 'Restoring', 'Unknown'. + * + * @param entityAvailabilityStatus the entityAvailabilityStatus value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + this.entityAvailabilityStatus = entityAvailabilityStatus; + return this; + } + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the countDetails value. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public String defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set default message time to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withDefaultMessageTimeToLive(String defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public String duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withDuplicateDetectionHistoryTimeWindow(String duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + * + * @return the enableExpress value + */ + public Boolean enableExpress() { + return this.enableExpress; + } + + /** + * Set value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + * + * @param enableExpress the enableExpress value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withEnableExpress(Boolean enableExpress) { + this.enableExpress = enableExpress; + return this; + } + + /** + * Get value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + * + * @return the enablePartitioning value + */ + public Boolean enablePartitioning() { + return this.enablePartitioning; + } + + /** + * Set value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + * + * @param enablePartitioning the enablePartitioning value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withEnablePartitioning(Boolean enablePartitioning) { + this.enablePartitioning = enablePartitioning; + return this; + } + + /** + * Get whether messages should be filtered before publishing. + * + * @return the filteringMessagesBeforePublishing value + */ + public Boolean filteringMessagesBeforePublishing() { + return this.filteringMessagesBeforePublishing; + } + + /** + * Set whether messages should be filtered before publishing. + * + * @param filteringMessagesBeforePublishing the filteringMessagesBeforePublishing value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withFilteringMessagesBeforePublishing(Boolean filteringMessagesBeforePublishing) { + this.filteringMessagesBeforePublishing = filteringMessagesBeforePublishing; + return this; + } + + /** + * Get value that indicates whether the message is accessible anonymously. + * + * @return the isAnonymousAccessible value + */ + public Boolean isAnonymousAccessible() { + return this.isAnonymousAccessible; + } + + /** + * Set value that indicates whether the message is accessible anonymously. + * + * @param isAnonymousAccessible the isAnonymousAccessible value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withIsAnonymousAccessible(Boolean isAnonymousAccessible) { + this.isAnonymousAccessible = isAnonymousAccessible; + return this; + } + + /** + * Get the isExpress value. + * + * @return the isExpress value + */ + public Boolean isExpress() { + return this.isExpress; + } + + /** + * Set the isExpress value. + * + * @param isExpress the isExpress value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withIsExpress(Boolean isExpress) { + this.isExpress = isExpress; + return this; + } + + /** + * Get maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. + * + * @return the maxSizeInMegabytes value + */ + public Long maxSizeInMegabytes() { + return this.maxSizeInMegabytes; + } + + /** + * Set maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. + * + * @param maxSizeInMegabytes the maxSizeInMegabytes value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withMaxSizeInMegabytes(Long maxSizeInMegabytes) { + this.maxSizeInMegabytes = maxSizeInMegabytes; + return this; + } + + /** + * Get value indicating if this topic requires duplicate detection. + * + * @return the requiresDuplicateDetection value + */ + public Boolean requiresDuplicateDetection() { + return this.requiresDuplicateDetection; + } + + /** + * Set value indicating if this topic requires duplicate detection. + * + * @param requiresDuplicateDetection the requiresDuplicateDetection value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.requiresDuplicateDetection = requiresDuplicateDetection; + return this; + } + + /** + * Get size of the topic, in bytes. + * + * @return the sizeInBytes value + */ + public Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Creating', 'Deleting', 'Disabled', 'ReceiveDisabled', 'Renaming', 'Restoring', 'SendDisabled', 'Unknown'. + * + * @param status the status value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get number of subscriptions. + * + * @return the subscriptionCount value + */ + public Integer subscriptionCount() { + return this.subscriptionCount; + } + + /** + * Get value that indicates whether the topic supports ordering. + * + * @return the supportOrdering value + */ + public Boolean supportOrdering() { + return this.supportOrdering; + } + + /** + * Set value that indicates whether the topic supports ordering. + * + * @param supportOrdering the supportOrdering value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withSupportOrdering(Boolean supportOrdering) { + this.supportOrdering = supportOrdering; + return this; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the TopicResourceInner object itself. + */ + public TopicResourceInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicsImpl.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicsImpl.java new file mode 100644 index 000000000000..395bf0675c6a --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicsImpl.java @@ -0,0 +1,178 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2015_08_01.Topics; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicNamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.NamespaceSharedAccessAuthorizationRuleResource; +import com.microsoft.azure.management.servicebus.v2015_08_01.ResourceListKeys; + +class TopicsImpl extends WrapperImpl implements Topics { + private final ServiceBusManager manager; + + TopicsImpl(ServiceBusManager manager) { + super(manager.inner().topics()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public TopicResourceImpl define(String name) { + return wrapModel(name); + } + + private TopicResourceImpl wrapModel(TopicResourceInner inner) { + return new TopicResourceImpl(inner, manager()); + } + + private TopicResourceImpl wrapModel(String name) { + return new TopicResourceImpl(name, this.manager()); + } + + @Override + public Observable listAllAsync(final String resourceGroupName, final String namespaceName) { + TopicsInner client = this.inner(); + return client.listAllAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TopicResource call(TopicResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName) { + TopicsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, topicName) + .map(new Func1() { + @Override + public TopicResource call(TopicResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName) { + TopicsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, topicName).toCompletable(); + } + + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResourceImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private TopicNamespaceSharedAccessAuthorizationRuleResourceImpl wrapAuthorizationRuleModel(String name) { + return new TopicNamespaceSharedAccessAuthorizationRuleResourceImpl(name, this.manager()); + } + + private TopicNamespaceSharedAccessAuthorizationRuleResourceImpl wrapTopicNamespaceSharedAccessAuthorizationRuleResourceModel(SharedAccessAuthorizationRuleResourceInner inner) { + return new TopicNamespaceSharedAccessAuthorizationRuleResourceImpl(inner, manager()); + } + + private Observable getSharedAccessAuthorizationRuleResourceInnerUsingTopicsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String topicName = IdParsingUtils.getValueFromIdByName(id, "topics"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + TopicsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) + .map(new Func1() { + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return wrapTopicNamespaceSharedAccessAuthorizationRuleResourceModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + TopicsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, topicName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TopicNamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return wrapTopicNamespaceSharedAccessAuthorizationRuleResourceModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.postAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceSharedAccessAuthorizationRuleResource call(SharedAccessAuthorizationRuleResourceInner inner) { + return new NamespaceSharedAccessAuthorizationRuleResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) + .map(new Func1() { + @Override + public ResourceListKeys call(ResourceListKeysInner inner) { + return new ResourceListKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) + .map(new Func1() { + @Override + public ResourceListKeys call(ResourceListKeysInner inner) { + return new ResourceListKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicsInner.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicsInner.java new file mode 100644 index 000000000000..5305ce032b94 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/TopicsInner.java @@ -0,0 +1,1596 @@ +/** + * 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.servicebus.v2015_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2015_08_01.Policykey; +import com.microsoft.azure.management.servicebus.v2015_08_01.RegenerateKeysParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import com.microsoft.azure.management.servicebus.v2015_08_01.TopicCreateOrUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Topics. + */ +public class TopicsInner { + /** The Retrofit service to perform REST calls. */ + private TopicsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of TopicsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TopicsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(TopicsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Topics to be + * used by Retrofit to perform actually REST calls. + */ + interface TopicsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Topics listAll" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") + Observable> listAll(@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.servicebus.v2015_08_01.Topics createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionId") String subscriptionId, @Body TopicCreateOrUpdateParameters 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.servicebus.v2015_08_01.Topics delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2015_08_01.Topics get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2015_08_01.Topics listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2015_08_01.Topics createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body SharedAccessAuthorizationRuleCreateOrUpdateParameters 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.servicebus.v2015_08_01.Topics postAuthorizationRule" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") + Observable> postAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Topics getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Topics deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Topics listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Topics regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeysParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2015_08_01.Topics listAllNext" }) + @GET + Observable> listAllNext(@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.servicebus.v2015_08_01.Topics listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TopicResourceInner> object if successful. + */ + public PagedList listAll(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listAllSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAllAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAllSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TopicResourceInner> object + */ + public Observable> listAllAsync(final String resourceGroupName, final String namespaceName) { + return listAllWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TopicResourceInner> object + */ + public Observable>> listAllWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listAllSinglePageAsync(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(listAllNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the topics in 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<TopicResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAllSinglePageAsync(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.listAll(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 = listAllDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAllDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TopicResourceInner object if successful. + */ + public TopicResourceInner createOrUpdate(String resourceGroupName, String namespaceName, String topicName, TopicCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, parameters).toBlocking().single().body(); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, TopicCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, parameters), serviceCallback); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TopicResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, TopicCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, parameters).map(new Func1, TopicResourceInner>() { + @Override + public TopicResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TopicResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, TopicCreateOrUpdateParameters 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String topicName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).toBlocking().single().body(); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String topicName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName), serviceCallback); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String topicName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TopicResourceInner object if successful. + */ + public TopicResourceInner get(String resourceGroupName, String namespaceName, String topicName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).toBlocking().single().body(); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String topicName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName), serviceCallback); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TopicResourceInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).map(new Func1, TopicResourceInner>() { + @Override + public TopicResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TopicResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String topicName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, topicName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, topicName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, topicName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, topicName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters The shared access authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner postAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> postAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.postAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = postAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse postAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedAccessAuthorizationRuleResourceInner object if successful. + */ + public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, SharedAccessAuthorizationRuleResourceInner>() { + @Override + public SharedAccessAuthorizationRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedAccessAuthorizationRuleResourceInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Policykey policykey = null; + RegenerateKeysParameters parameters = new RegenerateKeysParameters(); + parameters.withPolicykey(null); + return service.regenerateKeys(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceListKeysInner object if successful. + */ + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, Policykey policykey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, policykey).toBlocking().single().body(); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, Policykey policykey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, policykey), serviceCallback); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, Policykey policykey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, policykey).map(new Func1, ResourceListKeysInner>() { + @Override + public ResourceListKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceListKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, Policykey policykey) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + RegenerateKeysParameters parameters = new RegenerateKeysParameters(); + parameters.withPolicykey(policykey); + return service.regenerateKeys(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TopicResourceInner> object if successful. + */ + public PagedList listAllNext(final String nextPageLink) { + ServiceResponse> response = listAllNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAllNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAllNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAllNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TopicResourceInner> object + */ + public Observable> listAllNextAsync(final String nextPageLink) { + return listAllNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TopicResourceInner> object + */ + public Observable>> listAllNextWithServiceResponseAsync(final String nextPageLink) { + return listAllNextSinglePageAsync(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(listAllNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TopicResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAllNextSinglePageAsync(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.listAllNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAllNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAllNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets authorization rules for a topic. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets authorization rules for a topic. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets authorization rules for a topic. + * + * @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<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + * @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<SharedAccessAuthorizationRuleResourceInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SharedAccessAuthorizationRuleResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/package-info.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/package-info.java new file mode 100644 index 000000000000..5a42db447e36 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ServiceBusManagementClient. + * Azure Service Bus client. + */ +package com.microsoft.azure.management.servicebus.v2015_08_01.implementation; diff --git a/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/package-info.java b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/package-info.java new file mode 100644 index 000000000000..5bf17be5f3f9 --- /dev/null +++ b/servicebus/resource-manager/v2015_08_01/src/main/java/com/microsoft/azure/management/servicebus/v2015_08_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ServiceBusManagementClient. + * Azure Service Bus client. + */ +package com.microsoft.azure.management.servicebus.v2015_08_01; diff --git a/servicebus/resource-manager/v2017_04_01/pom.xml b/servicebus/resource-manager/v2017_04_01/pom.xml new file mode 100644 index 000000000000..1655f699ba4e --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.servicebus.v2017_04_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-servicebus + 1.0.0-beta + jar + Microsoft Azure SDK for ServiceBus Management + This package contains Microsoft ServiceBus Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AccessKeys.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AccessKeys.java new file mode 100644 index 000000000000..ecb1d8234a99 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AccessKeys.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.AccessKeysInner; + +/** + * Type representing AccessKeys. + */ +public interface AccessKeys extends HasInner, HasManager { + /** + * @return the aliasPrimaryConnectionString value. + */ + String aliasPrimaryConnectionString(); + + /** + * @return the aliasSecondaryConnectionString value. + */ + String aliasSecondaryConnectionString(); + + /** + * @return the keyName value. + */ + String keyName(); + + /** + * @return the primaryConnectionString value. + */ + String primaryConnectionString(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryConnectionString value. + */ + String secondaryConnectionString(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AccessRights.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AccessRights.java new file mode 100644 index 000000000000..c3254637ba8b --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AccessRights.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AccessRights. + */ +public enum AccessRights { + /** Enum value Manage. */ + MANAGE("Manage"), + + /** Enum value Send. */ + SEND("Send"), + + /** Enum value Listen. */ + LISTEN("Listen"); + + /** The actual serialized value for a AccessRights instance. */ + private String value; + + AccessRights(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessRights instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessRights object, or null if unable to parse. + */ + @JsonCreator + public static AccessRights fromString(String value) { + AccessRights[] items = AccessRights.values(); + for (AccessRights item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Action.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Action.java new file mode 100644 index 000000000000..6292fb2bc0f2 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Action.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.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the filter actions which are allowed for the transformation of a + * message that have been matched by a filter expression. + */ +public class Action { + /** + * SQL expression. e.g. MyProperty='ABC'. + */ + @JsonProperty(value = "sqlExpression") + private String sqlExpression; + + /** + * This property is reserved for future use. An integer value showing the + * compatibility level, currently hard-coded to 20. + */ + @JsonProperty(value = "compatibilityLevel") + private Integer compatibilityLevel; + + /** + * Value that indicates whether the rule action requires preprocessing. + */ + @JsonProperty(value = "requiresPreprocessing") + private Boolean requiresPreprocessing; + + /** + * Get sQL expression. e.g. MyProperty='ABC'. + * + * @return the sqlExpression value + */ + public String sqlExpression() { + return this.sqlExpression; + } + + /** + * Set sQL expression. e.g. MyProperty='ABC'. + * + * @param sqlExpression the sqlExpression value to set + * @return the Action object itself. + */ + public Action withSqlExpression(String sqlExpression) { + this.sqlExpression = sqlExpression; + return this; + } + + /** + * Get this property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + * + * @return the compatibilityLevel value + */ + public Integer compatibilityLevel() { + return this.compatibilityLevel; + } + + /** + * Set this property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + * + * @param compatibilityLevel the compatibilityLevel value to set + * @return the Action object itself. + */ + public Action withCompatibilityLevel(Integer compatibilityLevel) { + this.compatibilityLevel = compatibilityLevel; + return this; + } + + /** + * Get value that indicates whether the rule action requires preprocessing. + * + * @return the requiresPreprocessing value + */ + public Boolean requiresPreprocessing() { + return this.requiresPreprocessing; + } + + /** + * Set value that indicates whether the rule action requires preprocessing. + * + * @param requiresPreprocessing the requiresPreprocessing value to set + * @return the Action object itself. + */ + public Action withRequiresPreprocessing(Boolean requiresPreprocessing) { + this.requiresPreprocessing = requiresPreprocessing; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ArmDisasterRecovery.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ArmDisasterRecovery.java new file mode 100644 index 000000000000..89ed69c00a18 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ArmDisasterRecovery.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ArmDisasterRecoveryInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; + +/** + * Type representing ArmDisasterRecovery. + */ +public interface ArmDisasterRecovery extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the alternateName value. + */ + String alternateName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerNamespace value. + */ + String partnerNamespace(); + + /** + * @return the pendingReplicationOperationsCount value. + */ + Long pendingReplicationOperationsCount(); + + /** + * @return the provisioningState value. + */ + ProvisioningStateDR provisioningState(); + + /** + * @return the role value. + */ + RoleDisasterRecovery role(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ArmDisasterRecovery definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of ArmDisasterRecovery definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ArmDisasterRecovery definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the armdisasterrecovery definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the armdisasterrecovery definition allowing to specify AlternateName. + */ + interface WithAlternateName { + /** + * Specifies alternateName. + * @param alternateName Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + * @return the next definition stage + */ + WithCreate withAlternateName(String alternateName); + } + + /** + * The stage of the armdisasterrecovery definition allowing to specify PartnerNamespace. + */ + interface WithPartnerNamespace { + /** + * Specifies partnerNamespace. + * @param partnerNamespace ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + * @return the next definition stage + */ + WithCreate withPartnerNamespace(String partnerNamespace); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAlternateName, DefinitionStages.WithPartnerNamespace { + } + } + /** + * The template for a ArmDisasterRecovery update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAlternateName, UpdateStages.WithPartnerNamespace { + } + + /** + * Grouping of ArmDisasterRecovery update stages. + */ + interface UpdateStages { + /** + * The stage of the armdisasterrecovery update allowing to specify AlternateName. + */ + interface WithAlternateName { + /** + * Specifies alternateName. + * @param alternateName Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + * @return the next update stage + */ + Update withAlternateName(String alternateName); + } + + /** + * The stage of the armdisasterrecovery update allowing to specify PartnerNamespace. + */ + interface WithPartnerNamespace { + /** + * Specifies partnerNamespace. + * @param partnerNamespace ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing + * @return the next update stage + */ + Update withPartnerNamespace(String partnerNamespace); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AuthorizationRuleProperties.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AuthorizationRuleProperties.java new file mode 100644 index 000000000000..ca408ffa9b9d --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/AuthorizationRuleProperties.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * AuthorizationRule properties. + */ +public class AuthorizationRuleProperties { + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "rights", required = true) + private List rights; + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the AuthorizationRuleProperties object itself. + */ + public AuthorizationRuleProperties withRights(List rights) { + this.rights = rights; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CaptureDescription.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CaptureDescription.java new file mode 100644 index 000000000000..a27f84df3f54 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CaptureDescription.java @@ -0,0 +1,152 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to configure capture description for eventhub. + */ +public class CaptureDescription { + /** + * A value that indicates whether capture description is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Enumerates the possible values for the encoding format of capture + * description. Possible values include: 'Avro', 'AvroDeflate'. + */ + @JsonProperty(value = "encoding") + private EncodingCaptureDescription encoding; + + /** + * The time window allows you to set the frequency with which the capture + * to Azure Blobs will happen, value should between 60 to 900 seconds. + */ + @JsonProperty(value = "intervalInSeconds") + private Integer intervalInSeconds; + + /** + * The size window defines the amount of data built up in your Event Hub + * before an capture operation, value should be between 10485760 and + * 524288000 bytes. + */ + @JsonProperty(value = "sizeLimitInBytes") + private Integer sizeLimitInBytes; + + /** + * Properties of Destination where capture will be stored. (Storage + * Account, Blob Names). + */ + @JsonProperty(value = "destination") + private Destination destination; + + /** + * Get a value that indicates whether capture description is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set a value that indicates whether capture description is enabled. + * + * @param enabled the enabled value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get enumerates the possible values for the encoding format of capture description. Possible values include: 'Avro', 'AvroDeflate'. + * + * @return the encoding value + */ + public EncodingCaptureDescription encoding() { + return this.encoding; + } + + /** + * Set enumerates the possible values for the encoding format of capture description. Possible values include: 'Avro', 'AvroDeflate'. + * + * @param encoding the encoding value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withEncoding(EncodingCaptureDescription encoding) { + this.encoding = encoding; + return this; + } + + /** + * Get the time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. + * + * @return the intervalInSeconds value + */ + public Integer intervalInSeconds() { + return this.intervalInSeconds; + } + + /** + * Set the time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. + * + * @param intervalInSeconds the intervalInSeconds value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withIntervalInSeconds(Integer intervalInSeconds) { + this.intervalInSeconds = intervalInSeconds; + return this; + } + + /** + * Get the size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 and 524288000 bytes. + * + * @return the sizeLimitInBytes value + */ + public Integer sizeLimitInBytes() { + return this.sizeLimitInBytes; + } + + /** + * Set the size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 and 524288000 bytes. + * + * @param sizeLimitInBytes the sizeLimitInBytes value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withSizeLimitInBytes(Integer sizeLimitInBytes) { + this.sizeLimitInBytes = sizeLimitInBytes; + return this; + } + + /** + * Get properties of Destination where capture will be stored. (Storage Account, Blob Names). + * + * @return the destination value + */ + public Destination destination() { + return this.destination; + } + + /** + * Set properties of Destination where capture will be stored. (Storage Account, Blob Names). + * + * @param destination the destination value to set + * @return the CaptureDescription object itself. + */ + public CaptureDescription withDestination(Destination destination) { + this.destination = destination; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CheckNameAvailability.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CheckNameAvailability.java new file mode 100644 index 000000000000..cecad7bc7f9b --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CheckNameAvailability.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of a Check Name availability request properties. + */ +public class CheckNameAvailability { + /** + * The Name to check the namespace name availability and The namespace name + * can contain only letters, numbers, and hyphens. The namespace must start + * with a letter, and it must end with a letter or number. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * + * @param name the name value to set + * @return the CheckNameAvailability object itself. + */ + public CheckNameAvailability withName(String name) { + this.name = name; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CheckNameAvailabilityResult.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..b26fa2fc5567 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CheckNameAvailabilityResult.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.CheckNameAvailabilityResultInner; + +/** + * Type representing CheckNameAvailabilityResult. + */ +public interface CheckNameAvailabilityResult extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + UnavailableReason reason(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CorrelationFilter.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CorrelationFilter.java new file mode 100644 index 000000000000..6cd6765cef08 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/CorrelationFilter.java @@ -0,0 +1,278 @@ +/** + * 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.servicebus.v2017_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the correlation filter expression. + */ +public class CorrelationFilter { + /** + * dictionary object for custom filters. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Identifier of the correlation. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /** + * Identifier of the message. + */ + @JsonProperty(value = "messageId") + private String messageId; + + /** + * Address to send to. + */ + @JsonProperty(value = "to") + private String to; + + /** + * Address of the queue to reply to. + */ + @JsonProperty(value = "replyTo") + private String replyTo; + + /** + * Application specific label. + */ + @JsonProperty(value = "label") + private String label; + + /** + * Session identifier. + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /** + * Session identifier to reply to. + */ + @JsonProperty(value = "replyToSessionId") + private String replyToSessionId; + + /** + * Content type of the message. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /** + * Value that indicates whether the rule action requires preprocessing. + */ + @JsonProperty(value = "requiresPreprocessing") + private Boolean requiresPreprocessing; + + /** + * Get dictionary object for custom filters. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set dictionary object for custom filters. + * + * @param properties the properties value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get identifier of the correlation. + * + * @return the correlationId value + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Set identifier of the correlation. + * + * @param correlationId the correlationId value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get identifier of the message. + * + * @return the messageId value + */ + public String messageId() { + return this.messageId; + } + + /** + * Set identifier of the message. + * + * @param messageId the messageId value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withMessageId(String messageId) { + this.messageId = messageId; + return this; + } + + /** + * Get address to send to. + * + * @return the to value + */ + public String to() { + return this.to; + } + + /** + * Set address to send to. + * + * @param to the to value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withTo(String to) { + this.to = to; + return this; + } + + /** + * Get address of the queue to reply to. + * + * @return the replyTo value + */ + public String replyTo() { + return this.replyTo; + } + + /** + * Set address of the queue to reply to. + * + * @param replyTo the replyTo value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withReplyTo(String replyTo) { + this.replyTo = replyTo; + return this; + } + + /** + * Get application specific label. + * + * @return the label value + */ + public String label() { + return this.label; + } + + /** + * Set application specific label. + * + * @param label the label value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get session identifier. + * + * @return the sessionId value + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set session identifier. + * + * @param sessionId the sessionId value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get session identifier to reply to. + * + * @return the replyToSessionId value + */ + public String replyToSessionId() { + return this.replyToSessionId; + } + + /** + * Set session identifier to reply to. + * + * @param replyToSessionId the replyToSessionId value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withReplyToSessionId(String replyToSessionId) { + this.replyToSessionId = replyToSessionId; + return this; + } + + /** + * Get content type of the message. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set content type of the message. + * + * @param contentType the contentType value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get value that indicates whether the rule action requires preprocessing. + * + * @return the requiresPreprocessing value + */ + public Boolean requiresPreprocessing() { + return this.requiresPreprocessing; + } + + /** + * Set value that indicates whether the rule action requires preprocessing. + * + * @param requiresPreprocessing the requiresPreprocessing value to set + * @return the CorrelationFilter object itself. + */ + public CorrelationFilter withRequiresPreprocessing(Boolean requiresPreprocessing) { + this.requiresPreprocessing = requiresPreprocessing; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DefaultAction.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DefaultAction.java new file mode 100644 index 000000000000..e80301474010 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DefaultAction.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.servicebus.v2017_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DefaultAction. + */ +public final class DefaultAction extends ExpandableStringEnum { + /** Static value Allow for DefaultAction. */ + public static final DefaultAction ALLOW = fromString("Allow"); + + /** Static value Deny for DefaultAction. */ + public static final DefaultAction DENY = fromString("Deny"); + + /** + * Creates or finds a DefaultAction from its string representation. + * @param name a name to look for + * @return the corresponding DefaultAction + */ + @JsonCreator + public static DefaultAction fromString(String name) { + return fromString(name, DefaultAction.class); + } + + /** + * @return known DefaultAction values + */ + public static Collection values() { + return values(DefaultAction.class); + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Destination.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Destination.java new file mode 100644 index 000000000000..70410dddc349 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Destination.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Capture storage details for capture description. + */ +@JsonFlatten +public class Destination { + /** + * Name for capture destination. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Resource id of the storage account to be used to create the blobs. + */ + @JsonProperty(value = "properties.storageAccountResourceId") + private String storageAccountResourceId; + + /** + * Blob container Name. + */ + @JsonProperty(value = "properties.blobContainer") + private String blobContainer; + + /** + * Blob naming convention for archive, e.g. + * {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. + * Here all the parameters (Namespace,EventHub .. etc) are mandatory + * irrespective of order. + */ + @JsonProperty(value = "properties.archiveNameFormat") + private String archiveNameFormat; + + /** + * Get name for capture destination. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name for capture destination. + * + * @param name the name value to set + * @return the Destination object itself. + */ + public Destination withName(String name) { + this.name = name; + return this; + } + + /** + * Get resource id of the storage account to be used to create the blobs. + * + * @return the storageAccountResourceId value + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set resource id of the storage account to be used to create the blobs. + * + * @param storageAccountResourceId the storageAccountResourceId value to set + * @return the Destination object itself. + */ + public Destination withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get blob container Name. + * + * @return the blobContainer value + */ + public String blobContainer() { + return this.blobContainer; + } + + /** + * Set blob container Name. + * + * @param blobContainer the blobContainer value to set + * @return the Destination object itself. + */ + public Destination withBlobContainer(String blobContainer) { + this.blobContainer = blobContainer; + return this; + } + + /** + * Get blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + * + * @return the archiveNameFormat value + */ + public String archiveNameFormat() { + return this.archiveNameFormat; + } + + /** + * Set blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + * + * @param archiveNameFormat the archiveNameFormat value to set + * @return the Destination object itself. + */ + public Destination withArchiveNameFormat(String archiveNameFormat) { + this.archiveNameFormat = archiveNameFormat; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DisasterRecoveryConfigNamespaceSBAuthorizationRule.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DisasterRecoveryConfigNamespaceSBAuthorizationRule.java new file mode 100644 index 000000000000..fdc64ed5e8cc --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DisasterRecoveryConfigNamespaceSBAuthorizationRule.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBAuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing DisasterRecoveryConfigNamespaceSBAuthorizationRule. + */ +public interface DisasterRecoveryConfigNamespaceSBAuthorizationRule extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DisasterRecoveryConfigs.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DisasterRecoveryConfigs.java new file mode 100644 index 000000000000..cb198b540759 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/DisasterRecoveryConfigs.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.DisasterRecoveryConfigsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigNamespaceSBAuthorizationRule; + +/** + * Type representing DisasterRecoveryConfigs. + */ +public interface DisasterRecoveryConfigs extends SupportsCreating, HasInner { + /** + * Check the give namespace name availability. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityMethodAsync(String resourceGroupName, String namespaceName, String name); + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable breakPairingAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failOverAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String alias); + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName); + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias); + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EncodingCaptureDescription.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EncodingCaptureDescription.java new file mode 100644 index 000000000000..68877f674331 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EncodingCaptureDescription.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EncodingCaptureDescription. + */ +public enum EncodingCaptureDescription { + /** Enum value Avro. */ + AVRO("Avro"), + + /** Enum value AvroDeflate. */ + AVRO_DEFLATE("AvroDeflate"); + + /** The actual serialized value for a EncodingCaptureDescription instance. */ + private String value; + + EncodingCaptureDescription(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EncodingCaptureDescription instance. + * + * @param value the serialized value to parse. + * @return the parsed EncodingCaptureDescription object, or null if unable to parse. + */ + @JsonCreator + public static EncodingCaptureDescription fromString(String value) { + EncodingCaptureDescription[] items = EncodingCaptureDescription.values(); + for (EncodingCaptureDescription item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EntityStatus.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EntityStatus.java new file mode 100644 index 000000000000..c822c5ce92ad --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EntityStatus.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EntityStatus. + */ +public enum EntityStatus { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Restoring. */ + RESTORING("Restoring"), + + /** Enum value SendDisabled. */ + SEND_DISABLED("SendDisabled"), + + /** Enum value ReceiveDisabled. */ + RECEIVE_DISABLED("ReceiveDisabled"), + + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Renaming. */ + RENAMING("Renaming"), + + /** Enum value Unknown. */ + UNKNOWN("Unknown"); + + /** The actual serialized value for a EntityStatus instance. */ + private String value; + + EntityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EntityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed EntityStatus object, or null if unable to parse. + */ + @JsonCreator + public static EntityStatus fromString(String value) { + EntityStatus[] items = EntityStatus.values(); + for (EntityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ErrorResponse.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ErrorResponse.java new file mode 100644 index 000000000000..f276989db507 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ErrorResponse.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates ServiceBus service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ErrorResponseException.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ErrorResponseException.java new file mode 100644 index 000000000000..e4109630222e --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EventHubs.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EventHubs.java new file mode 100644 index 000000000000..5c8df9bf584c --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/EventHubs.java @@ -0,0 +1,29 @@ +/** + * 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.servicebus.v2017_04_01; + +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.EventHubsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EventHubs. + */ +public interface EventHubs extends HasInner { + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Eventhub.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Eventhub.java new file mode 100644 index 000000000000..68bce9717a94 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Eventhub.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.EventhubInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing Eventhub. + */ +public interface Eventhub extends HasInner, HasManager { + /** + * @return the captureDescription value. + */ + CaptureDescription captureDescription(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the messageRetentionInDays value. + */ + Long messageRetentionInDays(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partitionCount value. + */ + Long partitionCount(); + + /** + * @return the partitionIds value. + */ + List partitionIds(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/FilterType.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/FilterType.java new file mode 100644 index 000000000000..5230e5c9df72 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/FilterType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for FilterType. + */ +public enum FilterType { + /** Enum value SqlFilter. */ + SQL_FILTER("SqlFilter"), + + /** Enum value CorrelationFilter. */ + CORRELATION_FILTER("CorrelationFilter"); + + /** The actual serialized value for a FilterType instance. */ + private String value; + + FilterType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a FilterType instance. + * + * @param value the serialized value to parse. + * @return the parsed FilterType object, or null if unable to parse. + */ + @JsonCreator + public static FilterType fromString(String value) { + FilterType[] items = FilterType.values(); + for (FilterType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/KeyType.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/KeyType.java new file mode 100644 index 000000000000..de91735bff55 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/KeyType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyType. + */ +public enum KeyType { + /** Enum value PrimaryKey. */ + PRIMARY_KEY("PrimaryKey"), + + /** Enum value SecondaryKey. */ + SECONDARY_KEY("SecondaryKey"); + + /** The actual serialized value for a KeyType instance. */ + private String value; + + KeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyType object, or null if unable to parse. + */ + @JsonCreator + public static KeyType fromString(String value) { + KeyType[] items = KeyType.values(); + for (KeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MessageCountDetails.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MessageCountDetails.java new file mode 100644 index 000000000000..c032801b7673 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MessageCountDetails.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Message Count Details. + */ +public class MessageCountDetails { + /** + * Number of active messages in the queue, topic, or subscription. + */ + @JsonProperty(value = "activeMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long activeMessageCount; + + /** + * Number of messages that are dead lettered. + */ + @JsonProperty(value = "deadLetterMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long deadLetterMessageCount; + + /** + * Number of scheduled messages. + */ + @JsonProperty(value = "scheduledMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long scheduledMessageCount; + + /** + * Number of messages transferred to another queue, topic, or subscription. + */ + @JsonProperty(value = "transferMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long transferMessageCount; + + /** + * Number of messages transferred into dead letters. + */ + @JsonProperty(value = "transferDeadLetterMessageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long transferDeadLetterMessageCount; + + /** + * Get number of active messages in the queue, topic, or subscription. + * + * @return the activeMessageCount value + */ + public Long activeMessageCount() { + return this.activeMessageCount; + } + + /** + * Get number of messages that are dead lettered. + * + * @return the deadLetterMessageCount value + */ + public Long deadLetterMessageCount() { + return this.deadLetterMessageCount; + } + + /** + * Get number of scheduled messages. + * + * @return the scheduledMessageCount value + */ + public Long scheduledMessageCount() { + return this.scheduledMessageCount; + } + + /** + * Get number of messages transferred to another queue, topic, or subscription. + * + * @return the transferMessageCount value + */ + public Long transferMessageCount() { + return this.transferMessageCount; + } + + /** + * Get number of messages transferred into dead letters. + * + * @return the transferDeadLetterMessageCount value + */ + public Long transferDeadLetterMessageCount() { + return this.transferDeadLetterMessageCount; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MigrationConfigProperties.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MigrationConfigProperties.java new file mode 100644 index 000000000000..af5f6fb95cd9 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MigrationConfigProperties.java @@ -0,0 +1,137 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.MigrationConfigPropertiesInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; + +/** + * Type representing MigrationConfigProperties. + */ +public interface MigrationConfigProperties extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the migrationState value. + */ + String migrationState(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pendingReplicationOperationsCount value. + */ + Long pendingReplicationOperationsCount(); + + /** + * @return the postMigrationName value. + */ + String postMigrationName(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the targetNamespace value. + */ + String targetNamespace(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the MigrationConfigProperties definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithPostMigrationName, DefinitionStages.WithTargetNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of MigrationConfigProperties definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a MigrationConfigProperties definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the migrationconfigproperties definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithPostMigrationName withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the migrationconfigproperties definition allowing to specify PostMigrationName. + */ + interface WithPostMigrationName { + /** + * Specifies postMigrationName. + * @param postMigrationName Name to access Standard Namespace after migration + * @return the next definition stage + */ + WithTargetNamespace withPostMigrationName(String postMigrationName); + } + + /** + * The stage of the migrationconfigproperties definition allowing to specify TargetNamespace. + */ + interface WithTargetNamespace { + /** + * Specifies targetNamespace. + * @param targetNamespace Existing premium Namespace ARM Id name which has no entities, will be used for migration + * @return the next definition stage + */ + WithCreate withTargetNamespace(String targetNamespace); + } + + /** + * 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 MigrationConfigProperties update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of MigrationConfigProperties update stages. + */ + interface UpdateStages { + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MigrationConfigs.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MigrationConfigs.java new file mode 100644 index 000000000000..ff0c6a68df79 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/MigrationConfigs.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.MigrationConfigsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MigrationConfigs. + */ +public interface MigrationConfigs extends SupportsCreating, HasInner { + /** + * This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. + * + * @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 + */ + Completable completeMigrationAsync(String resourceGroupName, String namespaceName); + + /** + * This operation reverts Migration. + * + * @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 + */ + Completable revertAsync(String resourceGroupName, String namespaceName); + + /** + * Retrieves Migration Config. + * + * @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 getAsync(String resourceGroupName, String namespaceName); + + /** + * Gets all migrationConfigurations. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a MigrationConfiguration. + * + * @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 + */ + Completable deleteAsync(String resourceGroupName, String namespaceName); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NWRuleSetIpRules.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NWRuleSetIpRules.java new file mode 100644 index 000000000000..a7183969ed73 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NWRuleSetIpRules.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of NetWorkRuleSet - IpRules resource. + */ +public class NWRuleSetIpRules { + /** + * IP Mask. + */ + @JsonProperty(value = "ipMask") + private String ipMask; + + /** + * The IP Filter Action. Possible values include: 'Allow'. + */ + @JsonProperty(value = "action") + private NetworkRuleIPAction action; + + /** + * 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 NWRuleSetIpRules object itself. + */ + public NWRuleSetIpRules withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Get the IP Filter Action. Possible values include: 'Allow'. + * + * @return the action value + */ + public NetworkRuleIPAction action() { + return this.action; + } + + /** + * Set the IP Filter Action. Possible values include: 'Allow'. + * + * @param action the action value to set + * @return the NWRuleSetIpRules object itself. + */ + public NWRuleSetIpRules withAction(NetworkRuleIPAction action) { + this.action = action; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NWRuleSetVirtualNetworkRules.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NWRuleSetVirtualNetworkRules.java new file mode 100644 index 000000000000..55b04ebd17e7 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NWRuleSetVirtualNetworkRules.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of VirtualNetworkRules - NetworkRules resource. + */ +public class NWRuleSetVirtualNetworkRules { + /** + * Subnet properties. + */ + @JsonProperty(value = "subnet") + private Subnet subnet; + + /** + * Value that indicates whether to ignore missing VNet Service Endpoint. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Get subnet properties. + * + * @return the subnet value + */ + public Subnet subnet() { + return this.subnet; + } + + /** + * Set subnet properties. + * + * @param subnet the subnet value to set + * @return the NWRuleSetVirtualNetworkRules object itself. + */ + public NWRuleSetVirtualNetworkRules withSubnet(Subnet subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get value that indicates whether to ignore missing VNet Service Endpoint. + * + * @return the ignoreMissingVnetServiceEndpoint value + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set value that indicates whether to ignore missing VNet Service Endpoint. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set + * @return the NWRuleSetVirtualNetworkRules object itself. + */ + public NWRuleSetVirtualNetworkRules withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NameSpaceType.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NameSpaceType.java new file mode 100644 index 000000000000..c04082299a89 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NameSpaceType.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for NameSpaceType. + */ +public enum NameSpaceType { + /** Enum value Messaging. */ + MESSAGING("Messaging"), + + /** Enum value NotificationHub. */ + NOTIFICATION_HUB("NotificationHub"), + + /** Enum value Mixed. */ + MIXED("Mixed"), + + /** Enum value EventHub. */ + EVENT_HUB("EventHub"), + + /** Enum value Relay. */ + RELAY("Relay"); + + /** The actual serialized value for a NameSpaceType instance. */ + private String value; + + NameSpaceType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NameSpaceType instance. + * + * @param value the serialized value to parse. + * @return the parsed NameSpaceType object, or null if unable to parse. + */ + @JsonCreator + public static NameSpaceType fromString(String value) { + NameSpaceType[] items = NameSpaceType.values(); + for (NameSpaceType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NamespaceSBAuthorizationRule.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NamespaceSBAuthorizationRule.java new file mode 100644 index 000000000000..ef7044dae471 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NamespaceSBAuthorizationRule.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBAuthorizationRuleInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing NamespaceSBAuthorizationRule. + */ +public interface NamespaceSBAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the NamespaceSBAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of NamespaceSBAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NamespaceSBAuthorizationRule definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the namespacesbauthorizationrule definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithRights withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the namespacesbauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a NamespaceSBAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of NamespaceSBAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the namespacesbauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java new file mode 100644 index 000000000000..53a1692d1da7 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +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 rx.Completable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NamespacesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.NamespaceSBAuthorizationRule; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NetworkRuleSetInner; + +/** + * Type representing Namespaces. + */ +public interface Namespaces extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + NamespaceSBAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * This operation Migrate the given namespace to provided name type. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param targetNamespaceType Type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable migrateAsync(String resourceGroupName, String namespaceName, NameSpaceType targetNamespaceType); + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityMethodAsync(String name); + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters); + + /** + * Gets NetworkRuleSet 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 getNetworkRuleSetAsync(String resourceGroupName, String namespaceName); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleIPAction.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleIPAction.java new file mode 100644 index 000000000000..80ffa837dcdb --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleIPAction.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleIPAction. + */ +public final class NetworkRuleIPAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleIPAction. */ + public static final NetworkRuleIPAction ALLOW = fromString("Allow"); + + /** + * Creates or finds a NetworkRuleIPAction from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleIPAction + */ + @JsonCreator + public static NetworkRuleIPAction fromString(String name) { + return fromString(name, NetworkRuleIPAction.class); + } + + /** + * @return known NetworkRuleIPAction values + */ + public static Collection values() { + return values(NetworkRuleIPAction.class); + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java new file mode 100644 index 000000000000..e38c0cc505ff --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NetworkRuleSetInner; +import java.util.List; + +/** + * Type representing NetworkRuleSet. + */ +public interface NetworkRuleSet extends HasInner, HasManager { + /** + * @return the defaultAction value. + */ + DefaultAction defaultAction(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the ipRules value. + */ + List ipRules(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkRules value. + */ + List virtualNetworkRules(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Operation.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Operation.java new file mode 100644 index 000000000000..4bcb3b49ed26 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/OperationDisplay.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/OperationDisplay.java new file mode 100644 index 000000000000..0c2586446d76 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.ServiceBus. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: Invoice, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.ServiceBus. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: Invoice, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Operations.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Operations.java new file mode 100644 index 000000000000..f5bde12cd68b --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegion.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegion.java new file mode 100644 index 000000000000..bf2691ece2a1 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegion.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +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.resources.models.HasManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.PremiumMessagingRegionInner; + +/** + * Type representing PremiumMessagingRegion. + */ +public interface PremiumMessagingRegion extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, HasManager { + /** + * @return the properties value. + */ + PremiumMessagingRegionProperties properties(); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegionProperties.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegionProperties.java new file mode 100644 index 000000000000..30e65b36938a --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegionProperties.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The PremiumMessagingRegionProperties model. + */ +public class PremiumMessagingRegionProperties { + /** + * Region code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Full name of the region. + */ + @JsonProperty(value = "fullName", access = JsonProperty.Access.WRITE_ONLY) + private String fullName; + + /** + * Get region code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get full name of the region. + * + * @return the fullName value + */ + public String fullName() { + return this.fullName; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegions.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegions.java new file mode 100644 index 000000000000..06ab156a2393 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/PremiumMessagingRegions.java @@ -0,0 +1,19 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.PremiumMessagingRegionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PremiumMessagingRegions. + */ +public interface PremiumMessagingRegions extends SupportsListing, HasInner { +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ProvisioningStateDR.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ProvisioningStateDR.java new file mode 100644 index 000000000000..78fe1d823cc9 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ProvisioningStateDR.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningStateDR. + */ +public enum ProvisioningStateDR { + /** Enum value Accepted. */ + ACCEPTED("Accepted"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Failed. */ + FAILED("Failed"); + + /** The actual serialized value for a ProvisioningStateDR instance. */ + private String value; + + ProvisioningStateDR(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningStateDR instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningStateDR object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningStateDR fromString(String value) { + ProvisioningStateDR[] items = ProvisioningStateDR.values(); + for (ProvisioningStateDR item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/QueueNamespaceSBAuthorizationRule.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/QueueNamespaceSBAuthorizationRule.java new file mode 100644 index 000000000000..cae7b8e78bb4 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/QueueNamespaceSBAuthorizationRule.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBAuthorizationRuleInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing QueueNamespaceSBAuthorizationRule. + */ +public interface QueueNamespaceSBAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the QueueNamespaceSBAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithQueue, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of QueueNamespaceSBAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a QueueNamespaceSBAuthorizationRule definition. + */ + interface Blank extends WithQueue { + } + + /** + * The stage of the queuenamespacesbauthorizationrule definition allowing to specify Queue. + */ + interface WithQueue { + /** + * Specifies resourceGroupName, namespaceName, queueName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param queueName The queue name + * @return the next definition stage + */ + WithRights withExistingQueue(String resourceGroupName, String namespaceName, String queueName); + } + + /** + * The stage of the queuenamespacesbauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a QueueNamespaceSBAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of QueueNamespaceSBAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the queuenamespacesbauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Queues.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Queues.java new file mode 100644 index 000000000000..76f29dca0fc5 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Queues.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.QueuesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.QueueNamespaceSBAuthorizationRule; + +/** + * Type representing Queues. + */ +public interface Queues extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + QueueNamespaceSBAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String queueName); + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String queueName); + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName); + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/RegenerateAccessKeyParameters.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/RegenerateAccessKeyParameters.java new file mode 100644 index 000000000000..adfaeffadead --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/RegenerateAccessKeyParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the Regenerate Authorization Rule operation, + * specifies which key needs to be reset. + */ +public class RegenerateAccessKeyParameters { + /** + * The access key to regenerate. Possible values include: 'PrimaryKey', + * 'SecondaryKey'. + */ + @JsonProperty(value = "keyType", required = true) + private KeyType keyType; + + /** + * Optional, if the key value provided, is reset for KeyType value or + * autogenerate Key value set for keyType. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get the access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey'. + * + * @return the keyType value + */ + public KeyType keyType() { + return this.keyType; + } + + /** + * Set the access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey'. + * + * @param keyType the keyType value to set + * @return the RegenerateAccessKeyParameters object itself. + */ + public RegenerateAccessKeyParameters withKeyType(KeyType keyType) { + this.keyType = keyType; + return this; + } + + /** + * Get optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. + * + * @param key the key value to set + * @return the RegenerateAccessKeyParameters object itself. + */ + public RegenerateAccessKeyParameters withKey(String key) { + this.key = key; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Regions.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Regions.java new file mode 100644 index 000000000000..09f11d04febd --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Regions.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.RegionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Regions. + */ +public interface Regions extends HasInner { + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySkuAsync(final String sku); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java new file mode 100644 index 000000000000..d1072bc13bd1 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The Resource definition. + */ +public class ResourceNamespacePatch extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the ResourceNamespacePatch object itself. + */ + public ResourceNamespacePatch withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ResourceNamespacePatch object itself. + */ + public ResourceNamespacePatch withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/RoleDisasterRecovery.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/RoleDisasterRecovery.java new file mode 100644 index 000000000000..d7fa6dc7e86b --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/RoleDisasterRecovery.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RoleDisasterRecovery. + */ +public enum RoleDisasterRecovery { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value PrimaryNotReplicating. */ + PRIMARY_NOT_REPLICATING("PrimaryNotReplicating"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"); + + /** The actual serialized value for a RoleDisasterRecovery instance. */ + private String value; + + RoleDisasterRecovery(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RoleDisasterRecovery instance. + * + * @param value the serialized value to parse. + * @return the parsed RoleDisasterRecovery object, or null if unable to parse. + */ + @JsonCreator + public static RoleDisasterRecovery fromString(String value) { + RoleDisasterRecovery[] items = RoleDisasterRecovery.values(); + for (RoleDisasterRecovery item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Rule.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Rule.java new file mode 100644 index 000000000000..679b221b2df9 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Rule.java @@ -0,0 +1,206 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.RuleInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; + +/** + * Type representing Rule. + */ +public interface Rule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the action value. + */ + Action action(); + + /** + * @return the correlationFilter value. + */ + CorrelationFilter correlationFilter(); + + /** + * @return the filterType value. + */ + FilterType filterType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the sqlFilter value. + */ + SqlFilter sqlFilter(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Rule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSubscription, DefinitionStages.WithCreate { + } + + /** + * Grouping of Rule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Rule definition. + */ + interface Blank extends WithSubscription { + } + + /** + * The stage of the rule definition allowing to specify Subscription. + */ + interface WithSubscription { + /** + * Specifies resourceGroupName, namespaceName, topicName, subscriptionName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param topicName The topic name + * @param subscriptionName The subscription name + * @return the next definition stage + */ + WithCreate withExistingSubscription(String resourceGroupName, String namespaceName, String topicName, String subscriptionName); + } + + /** + * The stage of the rule definition allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + * @param action Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression + * @return the next definition stage + */ + WithCreate withAction(Action action); + } + + /** + * The stage of the rule definition allowing to specify CorrelationFilter. + */ + interface WithCorrelationFilter { + /** + * Specifies correlationFilter. + * @param correlationFilter Properties of correlationFilter + * @return the next definition stage + */ + WithCreate withCorrelationFilter(CorrelationFilter correlationFilter); + } + + /** + * The stage of the rule definition allowing to specify FilterType. + */ + interface WithFilterType { + /** + * Specifies filterType. + * @param filterType Filter type that is evaluated against a BrokeredMessage. Possible values include: 'SqlFilter', 'CorrelationFilter' + * @return the next definition stage + */ + WithCreate withFilterType(FilterType filterType); + } + + /** + * The stage of the rule definition allowing to specify SqlFilter. + */ + interface WithSqlFilter { + /** + * Specifies sqlFilter. + * @param sqlFilter Properties of sqlFilter + * @return the next definition stage + */ + WithCreate withSqlFilter(SqlFilter sqlFilter); + } + + /** + * 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.WithCorrelationFilter, DefinitionStages.WithFilterType, DefinitionStages.WithSqlFilter { + } + } + /** + * The template for a Rule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAction, UpdateStages.WithCorrelationFilter, UpdateStages.WithFilterType, UpdateStages.WithSqlFilter { + } + + /** + * Grouping of Rule update stages. + */ + interface UpdateStages { + /** + * The stage of the rule update allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + * @param action Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression + * @return the next update stage + */ + Update withAction(Action action); + } + + /** + * The stage of the rule update allowing to specify CorrelationFilter. + */ + interface WithCorrelationFilter { + /** + * Specifies correlationFilter. + * @param correlationFilter Properties of correlationFilter + * @return the next update stage + */ + Update withCorrelationFilter(CorrelationFilter correlationFilter); + } + + /** + * The stage of the rule update allowing to specify FilterType. + */ + interface WithFilterType { + /** + * Specifies filterType. + * @param filterType Filter type that is evaluated against a BrokeredMessage. Possible values include: 'SqlFilter', 'CorrelationFilter' + * @return the next update stage + */ + Update withFilterType(FilterType filterType); + } + + /** + * The stage of the rule update allowing to specify SqlFilter. + */ + interface WithSqlFilter { + /** + * Specifies sqlFilter. + * @param sqlFilter Properties of sqlFilter + * @return the next update stage + */ + Update withSqlFilter(SqlFilter sqlFilter); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Rules.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Rules.java new file mode 100644 index 000000000000..f21c2bffd146 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Rules.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.RulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Rules. + */ +public interface Rules extends SupportsCreating, HasInner { + /** + * Retrieves the description for the specified rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName); + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySubscriptionsAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName); + + /** + * Deletes an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespace.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespace.java new file mode 100644 index 000000000000..d4fbb56da91c --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespace.java @@ -0,0 +1,123 @@ +/** + * 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.servicebus.v2017_04_01; + +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBNamespaceInner; + +/** + * Type representing SBNamespace. + */ +public interface SBNamespace extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the metricId value. + */ + String metricId(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the serviceBusEndpoint value. + */ + String serviceBusEndpoint(); + + /** + * @return the sku value. + */ + SBSku sku(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the SBNamespace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of SBNamespace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SBNamespace definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the SBNamespace definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the sbnamespace definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Properties of Sku + * @return the next definition stage + */ + WithCreate withSku(SBSku sku); + } + + /** + * 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.WithSku { + } + } + /** + * The template for a SBNamespace update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku { + } + + /** + * Grouping of SBNamespace update stages. + */ + interface UpdateStages { + /** + * The stage of the sbnamespace update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Properties of Sku + * @return the next update stage + */ + Update withSku(SBSku sku); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespaceMigrate.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespaceMigrate.java new file mode 100644 index 000000000000..d91c967abc6c --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespaceMigrate.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Namespace Migrate Object. + */ +public class SBNamespaceMigrate { + /** + * Type of namespaces. Possible values include: 'Messaging', + * 'NotificationHub', 'Mixed', 'EventHub', 'Relay'. + */ + @JsonProperty(value = "targetNamespaceType", required = true) + private NameSpaceType targetNamespaceType; + + /** + * Get type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay'. + * + * @return the targetNamespaceType value + */ + public NameSpaceType targetNamespaceType() { + return this.targetNamespaceType; + } + + /** + * Set type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay'. + * + * @param targetNamespaceType the targetNamespaceType value to set + * @return the SBNamespaceMigrate object itself. + */ + public SBNamespaceMigrate withTargetNamespaceType(NameSpaceType targetNamespaceType) { + this.targetNamespaceType = targetNamespaceType; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespaceUpdateParameters.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespaceUpdateParameters.java new file mode 100644 index 000000000000..e38cd6800dd1 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBNamespaceUpdateParameters.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Description of a namespace resource. + */ +@JsonFlatten +public class SBNamespaceUpdateParameters extends ResourceNamespacePatch { + /** + * Properties of Sku. + */ + @JsonProperty(value = "sku") + private SBSku 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; + + /** + * Get properties of Sku. + * + * @return the sku value + */ + public SBSku sku() { + return this.sku; + } + + /** + * Set properties of Sku. + * + * @param sku the sku value to set + * @return the SBNamespaceUpdateParameters object itself. + */ + public SBNamespaceUpdateParameters withSku(SBSku 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; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBQueue.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBQueue.java new file mode 100644 index 000000000000..42d0341e2390 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBQueue.java @@ -0,0 +1,555 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBQueueInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; +import org.joda.time.Period; + +/** + * Type representing SBQueue. + */ +public interface SBQueue extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the accessedAt value. + */ + DateTime accessedAt(); + + /** + * @return the autoDeleteOnIdle value. + */ + Period autoDeleteOnIdle(); + + /** + * @return the countDetails value. + */ + MessageCountDetails countDetails(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the deadLetteringOnMessageExpiration value. + */ + Boolean deadLetteringOnMessageExpiration(); + + /** + * @return the defaultMessageTimeToLive value. + */ + Period defaultMessageTimeToLive(); + + /** + * @return the duplicateDetectionHistoryTimeWindow value. + */ + Period duplicateDetectionHistoryTimeWindow(); + + /** + * @return the enableBatchedOperations value. + */ + Boolean enableBatchedOperations(); + + /** + * @return the enableExpress value. + */ + Boolean enableExpress(); + + /** + * @return the enablePartitioning value. + */ + Boolean enablePartitioning(); + + /** + * @return the forwardDeadLetteredMessagesTo value. + */ + String forwardDeadLetteredMessagesTo(); + + /** + * @return the forwardTo value. + */ + String forwardTo(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lockDuration value. + */ + Period lockDuration(); + + /** + * @return the maxDeliveryCount value. + */ + Integer maxDeliveryCount(); + + /** + * @return the maxSizeInMegabytes value. + */ + Integer maxSizeInMegabytes(); + + /** + * @return the messageCount value. + */ + Long messageCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresDuplicateDetection value. + */ + Boolean requiresDuplicateDetection(); + + /** + * @return the requiresSession value. + */ + Boolean requiresSession(); + + /** + * @return the sizeInBytes value. + */ + Long sizeInBytes(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the SBQueue definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of SBQueue definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SBQueue definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the sbqueue definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the sbqueue definition allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes + * @return the next definition stage + */ + WithCreate withAutoDeleteOnIdle(Period autoDeleteOnIdle); + } + + /** + * The stage of the sbqueue definition allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration A value that indicates whether this queue has dead letter support when a message expires + * @return the next definition stage + */ + WithCreate withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the sbqueue definition allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next definition stage + */ + WithCreate withDefaultMessageTimeToLive(Period defaultMessageTimeToLive); + } + + /** + * The stage of the sbqueue definition allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next definition stage + */ + WithCreate withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the sbqueue definition allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next definition stage + */ + WithCreate withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the sbqueue definition allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage + * @return the next definition stage + */ + WithCreate withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the sbqueue definition allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning A value that indicates whether the queue is to be partitioned across multiple message brokers + * @return the next definition stage + */ + WithCreate withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the sbqueue definition allowing to specify ForwardDeadLetteredMessagesTo. + */ + interface WithForwardDeadLetteredMessagesTo { + /** + * Specifies forwardDeadLetteredMessagesTo. + * @param forwardDeadLetteredMessagesTo Queue/Topic name to forward the Dead Letter message + * @return the next definition stage + */ + WithCreate withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo); + } + + /** + * The stage of the sbqueue definition allowing to specify ForwardTo. + */ + interface WithForwardTo { + /** + * Specifies forwardTo. + * @param forwardTo Queue/Topic name to forward the messages + * @return the next definition stage + */ + WithCreate withForwardTo(String forwardTo); + } + + /** + * The stage of the sbqueue definition allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute + * @return the next definition stage + */ + WithCreate withLockDuration(Period lockDuration); + } + + /** + * The stage of the sbqueue definition allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10 + * @return the next definition stage + */ + WithCreate withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the sbqueue definition allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024 + * @return the next definition stage + */ + WithCreate withMaxSizeInMegabytes(Integer maxSizeInMegabytes); + } + + /** + * The stage of the sbqueue definition allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection A value indicating if this queue requires duplicate detection + * @return the next definition stage + */ + WithCreate withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the sbqueue definition allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession A value that indicates whether the queue supports the concept of sessions + * @return the next definition stage + */ + WithCreate withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the sbqueue definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAutoDeleteOnIdle, DefinitionStages.WithDeadLetteringOnMessageExpiration, DefinitionStages.WithDefaultMessageTimeToLive, DefinitionStages.WithDuplicateDetectionHistoryTimeWindow, DefinitionStages.WithEnableBatchedOperations, DefinitionStages.WithEnableExpress, DefinitionStages.WithEnablePartitioning, DefinitionStages.WithForwardDeadLetteredMessagesTo, DefinitionStages.WithForwardTo, DefinitionStages.WithLockDuration, DefinitionStages.WithMaxDeliveryCount, DefinitionStages.WithMaxSizeInMegabytes, DefinitionStages.WithRequiresDuplicateDetection, DefinitionStages.WithRequiresSession, DefinitionStages.WithStatus { + } + } + /** + * The template for a SBQueue update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoDeleteOnIdle, UpdateStages.WithDeadLetteringOnMessageExpiration, UpdateStages.WithDefaultMessageTimeToLive, UpdateStages.WithDuplicateDetectionHistoryTimeWindow, UpdateStages.WithEnableBatchedOperations, UpdateStages.WithEnableExpress, UpdateStages.WithEnablePartitioning, UpdateStages.WithForwardDeadLetteredMessagesTo, UpdateStages.WithForwardTo, UpdateStages.WithLockDuration, UpdateStages.WithMaxDeliveryCount, UpdateStages.WithMaxSizeInMegabytes, UpdateStages.WithRequiresDuplicateDetection, UpdateStages.WithRequiresSession, UpdateStages.WithStatus { + } + + /** + * Grouping of SBQueue update stages. + */ + interface UpdateStages { + /** + * The stage of the sbqueue update allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes + * @return the next update stage + */ + Update withAutoDeleteOnIdle(Period autoDeleteOnIdle); + } + + /** + * The stage of the sbqueue update allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration A value that indicates whether this queue has dead letter support when a message expires + * @return the next update stage + */ + Update withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the sbqueue update allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next update stage + */ + Update withDefaultMessageTimeToLive(Period defaultMessageTimeToLive); + } + + /** + * The stage of the sbqueue update allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next update stage + */ + Update withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the sbqueue update allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next update stage + */ + Update withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the sbqueue update allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage + * @return the next update stage + */ + Update withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the sbqueue update allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning A value that indicates whether the queue is to be partitioned across multiple message brokers + * @return the next update stage + */ + Update withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the sbqueue update allowing to specify ForwardDeadLetteredMessagesTo. + */ + interface WithForwardDeadLetteredMessagesTo { + /** + * Specifies forwardDeadLetteredMessagesTo. + * @param forwardDeadLetteredMessagesTo Queue/Topic name to forward the Dead Letter message + * @return the next update stage + */ + Update withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo); + } + + /** + * The stage of the sbqueue update allowing to specify ForwardTo. + */ + interface WithForwardTo { + /** + * Specifies forwardTo. + * @param forwardTo Queue/Topic name to forward the messages + * @return the next update stage + */ + Update withForwardTo(String forwardTo); + } + + /** + * The stage of the sbqueue update allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute + * @return the next update stage + */ + Update withLockDuration(Period lockDuration); + } + + /** + * The stage of the sbqueue update allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10 + * @return the next update stage + */ + Update withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the sbqueue update allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024 + * @return the next update stage + */ + Update withMaxSizeInMegabytes(Integer maxSizeInMegabytes); + } + + /** + * The stage of the sbqueue update allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection A value indicating if this queue requires duplicate detection + * @return the next update stage + */ + Update withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the sbqueue update allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession A value that indicates whether the queue supports the concept of sessions + * @return the next update stage + */ + Update withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the sbqueue update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBSku.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBSku.java new file mode 100644 index 000000000000..42ff8dd99c13 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBSku.java @@ -0,0 +1,98 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU of the namespace. + */ +public class SBSku { + /** + * Name of this SKU. Possible values include: 'Basic', 'Standard', + * 'Premium'. + */ + @JsonProperty(value = "name", required = true) + private SkuName name; + + /** + * The billing tier of this particular SKU. Possible values include: + * 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /** + * The specified messaging units for the tier. For Premium tier, capacity + * are 1,2 and 4. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get name of this SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set name of this SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param name the name value to set + * @return the SBSku object itself. + */ + public SBSku withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Get the billing tier of this particular SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the tier value + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the billing tier of this particular SKU. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param tier the tier value to set + * @return the SBSku object itself. + */ + public SBSku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. + * + * @param capacity the capacity value to set + * @return the SBSku object itself. + */ + public SBSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBSubscription.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBSubscription.java new file mode 100644 index 000000000000..a59a4f13d7dd --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBSubscription.java @@ -0,0 +1,464 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBSubscriptionInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; +import org.joda.time.Period; + +/** + * Type representing SBSubscription. + */ +public interface SBSubscription extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the accessedAt value. + */ + DateTime accessedAt(); + + /** + * @return the autoDeleteOnIdle value. + */ + Period autoDeleteOnIdle(); + + /** + * @return the countDetails value. + */ + MessageCountDetails countDetails(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the deadLetteringOnFilterEvaluationExceptions value. + */ + Boolean deadLetteringOnFilterEvaluationExceptions(); + + /** + * @return the deadLetteringOnMessageExpiration value. + */ + Boolean deadLetteringOnMessageExpiration(); + + /** + * @return the defaultMessageTimeToLive value. + */ + Period defaultMessageTimeToLive(); + + /** + * @return the duplicateDetectionHistoryTimeWindow value. + */ + Period duplicateDetectionHistoryTimeWindow(); + + /** + * @return the enableBatchedOperations value. + */ + Boolean enableBatchedOperations(); + + /** + * @return the forwardDeadLetteredMessagesTo value. + */ + String forwardDeadLetteredMessagesTo(); + + /** + * @return the forwardTo value. + */ + String forwardTo(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lockDuration value. + */ + Period lockDuration(); + + /** + * @return the maxDeliveryCount value. + */ + Integer maxDeliveryCount(); + + /** + * @return the messageCount value. + */ + Long messageCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresSession value. + */ + Boolean requiresSession(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the SBSubscription definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithTopic, DefinitionStages.WithCreate { + } + + /** + * Grouping of SBSubscription definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SBSubscription definition. + */ + interface Blank extends WithTopic { + } + + /** + * The stage of the sbsubscription definition allowing to specify Topic. + */ + interface WithTopic { + /** + * Specifies resourceGroupName, namespaceName, topicName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param topicName The topic name + * @return the next definition stage + */ + WithCreate withExistingTopic(String resourceGroupName, String namespaceName, String topicName); + } + + /** + * The stage of the sbsubscription definition allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next definition stage + */ + WithCreate withAutoDeleteOnIdle(Period autoDeleteOnIdle); + } + + /** + * The stage of the sbsubscription definition allowing to specify DeadLetteringOnFilterEvaluationExceptions. + */ + interface WithDeadLetteringOnFilterEvaluationExceptions { + /** + * Specifies deadLetteringOnFilterEvaluationExceptions. + * @param deadLetteringOnFilterEvaluationExceptions Value that indicates whether a subscription has dead letter support on filter evaluation exceptions + * @return the next definition stage + */ + WithCreate withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions); + } + + /** + * The stage of the sbsubscription definition allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration Value that indicates whether a subscription has dead letter support when a message expires + * @return the next definition stage + */ + WithCreate withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the sbsubscription definition allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive ISO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next definition stage + */ + WithCreate withDefaultMessageTimeToLive(Period defaultMessageTimeToLive); + } + + /** + * The stage of the sbsubscription definition allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next definition stage + */ + WithCreate withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the sbsubscription definition allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next definition stage + */ + WithCreate withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the sbsubscription definition allowing to specify ForwardDeadLetteredMessagesTo. + */ + interface WithForwardDeadLetteredMessagesTo { + /** + * Specifies forwardDeadLetteredMessagesTo. + * @param forwardDeadLetteredMessagesTo Queue/Topic name to forward the Dead Letter message + * @return the next definition stage + */ + WithCreate withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo); + } + + /** + * The stage of the sbsubscription definition allowing to specify ForwardTo. + */ + interface WithForwardTo { + /** + * Specifies forwardTo. + * @param forwardTo Queue/Topic name to forward the messages + * @return the next definition stage + */ + WithCreate withForwardTo(String forwardTo); + } + + /** + * The stage of the sbsubscription definition allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration ISO 8061 lock duration timespan for the subscription. The default value is 1 minute + * @return the next definition stage + */ + WithCreate withLockDuration(Period lockDuration); + } + + /** + * The stage of the sbsubscription definition allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount Number of maximum deliveries + * @return the next definition stage + */ + WithCreate withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the sbsubscription definition allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession Value indicating if a subscription supports the concept of sessions + * @return the next definition stage + */ + WithCreate withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the sbsubscription definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAutoDeleteOnIdle, DefinitionStages.WithDeadLetteringOnFilterEvaluationExceptions, DefinitionStages.WithDeadLetteringOnMessageExpiration, DefinitionStages.WithDefaultMessageTimeToLive, DefinitionStages.WithDuplicateDetectionHistoryTimeWindow, DefinitionStages.WithEnableBatchedOperations, DefinitionStages.WithForwardDeadLetteredMessagesTo, DefinitionStages.WithForwardTo, DefinitionStages.WithLockDuration, DefinitionStages.WithMaxDeliveryCount, DefinitionStages.WithRequiresSession, DefinitionStages.WithStatus { + } + } + /** + * The template for a SBSubscription update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoDeleteOnIdle, UpdateStages.WithDeadLetteringOnFilterEvaluationExceptions, UpdateStages.WithDeadLetteringOnMessageExpiration, UpdateStages.WithDefaultMessageTimeToLive, UpdateStages.WithDuplicateDetectionHistoryTimeWindow, UpdateStages.WithEnableBatchedOperations, UpdateStages.WithForwardDeadLetteredMessagesTo, UpdateStages.WithForwardTo, UpdateStages.WithLockDuration, UpdateStages.WithMaxDeliveryCount, UpdateStages.WithRequiresSession, UpdateStages.WithStatus { + } + + /** + * Grouping of SBSubscription update stages. + */ + interface UpdateStages { + /** + * The stage of the sbsubscription update allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next update stage + */ + Update withAutoDeleteOnIdle(Period autoDeleteOnIdle); + } + + /** + * The stage of the sbsubscription update allowing to specify DeadLetteringOnFilterEvaluationExceptions. + */ + interface WithDeadLetteringOnFilterEvaluationExceptions { + /** + * Specifies deadLetteringOnFilterEvaluationExceptions. + * @param deadLetteringOnFilterEvaluationExceptions Value that indicates whether a subscription has dead letter support on filter evaluation exceptions + * @return the next update stage + */ + Update withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions); + } + + /** + * The stage of the sbsubscription update allowing to specify DeadLetteringOnMessageExpiration. + */ + interface WithDeadLetteringOnMessageExpiration { + /** + * Specifies deadLetteringOnMessageExpiration. + * @param deadLetteringOnMessageExpiration Value that indicates whether a subscription has dead letter support when a message expires + * @return the next update stage + */ + Update withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration); + } + + /** + * The stage of the sbsubscription update allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive ISO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next update stage + */ + Update withDefaultMessageTimeToLive(Period defaultMessageTimeToLive); + } + + /** + * The stage of the sbsubscription update allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next update stage + */ + Update withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the sbsubscription update allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next update stage + */ + Update withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the sbsubscription update allowing to specify ForwardDeadLetteredMessagesTo. + */ + interface WithForwardDeadLetteredMessagesTo { + /** + * Specifies forwardDeadLetteredMessagesTo. + * @param forwardDeadLetteredMessagesTo Queue/Topic name to forward the Dead Letter message + * @return the next update stage + */ + Update withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo); + } + + /** + * The stage of the sbsubscription update allowing to specify ForwardTo. + */ + interface WithForwardTo { + /** + * Specifies forwardTo. + * @param forwardTo Queue/Topic name to forward the messages + * @return the next update stage + */ + Update withForwardTo(String forwardTo); + } + + /** + * The stage of the sbsubscription update allowing to specify LockDuration. + */ + interface WithLockDuration { + /** + * Specifies lockDuration. + * @param lockDuration ISO 8061 lock duration timespan for the subscription. The default value is 1 minute + * @return the next update stage + */ + Update withLockDuration(Period lockDuration); + } + + /** + * The stage of the sbsubscription update allowing to specify MaxDeliveryCount. + */ + interface WithMaxDeliveryCount { + /** + * Specifies maxDeliveryCount. + * @param maxDeliveryCount Number of maximum deliveries + * @return the next update stage + */ + Update withMaxDeliveryCount(Integer maxDeliveryCount); + } + + /** + * The stage of the sbsubscription update allowing to specify RequiresSession. + */ + interface WithRequiresSession { + /** + * Specifies requiresSession. + * @param requiresSession Value indicating if a subscription supports the concept of sessions + * @return the next update stage + */ + Update withRequiresSession(Boolean requiresSession); + } + + /** + * The stage of the sbsubscription update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBTopic.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBTopic.java new file mode 100644 index 000000000000..c9e5df7b74f0 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SBTopic.java @@ -0,0 +1,410 @@ +/** + * 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.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBTopicInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import org.joda.time.DateTime; +import org.joda.time.Period; + +/** + * Type representing SBTopic. + */ +public interface SBTopic extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the accessedAt value. + */ + DateTime accessedAt(); + + /** + * @return the autoDeleteOnIdle value. + */ + Period autoDeleteOnIdle(); + + /** + * @return the countDetails value. + */ + MessageCountDetails countDetails(); + + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the defaultMessageTimeToLive value. + */ + Period defaultMessageTimeToLive(); + + /** + * @return the duplicateDetectionHistoryTimeWindow value. + */ + Period duplicateDetectionHistoryTimeWindow(); + + /** + * @return the enableBatchedOperations value. + */ + Boolean enableBatchedOperations(); + + /** + * @return the enableExpress value. + */ + Boolean enableExpress(); + + /** + * @return the enablePartitioning value. + */ + Boolean enablePartitioning(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxSizeInMegabytes value. + */ + Integer maxSizeInMegabytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresDuplicateDetection value. + */ + Boolean requiresDuplicateDetection(); + + /** + * @return the sizeInBytes value. + */ + Long sizeInBytes(); + + /** + * @return the status value. + */ + EntityStatus status(); + + /** + * @return the subscriptionCount value. + */ + Integer subscriptionCount(); + + /** + * @return the supportOrdering value. + */ + Boolean supportOrdering(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the SBTopic definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of SBTopic definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SBTopic definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the sbtopic definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the sbtopic definition allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle ISO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next definition stage + */ + WithCreate withAutoDeleteOnIdle(Period autoDeleteOnIdle); + } + + /** + * The stage of the sbtopic definition allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next definition stage + */ + WithCreate withDefaultMessageTimeToLive(Period defaultMessageTimeToLive); + } + + /** + * The stage of the sbtopic definition allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow ISO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next definition stage + */ + WithCreate withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the sbtopic definition allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next definition stage + */ + WithCreate withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the sbtopic definition allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage + * @return the next definition stage + */ + WithCreate withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the sbtopic definition allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning Value that indicates whether the topic to be partitioned across multiple message brokers is enabled + * @return the next definition stage + */ + WithCreate withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the sbtopic definition allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024 + * @return the next definition stage + */ + WithCreate withMaxSizeInMegabytes(Integer maxSizeInMegabytes); + } + + /** + * The stage of the sbtopic definition allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection Value indicating if this topic requires duplicate detection + * @return the next definition stage + */ + WithCreate withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the sbtopic definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next definition stage + */ + WithCreate withStatus(EntityStatus status); + } + + /** + * The stage of the sbtopic definition allowing to specify SupportOrdering. + */ + interface WithSupportOrdering { + /** + * Specifies supportOrdering. + * @param supportOrdering Value that indicates whether the topic supports ordering + * @return the next definition stage + */ + WithCreate withSupportOrdering(Boolean supportOrdering); + } + + /** + * 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.WithAutoDeleteOnIdle, DefinitionStages.WithDefaultMessageTimeToLive, DefinitionStages.WithDuplicateDetectionHistoryTimeWindow, DefinitionStages.WithEnableBatchedOperations, DefinitionStages.WithEnableExpress, DefinitionStages.WithEnablePartitioning, DefinitionStages.WithMaxSizeInMegabytes, DefinitionStages.WithRequiresDuplicateDetection, DefinitionStages.WithStatus, DefinitionStages.WithSupportOrdering { + } + } + /** + * The template for a SBTopic update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoDeleteOnIdle, UpdateStages.WithDefaultMessageTimeToLive, UpdateStages.WithDuplicateDetectionHistoryTimeWindow, UpdateStages.WithEnableBatchedOperations, UpdateStages.WithEnableExpress, UpdateStages.WithEnablePartitioning, UpdateStages.WithMaxSizeInMegabytes, UpdateStages.WithRequiresDuplicateDetection, UpdateStages.WithStatus, UpdateStages.WithSupportOrdering { + } + + /** + * Grouping of SBTopic update stages. + */ + interface UpdateStages { + /** + * The stage of the sbtopic update allowing to specify AutoDeleteOnIdle. + */ + interface WithAutoDeleteOnIdle { + /** + * Specifies autoDeleteOnIdle. + * @param autoDeleteOnIdle ISO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes + * @return the next update stage + */ + Update withAutoDeleteOnIdle(Period autoDeleteOnIdle); + } + + /** + * The stage of the sbtopic update allowing to specify DefaultMessageTimeToLive. + */ + interface WithDefaultMessageTimeToLive { + /** + * Specifies defaultMessageTimeToLive. + * @param defaultMessageTimeToLive ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself + * @return the next update stage + */ + Update withDefaultMessageTimeToLive(Period defaultMessageTimeToLive); + } + + /** + * The stage of the sbtopic update allowing to specify DuplicateDetectionHistoryTimeWindow. + */ + interface WithDuplicateDetectionHistoryTimeWindow { + /** + * Specifies duplicateDetectionHistoryTimeWindow. + * @param duplicateDetectionHistoryTimeWindow ISO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes + * @return the next update stage + */ + Update withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow); + } + + /** + * The stage of the sbtopic update allowing to specify EnableBatchedOperations. + */ + interface WithEnableBatchedOperations { + /** + * Specifies enableBatchedOperations. + * @param enableBatchedOperations Value that indicates whether server-side batched operations are enabled + * @return the next update stage + */ + Update withEnableBatchedOperations(Boolean enableBatchedOperations); + } + + /** + * The stage of the sbtopic update allowing to specify EnableExpress. + */ + interface WithEnableExpress { + /** + * Specifies enableExpress. + * @param enableExpress Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage + * @return the next update stage + */ + Update withEnableExpress(Boolean enableExpress); + } + + /** + * The stage of the sbtopic update allowing to specify EnablePartitioning. + */ + interface WithEnablePartitioning { + /** + * Specifies enablePartitioning. + * @param enablePartitioning Value that indicates whether the topic to be partitioned across multiple message brokers is enabled + * @return the next update stage + */ + Update withEnablePartitioning(Boolean enablePartitioning); + } + + /** + * The stage of the sbtopic update allowing to specify MaxSizeInMegabytes. + */ + interface WithMaxSizeInMegabytes { + /** + * Specifies maxSizeInMegabytes. + * @param maxSizeInMegabytes Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024 + * @return the next update stage + */ + Update withMaxSizeInMegabytes(Integer maxSizeInMegabytes); + } + + /** + * The stage of the sbtopic update allowing to specify RequiresDuplicateDetection. + */ + interface WithRequiresDuplicateDetection { + /** + * Specifies requiresDuplicateDetection. + * @param requiresDuplicateDetection Value indicating if this topic requires duplicate detection + * @return the next update stage + */ + Update withRequiresDuplicateDetection(Boolean requiresDuplicateDetection); + } + + /** + * The stage of the sbtopic update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status Enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown' + * @return the next update stage + */ + Update withStatus(EntityStatus status); + } + + /** + * The stage of the sbtopic update allowing to specify SupportOrdering. + */ + interface WithSupportOrdering { + /** + * Specifies supportOrdering. + * @param supportOrdering Value that indicates whether the topic supports ordering + * @return the next update stage + */ + Update withSupportOrdering(Boolean supportOrdering); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SkuName.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SkuName.java new file mode 100644 index 000000000000..fb6157268475 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SkuName.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuName. + */ +public enum SkuName { + /** Enum value Basic. */ + BASIC("Basic"), + + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Premium. */ + PREMIUM("Premium"); + + /** The actual serialized value for a SkuName instance. */ + private String value; + + SkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuName object, or null if unable to parse. + */ + @JsonCreator + public static SkuName fromString(String value) { + SkuName[] items = SkuName.values(); + for (SkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SkuTier.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SkuTier.java new file mode 100644 index 000000000000..71cc6c2717e6 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SkuTier.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuTier. + */ +public enum SkuTier { + /** Enum value Basic. */ + BASIC("Basic"), + + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Premium. */ + PREMIUM("Premium"); + + /** The actual serialized value for a SkuTier instance. */ + private String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + @JsonCreator + public static SkuTier fromString(String value) { + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java new file mode 100644 index 000000000000..a917c1821c4f --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a filter which is a composition of an expression and an action + * that is executed in the pub/sub pipeline. + */ +public class SqlFilter { + /** + * The SQL expression. e.g. MyProperty='ABC'. + */ + @JsonProperty(value = "sqlExpression") + private String sqlExpression; + + /** + * This property is reserved for future use. An integer value showing the + * compatibility level, currently hard-coded to 20. + */ + @JsonProperty(value = "compatibilityLevel", access = JsonProperty.Access.WRITE_ONLY) + private Integer compatibilityLevel; + + /** + * Value that indicates whether the rule action requires preprocessing. + */ + @JsonProperty(value = "requiresPreprocessing") + private Boolean requiresPreprocessing; + + /** + * Get the SQL expression. e.g. MyProperty='ABC'. + * + * @return the sqlExpression value + */ + public String sqlExpression() { + return this.sqlExpression; + } + + /** + * Set the SQL expression. e.g. MyProperty='ABC'. + * + * @param sqlExpression the sqlExpression value to set + * @return the SqlFilter object itself. + */ + public SqlFilter withSqlExpression(String sqlExpression) { + this.sqlExpression = sqlExpression; + return this; + } + + /** + * Get this property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + * + * @return the compatibilityLevel value + */ + public Integer compatibilityLevel() { + return this.compatibilityLevel; + } + + /** + * Get value that indicates whether the rule action requires preprocessing. + * + * @return the requiresPreprocessing value + */ + public Boolean requiresPreprocessing() { + return this.requiresPreprocessing; + } + + /** + * Set value that indicates whether the rule action requires preprocessing. + * + * @param requiresPreprocessing the requiresPreprocessing value to set + * @return the SqlFilter object itself. + */ + public SqlFilter withRequiresPreprocessing(Boolean requiresPreprocessing) { + this.requiresPreprocessing = requiresPreprocessing; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlRuleAction.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlRuleAction.java new file mode 100644 index 000000000000..5fff59d5e73a --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlRuleAction.java @@ -0,0 +1,17 @@ +/** + * 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.servicebus.v2017_04_01; + + +/** + * Represents set of actions written in SQL language-based syntax that is + * performed against a ServiceBus.Messaging.BrokeredMessage. + */ +public class SqlRuleAction extends Action { +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Subnet.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Subnet.java new file mode 100644 index 000000000000..2c21bc000d7c --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Subnet.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties supplied for Subnet. + */ +public class Subnet { + /** + * Resource ID of Virtual Network Subnet. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get resource ID of Virtual Network Subnet. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource ID of Virtual Network Subnet. + * + * @param id the id value to set + * @return the Subnet object itself. + */ + public Subnet withId(String id) { + this.id = id; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Subscriptions.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Subscriptions.java new file mode 100644 index 000000000000..3068246edd17 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Subscriptions.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions extends SupportsCreating, HasInner { + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName); + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByTopicAsync(final String resourceGroupName, final String namespaceName, final String topicName); + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/TopicNamespaceSBAuthorizationRule.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/TopicNamespaceSBAuthorizationRule.java new file mode 100644 index 000000000000..c09eecb926a3 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/TopicNamespaceSBAuthorizationRule.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.SBAuthorizationRuleInner; +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.servicebus.v2017_04_01.implementation.ServiceBusManager; +import java.util.List; + +/** + * Type representing TopicNamespaceSBAuthorizationRule. + */ +public interface TopicNamespaceSBAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the TopicNamespaceSBAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithTopic, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of TopicNamespaceSBAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TopicNamespaceSBAuthorizationRule definition. + */ + interface Blank extends WithTopic { + } + + /** + * The stage of the topicnamespacesbauthorizationrule definition allowing to specify Topic. + */ + interface WithTopic { + /** + * Specifies resourceGroupName, namespaceName, topicName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param topicName The topic name + * @return the next definition stage + */ + WithRights withExistingTopic(String resourceGroupName, String namespaceName, String topicName); + } + + /** + * The stage of the topicnamespacesbauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a TopicNamespaceSBAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of TopicNamespaceSBAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the topicnamespacesbauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Topics.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Topics.java new file mode 100644 index 000000000000..da0220b677fe --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Topics.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.TopicsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.TopicNamespaceSBAuthorizationRule; + +/** + * Type representing Topics. + */ +public interface Topics extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + TopicNamespaceSBAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String topicName); + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName); + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName); + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName); + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/UnavailableReason.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/UnavailableReason.java new file mode 100644 index 000000000000..f516d72ca72f --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/UnavailableReason.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for UnavailableReason. + */ +public enum UnavailableReason { + /** Enum value None. */ + NONE("None"), + + /** Enum value InvalidName. */ + INVALID_NAME("InvalidName"), + + /** Enum value SubscriptionIsDisabled. */ + SUBSCRIPTION_IS_DISABLED("SubscriptionIsDisabled"), + + /** Enum value NameInUse. */ + NAME_IN_USE("NameInUse"), + + /** Enum value NameInLockdown. */ + NAME_IN_LOCKDOWN("NameInLockdown"), + + /** Enum value TooManyNamespaceInCurrentSubscription. */ + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION("TooManyNamespaceInCurrentSubscription"); + + /** The actual serialized value for a UnavailableReason instance. */ + private String value; + + UnavailableReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnavailableReason instance. + * + * @param value the serialized value to parse. + * @return the parsed UnavailableReason object, or null if unable to parse. + */ + @JsonCreator + public static UnavailableReason fromString(String value) { + UnavailableReason[] items = UnavailableReason.values(); + for (UnavailableReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/AccessKeysImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/AccessKeysImpl.java new file mode 100644 index 000000000000..fb3d720a9814 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/AccessKeysImpl.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AccessKeysImpl extends WrapperImpl implements AccessKeys { + private final ServiceBusManager manager; + AccessKeysImpl(AccessKeysInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public String aliasPrimaryConnectionString() { + return this.inner().aliasPrimaryConnectionString(); + } + + @Override + public String aliasSecondaryConnectionString() { + return this.inner().aliasSecondaryConnectionString(); + } + + @Override + public String keyName() { + return this.inner().keyName(); + } + + @Override + public String primaryConnectionString() { + return this.inner().primaryConnectionString(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryConnectionString() { + return this.inner().secondaryConnectionString(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/AccessKeysInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/AccessKeysInner.java new file mode 100644 index 000000000000..a419ecaffbce --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/AccessKeysInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Namespace/ServiceBus Connection String. + */ +public class AccessKeysInner { + /** + * Primary connection string of the created namespace authorization rule. + */ + @JsonProperty(value = "primaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String primaryConnectionString; + + /** + * Secondary connection string of the created namespace authorization rule. + */ + @JsonProperty(value = "secondaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryConnectionString; + + /** + * Primary connection string of the alias if GEO DR is enabled. + */ + @JsonProperty(value = "aliasPrimaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String aliasPrimaryConnectionString; + + /** + * Secondary connection string of the alias if GEO DR is enabled. + */ + @JsonProperty(value = "aliasSecondaryConnectionString", access = JsonProperty.Access.WRITE_ONLY) + private String aliasSecondaryConnectionString; + + /** + * A base64-encoded 256-bit primary key for signing and validating the SAS + * token. + */ + @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryKey; + + /** + * A base64-encoded 256-bit primary key for signing and validating the SAS + * token. + */ + @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryKey; + + /** + * A string that describes the authorization rule. + */ + @JsonProperty(value = "keyName", access = JsonProperty.Access.WRITE_ONLY) + private String keyName; + + /** + * Get primary connection string of the created namespace authorization rule. + * + * @return the primaryConnectionString value + */ + public String primaryConnectionString() { + return this.primaryConnectionString; + } + + /** + * Get secondary connection string of the created namespace authorization rule. + * + * @return the secondaryConnectionString value + */ + public String secondaryConnectionString() { + return this.secondaryConnectionString; + } + + /** + * Get primary connection string of the alias if GEO DR is enabled. + * + * @return the aliasPrimaryConnectionString value + */ + public String aliasPrimaryConnectionString() { + return this.aliasPrimaryConnectionString; + } + + /** + * Get secondary connection string of the alias if GEO DR is enabled. + * + * @return the aliasSecondaryConnectionString value + */ + public String aliasSecondaryConnectionString() { + return this.aliasSecondaryConnectionString; + } + + /** + * Get a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Get a base64-encoded 256-bit primary key for signing and validating the SAS token. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Get a string that describes the authorization rule. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ArmDisasterRecoveryImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ArmDisasterRecoveryImpl.java new file mode 100644 index 000000000000..c6ec82416f31 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ArmDisasterRecoveryImpl.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.ArmDisasterRecovery; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.ProvisioningStateDR; +import com.microsoft.azure.management.servicebus.v2017_04_01.RoleDisasterRecovery; + +class ArmDisasterRecoveryImpl extends CreatableUpdatableImpl implements ArmDisasterRecovery, ArmDisasterRecovery.Definition, ArmDisasterRecovery.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String alias; + + ArmDisasterRecoveryImpl(String name, ServiceBusManager manager) { + super(name, new ArmDisasterRecoveryInner()); + this.manager = manager; + // Set resource name + this.alias = name; + // + } + + ArmDisasterRecoveryImpl(ArmDisasterRecoveryInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.alias = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.alias = IdParsingUtils.getValueFromIdByName(inner.id(), "disasterRecoveryConfigs"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.alias, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.alias, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.alias); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String alternateName() { + return this.inner().alternateName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerNamespace() { + return this.inner().partnerNamespace(); + } + + @Override + public Long pendingReplicationOperationsCount() { + return this.inner().pendingReplicationOperationsCount(); + } + + @Override + public ProvisioningStateDR provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public RoleDisasterRecovery role() { + return this.inner().role(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ArmDisasterRecoveryImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public ArmDisasterRecoveryImpl withAlternateName(String alternateName) { + this.inner().withAlternateName(alternateName); + return this; + } + + @Override + public ArmDisasterRecoveryImpl withPartnerNamespace(String partnerNamespace) { + this.inner().withPartnerNamespace(partnerNamespace); + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ArmDisasterRecoveryInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ArmDisasterRecoveryInner.java new file mode 100644 index 000000000000..0226e57e50f8 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ArmDisasterRecoveryInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.ProvisioningStateDR; +import com.microsoft.azure.management.servicebus.v2017_04_01.RoleDisasterRecovery; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in List or Get Alias(Disaster Recovery configuration) operation. + */ +@JsonFlatten +public class ArmDisasterRecoveryInner extends ProxyResource { + /** + * Provisioning state of the Alias(Disaster Recovery configuration) - + * possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values + * include: 'Accepted', 'Succeeded', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningStateDR provisioningState; + + /** + * Number of entities pending to be replicated. + */ + @JsonProperty(value = "properties.pendingReplicationOperationsCount", access = JsonProperty.Access.WRITE_ONLY) + private Long pendingReplicationOperationsCount; + + /** + * ARM Id of the Primary/Secondary eventhub namespace name, which is part + * of GEO DR pairing. + */ + @JsonProperty(value = "properties.partnerNamespace") + private String partnerNamespace; + + /** + * Primary/Secondary eventhub namespace name, which is part of GEO DR + * pairing. + */ + @JsonProperty(value = "properties.alternateName") + private String alternateName; + + /** + * role of namespace in GEO DR - possible values 'Primary' or + * 'PrimaryNotReplicating' or 'Secondary'. Possible values include: + * 'Primary', 'PrimaryNotReplicating', 'Secondary'. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private RoleDisasterRecovery role; + + /** + * Get provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: 'Accepted', 'Succeeded', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningStateDR provisioningState() { + return this.provisioningState; + } + + /** + * Get number of entities pending to be replicated. + * + * @return the pendingReplicationOperationsCount value + */ + public Long pendingReplicationOperationsCount() { + return this.pendingReplicationOperationsCount; + } + + /** + * Get aRM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. + * + * @return the partnerNamespace value + */ + public String partnerNamespace() { + return this.partnerNamespace; + } + + /** + * Set aRM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing. + * + * @param partnerNamespace the partnerNamespace value to set + * @return the ArmDisasterRecoveryInner object itself. + */ + public ArmDisasterRecoveryInner withPartnerNamespace(String partnerNamespace) { + this.partnerNamespace = partnerNamespace; + return this; + } + + /** + * Get primary/Secondary eventhub namespace name, which is part of GEO DR pairing. + * + * @return the alternateName value + */ + public String alternateName() { + return this.alternateName; + } + + /** + * Set primary/Secondary eventhub namespace name, which is part of GEO DR pairing. + * + * @param alternateName the alternateName value to set + * @return the ArmDisasterRecoveryInner object itself. + */ + public ArmDisasterRecoveryInner withAlternateName(String alternateName) { + this.alternateName = alternateName; + return this; + } + + /** + * Get role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: 'Primary', 'PrimaryNotReplicating', 'Secondary'. + * + * @return the role value + */ + public RoleDisasterRecovery role() { + return this.role; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/CheckNameAvailabilityResultImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..cc1c479e1cdc --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.CheckNameAvailabilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.UnavailableReason; + +class CheckNameAvailabilityResultImpl extends WrapperImpl implements CheckNameAvailabilityResult { + private final ServiceBusManager manager; + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public UnavailableReason reason() { + return this.inner().reason(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/CheckNameAvailabilityResultInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..3770c4810e1e --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/CheckNameAvailabilityResultInner.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.UnavailableReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of a Check Name availability request properties. + */ +public class CheckNameAvailabilityResultInner { + /** + * The detailed info regarding the reason associated with the namespace. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Value indicating namespace is availability, true if the namespace is + * available; otherwise, false. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * The reason for unavailability of a namespace. Possible values include: + * 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', + * 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + */ + @JsonProperty(value = "reason") + private UnavailableReason reason; + + /** + * Get the detailed info regarding the reason associated with the namespace. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get value indicating namespace is availability, true if the namespace is available; otherwise, false. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set value indicating namespace is availability, true if the namespace is available; otherwise, false. + * + * @param nameAvailable the nameAvailable value to set + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason for unavailability of a namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + * + * @return the reason value + */ + public UnavailableReason reason() { + return this.reason; + } + + /** + * Set the reason for unavailability of a namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'. + * + * @param reason the reason value to set + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withReason(UnavailableReason reason) { + this.reason = reason; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl.java new file mode 100644 index 000000000000..a7807bb96a22 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigNamespaceSBAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; + +class DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl extends IndexableRefreshableWrapperImpl implements DisasterRecoveryConfigNamespaceSBAuthorizationRule { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String alias; + private String authorizationRuleName; + + DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl(SBAuthorizationRuleInner inner, ServiceBusManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.alias = IdParsingUtils.getValueFromIdByName(inner.id(), "disasterRecoveryConfigs"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "AuthorizationRules"); + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DisasterRecoveryConfigsInner client = this.manager().inner().disasterRecoveryConfigs(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.alias, this.authorizationRuleName); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java new file mode 100644 index 000000000000..d1e32adbb74f --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java @@ -0,0 +1,163 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.CheckNameAvailabilityResult; +import com.microsoft.azure.management.servicebus.v2017_04_01.ArmDisasterRecovery; +import com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigNamespaceSBAuthorizationRule; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessKeys; + +class DisasterRecoveryConfigsImpl extends WrapperImpl implements DisasterRecoveryConfigs { + private final ServiceBusManager manager; + + DisasterRecoveryConfigsImpl(ServiceBusManager manager) { + super(manager.inner().disasterRecoveryConfigs()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public ArmDisasterRecoveryImpl define(String name) { + return wrapModel(name); + } + + private ArmDisasterRecoveryImpl wrapModel(ArmDisasterRecoveryInner inner) { + return new ArmDisasterRecoveryImpl(inner, manager()); + } + + private ArmDisasterRecoveryImpl wrapModel(String name) { + return new ArmDisasterRecoveryImpl(name, this.manager()); + } + + @Override + public Observable checkNameAvailabilityMethodAsync(String resourceGroupName, String namespaceName, String name) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.checkNameAvailabilityMethodAsync(resourceGroupName, namespaceName, name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResult call(CheckNameAvailabilityResultInner inner) { + return new CheckNameAvailabilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable breakPairingAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.breakPairingAsync(resourceGroupName, namespaceName, alias).toCompletable(); + } + + @Override + public Completable failOverAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.failOverAsync(resourceGroupName, namespaceName, alias).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String namespaceName) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.listAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ArmDisasterRecovery call(ArmDisasterRecoveryInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, alias) + .map(new Func1() { + @Override + public ArmDisasterRecovery call(ArmDisasterRecoveryInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, alias).toCompletable(); + } + + private DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl wrapDisasterRecoveryConfigNamespaceSBAuthorizationRuleModel(SBAuthorizationRuleInner inner) { + return new DisasterRecoveryConfigNamespaceSBAuthorizationRuleImpl(inner, manager()); + } + + private Observable getSBAuthorizationRuleInnerUsingDisasterRecoveryConfigsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String alias = IdParsingUtils.getValueFromIdByName(id, "disasterRecoveryConfigs"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "AuthorizationRules"); + DisasterRecoveryConfigsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, alias, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, alias, authorizationRuleName) + .map(new Func1() { + @Override + public DisasterRecoveryConfigNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapDisasterRecoveryConfigNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, alias) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DisasterRecoveryConfigNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapDisasterRecoveryConfigNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + DisasterRecoveryConfigsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, alias, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsInner.java new file mode 100644 index 000000000000..bfccb7183780 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsInner.java @@ -0,0 +1,1358 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.CheckNameAvailability; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DisasterRecoveryConfigs. + */ +public class DisasterRecoveryConfigsInner { + /** The Retrofit service to perform REST calls. */ + private DisasterRecoveryConfigsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of DisasterRecoveryConfigsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DisasterRecoveryConfigsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(DisasterRecoveryConfigsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DisasterRecoveryConfigs to be + * used by Retrofit to perform actually REST calls. + */ + interface DisasterRecoveryConfigsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs checkNameAvailabilityMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability") + Observable> checkNameAvailabilityMethod(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailability parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Body ArmDisasterRecoveryInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs breakPairing" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing") + Observable> breakPairing(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs failOver" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover") + Observable> failOver(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("alias") String alias, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the give namespace name availability. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailabilityMethod(String resourceGroupName, String namespaceName, String name) { + return checkNameAvailabilityMethodWithServiceResponseAsync(resourceGroupName, namespaceName, name).toBlocking().single().body(); + } + + /** + * Check the give namespace name availability. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @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 checkNameAvailabilityMethodAsync(String resourceGroupName, String namespaceName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityMethodWithServiceResponseAsync(resourceGroupName, namespaceName, name), serviceCallback); + } + + /** + * Check the give namespace name availability. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityMethodAsync(String resourceGroupName, String namespaceName, String name) { + return checkNameAvailabilityMethodWithServiceResponseAsync(resourceGroupName, namespaceName, name).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check the give namespace name availability. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable> checkNameAvailabilityMethodWithServiceResponseAsync(String resourceGroupName, String namespaceName, String name) { + 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."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailability parameters = new CheckNameAvailability(); + parameters.withName(name); + return service.checkNameAvailabilityMethod(resourceGroupName, namespaceName, 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 = checkNameAvailabilityMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityMethodDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArmDisasterRecoveryInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmDisasterRecoveryInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String namespaceName) { + return listWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmDisasterRecoveryInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmDisasterRecoveryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArmDisasterRecoveryInner object if successful. + */ + public ArmDisasterRecoveryInner createOrUpdate(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters), serviceCallback); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, alias, parameters).map(new Func1, ArmDisasterRecoveryInner>() { + @Override + public ArmDisasterRecoveryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a new Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param parameters Parameters required to create an Alias(Disaster Recovery configuration) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, ArmDisasterRecoveryInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String alias) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String alias) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an Alias(Disaster Recovery configuration). + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArmDisasterRecoveryInner object if successful. + */ + public ArmDisasterRecoveryInner get(String resourceGroupName, String namespaceName, String alias) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String alias) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, ArmDisasterRecoveryInner>() { + @Override + public ArmDisasterRecoveryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmDisasterRecoveryInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void breakPairing(String resourceGroupName, String namespaceName, String alias) { + breakPairingWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture breakPairingAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(breakPairingWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable breakPairingAsync(String resourceGroupName, String namespaceName, String alias) { + return breakPairingWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> breakPairingWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.breakPairing(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = breakPairingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse breakPairingDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void failOver(String resourceGroupName, String namespaceName, String alias) { + failOverWithServiceResponseAsync(resourceGroupName, namespaceName, alias).toBlocking().single().body(); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failOverAsync(String resourceGroupName, String namespaceName, String alias, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failOverWithServiceResponseAsync(resourceGroupName, namespaceName, alias), serviceCallback); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable failOverAsync(String resourceGroupName, String namespaceName, String alias) { + return failOverWithServiceResponseAsync(resourceGroupName, namespaceName, alias).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> failOverWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.failOver(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = failOverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse failOverDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String alias) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, alias).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, alias), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String alias) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, alias) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String alias) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, alias) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization rules for a namespace. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param alias The Disaster Recovery configuration name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String alias) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, alias, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName), serviceCallback); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, alias, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, alias, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param alias The Disaster Recovery configuration name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (alias == null) { + throw new IllegalArgumentException("Parameter alias is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, alias, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArmDisasterRecoveryInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmDisasterRecoveryInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmDisasterRecoveryInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all Alias(Disaster Recovery configurations). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmDisasterRecoveryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for 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<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization rules for 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<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventHubsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventHubsImpl.java new file mode 100644 index 000000000000..dca3ca221598 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventHubsImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.EventHubs; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.Eventhub; + +class EventHubsImpl extends WrapperImpl implements EventHubs { + private final ServiceBusManager manager; + + EventHubsImpl(ServiceBusManager manager) { + super(manager.inner().eventHubs()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + private EventhubImpl wrapModel(EventhubInner inner) { + return new EventhubImpl(inner, manager()); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + EventHubsInner client = this.inner(); + return client.listByNamespaceAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Eventhub call(EventhubInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventHubsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventHubsInner.java new file mode 100644 index 000000000000..9a4a9897337a --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventHubsInner.java @@ -0,0 +1,303 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in EventHubs. + */ +public class EventHubsInner { + /** The Retrofit service to perform REST calls. */ + private EventHubsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of EventHubsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EventHubsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(EventHubsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EventHubs to be + * used by Retrofit to perform actually REST calls. + */ + interface EventHubsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.EventHubs listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs") + Observable> listByNamespace(@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.servicebus.v2017_04_01.EventHubs listByNamespaceNext" }) + @GET + Observable> listByNamespaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventhubInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Event Hubs in a service bus 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<EventhubInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByNamespace(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 = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventhubInner> object if successful. + */ + public PagedList listByNamespaceNext(final String nextPageLink) { + ServiceResponse> response = listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable>> listByNamespaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Event Hubs in a service bus Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventhubInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByNamespaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventhubImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventhubImpl.java new file mode 100644 index 000000000000..cbf66054f0b3 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventhubImpl.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.Eventhub; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.CaptureDescription; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; + +class EventhubImpl extends WrapperImpl implements Eventhub { + private final ServiceBusManager manager; + + EventhubImpl(EventhubInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + + + @Override + public CaptureDescription captureDescription() { + return this.inner().captureDescription(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Long messageRetentionInDays() { + return this.inner().messageRetentionInDays(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Long partitionCount() { + return this.inner().partitionCount(); + } + + @Override + public List partitionIds() { + return this.inner().partitionIds(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventhubInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventhubInner.java new file mode 100644 index 000000000000..7dc88e4caa44 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/EventhubInner.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; +import com.microsoft.azure.management.servicebus.v2017_04_01.CaptureDescription; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in List or Get Event Hub operation. + */ +@JsonFlatten +public class EventhubInner extends ProxyResource { + /** + * Current number of shards on the Event Hub. + */ + @JsonProperty(value = "properties.partitionIds", access = JsonProperty.Access.WRITE_ONLY) + private List partitionIds; + + /** + * Exact time the Event Hub was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Number of days to retain the events for this Event Hub, value should be + * 1 to 7 days. + */ + @JsonProperty(value = "properties.messageRetentionInDays") + private Long messageRetentionInDays; + + /** + * Number of partitions created for the Event Hub, allowed values are from + * 1 to 32 partitions. + */ + @JsonProperty(value = "properties.partitionCount") + private Long partitionCount; + + /** + * Enumerates the possible values for the status of the Event Hub. Possible + * values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', + * 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Properties of capture description. + */ + @JsonProperty(value = "properties.captureDescription") + private CaptureDescription captureDescription; + + /** + * Get current number of shards on the Event Hub. + * + * @return the partitionIds value + */ + public List partitionIds() { + return this.partitionIds; + } + + /** + * Get exact time the Event Hub was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get number of days to retain the events for this Event Hub, value should be 1 to 7 days. + * + * @return the messageRetentionInDays value + */ + public Long messageRetentionInDays() { + return this.messageRetentionInDays; + } + + /** + * Set number of days to retain the events for this Event Hub, value should be 1 to 7 days. + * + * @param messageRetentionInDays the messageRetentionInDays value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withMessageRetentionInDays(Long messageRetentionInDays) { + this.messageRetentionInDays = messageRetentionInDays; + return this; + } + + /** + * Get number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. + * + * @return the partitionCount value + */ + public Long partitionCount() { + return this.partitionCount; + } + + /** + * Set number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. + * + * @param partitionCount the partitionCount value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withPartitionCount(Long partitionCount) { + this.partitionCount = partitionCount; + return this; + } + + /** + * Get enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @param status the status value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get properties of capture description. + * + * @return the captureDescription value + */ + public CaptureDescription captureDescription() { + return this.captureDescription; + } + + /** + * Set properties of capture description. + * + * @param captureDescription the captureDescription value to set + * @return the EventhubInner object itself. + */ + public EventhubInner withCaptureDescription(CaptureDescription captureDescription) { + this.captureDescription = captureDescription; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/IdParsingUtils.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..bffe3aca1468 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesImpl.java new file mode 100644 index 000000000000..6aacbcd2854d --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesImpl.java @@ -0,0 +1,129 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigProperties; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class MigrationConfigPropertiesImpl extends CreatableUpdatableImpl implements MigrationConfigProperties, MigrationConfigProperties.Definition, MigrationConfigProperties.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + + MigrationConfigPropertiesImpl(String name, ServiceBusManager manager) { + super(name, new MigrationConfigPropertiesInner()); + this.manager = manager; + // Set resource name + this.namespaceName = name; + // + } + + MigrationConfigPropertiesImpl(MigrationConfigPropertiesInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.namespaceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + MigrationConfigsInner client = this.manager().inner().migrationConfigs(); + return client.createAndStartMigrationAsync(this.resourceGroupName, this.namespaceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + MigrationConfigsInner client = this.manager().inner().migrationConfigs(); + return client.createAndStartMigrationAsync(this.resourceGroupName, this.namespaceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MigrationConfigsInner client = this.manager().inner().migrationConfigs(); + return client.getAsync(this.resourceGroupName, this.namespaceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String migrationState() { + return this.inner().migrationState(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Long pendingReplicationOperationsCount() { + return this.inner().pendingReplicationOperationsCount(); + } + + @Override + public String postMigrationName() { + return this.inner().postMigrationName(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String targetNamespace() { + return this.inner().targetNamespace(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public MigrationConfigPropertiesImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public MigrationConfigPropertiesImpl withPostMigrationName(String postMigrationName) { + this.inner().withPostMigrationName(postMigrationName); + return this; + } + + @Override + public MigrationConfigPropertiesImpl withTargetNamespace(String targetNamespace) { + this.inner().withTargetNamespace(targetNamespace); + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesInner.java new file mode 100644 index 000000000000..169e0243b85e --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesInner.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Single item in List or Get Migration Config operation. + */ +@JsonFlatten +public class MigrationConfigPropertiesInner extends ProxyResource { + /** + * Provisioning state of Migration Configuration. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Number of entities pending to be replicated. + */ + @JsonProperty(value = "properties.pendingReplicationOperationsCount", access = JsonProperty.Access.WRITE_ONLY) + private Long pendingReplicationOperationsCount; + + /** + * Existing premium Namespace ARM Id name which has no entities, will be + * used for migration. + */ + @JsonProperty(value = "properties.targetNamespace", required = true) + private String targetNamespace; + + /** + * Name to access Standard Namespace after migration. + */ + @JsonProperty(value = "properties.postMigrationName", required = true) + private String postMigrationName; + + /** + * State in which Standard to Premium Migration is, possible values : + * Unknown, Reverting, Completing, Initiating, Syncing, Active. + */ + @JsonProperty(value = "properties.migrationState", access = JsonProperty.Access.WRITE_ONLY) + private String migrationState; + + /** + * Get provisioning state of Migration Configuration. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get number of entities pending to be replicated. + * + * @return the pendingReplicationOperationsCount value + */ + public Long pendingReplicationOperationsCount() { + return this.pendingReplicationOperationsCount; + } + + /** + * Get existing premium Namespace ARM Id name which has no entities, will be used for migration. + * + * @return the targetNamespace value + */ + public String targetNamespace() { + return this.targetNamespace; + } + + /** + * Set existing premium Namespace ARM Id name which has no entities, will be used for migration. + * + * @param targetNamespace the targetNamespace value to set + * @return the MigrationConfigPropertiesInner object itself. + */ + public MigrationConfigPropertiesInner withTargetNamespace(String targetNamespace) { + this.targetNamespace = targetNamespace; + return this; + } + + /** + * Get name to access Standard Namespace after migration. + * + * @return the postMigrationName value + */ + public String postMigrationName() { + return this.postMigrationName; + } + + /** + * Set name to access Standard Namespace after migration. + * + * @param postMigrationName the postMigrationName value to set + * @return the MigrationConfigPropertiesInner object itself. + */ + public MigrationConfigPropertiesInner withPostMigrationName(String postMigrationName) { + this.postMigrationName = postMigrationName; + return this; + } + + /** + * Get state in which Standard to Premium Migration is, possible values : Unknown, Reverting, Completing, Initiating, Syncing, Active. + * + * @return the migrationState value + */ + public String migrationState() { + return this.migrationState; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java new file mode 100644 index 000000000000..53b139e8bcaa --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java @@ -0,0 +1,93 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigProperties; + +class MigrationConfigsImpl extends WrapperImpl implements MigrationConfigs { + private final ServiceBusManager manager; + + MigrationConfigsImpl(ServiceBusManager manager) { + super(manager.inner().migrationConfigs()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public MigrationConfigPropertiesImpl define(String name) { + return wrapModel(name); + } + + private MigrationConfigPropertiesImpl wrapModel(MigrationConfigPropertiesInner inner) { + return new MigrationConfigPropertiesImpl(inner, manager()); + } + + private MigrationConfigPropertiesImpl wrapModel(String name) { + return new MigrationConfigPropertiesImpl(name, this.manager()); + } + + @Override + public Completable completeMigrationAsync(String resourceGroupName, String namespaceName) { + MigrationConfigsInner client = this.inner(); + return client.completeMigrationAsync(resourceGroupName, namespaceName).toCompletable(); + } + + @Override + public Completable revertAsync(String resourceGroupName, String namespaceName) { + MigrationConfigsInner client = this.inner(); + return client.revertAsync(resourceGroupName, namespaceName).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String namespaceName) { + MigrationConfigsInner client = this.inner(); + return client.listAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public MigrationConfigProperties call(MigrationConfigPropertiesInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName) { + MigrationConfigsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName) + .map(new Func1() { + @Override + public MigrationConfigProperties call(MigrationConfigPropertiesInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName) { + MigrationConfigsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName).toCompletable(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsInner.java new file mode 100644 index 000000000000..a3ea21552db5 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsInner.java @@ -0,0 +1,854 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MigrationConfigs. + */ +public class MigrationConfigsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private MigrationConfigsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of MigrationConfigsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MigrationConfigsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(MigrationConfigsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MigrationConfigs to be + * used by Retrofit to perform actually REST calls. + */ + interface MigrationConfigsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigs list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigs createAndStartMigration" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") + Observable> createAndStartMigration(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("configName") String configName, @Path("subscriptionId") String subscriptionId, @Body MigrationConfigPropertiesInner 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.servicebus.v2017_04_01.MigrationConfigs beginCreateAndStartMigration" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") + Observable> beginCreateAndStartMigration(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("configName") String configName, @Path("subscriptionId") String subscriptionId, @Body MigrationConfigPropertiesInner 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.servicebus.v2017_04_01.MigrationConfigs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("configName") String configName, @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.servicebus.v2017_04_01.MigrationConfigs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("configName") String configName, @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.servicebus.v2017_04_01.MigrationConfigs completeMigration" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade") + Observable> completeMigration(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("configName") String configName, @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.servicebus.v2017_04_01.MigrationConfigs revert" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert") + Observable> revert(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("configName") String configName, @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.servicebus.v2017_04_01.MigrationConfigs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all migrationConfigurations. + * + * @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<MigrationConfigPropertiesInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all migrationConfigurations. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all migrationConfigurations. + * + * @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<MigrationConfigPropertiesInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String namespaceName) { + return listWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all migrationConfigurations. + * + * @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<MigrationConfigPropertiesInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all migrationConfigurations. + * + 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<MigrationConfigPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MigrationConfigPropertiesInner object if successful. + */ + public MigrationConfigPropertiesInner createAndStartMigration(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner parameters) { + return createAndStartMigrationWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().last().body(); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAndStartMigrationAsync(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createAndStartMigrationWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAndStartMigrationAsync(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner parameters) { + return createAndStartMigrationWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, MigrationConfigPropertiesInner>() { + @Override + public MigrationConfigPropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createAndStartMigrationWithServiceResponseAsync(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner 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); + final String configName = "$default"; + Observable> observable = service.createAndStartMigration(resourceGroupName, namespaceName, configName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MigrationConfigPropertiesInner object if successful. + */ + public MigrationConfigPropertiesInner beginCreateAndStartMigration(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner parameters) { + return beginCreateAndStartMigrationWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAndStartMigrationAsync(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateAndStartMigrationWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MigrationConfigPropertiesInner object + */ + public Observable beginCreateAndStartMigrationAsync(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner parameters) { + return beginCreateAndStartMigrationWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, MigrationConfigPropertiesInner>() { + @Override + public MigrationConfigPropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates Migration configuration and starts migration of entities from Standard to Premium namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters required to create Migration Configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MigrationConfigPropertiesInner object + */ + public Observable> beginCreateAndStartMigrationWithServiceResponseAsync(String resourceGroupName, String namespaceName, MigrationConfigPropertiesInner 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); + final String configName = "$default"; + return service.beginCreateAndStartMigration(resourceGroupName, namespaceName, configName, 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 = beginCreateAndStartMigrationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateAndStartMigrationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a MigrationConfiguration. + * + * @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().single().body(); + } + + /** + * Deletes a MigrationConfiguration. + * + * @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 a MigrationConfiguration. + * + * @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 deleteAsync(String resourceGroupName, String namespaceName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a MigrationConfiguration. + * + * @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> 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."); + } + final String configName = "$default"; + return service.delete(resourceGroupName, namespaceName, configName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves Migration Config. + * + * @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 MigrationConfigPropertiesInner object if successful. + */ + public MigrationConfigPropertiesInner get(String resourceGroupName, String namespaceName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Retrieves Migration Config. + * + * @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 getAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Retrieves Migration Config. + * + * @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 MigrationConfigPropertiesInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, MigrationConfigPropertiesInner>() { + @Override + public MigrationConfigPropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves Migration Config. + * + * @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 MigrationConfigPropertiesInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String configName = "$default"; + return service.get(resourceGroupName, namespaceName, configName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. + * + * @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 completeMigration(String resourceGroupName, String namespaceName) { + completeMigrationWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. + * + * @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 completeMigrationAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(completeMigrationWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. + * + * @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 completeMigrationAsync(String resourceGroupName, String namespaceName) { + return completeMigrationWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation will fail when entity migration is in-progress. + * + * @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> completeMigrationWithServiceResponseAsync(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."); + } + final String configName = "$default"; + return service.completeMigration(resourceGroupName, namespaceName, configName, 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 = completeMigrationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse completeMigrationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation reverts Migration. + * + * @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 revert(String resourceGroupName, String namespaceName) { + revertWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * This operation reverts Migration. + * + * @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 revertAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(revertWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * This operation reverts Migration. + * + * @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 revertAsync(String resourceGroupName, String namespaceName) { + return revertWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation reverts Migration. + * + * @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> revertWithServiceResponseAsync(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."); + } + final String configName = "$default"; + return service.revert(resourceGroupName, namespaceName, configName, 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 = revertDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse revertDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all migrationConfigurations. + * + * @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<MigrationConfigPropertiesInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all migrationConfigurations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all migrationConfigurations. + * + * @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<MigrationConfigPropertiesInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all migrationConfigurations. + * + * @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<MigrationConfigPropertiesInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all migrationConfigurations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MigrationConfigPropertiesInner> 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); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespaceSBAuthorizationRuleImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespaceSBAuthorizationRuleImpl.java new file mode 100644 index 000000000000..cb96211fd7e2 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespaceSBAuthorizationRuleImpl.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.NamespaceSBAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; + +class NamespaceSBAuthorizationRuleImpl extends CreatableUpdatableImpl implements NamespaceSBAuthorizationRule, NamespaceSBAuthorizationRule.Definition, NamespaceSBAuthorizationRule.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String authorizationRuleName; + private List crights; + private List urights; + + NamespaceSBAuthorizationRuleImpl(String name, ServiceBusManager manager) { + super(name, new SBAuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + NamespaceSBAuthorizationRuleImpl(SBAuthorizationRuleInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "AuthorizationRules"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public NamespaceSBAuthorizationRuleImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public NamespaceSBAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java new file mode 100644 index 000000000000..a3d14e72a7b3 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java @@ -0,0 +1,267 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBNamespace; +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.servicebus.v2017_04_01.CheckNameAvailabilityResult; +import com.microsoft.azure.management.servicebus.v2017_04_01.NameSpaceType; +import com.microsoft.azure.management.servicebus.v2017_04_01.NamespaceSBAuthorizationRule; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessKeys; +import com.microsoft.azure.management.servicebus.v2017_04_01.RegenerateAccessKeyParameters; +import com.microsoft.azure.management.servicebus.v2017_04_01.NetworkRuleSet; + +class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { + protected NamespacesImpl(ServiceBusManager 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 SBNamespace call(SBNamespaceInner 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 SBNamespace call(SBNamespaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public SBNamespaceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable migrateAsync(String resourceGroupName, String namespaceName, NameSpaceType targetNamespaceType) { + NamespacesInner client = this.inner(); + return client.migrateAsync(resourceGroupName, namespaceName, targetNamespaceType).toCompletable(); + } + + @Override + public Observable checkNameAvailabilityMethodAsync(String name) { + NamespacesInner client = this.inner(); + return client.checkNameAvailabilityMethodAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResult call(CheckNameAvailabilityResultInner inner) { + return new CheckNameAvailabilityResultImpl(inner, manager()); + } + }); + } + + @Override + protected SBNamespaceImpl wrapModel(SBNamespaceInner inner) { + return new SBNamespaceImpl(inner.name(), inner, manager()); + } + + @Override + protected SBNamespaceImpl wrapModel(String name) { + return new SBNamespaceImpl(name, new SBNamespaceInner(), this.manager()); + } + + @Override + public NamespaceSBAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private NamespaceSBAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new NamespaceSBAuthorizationRuleImpl(name, this.manager()); + } + + private NamespaceSBAuthorizationRuleImpl wrapNamespaceSBAuthorizationRuleModel(SBAuthorizationRuleInner inner) { + return new NamespaceSBAuthorizationRuleImpl(inner, manager()); + } + + private Observable getSBAuthorizationRuleInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "AuthorizationRules"); + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + NamespacesInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + NamespacesInner client = this.inner(); + return client.createOrUpdateNetworkRuleSetAsync(resourceGroupName, namespaceName, parameters) + .map(new Func1() { + @Override + public NetworkRuleSet call(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + }); + } + + @Override + public Observable getNetworkRuleSetAsync(String resourceGroupName, String namespaceName) { + NamespacesInner client = this.inner(); + return client.getNetworkRuleSetAsync(resourceGroupName, namespaceName) + .map(new Func1() { + @Override + public NetworkRuleSet call(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java new file mode 100644 index 000000000000..9ccdbb2c48dc --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java @@ -0,0 +1,2187 @@ +/** + * 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.servicebus.v2017_04_01.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.servicebus.v2017_04_01.AccessRights; +import com.microsoft.azure.management.servicebus.v2017_04_01.CheckNameAvailability; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.management.servicebus.v2017_04_01.NameSpaceType; +import com.microsoft.azure.management.servicebus.v2017_04_01.RegenerateAccessKeyParameters; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBNamespaceMigrate; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBNamespaceUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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 ServiceBusManagementClientImpl 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, ServiceBusManagementClientImpl 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.servicebus.v2017_04_01.Namespaces checkNameAvailabilityMethod" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability") + Observable> checkNameAvailabilityMethod(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailability parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body SBNamespaceInner 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.servicebus.v2017_04_01.Namespaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body SBNamespaceInner 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.servicebus.v2017_04_01.Namespaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body SBNamespaceUpdateParameters 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.servicebus.v2017_04_01.Namespaces listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SBAuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body RegenerateAccessKeyParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces migrate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate") + Observable> migrate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SBNamespaceMigrate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces createOrUpdateNetworkRuleSet" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") + Observable> createOrUpdateNetworkRuleSet(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body NetworkRuleSetInner parameters, @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.servicebus.v2017_04_01.Namespaces getNetworkRuleSet" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default") + Observable> getNetworkRuleSet(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.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.servicebus.v2017_04_01.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.servicebus.v2017_04_01.Namespaces listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailabilityMethod(String name) { + return checkNameAvailabilityMethodWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @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 checkNameAvailabilityMethodAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityMethodWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityMethodAsync(String name) { + return checkNameAvailabilityMethodWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check the give namespace name availability. + * + * @param name The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable> checkNameAvailabilityMethodWithServiceResponseAsync(String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailability parameters = new CheckNameAvailability(); + parameters.withName(name); + return service.checkNameAvailabilityMethod(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 = checkNameAvailabilityMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityMethodDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the available namespaces within the 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<SBNamespaceInner> 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(); + } + }; + } + + /** + * Gets all the available namespaces within the 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); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBNamespaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBNamespaceInner> 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)); + } + }); + } + + /** + * Gets all the available namespaces within the subscription, irrespective of the resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBNamespaceInner> 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); + } + + /** + * Gets 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<SBNamespaceInner> 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(); + } + }; + } + + /** + * Gets 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); + } + + /** + * Gets 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<SBNamespaceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets 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<SBNamespaceInner> 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)); + } + }); + } + + /** + * Gets 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<SBNamespaceInner> 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 service 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 supplied to create 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 SBNamespaceInner object if successful. + */ + public SBNamespaceInner createOrUpdate(String resourceGroupName, String namespaceName, SBNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a service 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 supplied to create 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, SBNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, SBNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, SBNamespaceInner>() { + @Override + public SBNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, SBNamespaceInner 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 service 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 supplied to create 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 SBNamespaceInner object if successful. + */ + public SBNamespaceInner beginCreateOrUpdate(String resourceGroupName, String namespaceName, SBNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a service 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 supplied to create 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, SBNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBNamespaceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, SBNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, SBNamespaceInner>() { + @Override + public SBNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a service 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 supplied to create a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBNamespaceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, SBNamespaceInner 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 a description for 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 SBNamespaceInner object if successful. + */ + public SBNamespaceInner getByResourceGroup(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets a description for 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 a description for 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 SBNamespaceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, SBNamespaceInner>() { + @Override + public SBNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a description for 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 SBNamespaceInner 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()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates a service 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 supplied to update 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 SBNamespaceInner object if successful. + */ + public SBNamespaceInner update(String resourceGroupName, String namespaceName, SBNamespaceUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Updates a service 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 supplied to update 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, SBNamespaceUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Updates a service 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 supplied to update a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBNamespaceInner object + */ + public Observable updateAsync(String resourceGroupName, String namespaceName, SBNamespaceUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, SBNamespaceInner>() { + @Override + public SBNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a service 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 supplied to update a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBNamespaceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String namespaceName, SBNamespaceUpdateParameters 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 the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization 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> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listAuthorizationRulesSinglePageAsync(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(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization 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<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(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.listAuthorizationRules(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an authorization rule for a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + SBAuthorizationRuleInner parameters = new SBAuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an authorization rule for a namespace by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings for the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation Migrate the given namespace to provided name type. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param targetNamespaceType Type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + * @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 migrate(String resourceGroupName, String namespaceName, NameSpaceType targetNamespaceType) { + migrateWithServiceResponseAsync(resourceGroupName, namespaceName, targetNamespaceType).toBlocking().single().body(); + } + + /** + * This operation Migrate the given namespace to provided name type. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param targetNamespaceType Type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + * @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 migrateAsync(String resourceGroupName, String namespaceName, NameSpaceType targetNamespaceType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(migrateWithServiceResponseAsync(resourceGroupName, namespaceName, targetNamespaceType), serviceCallback); + } + + /** + * This operation Migrate the given namespace to provided name type. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param targetNamespaceType Type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable migrateAsync(String resourceGroupName, String namespaceName, NameSpaceType targetNamespaceType) { + return migrateWithServiceResponseAsync(resourceGroupName, namespaceName, targetNamespaceType).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation Migrate the given namespace to provided name type. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param targetNamespaceType Type of namespaces. Possible values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> migrateWithServiceResponseAsync(String resourceGroupName, String namespaceName, NameSpaceType targetNamespaceType) { + 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."); + } + if (targetNamespaceType == null) { + throw new IllegalArgumentException("Parameter targetNamespaceType is required and cannot be null."); + } + SBNamespaceMigrate parameters = new SBNamespaceMigrate(); + parameters.withTargetNamespaceType(targetNamespaceType); + return service.migrate(resourceGroupName, namespaceName, 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 = migrateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse migrateDelegate(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); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace 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 NetworkRuleSetInner object if successful. + */ + public NetworkRuleSetInner createOrUpdateNetworkRuleSet(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + return createOrUpdateNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace 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 createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkRuleSetInner object + */ + public Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + return createOrUpdateNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, NetworkRuleSetInner>() { + @Override + public NetworkRuleSetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkRuleSetInner object + */ + public Observable> createOrUpdateNetworkRuleSetWithServiceResponseAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateNetworkRuleSet(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateNetworkRuleSetDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateNetworkRuleSetDelegate(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 NetworkRuleSet 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 NetworkRuleSetInner object if successful. + */ + public NetworkRuleSetInner getNetworkRuleSet(String resourceGroupName, String namespaceName) { + return getNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets NetworkRuleSet 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 getNetworkRuleSetAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Gets NetworkRuleSet 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 NetworkRuleSetInner object + */ + public Observable getNetworkRuleSetAsync(String resourceGroupName, String namespaceName) { + return getNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, NetworkRuleSetInner>() { + @Override + public NetworkRuleSetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets NetworkRuleSet 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 NetworkRuleSetInner object + */ + public Observable> getNetworkRuleSetWithServiceResponseAsync(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.getNetworkRuleSet(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 = getNetworkRuleSetDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getNetworkRuleSetDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the available namespaces within the 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<SBNamespaceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the available namespaces within the 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); + } + + /** + * Gets all the available namespaces within the 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<SBNamespaceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the available namespaces within the 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<SBNamespaceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the available namespaces within the 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<SBNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets 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<SBNamespaceInner> 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(); + } + }; + } + + /** + * Gets 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); + } + + /** + * Gets 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<SBNamespaceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets 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<SBNamespaceInner> 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)); + } + }); + } + + /** + * Gets 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<SBNamespaceInner> 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 the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the authorization rules for 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<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the authorization rules for 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<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java new file mode 100644 index 000000000000..2b0eae6e1e38 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java @@ -0,0 +1,60 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.NetworkRuleSet; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.DefaultAction; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.NWRuleSetIpRules; +import com.microsoft.azure.management.servicebus.v2017_04_01.NWRuleSetVirtualNetworkRules; + +class NetworkRuleSetImpl extends WrapperImpl implements NetworkRuleSet { + private final ServiceBusManager manager; + NetworkRuleSetImpl(NetworkRuleSetInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public DefaultAction defaultAction() { + return this.inner().defaultAction(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List ipRules() { + return this.inner().ipRules(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List virtualNetworkRules() { + return this.inner().virtualNetworkRules(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetInner.java new file mode 100644 index 000000000000..6e2f85b111f5 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetInner.java @@ -0,0 +1,103 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.DefaultAction; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.NWRuleSetVirtualNetworkRules; +import com.microsoft.azure.management.servicebus.v2017_04_01.NWRuleSetIpRules; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of NetworkRuleSet resource. + */ +@JsonFlatten +public class NetworkRuleSetInner extends ProxyResource { + /** + * Default Action for Network Rule Set. Possible values include: 'Allow', + * 'Deny'. + */ + @JsonProperty(value = "properties.defaultAction") + private DefaultAction defaultAction; + + /** + * List VirtualNetwork Rules. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /** + * List of IpRules. + */ + @JsonProperty(value = "properties.ipRules") + private List ipRules; + + /** + * Get default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'. + * + * @return the defaultAction value + */ + public DefaultAction defaultAction() { + return this.defaultAction; + } + + /** + * Set default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSetInner object itself. + */ + public NetworkRuleSetInner withDefaultAction(DefaultAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get list VirtualNetwork Rules. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set list VirtualNetwork Rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSetInner object itself. + */ + public NetworkRuleSetInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get list of IpRules. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set list of IpRules. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSetInner object itself. + */ + public NetworkRuleSetInner withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..de6f30956b88 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ServiceBusManager manager; + OperationImpl(OperationInner inner, ServiceBusManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationInner.java new file mode 100644 index 000000000000..f00a548e6774 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A ServiceBus REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..6050810be5b2 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ServiceBusManager manager; + + OperationsImpl(ServiceBusManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..a5ba6915b3a8 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Operations list" }) + @GET("providers/Microsoft.ServiceBus/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @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<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @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<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available ServiceBus REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws 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/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PageImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PageImpl.java new file mode 100644 index 000000000000..6e93f3a67de2 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionImpl.java new file mode 100644 index 000000000000..707d8abb630a --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionImpl.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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegion; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegionProperties; + +class PremiumMessagingRegionImpl extends GroupableResourceCoreImpl implements PremiumMessagingRegion { + PremiumMessagingRegionImpl(String name, PremiumMessagingRegionInner inner, ServiceBusManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + PremiumMessagingRegionsInner client = this.manager().inner().premiumMessagingRegions(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + PremiumMessagingRegionsInner client = this.manager().inner().premiumMessagingRegions(); + return null; // NOP updateResourceAsync implementation as update is not supported + } + + @Override + protected Observable getInnerAsync() { + PremiumMessagingRegionsInner client = this.manager().inner().premiumMessagingRegions(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + + + @Override + public PremiumMessagingRegionProperties properties() { + return this.inner().properties(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionInner.java new file mode 100644 index 000000000000..dbaf948c96b8 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.management.servicebus.v2017_04_01.ResourceNamespacePatch; + +/** + * Premium Messaging Region. + */ +public class PremiumMessagingRegionInner extends ResourceNamespacePatch { + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private PremiumMessagingRegionProperties properties; + + /** + * Get the properties value. + * + * @return the properties value + */ + public PremiumMessagingRegionProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the PremiumMessagingRegionInner object itself. + */ + public PremiumMessagingRegionInner withProperties(PremiumMessagingRegionProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionsImpl.java new file mode 100644 index 000000000000..3f1828927b1c --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionsImpl.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegions; +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegion; +import rx.Observable; +import rx.Completable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class PremiumMessagingRegionsImpl extends GroupableResourcesCoreImpl implements PremiumMessagingRegions { + protected PremiumMessagingRegionsImpl(ServiceBusManager manager) { + super(manager.inner().premiumMessagingRegions(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + return null; // NOP Retrieve by resource group not supported + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + PremiumMessagingRegionsInner client = this.inner(); + return Completable.error(new Throwable("Delete by RG not supported for this resource")); // NOP Delete by RG not supported + } + + @Override + public PagedList list() { + PremiumMessagingRegionsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + PremiumMessagingRegionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PremiumMessagingRegion call(PremiumMessagingRegionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + protected PremiumMessagingRegionImpl wrapModel(PremiumMessagingRegionInner inner) { + return new PremiumMessagingRegionImpl(inner.name(), inner, manager()); + } + + @Override + protected PremiumMessagingRegionImpl wrapModel(String name) { + return null; // Model is not creatable + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionsInner.java new file mode 100644 index 000000000000..3853ef9ac50f --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/PremiumMessagingRegionsInner.java @@ -0,0 +1,287 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PremiumMessagingRegions. + */ +public class PremiumMessagingRegionsInner { + /** The Retrofit service to perform REST calls. */ + private PremiumMessagingRegionsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of PremiumMessagingRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PremiumMessagingRegionsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(PremiumMessagingRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PremiumMessagingRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface PremiumMessagingRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions") + 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.servicebus.v2017_04_01.PremiumMessagingRegions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @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<PremiumMessagingRegionInner> 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(); + } + }; + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @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); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PremiumMessagingRegionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PremiumMessagingRegionInner> 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)); + } + }); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PremiumMessagingRegionInner> 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); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @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<PremiumMessagingRegionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @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<PremiumMessagingRegionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + * @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<PremiumMessagingRegionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available premium messaging regions for servicebus. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PremiumMessagingRegionInner> 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); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueueNamespaceSBAuthorizationRuleImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueueNamespaceSBAuthorizationRuleImpl.java new file mode 100644 index 000000000000..d73495bd91ba --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueueNamespaceSBAuthorizationRuleImpl.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.QueueNamespaceSBAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; + +class QueueNamespaceSBAuthorizationRuleImpl extends CreatableUpdatableImpl implements QueueNamespaceSBAuthorizationRule, QueueNamespaceSBAuthorizationRule.Definition, QueueNamespaceSBAuthorizationRule.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String queueName; + private String authorizationRuleName; + private List crights; + private List urights; + + QueueNamespaceSBAuthorizationRuleImpl(String name, ServiceBusManager manager) { + super(name, new SBAuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + QueueNamespaceSBAuthorizationRuleImpl(SBAuthorizationRuleInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.queueName = IdParsingUtils.getValueFromIdByName(inner.id(), "queues"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public QueueNamespaceSBAuthorizationRuleImpl withExistingQueue(String resourceGroupName, String namespaceName, String queueName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.queueName = queueName; + return this; + } + + @Override + public QueueNamespaceSBAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java new file mode 100644 index 000000000000..0211a389ac2e --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java @@ -0,0 +1,166 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Queues; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBQueue; +import com.microsoft.azure.management.servicebus.v2017_04_01.QueueNamespaceSBAuthorizationRule; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessKeys; +import com.microsoft.azure.management.servicebus.v2017_04_01.RegenerateAccessKeyParameters; + +class QueuesImpl extends WrapperImpl implements Queues { + private final ServiceBusManager manager; + + QueuesImpl(ServiceBusManager manager) { + super(manager.inner().queues()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public SBQueueImpl define(String name) { + return wrapModel(name); + } + + private SBQueueImpl wrapModel(SBQueueInner inner) { + return new SBQueueImpl(inner, manager()); + } + + private SBQueueImpl wrapModel(String name) { + return new SBQueueImpl(name, this.manager()); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + QueuesInner client = this.inner(); + return client.listByNamespaceAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SBQueue call(SBQueueInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String queueName) { + QueuesInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, queueName) + .map(new Func1() { + @Override + public SBQueue call(SBQueueInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String queueName) { + QueuesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, queueName).toCompletable(); + } + + @Override + public QueueNamespaceSBAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private QueueNamespaceSBAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new QueueNamespaceSBAuthorizationRuleImpl(name, this.manager()); + } + + private QueueNamespaceSBAuthorizationRuleImpl wrapQueueNamespaceSBAuthorizationRuleModel(SBAuthorizationRuleInner inner) { + return new QueueNamespaceSBAuthorizationRuleImpl(inner, manager()); + } + + private Observable getSBAuthorizationRuleInnerUsingQueuesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String queueName = IdParsingUtils.getValueFromIdByName(id, "queues"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + QueuesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) + .map(new Func1() { + @Override + public QueueNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapQueueNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + QueuesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, queueName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public QueueNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapQueueNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + QueuesInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + QueuesInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesInner.java new file mode 100644 index 000000000000..f25949363da2 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesInner.java @@ -0,0 +1,1526 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.management.servicebus.v2017_04_01.RegenerateAccessKeyParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Queues. + */ +public class QueuesInner { + /** The Retrofit service to perform REST calls. */ + private QueuesService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of QueuesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueuesInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(QueuesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Queues to be + * used by Retrofit to perform actually REST calls. + */ + interface QueuesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues") + Observable> listByNamespace(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("subscriptionId") String subscriptionId, @Body SBQueueInner 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.servicebus.v2017_04_01.Queues delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @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.servicebus.v2017_04_01.Queues get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @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.servicebus.v2017_04_01.Queues listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @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.servicebus.v2017_04_01.Queues createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SBAuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body RegenerateAccessKeyParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues listByNamespaceNext" }) + @GET + Observable> listByNamespaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Queues listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the queues within 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<SBQueueInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the queues within 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<SBQueueInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the queues within 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<SBQueueInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBQueueInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer skip = null; + final Integer top = null; + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBQueueInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBQueueInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the queues within a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBQueueInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the queues within a namespace. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBQueueInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue 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 SBQueueInner object if successful. + */ + public SBQueueInner createOrUpdate(String resourceGroupName, String namespaceName, String queueName, SBQueueInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String queueName, SBQueueInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters), serviceCallback); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBQueueInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String queueName, SBQueueInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters).map(new Func1, SBQueueInner>() { + @Override + public SBQueueInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Service Bus queue. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param parameters Parameters supplied to create or update a queue resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBQueueInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, SBQueueInner 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String queueName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).toBlocking().single().body(); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String queueName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName), serviceCallback); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String queueName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a queue from the specified namespace in a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue 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 SBQueueInner object if successful. + */ + public SBQueueInner get(String resourceGroupName, String namespaceName, String queueName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).toBlocking().single().body(); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String queueName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName), serviceCallback); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBQueueInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String queueName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).map(new Func1, SBQueueInner>() { + @Override + public SBQueueInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a description for the specified queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBQueueInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue 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<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String queueName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, queueName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param queueName The queue name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String queueName) { + 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 (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, rights).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an authorization rule for a queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + SBAuthorizationRuleInner parameters = new SBAuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a queue authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an authorization rule for a queue by rule name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings to the queue. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param queueName The queue name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (queueName == null) { + throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.regenerateKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the queues within 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<SBQueueInner> object if successful. + */ + public PagedList listByNamespaceNext(final String nextPageLink) { + ServiceResponse> response = listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the queues within a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the queues within 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<SBQueueInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the queues within 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<SBQueueInner> object + */ + public Observable>> listByNamespaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the queues within 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<SBQueueInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByNamespaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all authorization rules for a queue. + * + * @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<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all authorization rules for a queue. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all authorization rules for a queue. + * + * @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<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + * @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<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all authorization rules for a queue. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RegionsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RegionsImpl.java new file mode 100644 index 000000000000..05fb0e1ca5af --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RegionsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Regions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegion; + +class RegionsImpl extends WrapperImpl implements Regions { + private final ServiceBusManager manager; + + RegionsImpl(ServiceBusManager manager) { + super(manager.inner().regions()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable listBySkuAsync(final String sku) { + RegionsInner client = this.inner(); + return client.listBySkuAsync(sku) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PremiumMessagingRegion call(PremiumMessagingRegionInner inner) { + return new PremiumMessagingRegionImpl(inner.name(), inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RegionsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RegionsInner.java new file mode 100644 index 000000000000..ce00153d8226 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RegionsInner.java @@ -0,0 +1,295 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Regions. + */ +public class RegionsInner { + /** The Retrofit service to perform REST calls. */ + private RegionsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of RegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegionsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(RegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Regions to be + * used by Retrofit to perform actually REST calls. + */ + interface RegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Regions listBySku" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions") + Observable> listBySku(@Path("subscriptionId") String subscriptionId, @Path("sku") String sku, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Regions listBySkuNext" }) + @GET + Observable> listBySkuNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PremiumMessagingRegionInner> object if successful. + */ + public PagedList listBySku(final String sku) { + ServiceResponse> response = listBySkuSinglePageAsync(sku).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBySkuAsync(final String sku, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySkuSinglePageAsync(sku), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PremiumMessagingRegionInner> object + */ + public Observable> listBySkuAsync(final String sku) { + return listBySkuWithServiceResponseAsync(sku) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PremiumMessagingRegionInner> object + */ + public Observable>> listBySkuWithServiceResponseAsync(final String sku) { + return listBySkuSinglePageAsync(sku) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBySkuNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + ServiceResponse> * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PremiumMessagingRegionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySkuSinglePageAsync(final String sku) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (sku == null) { + throw new IllegalArgumentException("Parameter sku is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBySku(this.client.subscriptionId(), sku, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySkuDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySkuDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the available Regions for a given sku. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PremiumMessagingRegionInner> object if successful. + */ + public PagedList listBySkuNext(final String nextPageLink) { + ServiceResponse> response = listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available Regions for a given sku. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBySkuNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySkuNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available Regions for a given sku. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PremiumMessagingRegionInner> object + */ + public Observable> listBySkuNextAsync(final String nextPageLink) { + return listBySkuNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PremiumMessagingRegionInner> object + */ + public Observable>> listBySkuNextWithServiceResponseAsync(final String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBySkuNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PremiumMessagingRegionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySkuNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBySkuNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySkuNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySkuNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RuleImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RuleImpl.java new file mode 100644 index 000000000000..2ce9493ada83 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RuleImpl.java @@ -0,0 +1,148 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.Rule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.Action; +import com.microsoft.azure.management.servicebus.v2017_04_01.FilterType; +import com.microsoft.azure.management.servicebus.v2017_04_01.SqlFilter; +import com.microsoft.azure.management.servicebus.v2017_04_01.CorrelationFilter; + +class RuleImpl extends CreatableUpdatableImpl implements Rule, Rule.Definition, Rule.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + private String subscriptionName; + private String ruleName; + + RuleImpl(String name, ServiceBusManager manager) { + super(name, new RuleInner()); + this.manager = manager; + // Set resource name + this.ruleName = name; + // + } + + RuleImpl(RuleInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.ruleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + this.subscriptionName = IdParsingUtils.getValueFromIdByName(inner.id(), "subscriptions"); + this.ruleName = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + RulesInner client = this.manager().inner().rules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.ruleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + RulesInner client = this.manager().inner().rules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.ruleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RulesInner client = this.manager().inner().rules(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.ruleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Action action() { + return this.inner().action(); + } + + @Override + public CorrelationFilter correlationFilter() { + return this.inner().correlationFilter(); + } + + @Override + public FilterType filterType() { + return this.inner().filterType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SqlFilter sqlFilter() { + return this.inner().sqlFilter(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public RuleImpl withExistingSubscription(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.topicName = topicName; + this.subscriptionName = subscriptionName; + return this; + } + + @Override + public RuleImpl withAction(Action action) { + this.inner().withAction(action); + return this; + } + + @Override + public RuleImpl withCorrelationFilter(CorrelationFilter correlationFilter) { + this.inner().withCorrelationFilter(correlationFilter); + return this; + } + + @Override + public RuleImpl withFilterType(FilterType filterType) { + this.inner().withFilterType(filterType); + return this; + } + + @Override + public RuleImpl withSqlFilter(SqlFilter sqlFilter) { + this.inner().withSqlFilter(sqlFilter); + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RuleInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RuleInner.java new file mode 100644 index 000000000000..e6879cdc5e96 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RuleInner.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.Action; +import com.microsoft.azure.management.servicebus.v2017_04_01.FilterType; +import com.microsoft.azure.management.servicebus.v2017_04_01.SqlFilter; +import com.microsoft.azure.management.servicebus.v2017_04_01.CorrelationFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of Rule Resource. + */ +@JsonFlatten +public class RuleInner extends ProxyResource { + /** + * Represents the filter actions which are allowed for the transformation + * of a message that have been matched by a filter expression. + */ + @JsonProperty(value = "properties.action") + private Action action; + + /** + * Filter type that is evaluated against a BrokeredMessage. Possible values + * include: 'SqlFilter', 'CorrelationFilter'. + */ + @JsonProperty(value = "properties.filterType") + private FilterType filterType; + + /** + * Properties of sqlFilter. + */ + @JsonProperty(value = "properties.sqlFilter") + private SqlFilter sqlFilter; + + /** + * Properties of correlationFilter. + */ + @JsonProperty(value = "properties.correlationFilter") + private CorrelationFilter correlationFilter; + + /** + * Get represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + * + * @param action the action value to set + * @return the RuleInner object itself. + */ + public RuleInner withAction(Action action) { + this.action = action; + return this; + } + + /** + * Get filter type that is evaluated against a BrokeredMessage. Possible values include: 'SqlFilter', 'CorrelationFilter'. + * + * @return the filterType value + */ + public FilterType filterType() { + return this.filterType; + } + + /** + * Set filter type that is evaluated against a BrokeredMessage. Possible values include: 'SqlFilter', 'CorrelationFilter'. + * + * @param filterType the filterType value to set + * @return the RuleInner object itself. + */ + public RuleInner withFilterType(FilterType filterType) { + this.filterType = filterType; + return this; + } + + /** + * Get properties of sqlFilter. + * + * @return the sqlFilter value + */ + public SqlFilter sqlFilter() { + return this.sqlFilter; + } + + /** + * Set properties of sqlFilter. + * + * @param sqlFilter the sqlFilter value to set + * @return the RuleInner object itself. + */ + public RuleInner withSqlFilter(SqlFilter sqlFilter) { + this.sqlFilter = sqlFilter; + return this; + } + + /** + * Get properties of correlationFilter. + * + * @return the correlationFilter value + */ + public CorrelationFilter correlationFilter() { + return this.correlationFilter; + } + + /** + * Set properties of correlationFilter. + * + * @param correlationFilter the correlationFilter value to set + * @return the RuleInner object itself. + */ + public RuleInner withCorrelationFilter(CorrelationFilter correlationFilter) { + this.correlationFilter = correlationFilter; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java new file mode 100644 index 000000000000..b07be1440337 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java @@ -0,0 +1,81 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Rules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.Rule; + +class RulesImpl extends WrapperImpl implements Rules { + private final ServiceBusManager manager; + + RulesImpl(ServiceBusManager manager) { + super(manager.inner().rules()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public RuleImpl define(String name) { + return wrapModel(name); + } + + private RuleImpl wrapModel(RuleInner inner) { + return new RuleImpl(inner, manager()); + } + + private RuleImpl wrapModel(String name) { + return new RuleImpl(name, this.manager()); + } + + @Override + public Observable listBySubscriptionsAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName) { + RulesInner client = this.inner(); + return client.listBySubscriptionsAsync(resourceGroupName, namespaceName, topicName, subscriptionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Rule call(RuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + RulesInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName) + .map(new Func1() { + @Override + public Rule call(RuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + RulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName).toCompletable(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesInner.java new file mode 100644 index 000000000000..0feeb29e8f2a --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesInner.java @@ -0,0 +1,809 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.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 Rules. + */ +public class RulesInner { + /** The Retrofit service to perform REST calls. */ + private RulesService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of RulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RulesInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(RulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Rules to be + * used by Retrofit to perform actually REST calls. + */ + interface RulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Rules listBySubscriptions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules") + Observable> listBySubscriptions(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Rules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Body RuleInner 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.servicebus.v2017_04_01.Rules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @Path("ruleName") String ruleName, @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.servicebus.v2017_04_01.Rules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @Path("ruleName") String ruleName, @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.servicebus.v2017_04_01.Rules listBySubscriptionsNext" }) + @GET + Observable> listBySubscriptionsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription 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<RuleInner> object if successful. + */ + public PagedList listBySubscriptions(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName) { + ServiceResponse> response = listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription 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> listBySubscriptionsAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName, subscriptionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RuleInner> object + */ + public Observable> listBySubscriptionsAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName) { + return listBySubscriptionsWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RuleInner> object + */ + public Observable>> listBySubscriptionsWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName) { + return listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName, subscriptionName) + .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(listBySubscriptionsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionsSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer skip = null; + final Integer top = null; + return service.listBySubscriptions(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<RuleInner> object if successful. + */ + public PagedList listBySubscriptions(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName, final Integer skip, final Integer top) { + ServiceResponse> response = listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName, subscriptionName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBySubscriptionsAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName, subscriptionName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RuleInner> object + */ + public Observable> listBySubscriptionsAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName, final Integer skip, final Integer top) { + return listBySubscriptionsWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RuleInner> object + */ + public Observable>> listBySubscriptionsWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName, final Integer skip, final Integer top) { + return listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName, subscriptionName, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBySubscriptionsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param topicName The topic name. + ServiceResponse> * @param subscriptionName The subscription name. + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionsSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName, final String subscriptionName, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName 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.listBySubscriptions(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySubscriptionsDelegate(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 a new rule and updates an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @param parameters Parameters supplied to create a rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RuleInner object if successful. + */ + public RuleInner createOrUpdate(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName, RuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new rule and updates an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @param parameters Parameters supplied to create a rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName, RuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters), serviceCallback); + } + + /** + * Creates a new rule and updates an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @param parameters Parameters supplied to create a rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName, RuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters).map(new Func1, RuleInner>() { + @Override + public RuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new rule and updates an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @param parameters Parameters supplied to create a rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName, RuleInner 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The 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 delete(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The 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 deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName), serviceCallback); + } + + /** + * Deletes an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the description for the specified rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The 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 RuleInner object if successful. + */ + public RuleInner get(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieves the description for the specified rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The 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 getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName), serviceCallback); + } + + /** + * Retrieves the description for the specified rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RuleInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName).map(new Func1, RuleInner>() { + @Override + public RuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the description for the specified rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param ruleName The rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List all the rules within given topic-subscription. + * + * @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<RuleInner> object if successful. + */ + public PagedList listBySubscriptionsNext(final String nextPageLink) { + ServiceResponse> response = listBySubscriptionsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the rules within given topic-subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBySubscriptionsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the rules within given topic-subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RuleInner> object + */ + public Observable> listBySubscriptionsNextAsync(final String nextPageLink) { + return listBySubscriptionsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RuleInner> object + */ + public Observable>> listBySubscriptionsNextWithServiceResponseAsync(final String nextPageLink) { + return listBySubscriptionsNextSinglePageAsync(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(listBySubscriptionsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the rules within given topic-subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionsNextSinglePageAsync(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.listBySubscriptionsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySubscriptionsNextDelegate(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/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBAuthorizationRuleInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBAuthorizationRuleInner.java new file mode 100644 index 000000000000..ff5c467c56e2 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBAuthorizationRuleInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of a namespace authorization rule. + */ +@JsonFlatten +public class SBAuthorizationRuleInner extends ProxyResource { + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "properties.rights", required = true) + private List rights; + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the SBAuthorizationRuleInner object itself. + */ + public SBAuthorizationRuleInner withRights(List rights) { + this.rights = rights; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBNamespaceImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBNamespaceImpl.java new file mode 100644 index 000000000000..4d8e8d92e720 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBNamespaceImpl.java @@ -0,0 +1,109 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBNamespace; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBNamespaceUpdateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBSku; +import rx.functions.Func1; + +class SBNamespaceImpl extends GroupableResourceCoreImpl implements SBNamespace, SBNamespace.Definition, SBNamespace.Update { + private SBNamespaceUpdateParameters updateParameter; + SBNamespaceImpl(String name, SBNamespaceInner inner, ServiceBusManager manager) { + super(name, inner, manager); + this.updateParameter = new SBNamespaceUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public SBNamespaceInner call(SBNamespaceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public SBNamespaceInner call(SBNamespaceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .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; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new SBNamespaceUpdateParameters(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @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 SBSku sku() { + return this.inner().sku(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public SBNamespaceImpl withSku(SBSku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBNamespaceInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBNamespaceInner.java new file mode 100644 index 000000000000..70d1a80ab3c7 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBNamespaceInner.java @@ -0,0 +1,123 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.SBSku; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Description of a namespace resource. + */ +@JsonFlatten +public class SBNamespaceInner extends Resource { + /** + * Properties of Sku. + */ + @JsonProperty(value = "sku") + private SBSku 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; + + /** + * Get properties of Sku. + * + * @return the sku value + */ + public SBSku sku() { + return this.sku; + } + + /** + * Set properties of Sku. + * + * @param sku the sku value to set + * @return the SBNamespaceInner object itself. + */ + public SBNamespaceInner withSku(SBSku 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; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBQueueImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBQueueImpl.java new file mode 100644 index 000000000000..c78bee1c8837 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBQueueImpl.java @@ -0,0 +1,293 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.SBQueue; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.servicebus.v2017_04_01.MessageCountDetails; +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; + +class SBQueueImpl extends CreatableUpdatableImpl implements SBQueue, SBQueue.Definition, SBQueue.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String queueName; + + SBQueueImpl(String name, ServiceBusManager manager) { + super(name, new SBQueueInner()); + this.manager = manager; + // Set resource name + this.queueName = name; + // + } + + SBQueueImpl(SBQueueInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.queueName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.queueName = IdParsingUtils.getValueFromIdByName(inner.id(), "queues"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.queueName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + QueuesInner client = this.manager().inner().queues(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.queueName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime accessedAt() { + return this.inner().accessedAt(); + } + + @Override + public Period autoDeleteOnIdle() { + return this.inner().autoDeleteOnIdle(); + } + + @Override + public MessageCountDetails countDetails() { + return this.inner().countDetails(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Boolean deadLetteringOnMessageExpiration() { + return this.inner().deadLetteringOnMessageExpiration(); + } + + @Override + public Period defaultMessageTimeToLive() { + return this.inner().defaultMessageTimeToLive(); + } + + @Override + public Period duplicateDetectionHistoryTimeWindow() { + return this.inner().duplicateDetectionHistoryTimeWindow(); + } + + @Override + public Boolean enableBatchedOperations() { + return this.inner().enableBatchedOperations(); + } + + @Override + public Boolean enableExpress() { + return this.inner().enableExpress(); + } + + @Override + public Boolean enablePartitioning() { + return this.inner().enablePartitioning(); + } + + @Override + public String forwardDeadLetteredMessagesTo() { + return this.inner().forwardDeadLetteredMessagesTo(); + } + + @Override + public String forwardTo() { + return this.inner().forwardTo(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Period lockDuration() { + return this.inner().lockDuration(); + } + + @Override + public Integer maxDeliveryCount() { + return this.inner().maxDeliveryCount(); + } + + @Override + public Integer maxSizeInMegabytes() { + return this.inner().maxSizeInMegabytes(); + } + + @Override + public Long messageCount() { + return this.inner().messageCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresDuplicateDetection() { + return this.inner().requiresDuplicateDetection(); + } + + @Override + public Boolean requiresSession() { + return this.inner().requiresSession(); + } + + @Override + public Long sizeInBytes() { + return this.inner().sizeInBytes(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public SBQueueImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public SBQueueImpl withAutoDeleteOnIdle(Period autoDeleteOnIdle) { + this.inner().withAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + @Override + public SBQueueImpl withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.inner().withDeadLetteringOnMessageExpiration(deadLetteringOnMessageExpiration); + return this; + } + + @Override + public SBQueueImpl withDefaultMessageTimeToLive(Period defaultMessageTimeToLive) { + this.inner().withDefaultMessageTimeToLive(defaultMessageTimeToLive); + return this; + } + + @Override + public SBQueueImpl withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow) { + this.inner().withDuplicateDetectionHistoryTimeWindow(duplicateDetectionHistoryTimeWindow); + return this; + } + + @Override + public SBQueueImpl withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.inner().withEnableBatchedOperations(enableBatchedOperations); + return this; + } + + @Override + public SBQueueImpl withEnableExpress(Boolean enableExpress) { + this.inner().withEnableExpress(enableExpress); + return this; + } + + @Override + public SBQueueImpl withEnablePartitioning(Boolean enablePartitioning) { + this.inner().withEnablePartitioning(enablePartitioning); + return this; + } + + @Override + public SBQueueImpl withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo) { + this.inner().withForwardDeadLetteredMessagesTo(forwardDeadLetteredMessagesTo); + return this; + } + + @Override + public SBQueueImpl withForwardTo(String forwardTo) { + this.inner().withForwardTo(forwardTo); + return this; + } + + @Override + public SBQueueImpl withLockDuration(Period lockDuration) { + this.inner().withLockDuration(lockDuration); + return this; + } + + @Override + public SBQueueImpl withMaxDeliveryCount(Integer maxDeliveryCount) { + this.inner().withMaxDeliveryCount(maxDeliveryCount); + return this; + } + + @Override + public SBQueueImpl withMaxSizeInMegabytes(Integer maxSizeInMegabytes) { + this.inner().withMaxSizeInMegabytes(maxSizeInMegabytes); + return this; + } + + @Override + public SBQueueImpl withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.inner().withRequiresDuplicateDetection(requiresDuplicateDetection); + return this; + } + + @Override + public SBQueueImpl withRequiresSession(Boolean requiresSession) { + this.inner().withRequiresSession(requiresSession); + return this; + } + + @Override + public SBQueueImpl withStatus(EntityStatus status) { + this.inner().withStatus(status); + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBQueueInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBQueueInner.java new file mode 100644 index 000000000000..88bae1cfdcbe --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBQueueInner.java @@ -0,0 +1,522 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.MessageCountDetails; +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of queue Resource. + */ +@JsonFlatten +public class SBQueueInner extends ProxyResource { + /** + * Message Count Details. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * The exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Last time a message was sent, or the last time there was a receive + * request to this queue. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * The size of the queue, in bytes. + */ + @JsonProperty(value = "properties.sizeInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long sizeInBytes; + + /** + * The number of messages in the queue. + */ + @JsonProperty(value = "properties.messageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long messageCount; + + /** + * ISO 8601 timespan duration of a peek-lock; that is, the amount of time + * that the message is locked for other receivers. The maximum value for + * LockDuration is 5 minutes; the default value is 1 minute. + */ + @JsonProperty(value = "properties.lockDuration") + private Period lockDuration; + + /** + * The maximum size of the queue in megabytes, which is the size of memory + * allocated for the queue. Default is 1024. + */ + @JsonProperty(value = "properties.maxSizeInMegabytes") + private Integer maxSizeInMegabytes; + + /** + * A value indicating if this queue requires duplicate detection. + */ + @JsonProperty(value = "properties.requiresDuplicateDetection") + private Boolean requiresDuplicateDetection; + + /** + * A value that indicates whether the queue supports the concept of + * sessions. + */ + @JsonProperty(value = "properties.requiresSession") + private Boolean requiresSession; + + /** + * ISO 8601 default message timespan to live value. This is the duration + * after which the message expires, starting from when the message is sent + * to Service Bus. This is the default value used when TimeToLive is not + * set on a message itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private Period defaultMessageTimeToLive; + + /** + * A value that indicates whether this queue has dead letter support when a + * message expires. + */ + @JsonProperty(value = "properties.deadLetteringOnMessageExpiration") + private Boolean deadLetteringOnMessageExpiration; + + /** + * ISO 8601 timeSpan structure that defines the duration of the duplicate + * detection history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private Period duplicateDetectionHistoryTimeWindow; + + /** + * The maximum delivery count. A message is automatically deadlettered + * after this number of deliveries. default value is 10. + */ + @JsonProperty(value = "properties.maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Disabled', 'Restoring', + * 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', + * 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * ISO 8061 timeSpan idle interval after which the queue is automatically + * deleted. The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private Period autoDeleteOnIdle; + + /** + * A value that indicates whether the queue is to be partitioned across + * multiple message brokers. + */ + @JsonProperty(value = "properties.enablePartitioning") + private Boolean enablePartitioning; + + /** + * A value that indicates whether Express Entities are enabled. An express + * queue holds a message in memory temporarily before writing it to + * persistent storage. + */ + @JsonProperty(value = "properties.enableExpress") + private Boolean enableExpress; + + /** + * Queue/Topic name to forward the messages. + */ + @JsonProperty(value = "properties.forwardTo") + private String forwardTo; + + /** + * Queue/Topic name to forward the Dead Letter message. + */ + @JsonProperty(value = "properties.forwardDeadLetteredMessagesTo") + private String forwardDeadLetteredMessagesTo; + + /** + * Get message Count Details. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get the exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get last time a message was sent, or the last time there was a receive request to this queue. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get the size of the queue, in bytes. + * + * @return the sizeInBytes value + */ + public Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get the number of messages in the queue. + * + * @return the messageCount value + */ + public Long messageCount() { + return this.messageCount; + } + + /** + * Get iSO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + * + * @return the lockDuration value + */ + public Period lockDuration() { + return this.lockDuration; + } + + /** + * Set iSO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. + * + * @param lockDuration the lockDuration value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withLockDuration(Period lockDuration) { + this.lockDuration = lockDuration; + return this; + } + + /** + * Get the maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. + * + * @return the maxSizeInMegabytes value + */ + public Integer maxSizeInMegabytes() { + return this.maxSizeInMegabytes; + } + + /** + * Set the maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. + * + * @param maxSizeInMegabytes the maxSizeInMegabytes value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withMaxSizeInMegabytes(Integer maxSizeInMegabytes) { + this.maxSizeInMegabytes = maxSizeInMegabytes; + return this; + } + + /** + * Get a value indicating if this queue requires duplicate detection. + * + * @return the requiresDuplicateDetection value + */ + public Boolean requiresDuplicateDetection() { + return this.requiresDuplicateDetection; + } + + /** + * Set a value indicating if this queue requires duplicate detection. + * + * @param requiresDuplicateDetection the requiresDuplicateDetection value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.requiresDuplicateDetection = requiresDuplicateDetection; + return this; + } + + /** + * Get a value that indicates whether the queue supports the concept of sessions. + * + * @return the requiresSession value + */ + public Boolean requiresSession() { + return this.requiresSession; + } + + /** + * Set a value that indicates whether the queue supports the concept of sessions. + * + * @param requiresSession the requiresSession value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withRequiresSession(Boolean requiresSession) { + this.requiresSession = requiresSession; + return this; + } + + /** + * Get iSO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public Period defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set iSO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withDefaultMessageTimeToLive(Period defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get a value that indicates whether this queue has dead letter support when a message expires. + * + * @return the deadLetteringOnMessageExpiration value + */ + public Boolean deadLetteringOnMessageExpiration() { + return this.deadLetteringOnMessageExpiration; + } + + /** + * Set a value that indicates whether this queue has dead letter support when a message expires. + * + * @param deadLetteringOnMessageExpiration the deadLetteringOnMessageExpiration value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.deadLetteringOnMessageExpiration = deadLetteringOnMessageExpiration; + return this; + } + + /** + * Get iSO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public Period duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set iSO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get the maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @param status the status value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get iSO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public Period autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set iSO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withAutoDeleteOnIdle(Period autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get a value that indicates whether the queue is to be partitioned across multiple message brokers. + * + * @return the enablePartitioning value + */ + public Boolean enablePartitioning() { + return this.enablePartitioning; + } + + /** + * Set a value that indicates whether the queue is to be partitioned across multiple message brokers. + * + * @param enablePartitioning the enablePartitioning value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withEnablePartitioning(Boolean enablePartitioning) { + this.enablePartitioning = enablePartitioning; + return this; + } + + /** + * Get a value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + * + * @return the enableExpress value + */ + public Boolean enableExpress() { + return this.enableExpress; + } + + /** + * Set a value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. + * + * @param enableExpress the enableExpress value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withEnableExpress(Boolean enableExpress) { + this.enableExpress = enableExpress; + return this; + } + + /** + * Get queue/Topic name to forward the messages. + * + * @return the forwardTo value + */ + public String forwardTo() { + return this.forwardTo; + } + + /** + * Set queue/Topic name to forward the messages. + * + * @param forwardTo the forwardTo value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withForwardTo(String forwardTo) { + this.forwardTo = forwardTo; + return this; + } + + /** + * Get queue/Topic name to forward the Dead Letter message. + * + * @return the forwardDeadLetteredMessagesTo value + */ + public String forwardDeadLetteredMessagesTo() { + return this.forwardDeadLetteredMessagesTo; + } + + /** + * Set queue/Topic name to forward the Dead Letter message. + * + * @param forwardDeadLetteredMessagesTo the forwardDeadLetteredMessagesTo value to set + * @return the SBQueueInner object itself. + */ + public SBQueueInner withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo) { + this.forwardDeadLetteredMessagesTo = forwardDeadLetteredMessagesTo; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBSubscriptionImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBSubscriptionImpl.java new file mode 100644 index 000000000000..abe388502588 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBSubscriptionImpl.java @@ -0,0 +1,258 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.SBSubscription; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.MessageCountDetails; +import org.joda.time.Period; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; + +class SBSubscriptionImpl extends CreatableUpdatableImpl implements SBSubscription, SBSubscription.Definition, SBSubscription.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + private String subscriptionName; + + SBSubscriptionImpl(String name, ServiceBusManager manager) { + super(name, new SBSubscriptionInner()); + this.manager = manager; + // Set resource name + this.subscriptionName = name; + // + } + + SBSubscriptionImpl(SBSubscriptionInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.subscriptionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + this.subscriptionName = IdParsingUtils.getValueFromIdByName(inner.id(), "subscriptions"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.subscriptionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime accessedAt() { + return this.inner().accessedAt(); + } + + @Override + public Period autoDeleteOnIdle() { + return this.inner().autoDeleteOnIdle(); + } + + @Override + public MessageCountDetails countDetails() { + return this.inner().countDetails(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Boolean deadLetteringOnFilterEvaluationExceptions() { + return this.inner().deadLetteringOnFilterEvaluationExceptions(); + } + + @Override + public Boolean deadLetteringOnMessageExpiration() { + return this.inner().deadLetteringOnMessageExpiration(); + } + + @Override + public Period defaultMessageTimeToLive() { + return this.inner().defaultMessageTimeToLive(); + } + + @Override + public Period duplicateDetectionHistoryTimeWindow() { + return this.inner().duplicateDetectionHistoryTimeWindow(); + } + + @Override + public Boolean enableBatchedOperations() { + return this.inner().enableBatchedOperations(); + } + + @Override + public String forwardDeadLetteredMessagesTo() { + return this.inner().forwardDeadLetteredMessagesTo(); + } + + @Override + public String forwardTo() { + return this.inner().forwardTo(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Period lockDuration() { + return this.inner().lockDuration(); + } + + @Override + public Integer maxDeliveryCount() { + return this.inner().maxDeliveryCount(); + } + + @Override + public Long messageCount() { + return this.inner().messageCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresSession() { + return this.inner().requiresSession(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public SBSubscriptionImpl withExistingTopic(String resourceGroupName, String namespaceName, String topicName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.topicName = topicName; + return this; + } + + @Override + public SBSubscriptionImpl withAutoDeleteOnIdle(Period autoDeleteOnIdle) { + this.inner().withAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + @Override + public SBSubscriptionImpl withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions) { + this.inner().withDeadLetteringOnFilterEvaluationExceptions(deadLetteringOnFilterEvaluationExceptions); + return this; + } + + @Override + public SBSubscriptionImpl withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.inner().withDeadLetteringOnMessageExpiration(deadLetteringOnMessageExpiration); + return this; + } + + @Override + public SBSubscriptionImpl withDefaultMessageTimeToLive(Period defaultMessageTimeToLive) { + this.inner().withDefaultMessageTimeToLive(defaultMessageTimeToLive); + return this; + } + + @Override + public SBSubscriptionImpl withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow) { + this.inner().withDuplicateDetectionHistoryTimeWindow(duplicateDetectionHistoryTimeWindow); + return this; + } + + @Override + public SBSubscriptionImpl withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.inner().withEnableBatchedOperations(enableBatchedOperations); + return this; + } + + @Override + public SBSubscriptionImpl withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo) { + this.inner().withForwardDeadLetteredMessagesTo(forwardDeadLetteredMessagesTo); + return this; + } + + @Override + public SBSubscriptionImpl withForwardTo(String forwardTo) { + this.inner().withForwardTo(forwardTo); + return this; + } + + @Override + public SBSubscriptionImpl withLockDuration(Period lockDuration) { + this.inner().withLockDuration(lockDuration); + return this; + } + + @Override + public SBSubscriptionImpl withMaxDeliveryCount(Integer maxDeliveryCount) { + this.inner().withMaxDeliveryCount(maxDeliveryCount); + return this; + } + + @Override + public SBSubscriptionImpl withRequiresSession(Boolean requiresSession) { + this.inner().withRequiresSession(requiresSession); + return this; + } + + @Override + public SBSubscriptionImpl withStatus(EntityStatus status) { + this.inner().withStatus(status); + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBSubscriptionInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBSubscriptionInner.java new file mode 100644 index 000000000000..91019d4aba72 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBSubscriptionInner.java @@ -0,0 +1,422 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.MessageCountDetails; +import org.joda.time.Period; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of subscription resource. + */ +@JsonFlatten +public class SBSubscriptionInner extends ProxyResource { + /** + * Number of messages. + */ + @JsonProperty(value = "properties.messageCount", access = JsonProperty.Access.WRITE_ONLY) + private Long messageCount; + + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * Last time there was a receive request to this subscription. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Message count details. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * ISO 8061 lock duration timespan for the subscription. The default value + * is 1 minute. + */ + @JsonProperty(value = "properties.lockDuration") + private Period lockDuration; + + /** + * Value indicating if a subscription supports the concept of sessions. + */ + @JsonProperty(value = "properties.requiresSession") + private Boolean requiresSession; + + /** + * ISO 8061 Default message timespan to live value. This is the duration + * after which the message expires, starting from when the message is sent + * to Service Bus. This is the default value used when TimeToLive is not + * set on a message itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private Period defaultMessageTimeToLive; + + /** + * Value that indicates whether a subscription has dead letter support on + * filter evaluation exceptions. + */ + @JsonProperty(value = "properties.deadLetteringOnFilterEvaluationExceptions") + private Boolean deadLetteringOnFilterEvaluationExceptions; + + /** + * Value that indicates whether a subscription has dead letter support when + * a message expires. + */ + @JsonProperty(value = "properties.deadLetteringOnMessageExpiration") + private Boolean deadLetteringOnMessageExpiration; + + /** + * ISO 8601 timeSpan structure that defines the duration of the duplicate + * detection history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private Period duplicateDetectionHistoryTimeWindow; + + /** + * Number of maximum deliveries. + */ + @JsonProperty(value = "properties.maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Disabled', 'Restoring', + * 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', + * 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * ISO 8061 timeSpan idle interval after which the topic is automatically + * deleted. The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private Period autoDeleteOnIdle; + + /** + * Queue/Topic name to forward the messages. + */ + @JsonProperty(value = "properties.forwardTo") + private String forwardTo; + + /** + * Queue/Topic name to forward the Dead Letter message. + */ + @JsonProperty(value = "properties.forwardDeadLetteredMessagesTo") + private String forwardDeadLetteredMessagesTo; + + /** + * Get number of messages. + * + * @return the messageCount value + */ + public Long messageCount() { + return this.messageCount; + } + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get last time there was a receive request to this subscription. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get message count details. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get iSO 8061 lock duration timespan for the subscription. The default value is 1 minute. + * + * @return the lockDuration value + */ + public Period lockDuration() { + return this.lockDuration; + } + + /** + * Set iSO 8061 lock duration timespan for the subscription. The default value is 1 minute. + * + * @param lockDuration the lockDuration value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withLockDuration(Period lockDuration) { + this.lockDuration = lockDuration; + return this; + } + + /** + * Get value indicating if a subscription supports the concept of sessions. + * + * @return the requiresSession value + */ + public Boolean requiresSession() { + return this.requiresSession; + } + + /** + * Set value indicating if a subscription supports the concept of sessions. + * + * @param requiresSession the requiresSession value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withRequiresSession(Boolean requiresSession) { + this.requiresSession = requiresSession; + return this; + } + + /** + * Get iSO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public Period defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set iSO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withDefaultMessageTimeToLive(Period defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + * + * @return the deadLetteringOnFilterEvaluationExceptions value + */ + public Boolean deadLetteringOnFilterEvaluationExceptions() { + return this.deadLetteringOnFilterEvaluationExceptions; + } + + /** + * Set value that indicates whether a subscription has dead letter support on filter evaluation exceptions. + * + * @param deadLetteringOnFilterEvaluationExceptions the deadLetteringOnFilterEvaluationExceptions value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withDeadLetteringOnFilterEvaluationExceptions(Boolean deadLetteringOnFilterEvaluationExceptions) { + this.deadLetteringOnFilterEvaluationExceptions = deadLetteringOnFilterEvaluationExceptions; + return this; + } + + /** + * Get value that indicates whether a subscription has dead letter support when a message expires. + * + * @return the deadLetteringOnMessageExpiration value + */ + public Boolean deadLetteringOnMessageExpiration() { + return this.deadLetteringOnMessageExpiration; + } + + /** + * Set value that indicates whether a subscription has dead letter support when a message expires. + * + * @param deadLetteringOnMessageExpiration the deadLetteringOnMessageExpiration value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withDeadLetteringOnMessageExpiration(Boolean deadLetteringOnMessageExpiration) { + this.deadLetteringOnMessageExpiration = deadLetteringOnMessageExpiration; + return this; + } + + /** + * Get iSO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public Period duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set iSO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get number of maximum deliveries. + * + * @return the maxDeliveryCount value + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set number of maximum deliveries. + * + * @param maxDeliveryCount the maxDeliveryCount value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @param status the status value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get iSO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public Period autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set iSO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withAutoDeleteOnIdle(Period autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get queue/Topic name to forward the messages. + * + * @return the forwardTo value + */ + public String forwardTo() { + return this.forwardTo; + } + + /** + * Set queue/Topic name to forward the messages. + * + * @param forwardTo the forwardTo value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withForwardTo(String forwardTo) { + this.forwardTo = forwardTo; + return this; + } + + /** + * Get queue/Topic name to forward the Dead Letter message. + * + * @return the forwardDeadLetteredMessagesTo value + */ + public String forwardDeadLetteredMessagesTo() { + return this.forwardDeadLetteredMessagesTo; + } + + /** + * Set queue/Topic name to forward the Dead Letter message. + * + * @param forwardDeadLetteredMessagesTo the forwardDeadLetteredMessagesTo value to set + * @return the SBSubscriptionInner object itself. + */ + public SBSubscriptionInner withForwardDeadLetteredMessagesTo(String forwardDeadLetteredMessagesTo) { + this.forwardDeadLetteredMessagesTo = forwardDeadLetteredMessagesTo; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBTopicImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBTopicImpl.java new file mode 100644 index 000000000000..45cf5c166e76 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBTopicImpl.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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.SBTopic; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.MessageCountDetails; +import org.joda.time.Period; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; + +class SBTopicImpl extends CreatableUpdatableImpl implements SBTopic, SBTopic.Definition, SBTopic.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + + SBTopicImpl(String name, ServiceBusManager manager) { + super(name, new SBTopicInner()); + this.manager = manager; + // Set resource name + this.topicName = name; + // + } + + SBTopicImpl(SBTopicInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.topicName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.topicName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime accessedAt() { + return this.inner().accessedAt(); + } + + @Override + public Period autoDeleteOnIdle() { + return this.inner().autoDeleteOnIdle(); + } + + @Override + public MessageCountDetails countDetails() { + return this.inner().countDetails(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public Period defaultMessageTimeToLive() { + return this.inner().defaultMessageTimeToLive(); + } + + @Override + public Period duplicateDetectionHistoryTimeWindow() { + return this.inner().duplicateDetectionHistoryTimeWindow(); + } + + @Override + public Boolean enableBatchedOperations() { + return this.inner().enableBatchedOperations(); + } + + @Override + public Boolean enableExpress() { + return this.inner().enableExpress(); + } + + @Override + public Boolean enablePartitioning() { + return this.inner().enablePartitioning(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer maxSizeInMegabytes() { + return this.inner().maxSizeInMegabytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresDuplicateDetection() { + return this.inner().requiresDuplicateDetection(); + } + + @Override + public Long sizeInBytes() { + return this.inner().sizeInBytes(); + } + + @Override + public EntityStatus status() { + return this.inner().status(); + } + + @Override + public Integer subscriptionCount() { + return this.inner().subscriptionCount(); + } + + @Override + public Boolean supportOrdering() { + return this.inner().supportOrdering(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public SBTopicImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public SBTopicImpl withAutoDeleteOnIdle(Period autoDeleteOnIdle) { + this.inner().withAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + @Override + public SBTopicImpl withDefaultMessageTimeToLive(Period defaultMessageTimeToLive) { + this.inner().withDefaultMessageTimeToLive(defaultMessageTimeToLive); + return this; + } + + @Override + public SBTopicImpl withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow) { + this.inner().withDuplicateDetectionHistoryTimeWindow(duplicateDetectionHistoryTimeWindow); + return this; + } + + @Override + public SBTopicImpl withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.inner().withEnableBatchedOperations(enableBatchedOperations); + return this; + } + + @Override + public SBTopicImpl withEnableExpress(Boolean enableExpress) { + this.inner().withEnableExpress(enableExpress); + return this; + } + + @Override + public SBTopicImpl withEnablePartitioning(Boolean enablePartitioning) { + this.inner().withEnablePartitioning(enablePartitioning); + return this; + } + + @Override + public SBTopicImpl withMaxSizeInMegabytes(Integer maxSizeInMegabytes) { + this.inner().withMaxSizeInMegabytes(maxSizeInMegabytes); + return this; + } + + @Override + public SBTopicImpl withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.inner().withRequiresDuplicateDetection(requiresDuplicateDetection); + return this; + } + + @Override + public SBTopicImpl withStatus(EntityStatus status) { + this.inner().withStatus(status); + return this; + } + + @Override + public SBTopicImpl withSupportOrdering(Boolean supportOrdering) { + this.inner().withSupportOrdering(supportOrdering); + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBTopicInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBTopicInner.java new file mode 100644 index 000000000000..2b344a751339 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SBTopicInner.java @@ -0,0 +1,387 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servicebus.v2017_04_01.MessageCountDetails; +import org.joda.time.Period; +import com.microsoft.azure.management.servicebus.v2017_04_01.EntityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of topic resource. + */ +@JsonFlatten +public class SBTopicInner extends ProxyResource { + /** + * Size of the topic, in bytes. + */ + @JsonProperty(value = "properties.sizeInBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long sizeInBytes; + + /** + * Exact time the message was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The exact time the message was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Last time the message was sent, or a request was received, for this + * topic. + */ + @JsonProperty(value = "properties.accessedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime accessedAt; + + /** + * Number of subscriptions. + */ + @JsonProperty(value = "properties.subscriptionCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer subscriptionCount; + + /** + * Message count details. + */ + @JsonProperty(value = "properties.countDetails", access = JsonProperty.Access.WRITE_ONLY) + private MessageCountDetails countDetails; + + /** + * ISO 8601 Default message timespan to live value. This is the duration + * after which the message expires, starting from when the message is sent + * to Service Bus. This is the default value used when TimeToLive is not + * set on a message itself. + */ + @JsonProperty(value = "properties.defaultMessageTimeToLive") + private Period defaultMessageTimeToLive; + + /** + * Maximum size of the topic in megabytes, which is the size of the memory + * allocated for the topic. Default is 1024. + */ + @JsonProperty(value = "properties.maxSizeInMegabytes") + private Integer maxSizeInMegabytes; + + /** + * Value indicating if this topic requires duplicate detection. + */ + @JsonProperty(value = "properties.requiresDuplicateDetection") + private Boolean requiresDuplicateDetection; + + /** + * ISO8601 timespan structure that defines the duration of the duplicate + * detection history. The default value is 10 minutes. + */ + @JsonProperty(value = "properties.duplicateDetectionHistoryTimeWindow") + private Period duplicateDetectionHistoryTimeWindow; + + /** + * Value that indicates whether server-side batched operations are enabled. + */ + @JsonProperty(value = "properties.enableBatchedOperations") + private Boolean enableBatchedOperations; + + /** + * Enumerates the possible values for the status of a messaging entity. + * Possible values include: 'Active', 'Disabled', 'Restoring', + * 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', + * 'Unknown'. + */ + @JsonProperty(value = "properties.status") + private EntityStatus status; + + /** + * Value that indicates whether the topic supports ordering. + */ + @JsonProperty(value = "properties.supportOrdering") + private Boolean supportOrdering; + + /** + * ISO 8601 timespan idle interval after which the topic is automatically + * deleted. The minimum duration is 5 minutes. + */ + @JsonProperty(value = "properties.autoDeleteOnIdle") + private Period autoDeleteOnIdle; + + /** + * Value that indicates whether the topic to be partitioned across multiple + * message brokers is enabled. + */ + @JsonProperty(value = "properties.enablePartitioning") + private Boolean enablePartitioning; + + /** + * Value that indicates whether Express Entities are enabled. An express + * topic holds a message in memory temporarily before writing it to + * persistent storage. + */ + @JsonProperty(value = "properties.enableExpress") + private Boolean enableExpress; + + /** + * Get size of the topic, in bytes. + * + * @return the sizeInBytes value + */ + public Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get exact time the message was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the exact time the message was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get last time the message was sent, or a request was received, for this topic. + * + * @return the accessedAt value + */ + public DateTime accessedAt() { + return this.accessedAt; + } + + /** + * Get number of subscriptions. + * + * @return the subscriptionCount value + */ + public Integer subscriptionCount() { + return this.subscriptionCount; + } + + /** + * Get message count details. + * + * @return the countDetails value + */ + public MessageCountDetails countDetails() { + return this.countDetails; + } + + /** + * Get iSO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @return the defaultMessageTimeToLive value + */ + public Period defaultMessageTimeToLive() { + return this.defaultMessageTimeToLive; + } + + /** + * Set iSO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. + * + * @param defaultMessageTimeToLive the defaultMessageTimeToLive value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withDefaultMessageTimeToLive(Period defaultMessageTimeToLive) { + this.defaultMessageTimeToLive = defaultMessageTimeToLive; + return this; + } + + /** + * Get maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024. + * + * @return the maxSizeInMegabytes value + */ + public Integer maxSizeInMegabytes() { + return this.maxSizeInMegabytes; + } + + /** + * Set maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024. + * + * @param maxSizeInMegabytes the maxSizeInMegabytes value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withMaxSizeInMegabytes(Integer maxSizeInMegabytes) { + this.maxSizeInMegabytes = maxSizeInMegabytes; + return this; + } + + /** + * Get value indicating if this topic requires duplicate detection. + * + * @return the requiresDuplicateDetection value + */ + public Boolean requiresDuplicateDetection() { + return this.requiresDuplicateDetection; + } + + /** + * Set value indicating if this topic requires duplicate detection. + * + * @param requiresDuplicateDetection the requiresDuplicateDetection value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withRequiresDuplicateDetection(Boolean requiresDuplicateDetection) { + this.requiresDuplicateDetection = requiresDuplicateDetection; + return this; + } + + /** + * Get iSO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @return the duplicateDetectionHistoryTimeWindow value + */ + public Period duplicateDetectionHistoryTimeWindow() { + return this.duplicateDetectionHistoryTimeWindow; + } + + /** + * Set iSO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. + * + * @param duplicateDetectionHistoryTimeWindow the duplicateDetectionHistoryTimeWindow value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withDuplicateDetectionHistoryTimeWindow(Period duplicateDetectionHistoryTimeWindow) { + this.duplicateDetectionHistoryTimeWindow = duplicateDetectionHistoryTimeWindow; + return this; + } + + /** + * Get value that indicates whether server-side batched operations are enabled. + * + * @return the enableBatchedOperations value + */ + public Boolean enableBatchedOperations() { + return this.enableBatchedOperations; + } + + /** + * Set value that indicates whether server-side batched operations are enabled. + * + * @param enableBatchedOperations the enableBatchedOperations value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withEnableBatchedOperations(Boolean enableBatchedOperations) { + this.enableBatchedOperations = enableBatchedOperations; + return this; + } + + /** + * Get enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @return the status value + */ + public EntityStatus status() { + return this.status; + } + + /** + * Set enumerates the possible values for the status of a messaging entity. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'. + * + * @param status the status value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withStatus(EntityStatus status) { + this.status = status; + return this; + } + + /** + * Get value that indicates whether the topic supports ordering. + * + * @return the supportOrdering value + */ + public Boolean supportOrdering() { + return this.supportOrdering; + } + + /** + * Set value that indicates whether the topic supports ordering. + * + * @param supportOrdering the supportOrdering value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withSupportOrdering(Boolean supportOrdering) { + this.supportOrdering = supportOrdering; + return this; + } + + /** + * Get iSO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @return the autoDeleteOnIdle value + */ + public Period autoDeleteOnIdle() { + return this.autoDeleteOnIdle; + } + + /** + * Set iSO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. + * + * @param autoDeleteOnIdle the autoDeleteOnIdle value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withAutoDeleteOnIdle(Period autoDeleteOnIdle) { + this.autoDeleteOnIdle = autoDeleteOnIdle; + return this; + } + + /** + * Get value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + * + * @return the enablePartitioning value + */ + public Boolean enablePartitioning() { + return this.enablePartitioning; + } + + /** + * Set value that indicates whether the topic to be partitioned across multiple message brokers is enabled. + * + * @param enablePartitioning the enablePartitioning value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withEnablePartitioning(Boolean enablePartitioning) { + this.enablePartitioning = enablePartitioning; + return this; + } + + /** + * Get value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + * + * @return the enableExpress value + */ + public Boolean enableExpress() { + return this.enableExpress; + } + + /** + * Set value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. + * + * @param enableExpress the enableExpress value to set + * @return the SBTopicInner object itself. + */ + public SBTopicInner withEnableExpress(Boolean enableExpress) { + this.enableExpress = enableExpress; + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ServiceBusManagementClientImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ServiceBusManagementClientImpl.java new file mode 100644 index 000000000000..bd40bf2e9d64 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ServiceBusManagementClientImpl.java @@ -0,0 +1,336 @@ +/** + * 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.servicebus.v2017_04_01.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 ServiceBusManagementClientImpl class. + */ +public class ServiceBusManagementClientImpl 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 ServiceBusManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client API version. */ + private String apiVersion; + + /** + * Gets Client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ServiceBusManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ServiceBusManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ServiceBusManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The NamespacesInner object to access its operations. + */ + private NamespacesInner namespaces; + + /** + * Gets the NamespacesInner object to access its operations. + * @return the NamespacesInner object. + */ + public NamespacesInner namespaces() { + return this.namespaces; + } + + /** + * The DisasterRecoveryConfigsInner object to access its operations. + */ + private DisasterRecoveryConfigsInner disasterRecoveryConfigs; + + /** + * Gets the DisasterRecoveryConfigsInner object to access its operations. + * @return the DisasterRecoveryConfigsInner object. + */ + public DisasterRecoveryConfigsInner disasterRecoveryConfigs() { + return this.disasterRecoveryConfigs; + } + + /** + * The MigrationConfigsInner object to access its operations. + */ + private MigrationConfigsInner migrationConfigs; + + /** + * Gets the MigrationConfigsInner object to access its operations. + * @return the MigrationConfigsInner object. + */ + public MigrationConfigsInner migrationConfigs() { + return this.migrationConfigs; + } + + /** + * The QueuesInner object to access its operations. + */ + private QueuesInner queues; + + /** + * Gets the QueuesInner object to access its operations. + * @return the QueuesInner object. + */ + public QueuesInner queues() { + return this.queues; + } + + /** + * The TopicsInner object to access its operations. + */ + private TopicsInner topics; + + /** + * Gets the TopicsInner object to access its operations. + * @return the TopicsInner object. + */ + public TopicsInner topics() { + return this.topics; + } + + /** + * The SubscriptionsInner object to access its operations. + */ + private SubscriptionsInner subscriptions; + + /** + * Gets the SubscriptionsInner object to access its operations. + * @return the SubscriptionsInner object. + */ + public SubscriptionsInner subscriptions() { + return this.subscriptions; + } + + /** + * The RulesInner object to access its operations. + */ + private RulesInner rules; + + /** + * Gets the RulesInner object to access its operations. + * @return the RulesInner object. + */ + public RulesInner rules() { + return this.rules; + } + + /** + * The RegionsInner object to access its operations. + */ + private RegionsInner regions; + + /** + * Gets the RegionsInner object to access its operations. + * @return the RegionsInner object. + */ + public RegionsInner regions() { + return this.regions; + } + + /** + * The PremiumMessagingRegionsInner object to access its operations. + */ + private PremiumMessagingRegionsInner premiumMessagingRegions; + + /** + * Gets the PremiumMessagingRegionsInner object to access its operations. + * @return the PremiumMessagingRegionsInner object. + */ + public PremiumMessagingRegionsInner premiumMessagingRegions() { + return this.premiumMessagingRegions; + } + + /** + * The EventHubsInner object to access its operations. + */ + private EventHubsInner eventHubs; + + /** + * Gets the EventHubsInner object to access its operations. + * @return the EventHubsInner object. + */ + public EventHubsInner eventHubs() { + return this.eventHubs; + } + + /** + * Initializes an instance of ServiceBusManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ServiceBusManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ServiceBusManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ServiceBusManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ServiceBusManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ServiceBusManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-04-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.namespaces = new NamespacesInner(restClient().retrofit(), this); + this.disasterRecoveryConfigs = new DisasterRecoveryConfigsInner(restClient().retrofit(), this); + this.migrationConfigs = new MigrationConfigsInner(restClient().retrofit(), this); + this.queues = new QueuesInner(restClient().retrofit(), this); + this.topics = new TopicsInner(restClient().retrofit(), this); + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.rules = new RulesInner(restClient().retrofit(), this); + this.regions = new RegionsInner(restClient().retrofit(), this); + this.premiumMessagingRegions = new PremiumMessagingRegionsInner(restClient().retrofit(), this); + this.eventHubs = new EventHubsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ServiceBusManagementClient", "2017-04-01"); + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ServiceBusManager.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ServiceBusManager.java new file mode 100644 index 000000000000..967732effc15 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/ServiceBusManager.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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.servicebus.v2017_04_01.Operations; +import com.microsoft.azure.management.servicebus.v2017_04_01.Namespaces; +import com.microsoft.azure.management.servicebus.v2017_04_01.DisasterRecoveryConfigs; +import com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigs; +import com.microsoft.azure.management.servicebus.v2017_04_01.Queues; +import com.microsoft.azure.management.servicebus.v2017_04_01.Topics; +import com.microsoft.azure.management.servicebus.v2017_04_01.Subscriptions; +import com.microsoft.azure.management.servicebus.v2017_04_01.Rules; +import com.microsoft.azure.management.servicebus.v2017_04_01.Regions; +import com.microsoft.azure.management.servicebus.v2017_04_01.PremiumMessagingRegions; +import com.microsoft.azure.management.servicebus.v2017_04_01.EventHubs; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure ServiceBus resource management. + */ +public final class ServiceBusManager extends ManagerCore { + private Operations operations; + private Namespaces namespaces; + private DisasterRecoveryConfigs disasterRecoveryConfigs; + private MigrationConfigs migrationConfigs; + private Queues queues; + private Topics topics; + private Subscriptions subscriptions; + private Rules rules; + private Regions regions; + private PremiumMessagingRegions premiumMessagingRegions; + private EventHubs eventHubs; + /** + * Get a Configurable instance that can be used to create ServiceBusManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ServiceBusManager.ConfigurableImpl(); + } + /** + * Creates an instance of ServiceBusManager that exposes ServiceBus resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ServiceBusManager + */ + public static ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ServiceBusManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of ServiceBusManager that exposes ServiceBus resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ServiceBusManager + */ + public static ServiceBusManager authenticate(RestClient restClient, String subscriptionId) { + return new ServiceBusManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ServiceBusManager that exposes ServiceBus management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing ServiceBus management API entry points that work across subscriptions + */ + ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Namespaces. + */ + public Namespaces namespaces() { + if (this.namespaces == null) { + this.namespaces = new NamespacesImpl(this); + } + return this.namespaces; + } + + /** + * @return Entry point to manage DisasterRecoveryConfigs. + */ + public DisasterRecoveryConfigs disasterRecoveryConfigs() { + if (this.disasterRecoveryConfigs == null) { + this.disasterRecoveryConfigs = new DisasterRecoveryConfigsImpl(this); + } + return this.disasterRecoveryConfigs; + } + + /** + * @return Entry point to manage MigrationConfigs. + */ + public MigrationConfigs migrationConfigs() { + if (this.migrationConfigs == null) { + this.migrationConfigs = new MigrationConfigsImpl(this); + } + return this.migrationConfigs; + } + + /** + * @return Entry point to manage Queues. + */ + public Queues queues() { + if (this.queues == null) { + this.queues = new QueuesImpl(this); + } + return this.queues; + } + + /** + * @return Entry point to manage Topics. + */ + public Topics topics() { + if (this.topics == null) { + this.topics = new TopicsImpl(this); + } + return this.topics; + } + + /** + * @return Entry point to manage Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * @return Entry point to manage Rules. + */ + public Rules rules() { + if (this.rules == null) { + this.rules = new RulesImpl(this); + } + return this.rules; + } + + /** + * @return Entry point to manage Regions. + */ + public Regions regions() { + if (this.regions == null) { + this.regions = new RegionsImpl(this); + } + return this.regions; + } + + /** + * @return Entry point to manage PremiumMessagingRegions. + */ + public PremiumMessagingRegions premiumMessagingRegions() { + if (this.premiumMessagingRegions == null) { + this.premiumMessagingRegions = new PremiumMessagingRegionsImpl(this); + } + return this.premiumMessagingRegions; + } + + /** + * @return Entry point to manage EventHubs. + */ + public EventHubs eventHubs() { + if (this.eventHubs == null) { + this.eventHubs = new EventHubsImpl(this); + } + return this.eventHubs; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ServiceBusManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ServiceBusManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ServiceBusManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java new file mode 100644 index 000000000000..275987ab62fb --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Subscriptions; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBSubscription; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final ServiceBusManager manager; + + SubscriptionsImpl(ServiceBusManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public SBSubscriptionImpl define(String name) { + return wrapModel(name); + } + + private SBSubscriptionImpl wrapModel(SBSubscriptionInner inner) { + return new SBSubscriptionImpl(inner, manager()); + } + + private SBSubscriptionImpl wrapModel(String name) { + return new SBSubscriptionImpl(name, this.manager()); + } + + @Override + public Observable listByTopicAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + SubscriptionsInner client = this.inner(); + return client.listByTopicAsync(resourceGroupName, namespaceName, topicName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SBSubscription call(SBSubscriptionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + SubscriptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, topicName, subscriptionName) + .map(new Func1() { + @Override + public SBSubscription call(SBSubscriptionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + SubscriptionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toCompletable(); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsInner.java new file mode 100644 index 000000000000..455cef73602b --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsInner.java @@ -0,0 +1,772 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.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 Subscriptions. + */ +public class SubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(SubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Subscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Subscriptions listByTopic" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions") + Observable> listByTopic(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Subscriptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @Path("subscriptionId") String subscriptionId, @Body SBSubscriptionInner 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.servicebus.v2017_04_01.Subscriptions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @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.servicebus.v2017_04_01.Subscriptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionName") String subscriptionName, @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.servicebus.v2017_04_01.Subscriptions listByTopicNext" }) + @GET + Observable> listByTopicNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic 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<SBSubscriptionInner> object if successful. + */ + public PagedList listByTopic(final String resourceGroupName, final String namespaceName, final String topicName) { + ServiceResponse> response = listByTopicSinglePageAsync(resourceGroupName, namespaceName, topicName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTopicNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic 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> listByTopicAsync(final String resourceGroupName, final String namespaceName, final String topicName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTopicSinglePageAsync(resourceGroupName, namespaceName, topicName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTopicNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBSubscriptionInner> object + */ + public Observable> listByTopicAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listByTopicWithServiceResponseAsync(resourceGroupName, namespaceName, topicName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBSubscriptionInner> object + */ + public Observable>> listByTopicWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listByTopicSinglePageAsync(resourceGroupName, namespaceName, topicName) + .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(listByTopicNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTopicSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer skip = null; + final Integer top = null; + return service.listByTopic(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTopicDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBSubscriptionInner> object if successful. + */ + public PagedList listByTopic(final String resourceGroupName, final String namespaceName, final String topicName, final Integer skip, final Integer top) { + ServiceResponse> response = listByTopicSinglePageAsync(resourceGroupName, namespaceName, topicName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTopicNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByTopicAsync(final String resourceGroupName, final String namespaceName, final String topicName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTopicSinglePageAsync(resourceGroupName, namespaceName, topicName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTopicNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBSubscriptionInner> object + */ + public Observable> listByTopicAsync(final String resourceGroupName, final String namespaceName, final String topicName, final Integer skip, final Integer top) { + return listByTopicWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBSubscriptionInner> object + */ + public Observable>> listByTopicWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName, final Integer skip, final Integer top) { + return listByTopicSinglePageAsync(resourceGroupName, namespaceName, topicName, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByTopicNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param topicName The topic name. + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTopicSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName 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.listByTopic(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTopicDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTopicDelegate(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 a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription 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 SBSubscriptionInner object if successful. + */ + public SBSubscriptionInner createOrUpdate(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SBSubscriptionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SBSubscriptionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, parameters), serviceCallback); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBSubscriptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SBSubscriptionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, parameters).map(new Func1, SBSubscriptionInner>() { + @Override + public SBSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a topic subscription. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param parameters Parameters supplied to create a subscription resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBSubscriptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, SBSubscriptionInner 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toBlocking().single().body(); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName), serviceCallback); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a subscription from the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription 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 SBSubscriptionInner object if successful. + */ + public SBSubscriptionInner get(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).toBlocking().single().body(); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName), serviceCallback); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBSubscriptionInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName).map(new Func1, SBSubscriptionInner>() { + @Override + public SBSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a subscription description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param subscriptionName The subscription name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBSubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (subscriptionName == null) { + throw new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, topicName, subscriptionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List all the subscriptions under a specified topic. + * + * @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<SBSubscriptionInner> object if successful. + */ + public PagedList listByTopicNext(final String nextPageLink) { + ServiceResponse> response = listByTopicNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTopicNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all the subscriptions under a specified topic. + * + * @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> listByTopicNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTopicNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTopicNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all the subscriptions under a specified topic. + * + * @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<SBSubscriptionInner> object + */ + public Observable> listByTopicNextAsync(final String nextPageLink) { + return listByTopicNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + * @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<SBSubscriptionInner> object + */ + public Observable>> listByTopicNextWithServiceResponseAsync(final String nextPageLink) { + return listByTopicNextSinglePageAsync(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(listByTopicNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all the subscriptions under a specified topic. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTopicNextSinglePageAsync(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.listByTopicNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTopicNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTopicNextDelegate(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/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicNamespaceSBAuthorizationRuleImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicNamespaceSBAuthorizationRuleImpl.java new file mode 100644 index 000000000000..8b6cb52dad02 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicNamespaceSBAuthorizationRuleImpl.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.management.servicebus.v2017_04_01.TopicNamespaceSBAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; + +class TopicNamespaceSBAuthorizationRuleImpl extends CreatableUpdatableImpl implements TopicNamespaceSBAuthorizationRule, TopicNamespaceSBAuthorizationRule.Definition, TopicNamespaceSBAuthorizationRule.Update { + private final ServiceBusManager manager; + private String resourceGroupName; + private String namespaceName; + private String topicName; + private String authorizationRuleName; + private List crights; + private List urights; + + TopicNamespaceSBAuthorizationRuleImpl(String name, ServiceBusManager manager) { + super(name, new SBAuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + TopicNamespaceSBAuthorizationRuleImpl(SBAuthorizationRuleInner inner, ServiceBusManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authorizationRuleName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.topicName = IdParsingUtils.getValueFromIdByName(inner.id(), "topics"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TopicsInner client = this.manager().inner().topics(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.topicName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TopicNamespaceSBAuthorizationRuleImpl withExistingTopic(String resourceGroupName, String namespaceName, String topicName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.topicName = topicName; + return this; + } + + @Override + public TopicNamespaceSBAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java new file mode 100644 index 000000000000..c74872e74fc4 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java @@ -0,0 +1,166 @@ +/** + * 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.servicebus.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.servicebus.v2017_04_01.Topics; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.servicebus.v2017_04_01.SBTopic; +import com.microsoft.azure.management.servicebus.v2017_04_01.TopicNamespaceSBAuthorizationRule; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessKeys; +import com.microsoft.azure.management.servicebus.v2017_04_01.RegenerateAccessKeyParameters; + +class TopicsImpl extends WrapperImpl implements Topics { + private final ServiceBusManager manager; + + TopicsImpl(ServiceBusManager manager) { + super(manager.inner().topics()); + this.manager = manager; + } + + public ServiceBusManager manager() { + return this.manager; + } + + @Override + public SBTopicImpl define(String name) { + return wrapModel(name); + } + + private SBTopicImpl wrapModel(SBTopicInner inner) { + return new SBTopicImpl(inner, manager()); + } + + private SBTopicImpl wrapModel(String name) { + return new SBTopicImpl(name, this.manager()); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + TopicsInner client = this.inner(); + return client.listByNamespaceAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SBTopic call(SBTopicInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName) { + TopicsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, topicName) + .map(new Func1() { + @Override + public SBTopic call(SBTopicInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String topicName) { + TopicsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, topicName).toCompletable(); + } + + @Override + public TopicNamespaceSBAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private TopicNamespaceSBAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new TopicNamespaceSBAuthorizationRuleImpl(name, this.manager()); + } + + private TopicNamespaceSBAuthorizationRuleImpl wrapTopicNamespaceSBAuthorizationRuleModel(SBAuthorizationRuleInner inner) { + return new TopicNamespaceSBAuthorizationRuleImpl(inner, manager()); + } + + private Observable getSBAuthorizationRuleInnerUsingTopicsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String topicName = IdParsingUtils.getValueFromIdByName(id, "topics"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + TopicsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) + .map(new Func1() { + @Override + public TopicNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapTopicNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + TopicsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, topicName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TopicNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { + return wrapTopicNamespaceSBAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + TopicsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + TopicsInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsInner.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsInner.java new file mode 100644 index 000000000000..9b25e5d91861 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsInner.java @@ -0,0 +1,1526 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servicebus.v2017_04_01.AccessRights; +import com.microsoft.azure.management.servicebus.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.management.servicebus.v2017_04_01.RegenerateAccessKeyParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Topics. + */ +public class TopicsInner { + /** The Retrofit service to perform REST calls. */ + private TopicsService service; + /** The service client containing this operation class. */ + private ServiceBusManagementClientImpl client; + + /** + * Initializes an instance of TopicsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TopicsInner(Retrofit retrofit, ServiceBusManagementClientImpl client) { + this.service = retrofit.create(TopicsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Topics to be + * used by Retrofit to perform actually REST calls. + */ + interface TopicsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics") + Observable> listByNamespace(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("subscriptionId") String subscriptionId, @Body SBTopicInner 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.servicebus.v2017_04_01.Topics delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2017_04_01.Topics get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2017_04_01.Topics listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @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.servicebus.v2017_04_01.Topics createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SBAuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("topicName") String topicName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Body RegenerateAccessKeyParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics listByNamespaceNext" }) + @GET + Observable> listByNamespaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.v2017_04_01.Topics listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBTopicInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBTopicInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBTopicInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBTopicInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer skip = null; + final Integer top = null; + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBTopicInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBTopicInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBTopicInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBTopicInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic 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 SBTopicInner object if successful. + */ + public SBTopicInner createOrUpdate(String resourceGroupName, String namespaceName, String topicName, SBTopicInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, parameters).toBlocking().single().body(); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, SBTopicInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, parameters), serviceCallback); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBTopicInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName, SBTopicInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, parameters).map(new Func1, SBTopicInner>() { + @Override + public SBTopicInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a topic in the specified namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param parameters Parameters supplied to create a topic resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBTopicInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, SBTopicInner 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String namespaceName, String topicName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).toBlocking().single().body(); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String topicName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName), serviceCallback); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String topicName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a topic from the specified namespace and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic 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 SBTopicInner object if successful. + */ + public SBTopicInner get(String resourceGroupName, String namespaceName, String topicName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).toBlocking().single().body(); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String topicName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName), serviceCallback); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBTopicInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String topicName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, topicName).map(new Func1, SBTopicInner>() { + @Override + public SBTopicInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a description for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBTopicInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic 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<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String topicName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, topicName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, topicName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, topicName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, topicName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param topicName The topic name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String topicName) { + 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 (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthorizationRules(resourceGroupName, namespaceName, topicName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, rights).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an authorization rule for the specified topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, List rights) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + SBAuthorizationRuleInner parameters = new SBAuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SBAuthorizationRuleInner object if successful. + */ + public SBAuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, SBAuthorizationRuleInner>() { + @Override + public SBAuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the specified authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SBAuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a topic authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAuthorizationRule(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner listKeys(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName), serviceCallback); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessKeysInner object if successful. + */ + public AccessKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates primary or secondary connection strings for the topic. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param topicName The topic name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate the authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (topicName == null) { + throw new IllegalArgumentException("Parameter topicName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.regenerateKeys(resourceGroupName, namespaceName, topicName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SBTopicInner> object if successful. + */ + public PagedList listByNamespaceNext(final String nextPageLink) { + ServiceResponse> response = listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByNamespaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBTopicInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SBTopicInner> object + */ + public Observable>> listByNamespaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the topics in a namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBTopicInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByNamespaceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByNamespaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByNamespaceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets authorization rules for a topic. + * + * @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<SBAuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets authorization rules for a topic. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets authorization rules for a topic. + * + * @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<SBAuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + * @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<SBAuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets authorization rules for a topic. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SBAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/package-info.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/package-info.java new file mode 100644 index 000000000000..f86484497da4 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ServiceBusManagementClient. + * Azure Service Bus client. + */ +package com.microsoft.azure.management.servicebus.v2017_04_01.implementation; diff --git a/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/package-info.java b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/package-info.java new file mode 100644 index 000000000000..830b6d18b590 --- /dev/null +++ b/servicebus/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ServiceBusManagementClient. + * Azure Service Bus client. + */ +package com.microsoft.azure.management.servicebus.v2017_04_01;