Search in sources :

Example 1 with KeyCredentialsUpdateParameters

use of com.microsoft.azure.management.graphrbac.KeyCredentialsUpdateParameters in project azure-sdk-for-java by Azure.

the class ServicePrincipalsInner method updateKeyCredentialsWithServiceResponseAsync.

/**
     * Update the keyCredentials associated with a service principal.
     *
     * @param objectId The object ID for which to get service principal information.
     * @param value A collection of KeyCredentials.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
public Observable<ServiceResponse<Void>> updateKeyCredentialsWithServiceResponseAsync(String objectId, List<KeyCredentialInner> value) {
    if (objectId == null) {
        throw new IllegalArgumentException("Parameter objectId is required and cannot be null.");
    }
    if (this.client.tenantID() == null) {
        throw new IllegalArgumentException("Parameter this.client.tenantID() 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 (value == null) {
        throw new IllegalArgumentException("Parameter value is required and cannot be null.");
    }
    Validator.validate(value);
    KeyCredentialsUpdateParameters parameters = new KeyCredentialsUpdateParameters();
    parameters.withValue(value);
    return service.updateKeyCredentials(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {

        @Override
        public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<Void> clientResponse = updateKeyCredentialsDelegate(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) KeyCredentialsUpdateParameters(com.microsoft.azure.management.graphrbac.KeyCredentialsUpdateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 2 with KeyCredentialsUpdateParameters

use of com.microsoft.azure.management.graphrbac.KeyCredentialsUpdateParameters in project azure-sdk-for-java by Azure.

the class ApplicationsInner method updateKeyCredentialsWithServiceResponseAsync.

/**
     * Update the keyCredentials associated with an application.
     *
     * @param applicationObjectId Application object ID.
     * @param value A collection of KeyCredentials.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
public Observable<ServiceResponse<Void>> updateKeyCredentialsWithServiceResponseAsync(String applicationObjectId, List<KeyCredentialInner> value) {
    if (applicationObjectId == null) {
        throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null.");
    }
    if (this.client.tenantID() == null) {
        throw new IllegalArgumentException("Parameter this.client.tenantID() 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 (value == null) {
        throw new IllegalArgumentException("Parameter value is required and cannot be null.");
    }
    Validator.validate(value);
    KeyCredentialsUpdateParameters parameters = new KeyCredentialsUpdateParameters();
    parameters.withValue(value);
    return service.updateKeyCredentials(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {

        @Override
        public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<Void> clientResponse = updateKeyCredentialsDelegate(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) KeyCredentialsUpdateParameters(com.microsoft.azure.management.graphrbac.KeyCredentialsUpdateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

KeyCredentialsUpdateParameters (com.microsoft.azure.management.graphrbac.KeyCredentialsUpdateParameters)2 ServiceResponse (com.microsoft.rest.ServiceResponse)2 ResponseBody (okhttp3.ResponseBody)2 Response (retrofit2.Response)2 Observable (rx.Observable)2