Search in sources :

Example 1 with DatabaseAccountPatchParameters

use of com.microsoft.azure.management.documentdb.DatabaseAccountPatchParameters in project azure-sdk-for-java by Azure.

the class DatabaseAccountsInner method patchWithServiceResponseAsync.

/**
     * Patches the properties of an existing Azure DocumentDB database account.
     *
     * @param resourceGroupName Name of an Azure resource group.
     * @param accountName DocumentDB database account name.
     * @param tags the Map<String, String> value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
public Observable<ServiceResponse<DatabaseAccountInner>> patchWithServiceResponseAsync(String resourceGroupName, String accountName, Map<String, String> tags) {
    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 (accountName == null) {
        throw new IllegalArgumentException("Parameter accountName 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 (tags == null) {
        throw new IllegalArgumentException("Parameter tags is required and cannot be null.");
    }
    Validator.validate(tags);
    DatabaseAccountPatchParameters updateParameters = new DatabaseAccountPatchParameters();
    updateParameters.withTags(tags);
    Observable<Response<ResponseBody>> observable = service.patch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), updateParameters, this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<DatabaseAccountInner>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) DatabaseAccountPatchParameters(com.microsoft.azure.management.documentdb.DatabaseAccountPatchParameters)

Example 2 with DatabaseAccountPatchParameters

use of com.microsoft.azure.management.documentdb.DatabaseAccountPatchParameters in project azure-sdk-for-java by Azure.

the class DatabaseAccountsInner method beginPatchWithServiceResponseAsync.

/**
     * Patches the properties of an existing Azure DocumentDB database account.
     *
     * @param resourceGroupName Name of an Azure resource group.
     * @param accountName DocumentDB database account name.
     * @param tags the Map&lt;String, String&gt; value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the DatabaseAccountInner object
     */
public Observable<ServiceResponse<DatabaseAccountInner>> beginPatchWithServiceResponseAsync(String resourceGroupName, String accountName, Map<String, String> tags) {
    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 (accountName == null) {
        throw new IllegalArgumentException("Parameter accountName 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 (tags == null) {
        throw new IllegalArgumentException("Parameter tags is required and cannot be null.");
    }
    Validator.validate(tags);
    DatabaseAccountPatchParameters updateParameters = new DatabaseAccountPatchParameters();
    updateParameters.withTags(tags);
    return service.beginPatch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), updateParameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DatabaseAccountInner>>>() {

        @Override
        public Observable<ServiceResponse<DatabaseAccountInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<DatabaseAccountInner> clientResponse = beginPatchDelegate(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) DatabaseAccountPatchParameters(com.microsoft.azure.management.documentdb.DatabaseAccountPatchParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

DatabaseAccountPatchParameters (com.microsoft.azure.management.documentdb.DatabaseAccountPatchParameters)2 ServiceResponse (com.microsoft.rest.ServiceResponse)2 Response (retrofit2.Response)2 TypeToken (com.google.common.reflect.TypeToken)1 ResponseBody (okhttp3.ResponseBody)1 Observable (rx.Observable)1