diff --git a/relay/resource-manager/v2016_07_01/pom.xml b/relay/resource-manager/v2016_07_01/pom.xml new file mode 100644 index 000000000000..6e0a44f7fbb8 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.relay.v2016_07_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-relay + 1.0.0-beta + jar + Microsoft Azure SDK for Relay Management + This package contains Microsoft Relay 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/AccessRights.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/AccessRights.java new file mode 100644 index 000000000000..700db6f062ab --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/AccessRights.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AccessRights. + */ +public final class AccessRights extends ExpandableStringEnum { + /** Static value Manage for AccessRights. */ + public static final AccessRights MANAGE = fromString("Manage"); + + /** Static value Send for AccessRights. */ + public static final AccessRights SEND = fromString("Send"); + + /** Static value Listen for AccessRights. */ + public static final AccessRights LISTEN = fromString("Listen"); + + /** + * Creates or finds a AccessRights from its string representation. + * @param name a name to look for + * @return the corresponding AccessRights + */ + @JsonCreator + public static AccessRights fromString(String name) { + return fromString(name, AccessRights.class); + } + + /** + * @return known AccessRights values + */ + public static Collection values() { + return values(AccessRights.class); + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/AuthorizationRuleKeys.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/AuthorizationRuleKeys.java new file mode 100644 index 000000000000..a0efece87380 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/AuthorizationRuleKeys.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.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.AuthorizationRuleKeysInner; + +/** + * Type representing AuthorizationRuleKeys. + */ +public interface AuthorizationRuleKeys 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/CheckNameAvailability.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/CheckNameAvailability.java new file mode 100644 index 000000000000..16f169816c43 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/CheckNameAvailabilityResult.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..ea3d36738f25 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayManager; +import com.microsoft.azure.management.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/ErrorResponse.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/ErrorResponse.java new file mode 100644 index 000000000000..2f455cc72997 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates Relay 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/ErrorResponseException.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/ErrorResponseException.java new file mode 100644 index 000000000000..b10dbab28e2f --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnection.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnection.java new file mode 100644 index 000000000000..8532e3787d27 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnection.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.HybridConnectionInner; +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.relay.v2016_07_01.implementation.RelayManager; +import org.joda.time.DateTime; + +/** + * Type representing HybridConnection. + */ +public interface HybridConnection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the listenerCount value. + */ + Integer listenerCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresClientAuthorization value. + */ + Boolean requiresClientAuthorization(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * @return the userMetadata value. + */ + String userMetadata(); + + /** + * The entirety of the HybridConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of HybridConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a HybridConnection definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the hybridconnection 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 hybridconnection definition allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization true if client authorization is needed for this HybridConnection; otherwise, false + * @return the next definition stage + */ + WithCreate withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the hybridconnection definition allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored + * @return the next definition stage + */ + WithCreate withUserMetadata(String userMetadata); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithRequiresClientAuthorization, DefinitionStages.WithUserMetadata { + } + } + /** + * The template for a HybridConnection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRequiresClientAuthorization, UpdateStages.WithUserMetadata { + } + + /** + * Grouping of HybridConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the hybridconnection update allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization true if client authorization is needed for this HybridConnection; otherwise, false + * @return the next update stage + */ + Update withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the hybridconnection update allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored + * @return the next update stage + */ + Update withUserMetadata(String userMetadata); + } + + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnectionNamespaceAuthorizationRule.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnectionNamespaceAuthorizationRule.java new file mode 100644 index 000000000000..4562f29f5623 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnectionNamespaceAuthorizationRule.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.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayManager; +import java.util.List; + +/** + * Type representing HybridConnectionNamespaceAuthorizationRule. + */ +public interface HybridConnectionNamespaceAuthorizationRule 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 HybridConnectionNamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithHybridConnection, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of HybridConnectionNamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a HybridConnectionNamespaceAuthorizationRule definition. + */ + interface Blank extends WithHybridConnection { + } + + /** + * The stage of the hybridconnectionnamespaceauthorizationrule definition allowing to specify HybridConnection. + */ + interface WithHybridConnection { + /** + * Specifies resourceGroupName, namespaceName, hybridConnectionName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name + * @return the next definition stage + */ + WithRights withExistingHybridConnection(String resourceGroupName, String namespaceName, String hybridConnectionName); + } + + /** + * The stage of the hybridconnectionnamespaceauthorizationrule 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 HybridConnectionNamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of HybridConnectionNamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the hybridconnectionnamespaceauthorizationrule 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnections.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnections.java new file mode 100644 index 000000000000..6d6e2d9ac8c2 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/HybridConnections.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.HybridConnectionsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnectionNamespaceAuthorizationRule; + +/** + * Type representing HybridConnections. + */ +public interface HybridConnections extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + HybridConnectionNamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName); + + /** + * Returns the description for the specified HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String hybridConnectionName); + + /** + * Lists the HybridConnection within 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 + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a HybridConnection . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String hybridConnectionName); + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName); + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName); + + /** + * Deletes a HybridConnection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName); + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName); + + /** + * Primary and Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName); + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName); + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/NamespaceAuthorizationRule.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/NamespaceAuthorizationRule.java new file mode 100644 index 000000000000..507fafa126db --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/NamespaceAuthorizationRule.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayManager; +import java.util.List; + +/** + * Type representing NamespaceAuthorizationRule. + */ +public interface NamespaceAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the NamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of NamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NamespaceAuthorizationRule definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the namespaceauthorizationrule definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The Namespace Name + * @return the next definition stage + */ + WithRights withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the namespaceauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a NamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of NamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the namespaceauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Namespaces.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Namespaces.java new file mode 100644 index 000000000000..18ef4b9238d0 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Namespaces.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.relay.v2016_07_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.relay.v2016_07_01.implementation.NamespacesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.NamespaceAuthorizationRule; +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. + */ + NamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * 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 listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName); + + /** + * 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); + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * 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 authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName); + + /** + * Primary and Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Operation.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Operation.java new file mode 100644 index 000000000000..9db01b25f90b --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayManager; +import com.microsoft.azure.management.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/OperationDisplay.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/OperationDisplay.java new file mode 100644 index 000000000000..62519dda49c9 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.EventHub. + */ + @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.EventHub. + * + * @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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Operations.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Operations.java new file mode 100644 index 000000000000..13efcc3f7753 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01; + +import rx.Observable; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Relay REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/PolicyKey.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/PolicyKey.java new file mode 100644 index 000000000000..9fb7164abf6f --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/PolicyKey.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.relay.v2016_07_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyKey. + */ +public final class PolicyKey extends ExpandableStringEnum { + /** Static value PrimaryKey for PolicyKey. */ + public static final PolicyKey PRIMARY_KEY = fromString("PrimaryKey"); + + /** Static value SecondaryKey for PolicyKey. */ + public static final PolicyKey SECONDARY_KEY = fromString("SecondaryKey"); + + /** + * Creates or finds a PolicyKey from its string representation. + * @param name a name to look for + * @return the corresponding PolicyKey + */ + @JsonCreator + public static PolicyKey fromString(String name) { + return fromString(name, PolicyKey.class); + } + + /** + * @return known PolicyKey values + */ + public static Collection values() { + return values(PolicyKey.class); + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RegenerateKeysParameters.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RegenerateKeysParameters.java new file mode 100644 index 000000000000..3c76a4bc394f --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RelayNamespace.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RelayNamespace.java new file mode 100644 index 000000000000..80a42e2ed939 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RelayNamespace.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.relay.v2016_07_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.relay.v2016_07_01.implementation.RelayManager; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayNamespaceInner; + +/** + * Type representing RelayNamespace. + */ +public interface RelayNamespace 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. + */ + Sku sku(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the RelayNamespace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of RelayNamespace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RelayNamespace definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the RelayNamespace definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the relaynamespace definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Sku of the Namespace + * @return the next definition stage + */ + WithCreate withSku(Sku 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 RelayNamespace update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithTags { + } + + /** + * Grouping of RelayNamespace update stages. + */ + interface UpdateStages { + /** + * The stage of the relaynamespace update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RelayNamespaceUpdateParameter.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RelayNamespaceUpdateParameter.java new file mode 100644 index 000000000000..d520b2be4065 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/RelayNamespaceUpdateParameter.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the Patch Namespace operation. + */ +public class RelayNamespaceUpdateParameter { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The sku of the created namespace. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Creates an instance of RelayNamespaceUpdateParameter class. + */ + public RelayNamespaceUpdateParameter() { + sku = new 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 RelayNamespaceUpdateParameter object itself. + */ + public RelayNamespaceUpdateParameter 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 RelayNamespaceUpdateParameter object itself. + */ + public RelayNamespaceUpdateParameter withSku(Sku sku) { + this.sku = sku; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Relaytype.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Relaytype.java new file mode 100644 index 000000000000..d7186ce5d4b7 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Relaytype.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.relay.v2016_07_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Relaytype. + */ +public final class Relaytype extends ExpandableStringEnum { + /** Static value NetTcp for Relaytype. */ + public static final Relaytype NET_TCP = fromString("NetTcp"); + + /** Static value Http for Relaytype. */ + public static final Relaytype HTTP = fromString("Http"); + + /** + * Creates or finds a Relaytype from its string representation. + * @param name a name to look for + * @return the corresponding Relaytype + */ + @JsonCreator + public static Relaytype fromString(String name) { + return fromString(name, Relaytype.class); + } + + /** + * @return known Relaytype values + */ + public static Collection values() { + return values(Relaytype.class); + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Sku.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Sku.java new file mode 100644 index 000000000000..db71f4ed3f15 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/Sku.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Sku of the Namespace. + */ +public class Sku { + /** + * Name of this Sku. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The tier of this particular SKU. + */ + @JsonProperty(value = "tier", required = true) + private String tier; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + name = "Standard"; + tier = "Standard"; + } + + /** + * Get name of this Sku. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of this Sku. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier of this particular SKU. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier of this particular SKU. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/UnavailableReason.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/UnavailableReason.java new file mode 100644 index 000000000000..e648e2a4f08b --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WCFRelays.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WCFRelays.java new file mode 100644 index 000000000000..3fac4319842c --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WCFRelays.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.WCFRelaysInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.WcfRelayNamespaceAuthorizationRule; + +/** + * Type representing WCFRelays. + */ +public interface WCFRelays extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + WcfRelayNamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName); + + /** + * Returns the description for the specified WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String relayName); + + /** + * Lists the WCFRelays within 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 + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a WCFRelays . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String relayName); + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName); + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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 relayName); + + /** + * Deletes a WCFRelays authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName); + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName); + + /** + * Primary and Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName); + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName); + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WcfRelay.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WcfRelay.java new file mode 100644 index 000000000000..1d6276a3d3d9 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WcfRelay.java @@ -0,0 +1,225 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.WcfRelayInner; +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.relay.v2016_07_01.implementation.RelayManager; +import org.joda.time.DateTime; + +/** + * Type representing WcfRelay. + */ +public interface WcfRelay extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isDynamic value. + */ + Boolean isDynamic(); + + /** + * @return the listenerCount value. + */ + Integer listenerCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the relayType value. + */ + Relaytype relayType(); + + /** + * @return the requiresClientAuthorization value. + */ + Boolean requiresClientAuthorization(); + + /** + * @return the requiresTransportSecurity value. + */ + Boolean requiresTransportSecurity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * @return the userMetadata value. + */ + String userMetadata(); + + /** + * The entirety of the WcfRelay definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of WcfRelay definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a WcfRelay definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the wcfrelay 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 wcfrelay definition allowing to specify RelayType. + */ + interface WithRelayType { + /** + * Specifies relayType. + * @param relayType WCFRelay Type. Possible values include: 'NetTcp', 'Http' + * @return the next definition stage + */ + WithCreate withRelayType(Relaytype relayType); + } + + /** + * The stage of the wcfrelay definition allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization true if client authorization is needed for this relay; otherwise, false + * @return the next definition stage + */ + WithCreate withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the wcfrelay definition allowing to specify RequiresTransportSecurity. + */ + interface WithRequiresTransportSecurity { + /** + * Specifies requiresTransportSecurity. + * @param requiresTransportSecurity true if transport security is needed for this relay; otherwise, false + * @return the next definition stage + */ + WithCreate withRequiresTransportSecurity(Boolean requiresTransportSecurity); + } + + /** + * The stage of the wcfrelay definition allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored + * @return the next definition stage + */ + WithCreate withUserMetadata(String userMetadata); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithRelayType, DefinitionStages.WithRequiresClientAuthorization, DefinitionStages.WithRequiresTransportSecurity, DefinitionStages.WithUserMetadata { + } + } + /** + * The template for a WcfRelay update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRelayType, UpdateStages.WithRequiresClientAuthorization, UpdateStages.WithRequiresTransportSecurity, UpdateStages.WithUserMetadata { + } + + /** + * Grouping of WcfRelay update stages. + */ + interface UpdateStages { + /** + * The stage of the wcfrelay update allowing to specify RelayType. + */ + interface WithRelayType { + /** + * Specifies relayType. + * @param relayType WCFRelay Type. Possible values include: 'NetTcp', 'Http' + * @return the next update stage + */ + Update withRelayType(Relaytype relayType); + } + + /** + * The stage of the wcfrelay update allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization true if client authorization is needed for this relay; otherwise, false + * @return the next update stage + */ + Update withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the wcfrelay update allowing to specify RequiresTransportSecurity. + */ + interface WithRequiresTransportSecurity { + /** + * Specifies requiresTransportSecurity. + * @param requiresTransportSecurity true if transport security is needed for this relay; otherwise, false + * @return the next update stage + */ + Update withRequiresTransportSecurity(Boolean requiresTransportSecurity); + } + + /** + * The stage of the wcfrelay update allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored + * @return the next update stage + */ + Update withUserMetadata(String userMetadata); + } + + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WcfRelayNamespaceAuthorizationRule.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WcfRelayNamespaceAuthorizationRule.java new file mode 100644 index 000000000000..6077d5c1cc20 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/WcfRelayNamespaceAuthorizationRule.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.relay.v2016_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2016_07_01.implementation.RelayManager; +import java.util.List; + +/** + * Type representing WcfRelayNamespaceAuthorizationRule. + */ +public interface WcfRelayNamespaceAuthorizationRule 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 WcfRelayNamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWcfRelay, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of WcfRelayNamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a WcfRelayNamespaceAuthorizationRule definition. + */ + interface Blank extends WithWcfRelay { + } + + /** + * The stage of the wcfrelaynamespaceauthorizationrule definition allowing to specify WcfRelay. + */ + interface WithWcfRelay { + /** + * Specifies resourceGroupName, namespaceName, relayName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @return the next definition stage + */ + WithRights withExistingWcfRelay(String resourceGroupName, String namespaceName, String relayName); + } + + /** + * The stage of the wcfrelaynamespaceauthorizationrule 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 WcfRelayNamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of WcfRelayNamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the wcfrelaynamespaceauthorizationrule 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleInner.java new file mode 100644 index 000000000000..ab8c5eb7780a --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.relay.v2016_07_01.AccessRights; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of a Namespace AuthorizationRules. + */ +@JsonFlatten +public class AuthorizationRuleInner extends ProxyResource { + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "properties.rights", required = true) + private List rights; + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the AuthorizationRuleInner object itself. + */ + public AuthorizationRuleInner withRights(List rights) { + this.rights = rights; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleKeysImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleKeysImpl.java new file mode 100644 index 000000000000..be4a2e939d46 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleKeysImpl.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.AuthorizationRuleKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AuthorizationRuleKeysImpl extends WrapperImpl implements AuthorizationRuleKeys { + private final RelayManager manager; + AuthorizationRuleKeysImpl(AuthorizationRuleKeysInner inner, RelayManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public RelayManager 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleKeysInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleKeysInner.java new file mode 100644 index 000000000000..3ccdb12ea86c --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/AuthorizationRuleKeysInner.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.relay.v2016_07_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Namespace/Relay Connection String. + */ +public class AuthorizationRuleKeysInner { + /** + * PrimaryConnectionString of the created Namespace AuthorizationRule. + */ + @JsonProperty(value = "primaryConnectionString") + private String primaryConnectionString; + + /** + * SecondaryConnectionString of the created Namespace AuthorizationRule. + */ + @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 secondary 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 primaryConnectionString of the created Namespace AuthorizationRule. + * + * @return the primaryConnectionString value + */ + public String primaryConnectionString() { + return this.primaryConnectionString; + } + + /** + * Set primaryConnectionString of the created Namespace AuthorizationRule. + * + * @param primaryConnectionString the primaryConnectionString value to set + * @return the AuthorizationRuleKeysInner object itself. + */ + public AuthorizationRuleKeysInner withPrimaryConnectionString(String primaryConnectionString) { + this.primaryConnectionString = primaryConnectionString; + return this; + } + + /** + * Get secondaryConnectionString of the created Namespace AuthorizationRule. + * + * @return the secondaryConnectionString value + */ + public String secondaryConnectionString() { + return this.secondaryConnectionString; + } + + /** + * Set secondaryConnectionString of the created Namespace AuthorizationRule. + * + * @param secondaryConnectionString the secondaryConnectionString value to set + * @return the AuthorizationRuleKeysInner object itself. + */ + public AuthorizationRuleKeysInner 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 AuthorizationRuleKeysInner object itself. + */ + public AuthorizationRuleKeysInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get a base64-encoded 256-bit secondary key for signing and validating the SAS token. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set a base64-encoded 256-bit secondary key for signing and validating the SAS token. + * + * @param secondaryKey the secondaryKey value to set + * @return the AuthorizationRuleKeysInner object itself. + */ + public AuthorizationRuleKeysInner 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 AuthorizationRuleKeysInner object itself. + */ + public AuthorizationRuleKeysInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/CheckNameAvailabilityResultImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..353e30b9a1a3 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.CheckNameAvailabilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2016_07_01.UnavailableReason; + +class CheckNameAvailabilityResultImpl extends WrapperImpl implements CheckNameAvailabilityResult { + private final RelayManager manager; + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner inner, RelayManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public RelayManager 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/CheckNameAvailabilityResultInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..78aa138ab219 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionImpl.java new file mode 100644 index 000000000000..4c15239b9bc1 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionImpl.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class HybridConnectionImpl extends CreatableUpdatableImpl implements HybridConnection, HybridConnection.Definition, HybridConnection.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String hybridConnectionName; + + HybridConnectionImpl(String name, RelayManager manager) { + super(name, new HybridConnectionInner()); + this.manager = manager; + // Set resource name + this.hybridConnectionName = name; + // + } + + HybridConnectionImpl(HybridConnectionInner inner, RelayManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.hybridConnectionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.hybridConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "HybridConnections"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer listenerCount() { + return this.inner().listenerCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresClientAuthorization() { + return this.inner().requiresClientAuthorization(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public String userMetadata() { + return this.inner().userMetadata(); + } + + @Override + public HybridConnectionImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public HybridConnectionImpl withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.inner().withRequiresClientAuthorization(requiresClientAuthorization); + return this; + } + + @Override + public HybridConnectionImpl withUserMetadata(String userMetadata) { + this.inner().withUserMetadata(userMetadata); + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionInner.java new file mode 100644 index 000000000000..095f6f7f9bc3 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionInner.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.relay.v2016_07_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of HybridConnection Resource. + */ +@JsonFlatten +public class HybridConnectionInner extends ProxyResource { + /** + * The time the HybridConnection 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; + + /** + * The number of listeners for this HybridConnection. min : 1 and max:25 + * supported. + */ + @JsonProperty(value = "properties.listenerCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer listenerCount; + + /** + * true if client authorization is needed for this HybridConnection; + * otherwise, false. + */ + @JsonProperty(value = "properties.requiresClientAuthorization") + private Boolean requiresClientAuthorization; + + /** + * userMetadata is a placeholder to store user-defined string data for the + * HybridConnection endpoint.e.g. it can be used to store descriptive + * data, such as list of teams and their contact information also + * user-defined configuration settings can be stored. + */ + @JsonProperty(value = "properties.userMetadata") + private String userMetadata; + + /** + * Get the time the HybridConnection 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 the number of listeners for this HybridConnection. min : 1 and max:25 supported. + * + * @return the listenerCount value + */ + public Integer listenerCount() { + return this.listenerCount; + } + + /** + * Get true if client authorization is needed for this HybridConnection; otherwise, false. + * + * @return the requiresClientAuthorization value + */ + public Boolean requiresClientAuthorization() { + return this.requiresClientAuthorization; + } + + /** + * Set true if client authorization is needed for this HybridConnection; otherwise, false. + * + * @param requiresClientAuthorization the requiresClientAuthorization value to set + * @return the HybridConnectionInner object itself. + */ + public HybridConnectionInner withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.requiresClientAuthorization = requiresClientAuthorization; + return this; + } + + /** + * Get userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * + * @return the userMetadata value + */ + public String userMetadata() { + return this.userMetadata; + } + + /** + * Set userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * + * @param userMetadata the userMetadata value to set + * @return the HybridConnectionInner object itself. + */ + public HybridConnectionInner withUserMetadata(String userMetadata) { + this.userMetadata = userMetadata; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionNamespaceAuthorizationRuleImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionNamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..fda5e5c64edf --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionNamespaceAuthorizationRuleImpl.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnectionNamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.relay.v2016_07_01.AccessRights; + +class HybridConnectionNamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements HybridConnectionNamespaceAuthorizationRule, HybridConnectionNamespaceAuthorizationRule.Definition, HybridConnectionNamespaceAuthorizationRule.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String hybridConnectionName; + private String authorizationRuleName; + private List crights; + private List urights; + + HybridConnectionNamespaceAuthorizationRuleImpl(String name, RelayManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + HybridConnectionNamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, RelayManager 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.hybridConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "HybridConnections"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, 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 HybridConnectionNamespaceAuthorizationRuleImpl withExistingHybridConnection(String resourceGroupName, String namespaceName, String hybridConnectionName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.hybridConnectionName = hybridConnectionName; + return this; + } + + @Override + public HybridConnectionNamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionsImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionsImpl.java new file mode 100644 index 000000000000..9b5b4e2ed4c9 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionsImpl.java @@ -0,0 +1,196 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.relay.v2016_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnections; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.relay.v2016_07_01.NamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnection; +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnectionNamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2016_07_01.AuthorizationRuleKeys; + +class HybridConnectionsImpl extends WrapperImpl implements HybridConnections { + private final RelayManager manager; + + HybridConnectionsImpl(RelayManager manager) { + super(manager.inner().hybridConnections()); + this.manager = manager; + } + + public RelayManager manager() { + return this.manager; + } + + @Override + public HybridConnectionImpl define(String name) { + return wrapModel(name); + } + + private HybridConnectionImpl wrapModel(HybridConnectionInner inner) { + return new HybridConnectionImpl(inner, manager()); + } + + private HybridConnectionImpl wrapModel(String name) { + return new HybridConnectionImpl(name, this.manager()); + } + + @Override + public Observable listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.listPostAuthorizationRulesAsync(resourceGroupName, namespaceName, hybridConnectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + HybridConnectionsInner 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 HybridConnection call(HybridConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, hybridConnectionName) + .map(new Func1() { + @Override + public HybridConnection call(HybridConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, hybridConnectionName).toCompletable(); + } + + @Override + public HybridConnectionNamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private HybridConnectionNamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new HybridConnectionNamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private HybridConnectionNamespaceAuthorizationRuleImpl wrapHybridConnectionNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new HybridConnectionNamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingHybridConnectionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String hybridConnectionName = IdParsingUtils.getValueFromIdByName(id, "HybridConnections"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + HybridConnectionsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + .map(new Func1() { + @Override + public HybridConnectionNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapHybridConnectionNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, hybridConnectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public HybridConnectionNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapHybridConnectionNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.postAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + }); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + .map(new Func1() { + @Override + public AuthorizationRuleKeys call(AuthorizationRuleKeysInner inner) { + return new AuthorizationRuleKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + .map(new Func1() { + @Override + public AuthorizationRuleKeys call(AuthorizationRuleKeysInner inner) { + return new AuthorizationRuleKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionsInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionsInner.java new file mode 100644 index 000000000000..e5214b25566d --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/HybridConnectionsInner.java @@ -0,0 +1,1848 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_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.relay.v2016_07_01.AccessRights; +import com.microsoft.azure.management.relay.v2016_07_01.ErrorResponseException; +import com.microsoft.azure.management.relay.v2016_07_01.PolicyKey; +import com.microsoft.azure.management.relay.v2016_07_01.RegenerateKeysParameters; +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 HybridConnections. + */ +public class HybridConnectionsInner { + /** The Retrofit service to perform REST calls. */ + private HybridConnectionsService service; + /** The service client containing this operation class. */ + private RelayManagementClientImpl client; + + /** + * Initializes an instance of HybridConnectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public HybridConnectionsInner(Retrofit retrofit, RelayManagementClientImpl client) { + this.service = retrofit.create(HybridConnectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for HybridConnections to be + * used by Retrofit to perform actually REST calls. + */ + interface HybridConnectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2016_07_01.HybridConnections listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections") + 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.relay.v2016_07_01.HybridConnections createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @Path("subscriptionId") String subscriptionId, @Body HybridConnectionInner 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.relay.v2016_07_01.HybridConnections delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections listPostAuthorizationRules" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules") + Observable> listPostAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2016_07_01.HybridConnections deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections postAuthorizationRule" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}") + Observable> postAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2016_07_01.HybridConnections 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.relay.v2016_07_01.HybridConnections listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@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.relay.v2016_07_01.HybridConnections listPostAuthorizationRulesNext" }) + @GET + Observable> listPostAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the HybridConnection within 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 + * @return the PagedList<HybridConnectionInner> 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(); + } + }; + } + + /** + * Lists the HybridConnection within 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> 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); + } + + /** + * Lists the HybridConnection within 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 to the PagedList<HybridConnectionInner> 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(); + } + }); + } + + /** + * Lists the HybridConnection within 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 to the PagedList<HybridConnectionInner> 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)); + } + }); + } + + /** + * Lists the HybridConnection within the 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<HybridConnectionInner> 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); + } + + /** + * Creates or Updates a service HybridConnection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a HybridConnection. + * @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 HybridConnectionInner object if successful. + */ + public HybridConnectionInner createOrUpdate(String resourceGroupName, String namespaceName, String hybridConnectionName, HybridConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a service HybridConnection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a HybridConnection. + * @param serviceCallback 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 hybridConnectionName, HybridConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters), serviceCallback); + } + + /** + * Creates or Updates a service HybridConnection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a HybridConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, HybridConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters).map(new Func1, HybridConnectionInner>() { + @Override + public HybridConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a service HybridConnection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a HybridConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, HybridConnectionInner 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 HybridConnection . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single().body(); + } + + /** + * Deletes a HybridConnection . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName), serviceCallback); + } + + /** + * Deletes a HybridConnection . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a HybridConnection . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 the description for the specified HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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 HybridConnectionInner object if successful. + */ + public HybridConnectionInner get(String resourceGroupName, String namespaceName, String hybridConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single().body(); + } + + /** + * Returns the description for the specified HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName), serviceCallback); + } + + /** + * Returns the description for the specified HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).map(new Func1, HybridConnectionInner>() { + @Override + public HybridConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the description for the specified HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName) + .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)); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace Name + ServiceResponse> * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listPostAuthorizationRules(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + ServiceResponse> response = listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection 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> listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + return listPostAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listPostAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + return listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName) + .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(listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace Name + ServiceResponse> * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listPostAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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.listPostAuthorizationRules(resourceGroupName, namespaceName, hybridConnectionName, 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 = listPostAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPostAuthorizationRulesDelegate(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 HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates or Updates an authorization rule for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates or Updates an authorization rule for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates an authorization rule for a HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, hybridConnectionName, 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 HybridConnection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a HybridConnection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a HybridConnection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a HybridConnection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner postAuthorizationRule(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * HybridConnection authorizationRule for a HybridConnection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> postAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 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 ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner listKeys(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * Primary and Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule name. + * @param policyKey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, PolicyKey policyKey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, policyKey).toBlocking().single().body(); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 hybridConnectionName, String authorizationRuleName, PolicyKey policyKey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, policyKey), serviceCallback); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, PolicyKey policyKey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, policyKey).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the HybridConnection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the HybridConnection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<HybridConnectionInner> 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(); + } + }; + } + + /** + * Lists the HybridConnection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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); + } + + /** + * Lists the HybridConnection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<HybridConnectionInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the HybridConnection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<HybridConnectionInner> 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)); + } + }); + } + + /** + * Lists the HybridConnection within the namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<HybridConnectionInner> 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); + } + + /** + * Authorization rules for a HybridConnection. + * + * @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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a HybridConnection. + * + * @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); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Authorization rules for a HybridConnection. + * + * @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<AuthorizationRuleInner> object if successful. + */ + public PagedList listPostAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a HybridConnection. + * + * @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> listPostAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listPostAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listPostAuthorizationRulesNextAsync(final String nextPageLink) { + return listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listPostAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(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(listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a HybridConnection. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listPostAuthorizationRulesNextSinglePageAsync(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.listPostAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listPostAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPostAuthorizationRulesNextDelegate(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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/IdParsingUtils.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ca4b49100f18 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespaceAuthorizationRuleImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..ef2e114aed6d --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespaceAuthorizationRuleImpl.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.NamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.relay.v2016_07_01.AccessRights; + +class NamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements NamespaceAuthorizationRule, NamespaceAuthorizationRule.Definition, NamespaceAuthorizationRule.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String authorizationRuleName; + private List crights; + private List urights; + + NamespaceAuthorizationRuleImpl(String name, RelayManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + NamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, RelayManager 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 RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public NamespaceAuthorizationRuleImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public NamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespacesImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespacesImpl.java new file mode 100644 index 000000000000..9ebe189e70b9 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespacesImpl.java @@ -0,0 +1,264 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.relay.v2016_07_01.Namespaces; +import com.microsoft.azure.management.relay.v2016_07_01.RelayNamespace; +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.relay.v2016_07_01.NamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2016_07_01.CheckNameAvailabilityResult; +import com.microsoft.azure.management.relay.v2016_07_01.AuthorizationRuleKeys; + +class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { + protected NamespacesImpl(RelayManager 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 RelayNamespace call(RelayNamespaceInner 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 RelayNamespace call(RelayNamespaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public RelayNamespaceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listPostAuthorizationRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + }); + } + + @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 RelayNamespaceImpl wrapModel(RelayNamespaceInner inner) { + return new RelayNamespaceImpl(inner.name(), inner, manager()); + } + + @Override + protected RelayNamespaceImpl wrapModel(String name) { + return new RelayNamespaceImpl(name, new RelayNamespaceInner(), this.manager()); + } + + @Override + public NamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private NamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new NamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private NamespaceAuthorizationRuleImpl wrapNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "AuthorizationRules"); + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.postAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + }); + } + + @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 AuthorizationRuleKeys call(AuthorizationRuleKeysInner inner) { + return new AuthorizationRuleKeysImpl(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 AuthorizationRuleKeys call(AuthorizationRuleKeysInner inner) { + return new AuthorizationRuleKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespacesInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespacesInner.java new file mode 100644 index 000000000000..9e24445079df --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/NamespacesInner.java @@ -0,0 +1,2406 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_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.relay.v2016_07_01.AccessRights; +import com.microsoft.azure.management.relay.v2016_07_01.CheckNameAvailability; +import com.microsoft.azure.management.relay.v2016_07_01.ErrorResponseException; +import com.microsoft.azure.management.relay.v2016_07_01.PolicyKey; +import com.microsoft.azure.management.relay.v2016_07_01.RegenerateKeysParameters; +import com.microsoft.azure.management.relay.v2016_07_01.RelayNamespaceUpdateParameter; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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 RelayManagementClientImpl 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, RelayManagementClientImpl 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.relay.v2016_07_01.Namespaces checkNameAvailabilityMethod" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body RelayNamespaceInner 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.relay.v2016_07_01.Namespaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body RelayNamespaceInner 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.relay.v2016_07_01.Namespaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RelayNamespaceUpdateParameter parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2016_07_01.Namespaces listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces listPostAuthorizationRules" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules") + Observable> listPostAuthorizationRules(@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.relay.v2016_07_01.Namespaces createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2016_07_01.Namespaces deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces postAuthorizationRule" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + Observable> postAuthorizationRule(@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.relay.v2016_07_01.Namespaces listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_01.Namespaces regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2016_07_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.relay.v2016_07_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.relay.v2016_07_01.Namespaces listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@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.relay.v2016_07_01.Namespaces listPostAuthorizationRulesNext" }) + @GET + Observable> listPostAuthorizationRulesNext(@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); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RelayNamespaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RelayNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> 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); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner createOrUpdate(String resourceGroupName, String namespaceName, RelayNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().last().body(); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner 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()); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner beginCreateOrUpdate(String resourceGroupName, String namespaceName, RelayNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, RelayNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, RelayNamespaceInner 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(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); + } + + /** + * Returns the 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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner getByResourceGroup(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Returns the 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); + } + + /** + * Returns the 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 RelayNamespaceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the 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 RelayNamespaceInner 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); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner update(String resourceGroupName, String namespaceName) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param serviceCallback 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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RelayNamespaceInner object + */ + public Observable updateAsync(String resourceGroupName, String namespaceName) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RelayNamespaceInner object + */ + public Observable> updateWithServiceResponseAsync(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 Map tags = null; + RelayNamespaceUpdateParameter parameters = new RelayNamespaceUpdateParameter(); + parameters.withTags(null); + return service.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner update(String resourceGroupName, String namespaceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, tags).toBlocking().single().body(); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param tags Resource tags + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String namespaceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, namespaceName, tags), serviceCallback); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RelayNamespaceInner object + */ + public Observable updateAsync(String resourceGroupName, String namespaceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, tags).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param tags Resource tags + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RelayNamespaceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String namespaceName, Map tags) { + 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."); + } + Validator.validate(tags); + RelayNamespaceUpdateParameter parameters = new RelayNamespaceUpdateParameter(); + parameters.withTags(tags); + return service.update(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 = 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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<AuthorizationRuleInner> 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(); + } + }; + } + + /** + * 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); + } + + /** + * 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<AuthorizationRuleInner> 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(); + } + }); + } + + /** + * 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<AuthorizationRuleInner> 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)); + } + }); + } + + /** + * 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<AuthorizationRuleInner> 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); + } + + /** + * 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listPostAuthorizationRules(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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> listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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<AuthorizationRuleInner> object + */ + public Observable> listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + return listPostAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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<AuthorizationRuleInner> object + */ + public Observable>> listPostAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listPostAuthorizationRulesSinglePageAsync(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(listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * 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<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listPostAuthorizationRulesSinglePageAsync(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.listPostAuthorizationRules(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 = listPostAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPostAuthorizationRulesDelegate(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 authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String 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 authorizationRule 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 authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner 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 authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 authorizationRule 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 authorizationRule 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 authorizationRule 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); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner postAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName), serviceCallback); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> postAuthorizationRuleWithServiceResponseAsync(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.postAuthorizationRule(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 = postAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse postAuthorizationRuleDelegate(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 ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner listKeys(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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); + } + + /** + * Primary and Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner 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 ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner 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 ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule name. + * @param policyKey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, PolicyKey policyKey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, policyKey).toBlocking().single().body(); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, PolicyKey policyKey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, policyKey).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the namespace. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @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<RelayNamespaceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + * @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<RelayNamespaceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the subscription irrespective of the resourceGroups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> 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); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AuthorizationRuleInner> object if successful. + */ + public PagedList listPostAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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> listPostAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listPostAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listPostAuthorizationRulesNextAsync(final String nextPageLink) { + return listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listPostAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(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(listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listPostAuthorizationRulesNextSinglePageAsync(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.listPostAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listPostAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPostAuthorizationRulesNextDelegate(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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..069d0c551c30 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2016_07_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final RelayManager manager; + OperationImpl(OperationInner inner, RelayManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationInner.java new file mode 100644 index 000000000000..a5143983f70d --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A EventHub 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationsImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b599dc989d30 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2016_07_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.relay.v2016_07_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final RelayManager manager; + + OperationsImpl(RelayManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public RelayManager 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationsInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..1a14fb0d6f58 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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.relay.v2016_07_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 RelayManagementClientImpl 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, RelayManagementClientImpl 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.relay.v2016_07_01.Operations list" }) + @GET("providers/Microsoft.Relay/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.relay.v2016_07_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Relay 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 Relay 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 Relay 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 Relay 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 Relay 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 Relay 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 Relay 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 Relay 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 Relay 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 Relay 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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/PageImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/PageImpl.java new file mode 100644 index 000000000000..e610592223dd --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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.relay.v2016_07_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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayManagementClientImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayManagementClientImpl.java new file mode 100644 index 000000000000..092f93f86a09 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayManagementClientImpl.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.relay.v2016_07_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 RelayManagementClientImpl class. + */ +public class RelayManagementClientImpl 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 which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify 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 which uniquely identify 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 RelayManagementClientImpl 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 RelayManagementClientImpl 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 RelayManagementClientImpl 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 RelayManagementClientImpl 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 HybridConnectionsInner object to access its operations. + */ + private HybridConnectionsInner hybridConnections; + + /** + * Gets the HybridConnectionsInner object to access its operations. + * @return the HybridConnectionsInner object. + */ + public HybridConnectionsInner hybridConnections() { + return this.hybridConnections; + } + + /** + * The WCFRelaysInner object to access its operations. + */ + private WCFRelaysInner wCFRelays; + + /** + * Gets the WCFRelaysInner object to access its operations. + * @return the WCFRelaysInner object. + */ + public WCFRelaysInner wCFRelays() { + return this.wCFRelays; + } + + /** + * Initializes an instance of RelayManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public RelayManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of RelayManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public RelayManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of RelayManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public RelayManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2016-07-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.hybridConnections = new HybridConnectionsInner(restClient().retrofit(), this); + this.wCFRelays = new WCFRelaysInner(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(), "RelayManagementClient", "2016-07-01"); + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayManager.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayManager.java new file mode 100644 index 000000000000..0994daf81b93 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_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.relay.v2016_07_01.Operations; +import com.microsoft.azure.management.relay.v2016_07_01.Namespaces; +import com.microsoft.azure.management.relay.v2016_07_01.HybridConnections; +import com.microsoft.azure.management.relay.v2016_07_01.WCFRelays; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Relay resource management. + */ +public final class RelayManager extends ManagerCore { + private Operations operations; + private Namespaces namespaces; + private HybridConnections hybridConnections; + private WCFRelays wCFRelays; + /** + * Get a Configurable instance that can be used to create RelayManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new RelayManager.ConfigurableImpl(); + } + /** + * Creates an instance of RelayManager that exposes Relay resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the RelayManager + */ + public static RelayManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new RelayManager(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 RelayManager that exposes Relay resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the RelayManager + */ + public static RelayManager authenticate(RestClient restClient, String subscriptionId) { + return new RelayManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of RelayManager that exposes Relay management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Relay management API entry points that work across subscriptions + */ + RelayManager 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 HybridConnections. + */ + public HybridConnections hybridConnections() { + if (this.hybridConnections == null) { + this.hybridConnections = new HybridConnectionsImpl(this); + } + return this.hybridConnections; + } + + /** + * @return Entry point to manage WCFRelays. + */ + public WCFRelays wCFRelays() { + if (this.wCFRelays == null) { + this.wCFRelays = new WCFRelaysImpl(this); + } + return this.wCFRelays; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public RelayManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return RelayManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private RelayManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new RelayManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayNamespaceImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayNamespaceImpl.java new file mode 100644 index 000000000000..c4069d9a858d --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayNamespaceImpl.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.relay.v2016_07_01.RelayNamespace; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.relay.v2016_07_01.Sku; +import org.joda.time.DateTime; + +class RelayNamespaceImpl extends GroupableResourceCoreImpl implements RelayNamespace, RelayNamespace.Definition, RelayNamespace.Update { + private Map utags; + RelayNamespaceImpl(String name, RelayNamespaceInner inner, RelayManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.utags) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String metricId() { + return this.inner().metricId(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String serviceBusEndpoint() { + return this.inner().serviceBusEndpoint(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public RelayNamespaceImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + + @Override + public RelayNamespaceImpl withTags(Map tags) { + this.utags = tags; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayNamespaceInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayNamespaceInner.java new file mode 100644 index 000000000000..b1b3e5da9a2e --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/RelayNamespaceInner.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.Sku; +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 RelayNamespaceInner extends Resource { + /** + * Sku of the Namespace. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Provisioning state of the namespace. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The time the namespace was created. + */ + @JsonProperty(value = "properties.createdAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAt; + + /** + * The time the namespace was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * Endpoint you can use to perform Service Bus operations. + */ + @JsonProperty(value = "properties.serviceBusEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String serviceBusEndpoint; + + /** + * Identifier for Azure Insights metrics. + */ + @JsonProperty(value = "properties.metricId", access = JsonProperty.Access.WRITE_ONLY) + private String metricId; + + /** + * Creates an instance of RelayNamespaceInner class. + */ + public RelayNamespaceInner() { + sku = new Sku(); + } + + /** + * Get sku of the Namespace. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set sku of the Namespace. + * + * @param sku the sku value to set + * @return the RelayNamespaceInner object itself. + */ + public RelayNamespaceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get provisioning state of the namespace. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the time the namespace was created. + * + * @return the createdAt value + */ + public DateTime createdAt() { + return this.createdAt; + } + + /** + * Get the time the namespace was updated. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get endpoint you can use to perform Service Bus operations. + * + * @return the serviceBusEndpoint value + */ + public String serviceBusEndpoint() { + return this.serviceBusEndpoint; + } + + /** + * Get identifier for Azure Insights metrics. + * + * @return the metricId value + */ + public String metricId() { + return this.metricId; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WCFRelaysImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WCFRelaysImpl.java new file mode 100644 index 000000000000..48ac0e3341ea --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WCFRelaysImpl.java @@ -0,0 +1,196 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.relay.v2016_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2016_07_01.WCFRelays; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.relay.v2016_07_01.NamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2016_07_01.WcfRelay; +import com.microsoft.azure.management.relay.v2016_07_01.WcfRelayNamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2016_07_01.AuthorizationRuleKeys; + +class WCFRelaysImpl extends WrapperImpl implements WCFRelays { + private final RelayManager manager; + + WCFRelaysImpl(RelayManager manager) { + super(manager.inner().wCFRelays()); + this.manager = manager; + } + + public RelayManager manager() { + return this.manager; + } + + @Override + public WcfRelayImpl define(String name) { + return wrapModel(name); + } + + private WcfRelayImpl wrapModel(WcfRelayInner inner) { + return new WcfRelayImpl(inner, manager()); + } + + private WcfRelayImpl wrapModel(String name) { + return new WcfRelayImpl(name, this.manager()); + } + + @Override + public Observable listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + WCFRelaysInner client = this.inner(); + return client.listPostAuthorizationRulesAsync(resourceGroupName, namespaceName, relayName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + WCFRelaysInner 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 WcfRelay call(WcfRelayInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String relayName) { + WCFRelaysInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, relayName) + .map(new Func1() { + @Override + public WcfRelay call(WcfRelayInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String relayName) { + WCFRelaysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, relayName).toCompletable(); + } + + @Override + public WcfRelayNamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private WcfRelayNamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new WcfRelayNamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private WcfRelayNamespaceAuthorizationRuleImpl wrapWcfRelayNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new WcfRelayNamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingWCFRelaysInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String relayName = IdParsingUtils.getValueFromIdByName(id, "WcfRelays"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + WCFRelaysInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName) + .map(new Func1() { + @Override + public WcfRelayNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapWcfRelayNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + WCFRelaysInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, relayName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public WcfRelayNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapWcfRelayNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.postAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + }); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName) + .map(new Func1() { + @Override + public AuthorizationRuleKeys call(AuthorizationRuleKeysInner inner) { + return new AuthorizationRuleKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName) + .map(new Func1() { + @Override + public AuthorizationRuleKeys call(AuthorizationRuleKeysInner inner) { + return new AuthorizationRuleKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WCFRelaysInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WCFRelaysInner.java new file mode 100644 index 000000000000..99ca3bdfb631 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WCFRelaysInner.java @@ -0,0 +1,1849 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_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.relay.v2016_07_01.AccessRights; +import com.microsoft.azure.management.relay.v2016_07_01.ErrorResponseException; +import com.microsoft.azure.management.relay.v2016_07_01.PolicyKey; +import com.microsoft.azure.management.relay.v2016_07_01.RegenerateKeysParameters; +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 WCFRelays. + */ +public class WCFRelaysInner { + /** The Retrofit service to perform REST calls. */ + private WCFRelaysService service; + /** The service client containing this operation class. */ + private RelayManagementClientImpl client; + + /** + * Initializes an instance of WCFRelaysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public WCFRelaysInner(Retrofit retrofit, RelayManagementClientImpl client) { + this.service = retrofit.create(WCFRelaysService.class); + this.client = client; + } + + /** + * The interface defining all the services for WCFRelays to be + * used by Retrofit to perform actually REST calls. + */ + interface WCFRelaysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2016_07_01.WCFRelays listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays") + 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.relay.v2016_07_01.WCFRelays createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @Path("subscriptionId") String subscriptionId, @Body WcfRelayInner 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.relay.v2016_07_01.WCFRelays delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays listPostAuthorizationRules" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules") + Observable> listPostAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2016_07_01.WCFRelays deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays postAuthorizationRule" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}") + Observable> postAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/ListKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2016_07_01.WCFRelays 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.relay.v2016_07_01.WCFRelays listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@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.relay.v2016_07_01.WCFRelays listPostAuthorizationRulesNext" }) + @GET + Observable> listPostAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the WCFRelays within 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 + * @return the PagedList<WcfRelayInner> 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(); + } + }; + } + + /** + * Lists the WCFRelays within 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> 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); + } + + /** + * Lists the WCFRelays within 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 to the PagedList<WcfRelayInner> 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(); + } + }); + } + + /** + * Lists the WCFRelays within 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 to the PagedList<WcfRelayInner> 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)); + } + }); + } + + /** + * Lists the WCFRelays within the 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<WcfRelayInner> 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); + } + + /** + * Creates or Updates a WCFRelay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param parameters Parameters supplied to create a WCFRelays. + * @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 WcfRelayInner object if successful. + */ + public WcfRelayInner createOrUpdate(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a WCFRelay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param parameters Parameters supplied to create a WCFRelays. + * @param serviceCallback 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 relayName, WcfRelayInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, parameters), serviceCallback); + } + + /** + * Creates or Updates a WCFRelay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param parameters Parameters supplied to create a WCFRelays. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, parameters).map(new Func1, WcfRelayInner>() { + @Override + public WcfRelayInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a WCFRelay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param parameters Parameters supplied to create a WCFRelays. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 WCFRelays . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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 relayName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).toBlocking().single().body(); + } + + /** + * Deletes a WCFRelays . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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 relayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, relayName), serviceCallback); + } + + /** + * Deletes a WCFRelays . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String relayName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a WCFRelays . + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 the description for the specified WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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 WcfRelayInner object if successful. + */ + public WcfRelayInner get(String resourceGroupName, String namespaceName, String relayName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).toBlocking().single().body(); + } + + /** + * Returns the description for the specified WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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 relayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, relayName), serviceCallback); + } + + /** + * Returns the description for the specified WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String relayName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).map(new Func1, WcfRelayInner>() { + @Override + public WcfRelayInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the description for the specified WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String relayName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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 relayName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, relayName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName) + .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)); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace Name + ServiceResponse> * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listPostAuthorizationRules(final String resourceGroupName, final String namespaceName, final String relayName) { + ServiceResponse> response = listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay 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> listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listPostAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + return listPostAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, relayName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listPostAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + return listPostAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName) + .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(listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The Namespace Name + ServiceResponse> * @param relayName The relay name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listPostAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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.listPostAuthorizationRules(resourceGroupName, namespaceName, relayName, 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 = listPostAuthorizationRulesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPostAuthorizationRulesDelegate(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 WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates or Updates an authorization rule for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates or Updates an authorization rule for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates an authorization rule for a WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, relayName, 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 WCFRelays authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a WCFRelays authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a WCFRelays authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a WCFRelays authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner postAuthorizationRule(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable postAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return postAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get authorizationRule for a WCFRelays by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> postAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 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 ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner listKeys(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Primary and Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule name. + * @param policyKey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleKeysInner object if successful. + */ + public AuthorizationRuleKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, PolicyKey policyKey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, policyKey).toBlocking().single().body(); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 relayName, String authorizationRuleName, PolicyKey policyKey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, policyKey), serviceCallback); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object + */ + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, PolicyKey policyKey) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, policyKey).map(new Func1, AuthorizationRuleKeysInner>() { + @Override + public AuthorizationRuleKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the Primary or Secondary ConnectionStrings to the WCFRelays. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The Namespace Name + * @param relayName The relay name + * @param authorizationRuleName The authorizationRule 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 AuthorizationRuleKeysInner object + */ + public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the WCFRelays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<WcfRelayInner> 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(); + } + }; + } + + /** + * Lists the WCFRelays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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); + } + + /** + * Lists the WCFRelays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<WcfRelayInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the WCFRelays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<WcfRelayInner> 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)); + } + }); + } + + /** + * Lists the WCFRelays within the namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<WcfRelayInner> 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); + } + + /** + * Authorization rules for a WCFRelays. + * + * @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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a WCFRelays. + * + * @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); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Authorization rules for a WCFRelays. + * + * @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<AuthorizationRuleInner> object if successful. + */ + public PagedList listPostAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a WCFRelays. + * + * @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> listPostAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listPostAuthorizationRulesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listPostAuthorizationRulesNextAsync(final String nextPageLink) { + return listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listPostAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listPostAuthorizationRulesNextSinglePageAsync(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(listPostAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a WCFRelays. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listPostAuthorizationRulesNextSinglePageAsync(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.listPostAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listPostAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPostAuthorizationRulesNextDelegate(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/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayImpl.java new file mode 100644 index 000000000000..4f2cc535b1d3 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayImpl.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.WcfRelay; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.relay.v2016_07_01.Relaytype; +import org.joda.time.DateTime; + +class WcfRelayImpl extends CreatableUpdatableImpl implements WcfRelay, WcfRelay.Definition, WcfRelay.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String relayName; + + WcfRelayImpl(String name, RelayManager manager) { + super(name, new WcfRelayInner()); + this.manager = manager; + // Set resource name + this.relayName = name; + // + } + + WcfRelayImpl(WcfRelayInner inner, RelayManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.relayName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.relayName = IdParsingUtils.getValueFromIdByName(inner.id(), "WcfRelays"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.relayName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isDynamic() { + return this.inner().isDynamic(); + } + + @Override + public Integer listenerCount() { + return this.inner().listenerCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Relaytype relayType() { + return this.inner().relayType(); + } + + @Override + public Boolean requiresClientAuthorization() { + return this.inner().requiresClientAuthorization(); + } + + @Override + public Boolean requiresTransportSecurity() { + return this.inner().requiresTransportSecurity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public String userMetadata() { + return this.inner().userMetadata(); + } + + @Override + public WcfRelayImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public WcfRelayImpl withRelayType(Relaytype relayType) { + this.inner().withRelayType(relayType); + return this; + } + + @Override + public WcfRelayImpl withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.inner().withRequiresClientAuthorization(requiresClientAuthorization); + return this; + } + + @Override + public WcfRelayImpl withRequiresTransportSecurity(Boolean requiresTransportSecurity) { + this.inner().withRequiresTransportSecurity(requiresTransportSecurity); + return this; + } + + @Override + public WcfRelayImpl withUserMetadata(String userMetadata) { + this.inner().withUserMetadata(userMetadata); + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayInner.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayInner.java new file mode 100644 index 000000000000..b364e1d822e6 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayInner.java @@ -0,0 +1,189 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.Relaytype; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of WcfRelays Resource. + */ +@JsonFlatten +public class WcfRelayInner extends ProxyResource { + /** + * WCFRelay Type. Possible values include: 'NetTcp', 'Http'. + */ + @JsonProperty(value = "properties.relayType") + private Relaytype relayType; + + /** + * The time the WCFRelay 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; + + /** + * The number of listeners for this relay. min : 1 and max:25 supported. + */ + @JsonProperty(value = "properties.listenerCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer listenerCount; + + /** + * true if client authorization is needed for this relay; otherwise, false. + */ + @JsonProperty(value = "properties.requiresClientAuthorization") + private Boolean requiresClientAuthorization; + + /** + * true if transport security is needed for this relay; otherwise, false. + */ + @JsonProperty(value = "properties.requiresTransportSecurity") + private Boolean requiresTransportSecurity; + + /** + * true if the relay is dynamic; otherwise, false. + */ + @JsonProperty(value = "properties.isDynamic", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDynamic; + + /** + * userMetadata is a placeholder to store user-defined string data for the + * HybridConnection endpoint.e.g. it can be used to store descriptive + * data, such as list of teams and their contact information also + * user-defined configuration settings can be stored. + */ + @JsonProperty(value = "properties.userMetadata") + private String userMetadata; + + /** + * Get wCFRelay Type. Possible values include: 'NetTcp', 'Http'. + * + * @return the relayType value + */ + public Relaytype relayType() { + return this.relayType; + } + + /** + * Set wCFRelay Type. Possible values include: 'NetTcp', 'Http'. + * + * @param relayType the relayType value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withRelayType(Relaytype relayType) { + this.relayType = relayType; + return this; + } + + /** + * Get the time the WCFRelay 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 the number of listeners for this relay. min : 1 and max:25 supported. + * + * @return the listenerCount value + */ + public Integer listenerCount() { + return this.listenerCount; + } + + /** + * Get true if client authorization is needed for this relay; otherwise, false. + * + * @return the requiresClientAuthorization value + */ + public Boolean requiresClientAuthorization() { + return this.requiresClientAuthorization; + } + + /** + * Set true if client authorization is needed for this relay; otherwise, false. + * + * @param requiresClientAuthorization the requiresClientAuthorization value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.requiresClientAuthorization = requiresClientAuthorization; + return this; + } + + /** + * Get true if transport security is needed for this relay; otherwise, false. + * + * @return the requiresTransportSecurity value + */ + public Boolean requiresTransportSecurity() { + return this.requiresTransportSecurity; + } + + /** + * Set true if transport security is needed for this relay; otherwise, false. + * + * @param requiresTransportSecurity the requiresTransportSecurity value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withRequiresTransportSecurity(Boolean requiresTransportSecurity) { + this.requiresTransportSecurity = requiresTransportSecurity; + return this; + } + + /** + * Get true if the relay is dynamic; otherwise, false. + * + * @return the isDynamic value + */ + public Boolean isDynamic() { + return this.isDynamic; + } + + /** + * Get userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * + * @return the userMetadata value + */ + public String userMetadata() { + return this.userMetadata; + } + + /** + * Set userMetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored. + * + * @param userMetadata the userMetadata value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withUserMetadata(String userMetadata) { + this.userMetadata = userMetadata; + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayNamespaceAuthorizationRuleImpl.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayNamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..6fb32e03277f --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/WcfRelayNamespaceAuthorizationRuleImpl.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.relay.v2016_07_01.implementation; + +import com.microsoft.azure.management.relay.v2016_07_01.WcfRelayNamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.relay.v2016_07_01.AccessRights; + +class WcfRelayNamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements WcfRelayNamespaceAuthorizationRule, WcfRelayNamespaceAuthorizationRule.Definition, WcfRelayNamespaceAuthorizationRule.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String relayName; + private String authorizationRuleName; + private List crights; + private List urights; + + WcfRelayNamespaceAuthorizationRuleImpl(String name, RelayManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + WcfRelayNamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, RelayManager 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.relayName = IdParsingUtils.getValueFromIdByName(inner.id(), "WcfRelays"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.relayName, 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 WcfRelayNamespaceAuthorizationRuleImpl withExistingWcfRelay(String resourceGroupName, String namespaceName, String relayName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.relayName = relayName; + return this; + } + + @Override + public WcfRelayNamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/package-info.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/implementation/package-info.java new file mode 100644 index 000000000000..ddfea7484169 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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 RelayManagementClient. + * Use these API to manage Azure Relay resources through Azure Resources Manager. + */ +package com.microsoft.azure.management.relay.v2016_07_01.implementation; diff --git a/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/package-info.java b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_01/package-info.java new file mode 100644 index 000000000000..73435b1d0e90 --- /dev/null +++ b/relay/resource-manager/v2016_07_01/src/main/java/com/microsoft/azure/management/relay/v2016_07_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 RelayManagementClient. + * Use these API to manage Azure Relay resources through Azure Resources Manager. + */ +package com.microsoft.azure.management.relay.v2016_07_01; diff --git a/relay/resource-manager/v2017_04_01/pom.xml b/relay/resource-manager/v2017_04_01/pom.xml new file mode 100644 index 000000000000..d5102415f120 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.relay.v2017_04_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-relay + 1.0.0-beta + jar + Microsoft Azure SDK for Relay Management + This package contains Microsoft Relay 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/AccessKeys.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/AccessKeys.java new file mode 100644 index 000000000000..b300da327653 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/AccessKeys.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.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.AccessKeysInner; + +/** + * Type representing AccessKeys. + */ +public interface AccessKeys 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/AccessRights.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/AccessRights.java new file mode 100644 index 000000000000..ac0817bf9557 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/CheckNameAvailability.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/CheckNameAvailability.java new file mode 100644 index 000000000000..0b262d48ad65 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of the check name availability request properties. + */ +public class CheckNameAvailability { + /** + * The namespace name to check for availability. 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 namespace name to check for availability. 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 namespace name to check for availability. 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/CheckNameAvailabilityResult.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..5a9ce798855b --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayManager; +import com.microsoft.azure.management.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ErrorResponse.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ErrorResponse.java new file mode 100644 index 000000000000..2631a86587b4 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates Relay 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ErrorResponseException.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ErrorResponseException.java new file mode 100644 index 000000000000..751c0293c36a --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnection.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnection.java new file mode 100644 index 000000000000..660b6644cf4b --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnection.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.HybridConnectionInner; +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.relay.v2017_04_01.implementation.RelayManager; +import org.joda.time.DateTime; + +/** + * Type representing HybridConnection. + */ +public interface HybridConnection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the listenerCount value. + */ + Integer listenerCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiresClientAuthorization value. + */ + Boolean requiresClientAuthorization(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * @return the userMetadata value. + */ + String userMetadata(); + + /** + * The entirety of the HybridConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of HybridConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a HybridConnection definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the hybridconnection 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 hybridconnection definition allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization Returns true if client authorization is needed for this hybrid connection; otherwise, false + * @return the next definition stage + */ + WithCreate withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the hybridconnection definition allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata The userMetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their contact information. Also, user-defined configuration settings can be stored + * @return the next definition stage + */ + WithCreate withUserMetadata(String userMetadata); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithRequiresClientAuthorization, DefinitionStages.WithUserMetadata { + } + } + /** + * The template for a HybridConnection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRequiresClientAuthorization, UpdateStages.WithUserMetadata { + } + + /** + * Grouping of HybridConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the hybridconnection update allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization Returns true if client authorization is needed for this hybrid connection; otherwise, false + * @return the next update stage + */ + Update withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the hybridconnection update allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata The userMetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their contact information. Also, user-defined configuration settings can be stored + * @return the next update stage + */ + Update withUserMetadata(String userMetadata); + } + + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnectionNamespaceAuthorizationRule.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnectionNamespaceAuthorizationRule.java new file mode 100644 index 000000000000..55df16f5ffd0 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnectionNamespaceAuthorizationRule.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.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayManager; +import java.util.List; + +/** + * Type representing HybridConnectionNamespaceAuthorizationRule. + */ +public interface HybridConnectionNamespaceAuthorizationRule 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 HybridConnectionNamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithHybridConnection, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of HybridConnectionNamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a HybridConnectionNamespaceAuthorizationRule definition. + */ + interface Blank extends WithHybridConnection { + } + + /** + * The stage of the hybridconnectionnamespaceauthorizationrule definition allowing to specify HybridConnection. + */ + interface WithHybridConnection { + /** + * Specifies resourceGroupName, namespaceName, hybridConnectionName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name + * @return the next definition stage + */ + WithRights withExistingHybridConnection(String resourceGroupName, String namespaceName, String hybridConnectionName); + } + + /** + * The stage of the hybridconnectionnamespaceauthorizationrule 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 HybridConnectionNamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of HybridConnectionNamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the hybridconnectionnamespaceauthorizationrule 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnections.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnections.java new file mode 100644 index 000000000000..9860520c28c7 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/HybridConnections.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.relay.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.HybridConnectionsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnectionNamespaceAuthorizationRule; + +/** + * Type representing HybridConnections. + */ +public interface HybridConnections extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + HybridConnectionNamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Returns the description for the specified hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String hybridConnectionName); + + /** + * Lists the hybrid connection within 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 + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String hybridConnectionName); + + /** + * Hybrid connection authorization rule for a hybrid connection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName); + + /** + * Authorization rules for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName); + + /** + * Deletes a hybrid connection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName); + + /** + * Primary and secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/KeyType.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/KeyType.java new file mode 100644 index 000000000000..55fa89b3986a --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/NamespaceAuthorizationRule.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/NamespaceAuthorizationRule.java new file mode 100644 index 000000000000..ea23ae5fe1cd --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/NamespaceAuthorizationRule.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayManager; +import java.util.List; + +/** + * Type representing NamespaceAuthorizationRule. + */ +public interface NamespaceAuthorizationRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the rights value. + */ + List rights(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the NamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of NamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NamespaceAuthorizationRule definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the namespaceauthorizationrule definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies resourceGroupName, namespaceName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @return the next definition stage + */ + WithRights withExistingNamespace(String resourceGroupName, String namespaceName); + } + + /** + * The stage of the namespaceauthorizationrule definition allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next definition stage + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a NamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of NamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the namespaceauthorizationrule update allowing to specify Rights. + */ + interface WithRights { + /** + * Specifies rights. + * @param rights The rights associated with the rule + * @return the next update stage + */ + Update withRights(List rights); + } + + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Namespaces.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Namespaces.java new file mode 100644 index 000000000000..11b7e5a64ed4 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Namespaces.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.relay.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 com.microsoft.azure.management.relay.v2017_04_01.implementation.NamespacesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.NamespaceAuthorizationRule; +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. + */ + NamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Check the specified namespace name availability. + * + * @param name The namespace name to check for availability. 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); + + /** + * Authorization rule for a namespace by 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); + + /** + * 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); + + /** + * Primary and secondary connection strings to 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 to 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 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); + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Operation.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Operation.java new file mode 100644 index 000000000000..dd884695dcbb --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayManager; +import com.microsoft.azure.management.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/OperationDisplay.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/OperationDisplay.java new file mode 100644 index 000000000000..d490cef526a3 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Relay. + */ + @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: Relay. + * + * @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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Operations.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Operations.java new file mode 100644 index 000000000000..bd62722c31a4 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01; + +import rx.Observable; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all available Relay REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ProvisioningStateEnum.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ProvisioningStateEnum.java new file mode 100644 index 000000000000..3e8e8c5b877c --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ProvisioningStateEnum.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.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningStateEnum. + */ +public enum ProvisioningStateEnum { + /** Enum value Created. */ + CREATED("Created"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Deleted. */ + DELETED("Deleted"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Updating. */ + UPDATING("Updating"), + + /** Enum value Unknown. */ + UNKNOWN("Unknown"); + + /** The actual serialized value for a ProvisioningStateEnum instance. */ + private String value; + + ProvisioningStateEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningStateEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningStateEnum object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningStateEnum fromString(String value) { + ProvisioningStateEnum[] items = ProvisioningStateEnum.values(); + for (ProvisioningStateEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RegenerateAccessKeyParameters.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RegenerateAccessKeyParameters.java new file mode 100644 index 000000000000..dfd0828301c9 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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 is provided, this is set to key type, or + * autogenerated key value set for key type. + */ + @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 is provided, this is set to key type, or autogenerated key value set for key type. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set optional. If the key value is provided, this is set to key type, or autogenerated key value set for key type. + * + * @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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayNamespace.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayNamespace.java new file mode 100644 index 000000000000..1859b35dd9e6 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayNamespace.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.relay.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.relay.v2017_04_01.implementation.RelayManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayNamespaceInner; + +/** + * Type representing RelayNamespace. + */ +public interface RelayNamespace extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the metricId value. + */ + String metricId(); + + /** + * @return the provisioningState value. + */ + ProvisioningStateEnum provisioningState(); + + /** + * @return the serviceBusEndpoint value. + */ + String serviceBusEndpoint(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * The entirety of the RelayNamespace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of RelayNamespace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RelayNamespace definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the RelayNamespace definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the relaynamespace definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku SKU of the namespace + * @return the next definition stage + */ + WithCreate withSku(Sku 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 RelayNamespace update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku { + } + + /** + * Grouping of RelayNamespace update stages. + */ + interface UpdateStages { + /** + * The stage of the relaynamespace update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku SKU of the namespace + * @return the next update stage + */ + Update withSku(Sku sku); + } + + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayUpdateParameters.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayUpdateParameters.java new file mode 100644 index 000000000000..66f4873d6c6d --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayUpdateParameters.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.relay.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 RelayUpdateParameters extends ResourceNamespacePatch { + /** + * SKU of the namespace. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Possible values include: 'Created', 'Succeeded', 'Deleted', 'Failed', + * 'Updating', 'Unknown'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningStateEnum 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 sKU of the namespace. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set sKU of the namespace. + * + * @param sku the sku value to set + * @return the RelayUpdateParameters object itself. + */ + public RelayUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get possible values include: 'Created', 'Succeeded', 'Deleted', 'Failed', 'Updating', 'Unknown'. + * + * @return the provisioningState value + */ + public ProvisioningStateEnum 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Relaytype.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Relaytype.java new file mode 100644 index 000000000000..1f8c854ae57b --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Relaytype.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.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Relaytype. + */ +public enum Relaytype { + /** Enum value NetTcp. */ + NET_TCP("NetTcp"), + + /** Enum value Http. */ + HTTP("Http"); + + /** The actual serialized value for a Relaytype instance. */ + private String value; + + Relaytype(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Relaytype instance. + * + * @param value the serialized value to parse. + * @return the parsed Relaytype object, or null if unable to parse. + */ + @JsonCreator + public static Relaytype fromString(String value) { + Relaytype[] items = Relaytype.values(); + for (Relaytype item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ResourceNamespacePatch.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ResourceNamespacePatch.java new file mode 100644 index 000000000000..1e36a013d3d5 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/ResourceNamespacePatch.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.relay.v2017_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * Definition of resource. + */ +public class ResourceNamespacePatch extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Sku.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Sku.java new file mode 100644 index 000000000000..02e4fd4f44db --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/Sku.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU of the namespace. + */ +public class Sku { + /** + * Name of this SKU. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The tier of this SKU. Possible values include: 'Standard'. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + name = "Standard"; + } + + /** + * Get name of this SKU. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of this SKU. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier of this SKU. Possible values include: 'Standard'. + * + * @return the tier value + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier of this SKU. Possible values include: 'Standard'. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/SkuTier.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/SkuTier.java new file mode 100644 index 000000000000..fbdffa82886b --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/SkuTier.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuTier. + */ +public enum SkuTier { + /** Enum value Standard. */ + STANDARD("Standard"); + + /** 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/UnavailableReason.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/UnavailableReason.java new file mode 100644 index 000000000000..4eca057458f4 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WCFRelays.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WCFRelays.java new file mode 100644 index 000000000000..1276c8813f26 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WCFRelays.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.relay.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.WCFRelaysInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.WcfRelayNamespaceAuthorizationRule; + +/** + * Type representing WCFRelays. + */ +public interface WCFRelays extends SupportsCreating, HasInner { + /** + * Begins definition for a new AuthorizationRule resource. + * @param name resource name. + * @return the first stage of the new AuthorizationRule definition. + */ + WcfRelayNamespaceAuthorizationRule.DefinitionStages.Blank defineAuthorizationRule(String name); + + /** + * Returns the description for the specified WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String namespaceName, String relayName); + + /** + * Lists the WCF relays within 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 + */ + Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName); + + /** + * Deletes a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String namespaceName, String relayName); + + /** + * Get authorizationRule for a WCF relay by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName); + + /** + * Authorization rules for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName); + + /** + * Deletes a WCF relay authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName); + + /** + * Primary and secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName); + + /** + * Regenerates the primary or secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate authorization rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WcfRelay.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WcfRelay.java new file mode 100644 index 000000000000..06adeb4bda1c --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WcfRelay.java @@ -0,0 +1,225 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.WcfRelayInner; +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.relay.v2017_04_01.implementation.RelayManager; +import org.joda.time.DateTime; + +/** + * Type representing WcfRelay. + */ +public interface WcfRelay extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdAt value. + */ + DateTime createdAt(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isDynamic value. + */ + Boolean isDynamic(); + + /** + * @return the listenerCount value. + */ + Integer listenerCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the relayType value. + */ + Relaytype relayType(); + + /** + * @return the requiresClientAuthorization value. + */ + Boolean requiresClientAuthorization(); + + /** + * @return the requiresTransportSecurity value. + */ + Boolean requiresTransportSecurity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedAt value. + */ + DateTime updatedAt(); + + /** + * @return the userMetadata value. + */ + String userMetadata(); + + /** + * The entirety of the WcfRelay definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithCreate { + } + + /** + * Grouping of WcfRelay definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a WcfRelay definition. + */ + interface Blank extends WithNamespace { + } + + /** + * The stage of the wcfrelay 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 wcfrelay definition allowing to specify RelayType. + */ + interface WithRelayType { + /** + * Specifies relayType. + * @param relayType WCF relay type. Possible values include: 'NetTcp', 'Http' + * @return the next definition stage + */ + WithCreate withRelayType(Relaytype relayType); + } + + /** + * The stage of the wcfrelay definition allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization Returns true if client authorization is needed for this relay; otherwise, false + * @return the next definition stage + */ + WithCreate withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the wcfrelay definition allowing to specify RequiresTransportSecurity. + */ + interface WithRequiresTransportSecurity { + /** + * Specifies requiresTransportSecurity. + * @param requiresTransportSecurity Returns true if transport security is needed for this relay; otherwise, false + * @return the next definition stage + */ + WithCreate withRequiresTransportSecurity(Boolean requiresTransportSecurity); + } + + /** + * The stage of the wcfrelay definition allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata The userMetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored + * @return the next definition stage + */ + WithCreate withUserMetadata(String userMetadata); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithRelayType, DefinitionStages.WithRequiresClientAuthorization, DefinitionStages.WithRequiresTransportSecurity, DefinitionStages.WithUserMetadata { + } + } + /** + * The template for a WcfRelay update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRelayType, UpdateStages.WithRequiresClientAuthorization, UpdateStages.WithRequiresTransportSecurity, UpdateStages.WithUserMetadata { + } + + /** + * Grouping of WcfRelay update stages. + */ + interface UpdateStages { + /** + * The stage of the wcfrelay update allowing to specify RelayType. + */ + interface WithRelayType { + /** + * Specifies relayType. + * @param relayType WCF relay type. Possible values include: 'NetTcp', 'Http' + * @return the next update stage + */ + Update withRelayType(Relaytype relayType); + } + + /** + * The stage of the wcfrelay update allowing to specify RequiresClientAuthorization. + */ + interface WithRequiresClientAuthorization { + /** + * Specifies requiresClientAuthorization. + * @param requiresClientAuthorization Returns true if client authorization is needed for this relay; otherwise, false + * @return the next update stage + */ + Update withRequiresClientAuthorization(Boolean requiresClientAuthorization); + } + + /** + * The stage of the wcfrelay update allowing to specify RequiresTransportSecurity. + */ + interface WithRequiresTransportSecurity { + /** + * Specifies requiresTransportSecurity. + * @param requiresTransportSecurity Returns true if transport security is needed for this relay; otherwise, false + * @return the next update stage + */ + Update withRequiresTransportSecurity(Boolean requiresTransportSecurity); + } + + /** + * The stage of the wcfrelay update allowing to specify UserMetadata. + */ + interface WithUserMetadata { + /** + * Specifies userMetadata. + * @param userMetadata The userMetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored + * @return the next update stage + */ + Update withUserMetadata(String userMetadata); + } + + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WcfRelayNamespaceAuthorizationRule.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WcfRelayNamespaceAuthorizationRule.java new file mode 100644 index 000000000000..965164e9fc0a --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/WcfRelayNamespaceAuthorizationRule.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.relay.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.AuthorizationRuleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.relay.v2017_04_01.implementation.RelayManager; +import java.util.List; + +/** + * Type representing WcfRelayNamespaceAuthorizationRule. + */ +public interface WcfRelayNamespaceAuthorizationRule 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 WcfRelayNamespaceAuthorizationRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWcfRelay, DefinitionStages.WithRights, DefinitionStages.WithCreate { + } + + /** + * Grouping of WcfRelayNamespaceAuthorizationRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a WcfRelayNamespaceAuthorizationRule definition. + */ + interface Blank extends WithWcfRelay { + } + + /** + * The stage of the wcfrelaynamespaceauthorizationrule definition allowing to specify WcfRelay. + */ + interface WithWcfRelay { + /** + * Specifies resourceGroupName, namespaceName, relayName. + * @param resourceGroupName Name of the Resource group within the Azure subscription + * @param namespaceName The namespace name + * @param relayName The relay name + * @return the next definition stage + */ + WithRights withExistingWcfRelay(String resourceGroupName, String namespaceName, String relayName); + } + + /** + * The stage of the wcfrelaynamespaceauthorizationrule 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 WcfRelayNamespaceAuthorizationRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRights { + } + + /** + * Grouping of WcfRelayNamespaceAuthorizationRule update stages. + */ + interface UpdateStages { + /** + * The stage of the wcfrelaynamespaceauthorizationrule 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AccessKeysImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AccessKeysImpl.java new file mode 100644 index 000000000000..da7375d0fd47 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AccessKeysImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.AccessKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AccessKeysImpl extends WrapperImpl implements AccessKeys { + private final RelayManager manager; + AccessKeysImpl(AccessKeysInner inner, RelayManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public RelayManager 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AccessKeysInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AccessKeysInner.java new file mode 100644 index 000000000000..4dc19ab69819 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AccessKeysInner.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.relay.v2017_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Namespace/Relay Connection String. + */ +public class AccessKeysInner { + /** + * 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 secondary 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 AccessKeysInner object itself. + */ + public AccessKeysInner 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 AccessKeysInner object itself. + */ + public AccessKeysInner 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 AccessKeysInner object itself. + */ + public AccessKeysInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get a base64-encoded 256-bit secondary key for signing and validating the SAS token. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set a base64-encoded 256-bit secondary key for signing and validating the SAS token. + * + * @param secondaryKey the secondaryKey value to set + * @return the AccessKeysInner object itself. + */ + public AccessKeysInner 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 AccessKeysInner object itself. + */ + public AccessKeysInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AuthorizationRuleInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AuthorizationRuleInner.java new file mode 100644 index 000000000000..1454fea60121 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AuthorizationRuleInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.relay.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 AuthorizationRuleInner extends ProxyResource { + /** + * The rights associated with the rule. + */ + @JsonProperty(value = "properties.rights", required = true) + private List rights; + + /** + * Get the rights associated with the rule. + * + * @return the rights value + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights associated with the rule. + * + * @param rights the rights value to set + * @return the AuthorizationRuleInner object itself. + */ + public AuthorizationRuleInner withRights(List rights) { + this.rights = rights; + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/CheckNameAvailabilityResultImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..fc45a814b117 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.CheckNameAvailabilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2017_04_01.UnavailableReason; + +class CheckNameAvailabilityResultImpl extends WrapperImpl implements CheckNameAvailabilityResult { + private final RelayManager manager; + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner inner, RelayManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public RelayManager 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/CheckNameAvailabilityResultInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..d2cc721be5ea --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.UnavailableReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of the 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 available. Returns 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 available. Returns true if the namespace is available; otherwise, false. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set value indicating namespace is available. Returns 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionImpl.java new file mode 100644 index 000000000000..5218292300dd --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class HybridConnectionImpl extends CreatableUpdatableImpl implements HybridConnection, HybridConnection.Definition, HybridConnection.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String hybridConnectionName; + + HybridConnectionImpl(String name, RelayManager manager) { + super(name, new HybridConnectionInner()); + this.manager = manager; + // Set resource name + this.hybridConnectionName = name; + // + } + + HybridConnectionImpl(HybridConnectionInner inner, RelayManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.hybridConnectionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.hybridConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "hybridConnections"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer listenerCount() { + return this.inner().listenerCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean requiresClientAuthorization() { + return this.inner().requiresClientAuthorization(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public String userMetadata() { + return this.inner().userMetadata(); + } + + @Override + public HybridConnectionImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public HybridConnectionImpl withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.inner().withRequiresClientAuthorization(requiresClientAuthorization); + return this; + } + + @Override + public HybridConnectionImpl withUserMetadata(String userMetadata) { + this.inner().withUserMetadata(userMetadata); + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionInner.java new file mode 100644 index 000000000000..acd2cd5abba6 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionInner.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.relay.v2017_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of hybrid connection resource. + */ +@JsonFlatten +public class HybridConnectionInner extends ProxyResource { + /** + * The time the hybrid connection 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; + + /** + * The number of listeners for this hybrid connection. Note that min : 1 + * and max:25 are supported. + */ + @JsonProperty(value = "properties.listenerCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer listenerCount; + + /** + * Returns true if client authorization is needed for this hybrid + * connection; otherwise, false. + */ + @JsonProperty(value = "properties.requiresClientAuthorization") + private Boolean requiresClientAuthorization; + + /** + * The userMetadata is a placeholder to store user-defined string data for + * the hybrid connection endpoint. For example, it can be used to store + * descriptive data, such as a list of teams and their contact information. + * Also, user-defined configuration settings can be stored. + */ + @JsonProperty(value = "properties.userMetadata") + private String userMetadata; + + /** + * Get the time the hybrid connection 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 the number of listeners for this hybrid connection. Note that min : 1 and max:25 are supported. + * + * @return the listenerCount value + */ + public Integer listenerCount() { + return this.listenerCount; + } + + /** + * Get returns true if client authorization is needed for this hybrid connection; otherwise, false. + * + * @return the requiresClientAuthorization value + */ + public Boolean requiresClientAuthorization() { + return this.requiresClientAuthorization; + } + + /** + * Set returns true if client authorization is needed for this hybrid connection; otherwise, false. + * + * @param requiresClientAuthorization the requiresClientAuthorization value to set + * @return the HybridConnectionInner object itself. + */ + public HybridConnectionInner withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.requiresClientAuthorization = requiresClientAuthorization; + return this; + } + + /** + * Get the userMetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their contact information. Also, user-defined configuration settings can be stored. + * + * @return the userMetadata value + */ + public String userMetadata() { + return this.userMetadata; + } + + /** + * Set the userMetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their contact information. Also, user-defined configuration settings can be stored. + * + * @param userMetadata the userMetadata value to set + * @return the HybridConnectionInner object itself. + */ + public HybridConnectionInner withUserMetadata(String userMetadata) { + this.userMetadata = userMetadata; + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionNamespaceAuthorizationRuleImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionNamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..7828eab51621 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionNamespaceAuthorizationRuleImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnectionNamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.relay.v2017_04_01.AccessRights; + +class HybridConnectionNamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements HybridConnectionNamespaceAuthorizationRule, HybridConnectionNamespaceAuthorizationRule.Definition, HybridConnectionNamespaceAuthorizationRule.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String hybridConnectionName; + private String authorizationRuleName; + private List crights; + private List urights; + + HybridConnectionNamespaceAuthorizationRuleImpl(String name, RelayManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + HybridConnectionNamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, RelayManager 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.hybridConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "hybridConnections"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + HybridConnectionsInner client = this.manager().inner().hybridConnections(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.hybridConnectionName, 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 HybridConnectionNamespaceAuthorizationRuleImpl withExistingHybridConnection(String resourceGroupName, String namespaceName, String hybridConnectionName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.hybridConnectionName = hybridConnectionName; + return this; + } + + @Override + public HybridConnectionNamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionsImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionsImpl.java new file mode 100644 index 000000000000..8ef35ae4901e --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionsImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnections; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnection; +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnectionNamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2017_04_01.AccessKeys; +import com.microsoft.azure.management.relay.v2017_04_01.RegenerateAccessKeyParameters; + +class HybridConnectionsImpl extends WrapperImpl implements HybridConnections { + private final RelayManager manager; + + HybridConnectionsImpl(RelayManager manager) { + super(manager.inner().hybridConnections()); + this.manager = manager; + } + + public RelayManager manager() { + return this.manager; + } + + @Override + public HybridConnectionImpl define(String name) { + return wrapModel(name); + } + + private HybridConnectionImpl wrapModel(HybridConnectionInner inner) { + return new HybridConnectionImpl(inner, manager()); + } + + private HybridConnectionImpl wrapModel(String name) { + return new HybridConnectionImpl(name, this.manager()); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + HybridConnectionsInner 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 HybridConnection call(HybridConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, hybridConnectionName) + .map(new Func1() { + @Override + public HybridConnection call(HybridConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, hybridConnectionName).toCompletable(); + } + + @Override + public HybridConnectionNamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private HybridConnectionNamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new HybridConnectionNamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private HybridConnectionNamespaceAuthorizationRuleImpl wrapHybridConnectionNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new HybridConnectionNamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingHybridConnectionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String hybridConnectionName = IdParsingUtils.getValueFromIdByName(id, "hybridConnections"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + HybridConnectionsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + .map(new Func1() { + @Override + public HybridConnectionNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapHybridConnectionNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + HybridConnectionsInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, hybridConnectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public HybridConnectionNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapHybridConnectionNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + HybridConnectionsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + HybridConnectionsInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionsInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionsInner.java new file mode 100644 index 000000000000..a04716278f7f --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/HybridConnectionsInner.java @@ -0,0 +1,1398 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.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.relay.v2017_04_01.AccessRights; +import com.microsoft.azure.management.relay.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.management.relay.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 HybridConnections. + */ +public class HybridConnectionsInner { + /** The Retrofit service to perform REST calls. */ + private HybridConnectionsService service; + /** The service client containing this operation class. */ + private RelayManagementClientImpl client; + + /** + * Initializes an instance of HybridConnectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public HybridConnectionsInner(Retrofit retrofit, RelayManagementClientImpl client) { + this.service = retrofit.create(HybridConnectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for HybridConnections to be + * used by Retrofit to perform actually REST calls. + */ + interface HybridConnectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2017_04_01.HybridConnections listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections") + 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.relay.v2017_04_01.HybridConnections createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @Path("subscriptionId") String subscriptionId, @Body HybridConnectionInner 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.relay.v2017_04_01.HybridConnections delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2017_04_01.HybridConnections deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("hybridConnectionName") String hybridConnectionName, @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.relay.v2017_04_01.HybridConnections 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.relay.v2017_04_01.HybridConnections listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the hybrid connection within 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 + * @return the PagedList<HybridConnectionInner> 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(); + } + }; + } + + /** + * Lists the hybrid connection within 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> 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); + } + + /** + * Lists the hybrid connection within 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 to the PagedList<HybridConnectionInner> 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(); + } + }); + } + + /** + * Lists the hybrid connection within 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 to the PagedList<HybridConnectionInner> 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)); + } + }); + } + + /** + * Lists the hybrid connection within the 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<HybridConnectionInner> 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); + } + + /** + * Creates or updates a service hybrid connection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a hybrid connection. + * @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 HybridConnectionInner object if successful. + */ + public HybridConnectionInner createOrUpdate(String resourceGroupName, String namespaceName, String hybridConnectionName, HybridConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a service hybrid connection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a hybrid connection. + * @param serviceCallback 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 hybridConnectionName, HybridConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters), serviceCallback); + } + + /** + * Creates or updates a service hybrid connection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a hybrid connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, HybridConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters).map(new Func1, HybridConnectionInner>() { + @Override + public HybridConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a service hybrid connection. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param parameters Parameters supplied to create a hybrid connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, HybridConnectionInner 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single().body(); + } + + /** + * Deletes a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName), serviceCallback); + } + + /** + * Deletes a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 the description for the specified hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 HybridConnectionInner object if successful. + */ + public HybridConnectionInner get(String resourceGroupName, String namespaceName, String hybridConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single().body(); + } + + /** + * Returns the description for the specified hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName), serviceCallback); + } + + /** + * Returns the description for the specified hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName).map(new Func1, HybridConnectionInner>() { + @Override + public HybridConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the description for the specified hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the HybridConnectionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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); + } + + /** + * Authorization rules for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, hybridConnectionName) + .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)); + } + }); + } + + /** + * Authorization rules for a hybrid connection. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param hybridConnectionName The hybrid connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String hybridConnectionName) { + 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates or updates an authorization rule for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates or updates an authorization rule for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an authorization rule for a hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, hybridConnectionName, 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 hybrid connection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a hybrid connection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a hybrid connection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a hybrid connection authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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); + } + + /** + * Hybrid connection authorization rule for a hybrid connection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Hybrid connection authorization rule for a hybrid connection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * Hybrid connection authorization rule for a hybrid connection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Hybrid connection authorization rule for a hybrid connection by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName), serviceCallback); + } + + /** + * Primary and secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection 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 hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, 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 hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 hybridConnectionName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 hybridConnectionName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 hybridConnectionName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings to the hybrid connection. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param hybridConnectionName The hybrid connection name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 hybridConnectionName, 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 (hybridConnectionName == null) { + throw new IllegalArgumentException("Parameter hybridConnectionName 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, hybridConnectionName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the hybrid connection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<HybridConnectionInner> 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(); + } + }; + } + + /** + * Lists the hybrid connection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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); + } + + /** + * Lists the hybrid connection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<HybridConnectionInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the hybrid connection within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<HybridConnectionInner> 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)); + } + }); + } + + /** + * Lists the hybrid connection within the namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<HybridConnectionInner> 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); + } + + /** + * Authorization rules for a hybrid connection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a hybrid connection. + * + * @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); + } + + /** + * Authorization rules for a hybrid connection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a hybrid connection. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a hybrid connection. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/IdParsingUtils.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..d28c03f94c02 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespaceAuthorizationRuleImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..a117ac8d2050 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespaceAuthorizationRuleImpl.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.NamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.relay.v2017_04_01.AccessRights; + +class NamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements NamespaceAuthorizationRule, NamespaceAuthorizationRule.Definition, NamespaceAuthorizationRule.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String authorizationRuleName; + private List crights; + private List urights; + + NamespaceAuthorizationRuleImpl(String name, RelayManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + NamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, RelayManager 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 RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.authorizationRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List rights() { + return this.inner().rights(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public NamespaceAuthorizationRuleImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public NamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesImpl.java new file mode 100644 index 000000000000..fc629fc39f96 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesImpl.java @@ -0,0 +1,235 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.relay.v2017_04_01.Namespaces; +import com.microsoft.azure.management.relay.v2017_04_01.RelayNamespace; +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.relay.v2017_04_01.CheckNameAvailabilityResult; +import com.microsoft.azure.management.relay.v2017_04_01.NamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2017_04_01.AccessKeys; +import com.microsoft.azure.management.relay.v2017_04_01.RegenerateAccessKeyParameters; + +class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { + protected NamespacesImpl(RelayManager 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 RelayNamespace call(RelayNamespaceInner 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 RelayNamespace call(RelayNamespaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public RelayNamespaceImpl 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 RelayNamespaceImpl wrapModel(RelayNamespaceInner inner) { + return new RelayNamespaceImpl(inner.name(), inner, manager()); + } + + @Override + protected RelayNamespaceImpl wrapModel(String name) { + return new RelayNamespaceImpl(name, new RelayNamespaceInner(), this.manager()); + } + + @Override + public NamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private NamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new NamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private NamespaceAuthorizationRuleImpl wrapNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new NamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingNamespacesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + NamespacesInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + NamespacesInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesInner.java new file mode 100644 index 000000000000..33ad6b1db3f5 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesInner.java @@ -0,0 +1,1897 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.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.relay.v2017_04_01.AccessRights; +import com.microsoft.azure.management.relay.v2017_04_01.CheckNameAvailability; +import com.microsoft.azure.management.relay.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.management.relay.v2017_04_01.RegenerateAccessKeyParameters; +import com.microsoft.azure.management.relay.v2017_04_01.RelayUpdateParameters; +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 RelayManagementClientImpl 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, RelayManagementClientImpl 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.relay.v2017_04_01.Namespaces checkNameAvailabilityMethod" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body RelayNamespaceInner 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.relay.v2017_04_01.Namespaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body RelayNamespaceInner 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.relay.v2017_04_01.Namespaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body RelayUpdateParameters 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.relay.v2017_04_01.Namespaces listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2017_04_01.Namespaces deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.v2017_04_01.Namespaces regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/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.relay.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.relay.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.relay.v2017_04_01.Namespaces listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the specified namespace name availability. + * + * @param name The namespace name to check for availability. 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 specified namespace name availability. + * + * @param name The namespace name to check for availability. 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 specified namespace name availability. + * + * @param name The namespace name to check for availability. 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 specified namespace name availability. + * + * @param name The namespace name to check for availability. 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); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RelayNamespaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RelayNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> 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); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner createOrUpdate(String resourceGroupName, String namespaceName, RelayNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().last().body(); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner 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()); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner beginCreateOrUpdate(String resourceGroupName, String namespaceName, RelayNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Create Azure Relay namespace. + * + * @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, RelayNamespaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, RelayNamespaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create Azure Relay namespace. + * + * @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 RelayNamespaceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, RelayNamespaceInner 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()) + .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); + } + + /** + * Returns the 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 RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner getByResourceGroup(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Returns the 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); + } + + /** + * Returns the 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 RelayNamespaceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the 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 RelayNamespaceInner 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); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters for updating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RelayNamespaceInner object if successful. + */ + public RelayNamespaceInner update(String resourceGroupName, String namespaceName, RelayUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters for updating a namespace resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String namespaceName, RelayUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters for updating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RelayNamespaceInner object + */ + public Observable updateAsync(String resourceGroupName, String namespaceName, RelayUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, RelayNamespaceInner>() { + @Override + public RelayNamespaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param parameters Parameters for updating a namespace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RelayNamespaceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String namespaceName, RelayUpdateParameters 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()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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<AuthorizationRuleInner> 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(); + } + }; + } + + /** + * 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); + } + + /** + * 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<AuthorizationRuleInner> 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(); + } + }); + } + + /** + * 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<AuthorizationRuleInner> 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)); + } + }); + } + + /** + * 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<AuthorizationRuleInner> 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 AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner 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 AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 AuthorizationRuleInner 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); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes 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); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Authorization rule for a namespace by 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); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Authorization rule for a namespace by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAuthorizationRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAuthorizationRuleDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Primary and secondary connection strings to 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(); + } + + /** + * Primary and secondary connection strings to 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); + } + + /** + * Primary and secondary connection strings to 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(); + } + }); + } + + /** + * Primary and secondary connection strings to 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 to 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 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 to 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 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 to 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 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 to 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 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); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @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<RelayNamespaceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + * @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<RelayNamespaceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the subscription regardless of the resourceGroups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + * @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<RelayNamespaceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available namespaces within the ResourceGroup. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RelayNamespaceInner> 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); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..5da8f7faf1b6 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2017_04_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final RelayManager manager; + OperationImpl(OperationInner inner, RelayManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationInner.java new file mode 100644 index 000000000000..82fa2f792065 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Relay 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationsImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..243679122b12 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2017_04_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.relay.v2017_04_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final RelayManager manager; + + OperationsImpl(RelayManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public RelayManager 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationsInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..40a02af294e1 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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.relay.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 RelayManagementClientImpl 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, RelayManagementClientImpl 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.relay.v2017_04_01.Operations list" }) + @GET("providers/Microsoft.Relay/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.relay.v2017_04_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all available Relay 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 available Relay 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 available Relay 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 available Relay 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 available Relay 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 available Relay 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 available Relay 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 available Relay 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 available Relay 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 available Relay 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/PageImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/PageImpl.java new file mode 100644 index 000000000000..cd72953d3186 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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.relay.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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayManagementClientImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayManagementClientImpl.java new file mode 100644 index 000000000000..247ac1d75a38 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayManagementClientImpl.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.relay.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 RelayManagementClientImpl class. + */ +public class RelayManagementClientImpl 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 which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify the 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 which uniquely identify the 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 RelayManagementClientImpl 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 RelayManagementClientImpl 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 RelayManagementClientImpl 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 RelayManagementClientImpl 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 HybridConnectionsInner object to access its operations. + */ + private HybridConnectionsInner hybridConnections; + + /** + * Gets the HybridConnectionsInner object to access its operations. + * @return the HybridConnectionsInner object. + */ + public HybridConnectionsInner hybridConnections() { + return this.hybridConnections; + } + + /** + * The WCFRelaysInner object to access its operations. + */ + private WCFRelaysInner wCFRelays; + + /** + * Gets the WCFRelaysInner object to access its operations. + * @return the WCFRelaysInner object. + */ + public WCFRelaysInner wCFRelays() { + return this.wCFRelays; + } + + /** + * Initializes an instance of RelayManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public RelayManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of RelayManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public RelayManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of RelayManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public RelayManagementClientImpl(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.hybridConnections = new HybridConnectionsInner(restClient().retrofit(), this); + this.wCFRelays = new WCFRelaysInner(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(), "RelayManagementClient", "2017-04-01"); + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayManager.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayManager.java new file mode 100644 index 000000000000..ae2794b3dc05 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.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.relay.v2017_04_01.Operations; +import com.microsoft.azure.management.relay.v2017_04_01.Namespaces; +import com.microsoft.azure.management.relay.v2017_04_01.HybridConnections; +import com.microsoft.azure.management.relay.v2017_04_01.WCFRelays; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Relay resource management. + */ +public final class RelayManager extends ManagerCore { + private Operations operations; + private Namespaces namespaces; + private HybridConnections hybridConnections; + private WCFRelays wCFRelays; + /** + * Get a Configurable instance that can be used to create RelayManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new RelayManager.ConfigurableImpl(); + } + /** + * Creates an instance of RelayManager that exposes Relay resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the RelayManager + */ + public static RelayManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new RelayManager(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 RelayManager that exposes Relay resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the RelayManager + */ + public static RelayManager authenticate(RestClient restClient, String subscriptionId) { + return new RelayManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of RelayManager that exposes Relay management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Relay management API entry points that work across subscriptions + */ + RelayManager 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 HybridConnections. + */ + public HybridConnections hybridConnections() { + if (this.hybridConnections == null) { + this.hybridConnections = new HybridConnectionsImpl(this); + } + return this.hybridConnections; + } + + /** + * @return Entry point to manage WCFRelays. + */ + public WCFRelays wCFRelays() { + if (this.wCFRelays == null) { + this.wCFRelays = new WCFRelaysImpl(this); + } + return this.wCFRelays; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public RelayManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return RelayManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private RelayManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new RelayManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayNamespaceImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayNamespaceImpl.java new file mode 100644 index 000000000000..c2625c5baeda --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayNamespaceImpl.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.relay.v2017_04_01.RelayNamespace; +import rx.Observable; +import com.microsoft.azure.management.relay.v2017_04_01.RelayUpdateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.relay.v2017_04_01.Sku; +import com.microsoft.azure.management.relay.v2017_04_01.ProvisioningStateEnum; +import rx.functions.Func1; + +class RelayNamespaceImpl extends GroupableResourceCoreImpl implements RelayNamespace, RelayNamespace.Definition, RelayNamespace.Update { + private RelayUpdateParameters updateParameter; + RelayNamespaceImpl(String name, RelayNamespaceInner inner, RelayManager manager) { + super(name, inner, manager); + this.updateParameter = new RelayUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + NamespacesInner client = this.manager().inner().namespaces(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public RelayNamespaceInner call(RelayNamespaceInner 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 RelayNamespaceInner call(RelayNamespaceInner 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 RelayUpdateParameters(); + } + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String metricId() { + return this.inner().metricId(); + } + + @Override + public ProvisioningStateEnum provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String serviceBusEndpoint() { + return this.inner().serviceBusEndpoint(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public RelayNamespaceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayNamespaceInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayNamespaceInner.java new file mode 100644 index 000000000000..36142716b6bb --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/RelayNamespaceInner.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.Sku; +import com.microsoft.azure.management.relay.v2017_04_01.ProvisioningStateEnum; +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 RelayNamespaceInner extends Resource { + /** + * SKU of the namespace. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Possible values include: 'Created', 'Succeeded', 'Deleted', 'Failed', + * 'Updating', 'Unknown'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningStateEnum 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 sKU of the namespace. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set sKU of the namespace. + * + * @param sku the sku value to set + * @return the RelayNamespaceInner object itself. + */ + public RelayNamespaceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get possible values include: 'Created', 'Succeeded', 'Deleted', 'Failed', 'Updating', 'Unknown'. + * + * @return the provisioningState value + */ + public ProvisioningStateEnum 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WCFRelaysImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WCFRelaysImpl.java new file mode 100644 index 000000000000..228fc548a847 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WCFRelaysImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.relay.v2017_04_01.WCFRelays; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.relay.v2017_04_01.WcfRelay; +import com.microsoft.azure.management.relay.v2017_04_01.WcfRelayNamespaceAuthorizationRule; +import com.microsoft.azure.management.relay.v2017_04_01.AccessKeys; +import com.microsoft.azure.management.relay.v2017_04_01.RegenerateAccessKeyParameters; + +class WCFRelaysImpl extends WrapperImpl implements WCFRelays { + private final RelayManager manager; + + WCFRelaysImpl(RelayManager manager) { + super(manager.inner().wCFRelays()); + this.manager = manager; + } + + public RelayManager manager() { + return this.manager; + } + + @Override + public WcfRelayImpl define(String name) { + return wrapModel(name); + } + + private WcfRelayImpl wrapModel(WcfRelayInner inner) { + return new WcfRelayImpl(inner, manager()); + } + + private WcfRelayImpl wrapModel(String name) { + return new WcfRelayImpl(name, this.manager()); + } + + @Override + public Observable listByNamespaceAsync(final String resourceGroupName, final String namespaceName) { + WCFRelaysInner 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 WcfRelay call(WcfRelayInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String namespaceName, String relayName) { + WCFRelaysInner client = this.inner(); + return client.getAsync(resourceGroupName, namespaceName, relayName) + .map(new Func1() { + @Override + public WcfRelay call(WcfRelayInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String namespaceName, String relayName) { + WCFRelaysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, namespaceName, relayName).toCompletable(); + } + + @Override + public WcfRelayNamespaceAuthorizationRuleImpl defineAuthorizationRule(String name) { + return wrapAuthorizationRuleModel(name); + } + + private WcfRelayNamespaceAuthorizationRuleImpl wrapAuthorizationRuleModel(String name) { + return new WcfRelayNamespaceAuthorizationRuleImpl(name, this.manager()); + } + + private WcfRelayNamespaceAuthorizationRuleImpl wrapWcfRelayNamespaceAuthorizationRuleModel(AuthorizationRuleInner inner) { + return new WcfRelayNamespaceAuthorizationRuleImpl(inner, manager()); + } + + private Observable getAuthorizationRuleInnerUsingWCFRelaysInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); + String relayName = IdParsingUtils.getValueFromIdByName(id, "wcfRelays"); + String authorizationRuleName = IdParsingUtils.getValueFromIdByName(id, "authorizationRules"); + WCFRelaysInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName); + } + + @Override + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName) + .map(new Func1() { + @Override + public WcfRelayNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapWcfRelayNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Observable listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + WCFRelaysInner client = this.inner(); + return client.listAuthorizationRulesAsync(resourceGroupName, namespaceName, relayName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public WcfRelayNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { + return wrapWcfRelayNamespaceAuthorizationRuleModel(inner); + } + }); + } + + @Override + public Completable deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.deleteAuthorizationRuleAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + WCFRelaysInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + WCFRelaysInner client = this.inner(); + return client.regenerateKeysAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters) + .map(new Func1() { + @Override + public AccessKeys call(AccessKeysInner inner) { + return new AccessKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WCFRelaysInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WCFRelaysInner.java new file mode 100644 index 000000000000..5b19bbd40005 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WCFRelaysInner.java @@ -0,0 +1,1400 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_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.relay.v2017_04_01.AccessRights; +import com.microsoft.azure.management.relay.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.management.relay.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 WCFRelays. + */ +public class WCFRelaysInner { + /** The Retrofit service to perform REST calls. */ + private WCFRelaysService service; + /** The service client containing this operation class. */ + private RelayManagementClientImpl client; + + /** + * Initializes an instance of WCFRelaysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public WCFRelaysInner(Retrofit retrofit, RelayManagementClientImpl client) { + this.service = retrofit.create(WCFRelaysService.class); + this.client = client; + } + + /** + * The interface defining all the services for WCFRelays to be + * used by Retrofit to perform actually REST calls. + */ + interface WCFRelaysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2017_04_01.WCFRelays listByNamespace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays") + 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.relay.v2017_04_01.WCFRelays createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @Path("subscriptionId") String subscriptionId, @Body WcfRelayInner 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.relay.v2017_04_01.WCFRelays delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays listAuthorizationRules" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules") + Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays createOrUpdateAuthorizationRule" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}") + Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AuthorizationRuleInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.v2017_04_01.WCFRelays deleteAuthorizationRule" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true) + Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays getAuthorizationRule" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}") + Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays regenerateKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.relay.v2017_04_01.WCFRelays 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.relay.v2017_04_01.WCFRelays listAuthorizationRulesNext" }) + @GET + Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the WCF relays within 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 + * @return the PagedList<WcfRelayInner> 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(); + } + }; + } + + /** + * Lists the WCF relays within 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> 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); + } + + /** + * Lists the WCF relays within 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 to the PagedList<WcfRelayInner> 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(); + } + }); + } + + /** + * Lists the WCF relays within 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 to the PagedList<WcfRelayInner> 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)); + } + }); + } + + /** + * Lists the WCF relays within the 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<WcfRelayInner> 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); + } + + /** + * Creates or updates a WCF relay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param parameters Parameters supplied to create a WCF 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 + * @return the WcfRelayInner object if successful. + */ + public WcfRelayInner createOrUpdate(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a WCF relay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param parameters Parameters supplied to create a WCF 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 createOrUpdateAsync(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, parameters), serviceCallback); + } + + /** + * Creates or updates a WCF relay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param parameters Parameters supplied to create a WCF relay. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, parameters).map(new Func1, WcfRelayInner>() { + @Override + public WcfRelayInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a WCF relay. This operation is idempotent. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param parameters Parameters supplied to create a WCF relay. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, WcfRelayInner 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName) { + deleteWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).toBlocking().single().body(); + } + + /** + * Deletes a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, relayName), serviceCallback); + } + + /** + * Deletes a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String namespaceName, String relayName) { + return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 the description for the specified WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 WcfRelayInner object if successful. + */ + public WcfRelayInner get(String resourceGroupName, String namespaceName, String relayName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).toBlocking().single().body(); + } + + /** + * Returns the description for the specified WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, relayName), serviceCallback); + } + + /** + * Returns the description for the specified WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName, String relayName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName, relayName).map(new Func1, WcfRelayInner>() { + @Override + public WcfRelayInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the description for the specified WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WcfRelayInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Authorization rules for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String relayName) { + ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Authorization rules for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, relayName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, relayName) + .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)); + } + }); + } + + /** + * Authorization rules for a WCF relay. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param namespaceName The namespace name + ServiceResponse> * @param relayName The relay name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String relayName) { + 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, rights).toBlocking().single().body(); + } + + /** + * Creates or updates an authorization rule for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, rights), serviceCallback); + } + + /** + * Creates or updates an authorization rule for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName, List rights) { + return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, rights).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an authorization rule for a WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param rights The rights associated with the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName is required and cannot be null."); + } + if (authorizationRuleName == null) { + throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (rights == null) { + throw new IllegalArgumentException("Parameter rights is required and cannot be null."); + } + Validator.validate(rights); + AuthorizationRuleInner parameters = new AuthorizationRuleInner(); + parameters.withRights(rights); + return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, relayName, 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 WCF relay authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName) { + deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Deletes a WCF relay authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Deletes a WCF relay authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName) { + return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a WCF relay authorization rule. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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); + } + + /** + * Get authorizationRule for a WCF relay by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationRuleInner object if successful. + */ + public AuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Get authorizationRule for a WCF relay by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Get authorizationRule for a WCF relay by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String relayName, String authorizationRuleName) { + return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, AuthorizationRuleInner>() { + @Override + public AuthorizationRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get authorizationRule for a WCF relay by name. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationRuleInner object + */ + public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).toBlocking().single().body(); + } + + /** + * Primary and secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName), serviceCallback); + } + + /** + * Primary and secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, String authorizationRuleName) { + return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Primary and secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay 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 relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, 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 WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 relayName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters).toBlocking().single().body(); + } + + /** + * Regenerates the primary or secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 relayName, String authorizationRuleName, RegenerateAccessKeyParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters), serviceCallback); + } + + /** + * Regenerates the primary or secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 relayName, String authorizationRuleName, RegenerateAccessKeyParameters parameters) { + return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters).map(new Func1, AccessKeysInner>() { + @Override + public AccessKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the primary or secondary connection strings to the WCF relay. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param namespaceName The namespace name + * @param relayName The relay name. + * @param authorizationRuleName The authorization rule name. + * @param parameters Parameters supplied to regenerate 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 relayName, 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 (relayName == null) { + throw new IllegalArgumentException("Parameter relayName 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, relayName, authorizationRuleName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the WCF relays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<WcfRelayInner> 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(); + } + }; + } + + /** + * Lists the WCF relays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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); + } + + /** + * Lists the WCF relays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<WcfRelayInner> object + */ + public Observable> listByNamespaceNextAsync(final String nextPageLink) { + return listByNamespaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the WCF relays within the namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<WcfRelayInner> 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)); + } + }); + } + + /** + * Lists the WCF relays within the namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<WcfRelayInner> 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); + } + + /** + * Authorization rules for a WCF relay. + * + * @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<AuthorizationRuleInner> object if successful. + */ + public PagedList listAuthorizationRulesNext(final String nextPageLink) { + ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Authorization rules for a WCF relay. + * + * @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); + } + + /** + * Authorization rules for a WCF relay. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) { + return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Authorization rules for a WCF relay. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationRuleInner> object + */ + public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) { + return listAuthorizationRulesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Authorization rules for a WCF relay. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAuthorizationRulesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAuthorizationRulesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAuthorizationRulesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAuthorizationRulesNextDelegate(Response response) throws 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/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayImpl.java new file mode 100644 index 000000000000..0d5747661801 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.WcfRelay; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.relay.v2017_04_01.Relaytype; + +class WcfRelayImpl extends CreatableUpdatableImpl implements WcfRelay, WcfRelay.Definition, WcfRelay.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String relayName; + + WcfRelayImpl(String name, RelayManager manager) { + super(name, new WcfRelayInner()); + this.manager = manager; + // Set resource name + this.relayName = name; + // + } + + WcfRelayImpl(WcfRelayInner inner, RelayManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.relayName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces"); + this.relayName = IdParsingUtils.getValueFromIdByName(inner.id(), "wcfRelays"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.getAsync(this.resourceGroupName, this.namespaceName, this.relayName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdAt() { + return this.inner().createdAt(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isDynamic() { + return this.inner().isDynamic(); + } + + @Override + public Integer listenerCount() { + return this.inner().listenerCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Relaytype relayType() { + return this.inner().relayType(); + } + + @Override + public Boolean requiresClientAuthorization() { + return this.inner().requiresClientAuthorization(); + } + + @Override + public Boolean requiresTransportSecurity() { + return this.inner().requiresTransportSecurity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedAt() { + return this.inner().updatedAt(); + } + + @Override + public String userMetadata() { + return this.inner().userMetadata(); + } + + @Override + public WcfRelayImpl withExistingNamespace(String resourceGroupName, String namespaceName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + return this; + } + + @Override + public WcfRelayImpl withRelayType(Relaytype relayType) { + this.inner().withRelayType(relayType); + return this; + } + + @Override + public WcfRelayImpl withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.inner().withRequiresClientAuthorization(requiresClientAuthorization); + return this; + } + + @Override + public WcfRelayImpl withRequiresTransportSecurity(Boolean requiresTransportSecurity) { + this.inner().withRequiresTransportSecurity(requiresTransportSecurity); + return this; + } + + @Override + public WcfRelayImpl withUserMetadata(String userMetadata) { + this.inner().withUserMetadata(userMetadata); + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayInner.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayInner.java new file mode 100644 index 000000000000..c733f4b8a284 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayInner.java @@ -0,0 +1,192 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.relay.v2017_04_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.relay.v2017_04_01.Relaytype; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of the WCF relay resource. + */ +@JsonFlatten +public class WcfRelayInner extends ProxyResource { + /** + * Returns true if the relay is dynamic; otherwise, false. + */ + @JsonProperty(value = "properties.isDynamic", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDynamic; + + /** + * The time the WCF relay 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; + + /** + * The number of listeners for this relay. Note that min :1 and max:25 are + * supported. + */ + @JsonProperty(value = "properties.listenerCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer listenerCount; + + /** + * WCF relay type. Possible values include: 'NetTcp', 'Http'. + */ + @JsonProperty(value = "properties.relayType") + private Relaytype relayType; + + /** + * Returns true if client authorization is needed for this relay; + * otherwise, false. + */ + @JsonProperty(value = "properties.requiresClientAuthorization") + private Boolean requiresClientAuthorization; + + /** + * Returns true if transport security is needed for this relay; otherwise, + * false. + */ + @JsonProperty(value = "properties.requiresTransportSecurity") + private Boolean requiresTransportSecurity; + + /** + * The userMetadata is a placeholder to store user-defined string data for + * the WCF Relay endpoint. For example, it can be used to store descriptive + * data, such as list of teams and their contact information. Also, + * user-defined configuration settings can be stored. + */ + @JsonProperty(value = "properties.userMetadata") + private String userMetadata; + + /** + * Get returns true if the relay is dynamic; otherwise, false. + * + * @return the isDynamic value + */ + public Boolean isDynamic() { + return this.isDynamic; + } + + /** + * Get the time the WCF relay 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 the number of listeners for this relay. Note that min :1 and max:25 are supported. + * + * @return the listenerCount value + */ + public Integer listenerCount() { + return this.listenerCount; + } + + /** + * Get wCF relay type. Possible values include: 'NetTcp', 'Http'. + * + * @return the relayType value + */ + public Relaytype relayType() { + return this.relayType; + } + + /** + * Set wCF relay type. Possible values include: 'NetTcp', 'Http'. + * + * @param relayType the relayType value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withRelayType(Relaytype relayType) { + this.relayType = relayType; + return this; + } + + /** + * Get returns true if client authorization is needed for this relay; otherwise, false. + * + * @return the requiresClientAuthorization value + */ + public Boolean requiresClientAuthorization() { + return this.requiresClientAuthorization; + } + + /** + * Set returns true if client authorization is needed for this relay; otherwise, false. + * + * @param requiresClientAuthorization the requiresClientAuthorization value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withRequiresClientAuthorization(Boolean requiresClientAuthorization) { + this.requiresClientAuthorization = requiresClientAuthorization; + return this; + } + + /** + * Get returns true if transport security is needed for this relay; otherwise, false. + * + * @return the requiresTransportSecurity value + */ + public Boolean requiresTransportSecurity() { + return this.requiresTransportSecurity; + } + + /** + * Set returns true if transport security is needed for this relay; otherwise, false. + * + * @param requiresTransportSecurity the requiresTransportSecurity value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withRequiresTransportSecurity(Boolean requiresTransportSecurity) { + this.requiresTransportSecurity = requiresTransportSecurity; + return this; + } + + /** + * Get the userMetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored. + * + * @return the userMetadata value + */ + public String userMetadata() { + return this.userMetadata; + } + + /** + * Set the userMetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored. + * + * @param userMetadata the userMetadata value to set + * @return the WcfRelayInner object itself. + */ + public WcfRelayInner withUserMetadata(String userMetadata) { + this.userMetadata = userMetadata; + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayNamespaceAuthorizationRuleImpl.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayNamespaceAuthorizationRuleImpl.java new file mode 100644 index 000000000000..c98f1952f301 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/WcfRelayNamespaceAuthorizationRuleImpl.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.relay.v2017_04_01.implementation; + +import com.microsoft.azure.management.relay.v2017_04_01.WcfRelayNamespaceAuthorizationRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.relay.v2017_04_01.AccessRights; + +class WcfRelayNamespaceAuthorizationRuleImpl extends CreatableUpdatableImpl implements WcfRelayNamespaceAuthorizationRule, WcfRelayNamespaceAuthorizationRule.Definition, WcfRelayNamespaceAuthorizationRule.Update { + private final RelayManager manager; + private String resourceGroupName; + private String namespaceName; + private String relayName; + private String authorizationRuleName; + private List crights; + private List urights; + + WcfRelayNamespaceAuthorizationRuleImpl(String name, RelayManager manager) { + super(name, new AuthorizationRuleInner()); + this.manager = manager; + // Set resource name + this.authorizationRuleName = name; + // + } + + WcfRelayNamespaceAuthorizationRuleImpl(AuthorizationRuleInner inner, RelayManager 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.relayName = IdParsingUtils.getValueFromIdByName(inner.id(), "wcfRelays"); + this.authorizationRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationRules"); + // + } + + @Override + public RelayManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.authorizationRuleName, this.crights) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.createOrUpdateAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.relayName, this.authorizationRuleName, this.urights) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WCFRelaysInner client = this.manager().inner().wCFRelays(); + return client.getAuthorizationRuleAsync(this.resourceGroupName, this.namespaceName, this.relayName, 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 WcfRelayNamespaceAuthorizationRuleImpl withExistingWcfRelay(String resourceGroupName, String namespaceName, String relayName) { + this.resourceGroupName = resourceGroupName; + this.namespaceName = namespaceName; + this.relayName = relayName; + return this; + } + + @Override + public WcfRelayNamespaceAuthorizationRuleImpl withRights(List rights) { + if (isInCreateMode()) { + this.crights = rights; + } else { + this.urights = rights; + } + return this; + } + +} diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/package-info.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/package-info.java new file mode 100644 index 000000000000..7d5718ed58b4 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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 RelayManagementClient. + * Use these API to manage Azure Relay resources through Azure Resource Manager. + */ +package com.microsoft.azure.management.relay.v2017_04_01.implementation; diff --git a/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/package-info.java b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/package-info.java new file mode 100644 index 000000000000..c852f844ecf6 --- /dev/null +++ b/relay/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/relay/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 RelayManagementClient. + * Use these API to manage Azure Relay resources through Azure Resource Manager. + */ +package com.microsoft.azure.management.relay.v2017_04_01;