Search in sources :

Example 1 with RedisRegenerateKeyParameters

use of com.microsoft.azure.management.redis.RedisRegenerateKeyParameters in project azure-sdk-for-java by Azure.

the class RedisInner method regenerateKeyWithServiceResponseAsync.

/**
     * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource.
     *
     * @param resourceGroupName The name of the resource group.
     * @param name The name of the Redis cache.
     * @param keyType The Redis access key to regenerate. Possible values include: 'Primary', 'Secondary'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the RedisAccessKeysInner object
     */
public Observable<ServiceResponse<RedisAccessKeysInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String name, RedisKeyType keyType) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name 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 (keyType == null) {
        throw new IllegalArgumentException("Parameter keyType is required and cannot be null.");
    }
    RedisRegenerateKeyParameters parameters = new RedisRegenerateKeyParameters();
    parameters.withKeyType(keyType);
    return service.regenerateKey(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RedisAccessKeysInner>>>() {

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

Aggregations

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