Search in sources :

Example 1 with RegenerateCredentialParameters

use of com.microsoft.azure.management.containerregistry.RegenerateCredentialParameters in project azure-sdk-for-java by Azure.

the class RegistriesInner method regenerateCredentialWithServiceResponseAsync.

/**
     * Regenerates one of the login credentials for the specified container registry.
     *
     * @param resourceGroupName The name of the resource group to which the container registry belongs.
     * @param registryName The name of the container registry.
     * @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the RegistryListCredentials object
     */
public Observable<ServiceResponse<RegistryListCredentials>> regenerateCredentialWithServiceResponseAsync(String resourceGroupName, String registryName, PasswordName name) {
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (registryName == null) {
        throw new IllegalArgumentException("Parameter registryName 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.");
    }
    RegenerateCredentialParameters regenerateCredentialParameters = new RegenerateCredentialParameters();
    regenerateCredentialParameters.withName(name);
    return service.regenerateCredential(this.client.subscriptionId(), resourceGroupName, registryName, this.client.apiVersion(), this.client.acceptLanguage(), regenerateCredentialParameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RegistryListCredentials>>>() {

        @Override
        public Observable<ServiceResponse<RegistryListCredentials>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<RegistryListCredentials> clientResponse = regenerateCredentialDelegate(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) RegenerateCredentialParameters(com.microsoft.azure.management.containerregistry.RegenerateCredentialParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

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