Search in sources :

Example 51 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class NamespacesInner method regenerateKeysWithServiceResponseAsync.

/**
     * Regenerates the primary or secondary connection strings for the namespace.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param authorizationRuleName The authorizationrule name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceListKeysInner object
     */
public Observable<ServiceResponse<ResourceListKeysInner>> 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<Response<ResponseBody>, Observable<ServiceResponse<ResourceListKeysInner>>>() {

        @Override
        public Observable<ServiceResponse<ResourceListKeysInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<ResourceListKeysInner> clientResponse = regenerateKeysDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) Policykey(com.microsoft.azure.management.servicebus.Policykey) RegenerateKeysParameters(com.microsoft.azure.management.servicebus.RegenerateKeysParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 52 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class NamespacesInner method regenerateKeysWithServiceResponseAsync.

/**
     * Regenerates the primary or secondary connection strings for the namespace.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param namespaceName The namespace name
     * @param authorizationRuleName The 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<ServiceResponse<ResourceListKeysInner>> 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<Response<ResponseBody>, Observable<ServiceResponse<ResourceListKeysInner>>>() {

        @Override
        public Observable<ServiceResponse<ResourceListKeysInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<ResourceListKeysInner> clientResponse = regenerateKeysDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) RegenerateKeysParameters(com.microsoft.azure.management.servicebus.RegenerateKeysParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 53 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class StorageAccountsInner method checkNameAvailabilityWithServiceResponseAsync.

/**
     * Checks that the storage account name is valid and is not already in use.
     *
     * @param name the String value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the CheckNameAvailabilityResultInner object
     */
public Observable<ServiceResponse<CheckNameAvailabilityResultInner>> checkNameAvailabilityWithServiceResponseAsync(String name) {
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    StorageAccountCheckNameAvailabilityParameters accountName = new StorageAccountCheckNameAvailabilityParameters();
    accountName.withName(name);
    return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), accountName, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CheckNameAvailabilityResultInner>>>() {

        @Override
        public Observable<ServiceResponse<CheckNameAvailabilityResultInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CheckNameAvailabilityResultInner> clientResponse = checkNameAvailabilityDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : StorageAccountCheckNameAvailabilityParameters(com.microsoft.azure.management.storage.StorageAccountCheckNameAvailabilityParameters) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 54 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class EndpointsInner method purgeContentWithServiceResponseAsync.

/**
     * Removes a content from CDN.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param profileName Name of the CDN profile which is unique within the resource group.
     * @param endpointName Name of the endpoint under the profile which is unique globally.
     * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
public Observable<ServiceResponse<Void>> purgeContentWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, List<String> contentPaths) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (profileName == null) {
        throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
    }
    if (endpointName == null) {
        throw new IllegalArgumentException("Parameter endpointName 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 (contentPaths == null) {
        throw new IllegalArgumentException("Parameter contentPaths is required and cannot be null.");
    }
    Validator.validate(contentPaths);
    PurgeParameters contentFilePaths = new PurgeParameters();
    contentFilePaths.withContentPaths(contentPaths);
    Observable<Response<ResponseBody>> observable = service.purgeContent(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), contentFilePaths, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) PurgeParameters(com.microsoft.azure.management.cdn.PurgeParameters) TypeToken(com.google.common.reflect.TypeToken)

Example 55 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class ProfilesInner method beginUpdateWithServiceResponseAsync.

/**
     * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param profileName Name of the CDN profile which is unique within the resource group.
     * @param tags Profile tags
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ProfileInner object
     */
public Observable<ServiceResponse<ProfileInner>> beginUpdateWithServiceResponseAsync(String resourceGroupName, String profileName, Map<String, String> tags) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (profileName == null) {
        throw new IllegalArgumentException("Parameter profileName 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 (tags == null) {
        throw new IllegalArgumentException("Parameter tags is required and cannot be null.");
    }
    Validator.validate(tags);
    ProfileUpdateParameters profileUpdateParameters = new ProfileUpdateParameters();
    profileUpdateParameters.withTags(tags);
    return service.beginUpdate(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), profileUpdateParameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ProfileInner>>>() {

        @Override
        public Observable<ServiceResponse<ProfileInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<ProfileInner> clientResponse = beginUpdateDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) ProfileUpdateParameters(com.microsoft.azure.management.cdn.ProfileUpdateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

ServiceResponse (com.microsoft.rest.ServiceResponse)114 Response (retrofit2.Response)114 ResponseBody (okhttp3.ResponseBody)92 Observable (rx.Observable)92 TypeToken (com.google.common.reflect.TypeToken)22 VirtualMachineScaleSetVMInstanceIDs (com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs)16 KeyBundle (com.microsoft.azure.keyvault.models.KeyBundle)7 CertificateBundle (com.microsoft.azure.keyvault.models.CertificateBundle)6 RegenerateKeysParameters (com.microsoft.azure.management.servicebus.RegenerateKeysParameters)6 CertificateAttributes (com.microsoft.azure.keyvault.models.CertificateAttributes)4 IssuerBundle (com.microsoft.azure.keyvault.models.IssuerBundle)4 KeyOperationResult (com.microsoft.azure.keyvault.models.KeyOperationResult)4 SecretBundle (com.microsoft.azure.keyvault.models.SecretBundle)4 CsmPublishingProfileOptions (com.microsoft.azure.management.appservice.CsmPublishingProfileOptions)4 FailoverPolicies (com.microsoft.azure.management.documentdb.FailoverPolicies)4 RoleAssignmentCreateParameters (com.microsoft.azure.management.graphrbac.RoleAssignmentCreateParameters)4 InputStream (java.io.InputStream)4 Page (com.microsoft.azure.Page)3 CertificateOperation (com.microsoft.azure.keyvault.models.CertificateOperation)3 CertificatePolicy (com.microsoft.azure.keyvault.models.CertificatePolicy)3