Search in sources :

Example 76 with Response

use of org.wicketstuff.select2.Response 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 77 with Response

use of org.wicketstuff.select2.Response in project azure-sdk-for-java by Azure.

the class DatabaseAccountsInner method failoverPriorityChangeWithServiceResponseAsync.

/**
     * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
     *
     * @param resourceGroupName Name of an Azure resource group.
     * @param accountName DocumentDB database account name.
     * @param failoverPolicies List of failover policies.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
public Observable<ServiceResponse<Void>> failoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List<FailoverPolicyInner> failoverPolicies) {
    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.");
    }
    Validator.validate(failoverPolicies);
    FailoverPolicies failoverParameters = new FailoverPolicies();
    failoverParameters.withFailoverPolicies(failoverPolicies);
    Observable<Response<ResponseBody>> observable = service.failoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), failoverParameters, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) FailoverPolicies(com.microsoft.azure.management.documentdb.FailoverPolicies)

Example 78 with Response

use of org.wicketstuff.select2.Response 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 79 with Response

use of org.wicketstuff.select2.Response 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 80 with Response

use of org.wicketstuff.select2.Response 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)

Aggregations

Response (okhttp3.Response)1402 Request (okhttp3.Request)993 IOException (java.io.IOException)526 Test (org.junit.Test)418 Response (retrofit2.Response)337 OkHttpClient (okhttp3.OkHttpClient)275 Call (okhttp3.Call)274 ResponseBody (okhttp3.ResponseBody)237 ServiceResponse (com.microsoft.rest.ServiceResponse)179 MockResponse (okhttp3.mockwebserver.MockResponse)148 RequestBody (okhttp3.RequestBody)142 Callback (okhttp3.Callback)123 Observable (rx.Observable)114 List (java.util.List)111 HttpUrl (okhttp3.HttpUrl)86 JSONObject (org.json.JSONObject)85 ANResponse (com.androidnetworking.common.ANResponse)84 ArrayList (java.util.ArrayList)84 AtomicReference (java.util.concurrent.atomic.AtomicReference)79 ANError (com.androidnetworking.error.ANError)77