Search in sources :

Example 21 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class GroupsInner method addMemberWithServiceResponseAsync.

/**
     * Add a member to a group.
     *
     * @param groupObjectId The object ID of the group to which to add the member.
     * @param url A member object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the member (user, application, servicePrincipal, group) to be added.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
public Observable<ServiceResponse<Void>> addMemberWithServiceResponseAsync(String groupObjectId, String url) {
    if (groupObjectId == null) {
        throw new IllegalArgumentException("Parameter groupObjectId 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 (url == null) {
        throw new IllegalArgumentException("Parameter url is required and cannot be null.");
    }
    GroupAddMemberParameters parameters = new GroupAddMemberParameters();
    parameters.withUrl(url);
    return service.addMember(groupObjectId, 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 = addMemberDelegate(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) GroupAddMemberParameters(com.microsoft.azure.management.graphrbac.GroupAddMemberParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 22 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class UsersInner method getMemberGroupsWithServiceResponseAsync.

/**
     * Gets a collection that contains the object IDs of the groups of which the user is a member.
     *
     * @param objectId The object ID of the user for which to get group membership.
     * @param securityEnabledOnly If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the List&lt;String&gt; object
     */
public Observable<ServiceResponse<List<String>>> getMemberGroupsWithServiceResponseAsync(String objectId, boolean securityEnabledOnly) {
    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.");
    }
    UserGetMemberGroupsParameters parameters = new UserGetMemberGroupsParameters();
    parameters.withSecurityEnabledOnly(securityEnabledOnly);
    return service.getMemberGroups(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<String>>>>() {

        @Override
        public Observable<ServiceResponse<List<String>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl1<String>> result = getMemberGroupsDelegate(response);
                ServiceResponse<List<String>> clientResponse = new ServiceResponse<List<String>>(result.body().items(), result.response());
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : UserGetMemberGroupsParameters(com.microsoft.azure.management.graphrbac.UserGetMemberGroupsParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) PagedList(com.microsoft.azure.PagedList) List(java.util.List)

Example 23 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class RoleAssignmentsInner method createWithServiceResponseAsync.

/**
     * Creates a role assignment.
     *
     * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.
     * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the RoleAssignmentInner object
     */
public Observable<ServiceResponse<RoleAssignmentInner>> createWithServiceResponseAsync(String scope, String roleAssignmentName) {
    if (scope == null) {
        throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
    }
    if (roleAssignmentName == null) {
        throw new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    final RoleAssignmentPropertiesInner properties = null;
    RoleAssignmentCreateParameters parameters = new RoleAssignmentCreateParameters();
    parameters.withProperties(null);
    return service.create(scope, roleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RoleAssignmentInner>>>() {

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

Example 24 with ServiceResponse

use of com.microsoft.rest.ServiceResponse 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&lt;String, String&gt; 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 25 with ServiceResponse

use of com.microsoft.rest.ServiceResponse 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

ServiceResponse (com.microsoft.rest.ServiceResponse)114 Response (retrofit2.Response)114 ResponseBody (okhttp3.ResponseBody)92 Observable (rx.Observable)92 TypeToken (com.google.common.reflect.TypeToken)22 VirtualMachineScaleSetVMInstanceIDs (com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs)16 KeyBundle (com.microsoft.azure.keyvault.models.KeyBundle)7 CertificateBundle (com.microsoft.azure.keyvault.models.CertificateBundle)6 RegenerateKeysParameters (com.microsoft.azure.management.servicebus.RegenerateKeysParameters)6 CertificateAttributes (com.microsoft.azure.keyvault.models.CertificateAttributes)4 IssuerBundle (com.microsoft.azure.keyvault.models.IssuerBundle)4 KeyOperationResult (com.microsoft.azure.keyvault.models.KeyOperationResult)4 SecretBundle (com.microsoft.azure.keyvault.models.SecretBundle)4 CsmPublishingProfileOptions (com.microsoft.azure.management.appservice.CsmPublishingProfileOptions)4 FailoverPolicies (com.microsoft.azure.management.documentdb.FailoverPolicies)4 RoleAssignmentCreateParameters (com.microsoft.azure.management.graphrbac.RoleAssignmentCreateParameters)4 InputStream (java.io.InputStream)4 Page (com.microsoft.azure.Page)3 CertificateOperation (com.microsoft.azure.keyvault.models.CertificateOperation)3 CertificatePolicy (com.microsoft.azure.keyvault.models.CertificatePolicy)3