All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.management.servicebus.implementation.QueuesInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Service Bus Management SDK. A new set of management libraries are now Generally Available. For documentation on how to use the new libraries, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 1.41.4
Show newest version
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 */

package com.microsoft.azure.management.servicebus.implementation;

import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.management.servicebus.AccessRights;
import com.microsoft.azure.management.servicebus.Policykey;
import com.microsoft.azure.management.servicebus.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 Queues.
 */
public class QueuesInner {
    /** The Retrofit service to perform REST calls. */
    private QueuesService service;
    /** The service client containing this operation class. */
    private ServiceBusManagementClientImpl client;

    /**
     * Initializes an instance of QueuesInner.
     *
     * @param retrofit the Retrofit instance built from a Retrofit Builder.
     * @param client the instance of the service client containing this operation class.
     */
    public QueuesInner(Retrofit retrofit, ServiceBusManagementClientImpl client) {
        this.service = retrofit.create(QueuesService.class);
        this.client = client;
    }

    /**
     * The interface defining all the services for Queues to be
     * used by Retrofit to perform actually REST calls.
     */
    interface QueuesService {
        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues listByNamespace" })
        @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues")
        Observable> listByNamespace(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues createOrUpdate" })
        @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}")
        Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("subscriptionId") String subscriptionId, @Body QueueInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues delete" })
        @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", method = "DELETE", hasBody = true)
        Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues get" })
        @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}")
        Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues listAuthorizationRules" })
        @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules")
        Observable> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues createOrUpdateAuthorizationRule" })
        @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}")
        Observable> createOrUpdateAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SharedAccessAuthorizationRuleInner parameters, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues deleteAuthorizationRule" })
        @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", method = "DELETE", hasBody = true)
        Observable> deleteAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues getAuthorizationRule" })
        @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}")
        Observable> getAuthorizationRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues listKeys" })
        @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys")
        Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues regenerateKeys" })
        @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys")
        Observable> regenerateKeys(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("queueName") String queueName, @Path("authorizationRuleName") String authorizationRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeysParameters parameters, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues listByNamespaceNext" })
        @GET
        Observable> listByNamespaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servicebus.Queues listAuthorizationRulesNext" })
        @GET
        Observable> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

    }

    /**
     * Gets the queues within a namespace.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<QueueInner> object if successful.
     */
    public PagedList listByNamespace(final String resourceGroupName, final String namespaceName) {
        ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single();
        return new PagedList(response.body()) {
            @Override
            public Page nextPage(String nextPageLink) {
                return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listByNamespaceSinglePageAsync(resourceGroupName, namespaceName),
            new Func1>>>() {
                @Override
                public Observable>> call(String nextPageLink) {
                    return listByNamespaceNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<QueueInner> object
     */
    public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName) {
        return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName)
            .map(new Func1>, Page>() {
                @Override
                public Page call(ServiceResponse> response) {
                    return response.body();
                }
            });
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<QueueInner> object
     */
    public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) {
        return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName)
            .concatMap(new Func1>, Observable>>>() {
                @Override
                public Observable>> call(ServiceResponse> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Gets the queues within a namespace.
     *
    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<QueueInner> 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 CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Creates or updates a Service Bus queue. This operation is idempotent.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param parameters Parameters supplied to create or update a queue resource.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the QueueInner object if successful.
     */
    public QueueInner createOrUpdate(String resourceGroupName, String namespaceName, String queueName, QueueInner parameters) {
        return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters).toBlocking().single().body();
    }

    /**
     * Creates or updates a Service Bus queue. This operation is idempotent.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param parameters Parameters supplied to create or update a queue resource.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture createOrUpdateAsync(String resourceGroupName, String namespaceName, String queueName, QueueInner parameters, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters), serviceCallback);
    }

    /**
     * Creates or updates a Service Bus queue. This operation is idempotent.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param parameters Parameters supplied to create or update a queue resource.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the QueueInner object
     */
    public Observable createOrUpdateAsync(String resourceGroupName, String namespaceName, String queueName, QueueInner parameters) {
        return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, parameters).map(new Func1, QueueInner>() {
            @Override
            public QueueInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Creates or updates a Service Bus queue. This operation is idempotent.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param parameters Parameters supplied to create or update a queue resource.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the QueueInner object
     */
    public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, QueueInner parameters) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (parameters == null) {
            throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        Validator.validate(parameters);
        return service.createOrUpdate(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = createOrUpdateDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Deletes a queue from the specified namespace in a resource group.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     */
    public void delete(String resourceGroupName, String namespaceName, String queueName) {
        deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).toBlocking().single().body();
    }

    /**
     * Deletes a queue from the specified namespace in a resource group.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture deleteAsync(String resourceGroupName, String namespaceName, String queueName, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName), serviceCallback);
    }

    /**
     * Deletes a queue from the specified namespace in a resource group.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable deleteAsync(String resourceGroupName, String namespaceName, String queueName) {
        return deleteWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).map(new Func1, Void>() {
            @Override
            public Void call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Deletes a queue from the specified namespace in a resource group.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.delete(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = deleteDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(204, new TypeToken() { }.getType())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Returns a description for the specified queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the QueueInner object if successful.
     */
    public QueueInner get(String resourceGroupName, String namespaceName, String queueName) {
        return getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).toBlocking().single().body();
    }

    /**
     * Returns a description for the specified queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture getAsync(String resourceGroupName, String namespaceName, String queueName, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName), serviceCallback);
    }

    /**
     * Returns a description for the specified queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the QueueInner object
     */
    public Observable getAsync(String resourceGroupName, String namespaceName, String queueName) {
        return getWithServiceResponseAsync(resourceGroupName, namespaceName, queueName).map(new Func1, QueueInner>() {
            @Override
            public QueueInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Returns a description for the specified queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the QueueInner object
     */
    public Observable> getWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.get(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = getDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<SharedAccessAuthorizationRuleInner> object if successful.
     */
    public PagedList listAuthorizationRules(final String resourceGroupName, final String namespaceName, final String queueName) {
        ServiceResponse> response = listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName).toBlocking().single();
        return new PagedList(response.body()) {
            @Override
            public Page nextPage(String nextPageLink) {
                return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName, final ListOperationCallback serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName),
            new Func1>>>() {
                @Override
                public Observable>> call(String nextPageLink) {
                    return listAuthorizationRulesNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<SharedAccessAuthorizationRuleInner> object
     */
    public Observable> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String queueName) {
        return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, queueName)
            .map(new Func1>, Page>() {
                @Override
                public Page call(ServiceResponse> response) {
                    return response.body();
                }
            });
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<SharedAccessAuthorizationRuleInner> object
     */
    public Observable>> listAuthorizationRulesWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String queueName) {
        return listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, queueName)
            .concatMap(new Func1>, Observable>>>() {
                @Override
                public Observable>> call(ServiceResponse> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Gets all authorization rules for a queue.
     *
    ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription.
    ServiceResponse> * @param namespaceName The namespace name
    ServiceResponse> * @param queueName The queue name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<SharedAccessAuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName, final String queueName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.listAuthorizationRules(resourceGroupName, namespaceName, queueName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>>() {
                @Override
                public Observable>> call(Response response) {
                    try {
                        ServiceResponse> result = listAuthorizationRulesDelegate(response);
                        return Observable.just(new ServiceResponse>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse> listAuthorizationRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Creates an authorization rule for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @param rights The rights associated with the rule.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the SharedAccessAuthorizationRuleInner object if successful.
     */
    public SharedAccessAuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights) {
        return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, rights).toBlocking().single().body();
    }

    /**
     * Creates an authorization rule for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName, List rights, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, rights), serviceCallback);
    }

    /**
     * Creates an authorization rule for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @param rights The rights associated with the rule.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the SharedAccessAuthorizationRuleInner object
     */
    public Observable createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights) {
        return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, rights).map(new Func1, SharedAccessAuthorizationRuleInner>() {
            @Override
            public SharedAccessAuthorizationRuleInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Creates an authorization rule for a queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @param rights The rights associated with the rule.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the SharedAccessAuthorizationRuleInner object
     */
    public Observable> createOrUpdateAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, List rights) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (authorizationRuleName == null) {
            throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        if (rights == null) {
            throw new IllegalArgumentException("Parameter rights is required and cannot be null.");
        }
        Validator.validate(rights);
        SharedAccessAuthorizationRuleInner parameters = new SharedAccessAuthorizationRuleInner();
        parameters.withRights(rights);
        return service.createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = createOrUpdateAuthorizationRuleDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse createOrUpdateAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Deletes a queue authorization rule.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     */
    public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body();
    }

    /**
     * Deletes a queue authorization rule.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback);
    }

    /**
     * Deletes a queue authorization rule.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName) {
        return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, Void>() {
            @Override
            public Void call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Deletes a queue authorization rule.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (authorizationRuleName == null) {
            throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.deleteAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = deleteAuthorizationRuleDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse deleteAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(204, new TypeToken() { }.getType())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Gets an authorization rule for a queue by rule name.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule 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 SharedAccessAuthorizationRuleInner object if successful.
     */
    public SharedAccessAuthorizationRuleInner getAuthorizationRule(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body();
    }

    /**
     * Gets an authorization rule for a queue by rule name.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback);
    }

    /**
     * Gets an authorization rule for a queue by rule name.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the SharedAccessAuthorizationRuleInner object
     */
    public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        return getAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, SharedAccessAuthorizationRuleInner>() {
            @Override
            public SharedAccessAuthorizationRuleInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Gets an authorization rule for a queue by rule name.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the SharedAccessAuthorizationRuleInner object
     */
    public Observable> getAuthorizationRuleWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (authorizationRuleName == null) {
            throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.getAuthorizationRule(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = getAuthorizationRuleDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse getAuthorizationRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Primary and secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the ResourceListKeysInner object if successful.
     */
    public ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body();
    }

    /**
     * Primary and secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback);
    }

    /**
     * Primary and secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceListKeysInner object
     */
    public Observable listKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() {
            @Override
            public ResourceListKeysInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Primary and secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceListKeysInner object
     */
    public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (authorizationRuleName == null) {
            throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.listKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = listKeysDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the ResourceListKeysInner object if successful.
     */
    public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).toBlocking().single().body();
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName), serviceCallback);
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceListKeysInner object
     */
    public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName).map(new Func1, ResourceListKeysInner>() {
            @Override
            public ResourceListKeysInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceListKeysInner object
     */
    public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (authorizationRuleName == null) {
            throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        final Policykey policykey = null;
        RegenerateKeysParameters parameters = new RegenerateKeysParameters();
        parameters.withPolicykey(null);
        return service.regenerateKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = regenerateKeysDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The authorizationrule name.
     * @param policykey Key that needs to be regenerated. Possible values include: 'PrimaryKey', 'SecondaryKey'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the ResourceListKeysInner object if successful.
     */
    public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey) {
        return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, policykey).toBlocking().single().body();
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 queueName, String authorizationRuleName, Policykey policykey, final ServiceCallback serviceCallback) {
        return ServiceFuture.fromResponse(regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, policykey), serviceCallback);
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 ResourceListKeysInner object
     */
    public Observable regenerateKeysAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey) {
        return regenerateKeysWithServiceResponseAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName, policykey).map(new Func1, ResourceListKeysInner>() {
            @Override
            public ResourceListKeysInner call(ServiceResponse response) {
                return response.body();
            }
        });
    }

    /**
     * Regenerates the primary or secondary connection strings to the queue.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param queueName The queue name.
     * @param authorizationRuleName The 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 ResourceListKeysInner object
     */
    public Observable> regenerateKeysWithServiceResponseAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName, Policykey policykey) {
        if (resourceGroupName == null) {
            throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
        }
        if (namespaceName == null) {
            throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
        }
        if (queueName == null) {
            throw new IllegalArgumentException("Parameter queueName is required and cannot be null.");
        }
        if (authorizationRuleName == null) {
            throw new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.");
        }
        if (this.client.subscriptionId() == null) {
            throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        RegenerateKeysParameters parameters = new RegenerateKeysParameters();
        parameters.withPolicykey(policykey);
        return service.regenerateKeys(resourceGroupName, namespaceName, queueName, authorizationRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
            .flatMap(new Func1, Observable>>() {
                @Override
                public Observable> call(Response response) {
                    try {
                        ServiceResponse clientResponse = regenerateKeysDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse regenerateKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<QueueInner> object if successful.
     */
    public PagedList listByNamespaceNext(final String nextPageLink) {
        ServiceResponse> response = listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList(response.body()) {
            @Override
            public Page nextPage(String nextPageLink) {
                return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture> listByNamespaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listByNamespaceNextSinglePageAsync(nextPageLink),
            new Func1>>>() {
                @Override
                public Observable>> call(String nextPageLink) {
                    return listByNamespaceNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<QueueInner> object
     */
    public Observable> listByNamespaceNextAsync(final String nextPageLink) {
        return listByNamespaceNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1>, Page>() {
                @Override
                public Page call(ServiceResponse> response) {
                    return response.body();
                }
            });
    }

    /**
     * Gets the queues within a namespace.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<QueueInner> object
     */
    public Observable>> listByNamespaceNextWithServiceResponseAsync(final String nextPageLink) {
        return listByNamespaceNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1>, Observable>>>() {
                @Override
                public Observable>> call(ServiceResponse> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Gets the queues within a namespace.
     *
    ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<QueueInner> 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 CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList<SharedAccessAuthorizationRuleInner> object if successful.
     */
    public PagedList listAuthorizationRulesNext(final String nextPageLink) {
        ServiceResponse> response = listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList(response.body()) {
            @Override
            public Page nextPage(String nextPageLink) {
                return listAuthorizationRulesNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture> listAuthorizationRulesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            listAuthorizationRulesNextSinglePageAsync(nextPageLink),
            new Func1>>>() {
                @Override
                public Observable>> call(String nextPageLink) {
                    return listAuthorizationRulesNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<SharedAccessAuthorizationRuleInner> object
     */
    public Observable> listAuthorizationRulesNextAsync(final String nextPageLink) {
        return listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1>, Page>() {
                @Override
                public Page call(ServiceResponse> response) {
                    return response.body();
                }
            });
    }

    /**
     * Gets all authorization rules for a queue.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList<SharedAccessAuthorizationRuleInner> object
     */
    public Observable>> listAuthorizationRulesNextWithServiceResponseAsync(final String nextPageLink) {
        return listAuthorizationRulesNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1>, Observable>>>() {
                @Override
                public Observable>> call(ServiceResponse> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(listAuthorizationRulesNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * Gets all authorization rules for a queue.
     *
    ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<SharedAccessAuthorizationRuleInner> 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);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy