Search in sources :

Example 1 with StorageAccountRegenerateKeyParameters

use of com.microsoft.azure.management.storage.StorageAccountRegenerateKeyParameters in project azure-sdk-for-java by Azure.

the class StorageAccountsInner method regenerateKeyWithServiceResponseAsync.

/**
     * Regenerates one of the access keys for the specified storage account.
     *
     * @param resourceGroupName The name of the resource group within the user's subscription.
     * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
     * @param keyName the String value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the StorageAccountListKeysResultInner object
     */
public Observable<ServiceResponse<StorageAccountListKeysResultInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, String keyName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (accountName == null) {
        throw new IllegalArgumentException("Parameter accountName 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 (keyName == null) {
        throw new IllegalArgumentException("Parameter keyName is required and cannot be null.");
    }
    StorageAccountRegenerateKeyParameters regenerateKey = new StorageAccountRegenerateKeyParameters();
    regenerateKey.withKeyName(keyName);
    return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), regenerateKey, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<StorageAccountListKeysResultInner>>>() {

        @Override
        public Observable<ServiceResponse<StorageAccountListKeysResultInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<StorageAccountListKeysResultInner> clientResponse = regenerateKeyDelegate(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) Observable(rx.Observable) StorageAccountRegenerateKeyParameters(com.microsoft.azure.management.storage.StorageAccountRegenerateKeyParameters) ResponseBody(okhttp3.ResponseBody)

Aggregations

StorageAccountRegenerateKeyParameters (com.microsoft.azure.management.storage.StorageAccountRegenerateKeyParameters)1 ServiceResponse (com.microsoft.rest.ServiceResponse)1 ResponseBody (okhttp3.ResponseBody)1 Response (retrofit2.Response)1 Observable (rx.Observable)1