Search in sources :

Example 1 with UserGetMemberGroupsParameters

use of com.microsoft.azure.management.graphrbac.UserGetMemberGroupsParameters 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<String> 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)

Aggregations

PagedList (com.microsoft.azure.PagedList)1 UserGetMemberGroupsParameters (com.microsoft.azure.management.graphrbac.UserGetMemberGroupsParameters)1 ServiceResponse (com.microsoft.rest.ServiceResponse)1 List (java.util.List)1 ResponseBody (okhttp3.ResponseBody)1 Response (retrofit2.Response)1 Observable (rx.Observable)1