Search in sources :

Example 1 with BatchAccountRegenerateKeyParameters

use of com.microsoft.azure.management.batch.BatchAccountRegenerateKeyParameters in project azure-sdk-for-java by Azure.

the class BatchAccountsInner method regenerateKeyWithServiceResponseAsync.

/**
     * Regenerates the specified account key for the Batch account.
     *
     * @param resourceGroupName The name of the resource group that contains the Batch account.
     * @param accountName The name of the Batch account.
     * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the BatchAccountKeysInner object
     */
public Observable<ServiceResponse<BatchAccountKeysInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, AccountKeyType 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.");
    }
    BatchAccountRegenerateKeyParameters parameters = new BatchAccountRegenerateKeyParameters();
    parameters.withKeyName(keyName);
    return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<BatchAccountKeysInner>>>() {

        @Override
        public Observable<ServiceResponse<BatchAccountKeysInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<BatchAccountKeysInner> 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) BatchAccountRegenerateKeyParameters(com.microsoft.azure.management.batch.BatchAccountRegenerateKeyParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

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