Search in sources :

Example 21 with Query

use of retrofit2.http.Query in project azure-sdk-for-java by Azure.

the class NetworkWatchersInner method beginGetTroubleshootingResultWithServiceResponseAsync.

/**
     * Get the last completed troubleshooting result on a specified resource.
     *
     * @param resourceGroupName The name of the resource group.
     * @param networkWatcherName The name of the network watcher resource.
     * @param targetResourceId The target resource ID to query the troubleshooting result.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the TroubleshootingResultInner object
     */
public Observable<ServiceResponse<TroubleshootingResultInner>> beginGetTroubleshootingResultWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (networkWatcherName == null) {
        throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (targetResourceId == null) {
        throw new IllegalArgumentException("Parameter targetResourceId is required and cannot be null.");
    }
    final String apiVersion = "2016-12-01";
    QueryTroubleshootingParameters parameters = new QueryTroubleshootingParameters();
    parameters.withTargetResourceId(targetResourceId);
    return service.beginGetTroubleshootingResult(resourceGroupName, networkWatcherName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<TroubleshootingResultInner>>>() {

        @Override
        public Observable<ServiceResponse<TroubleshootingResultInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<TroubleshootingResultInner> clientResponse = beginGetTroubleshootingResultDelegate(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) Observable(rx.Observable) QueryTroubleshootingParameters(com.microsoft.azure.management.network.QueryTroubleshootingParameters) ResponseBody(okhttp3.ResponseBody)

Example 22 with Query

use of retrofit2.http.Query in project azure-sdk-for-java by Azure.

the class NetworkWatchersInner method getTroubleshootingResultWithServiceResponseAsync.

/**
     * Get the last completed troubleshooting result on a specified resource.
     *
     * @param resourceGroupName The name of the resource group.
     * @param networkWatcherName The name of the network watcher resource.
     * @param targetResourceId The target resource ID to query the troubleshooting result.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
public Observable<ServiceResponse<TroubleshootingResultInner>> getTroubleshootingResultWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (networkWatcherName == null) {
        throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (targetResourceId == null) {
        throw new IllegalArgumentException("Parameter targetResourceId is required and cannot be null.");
    }
    final String apiVersion = "2016-12-01";
    QueryTroubleshootingParameters parameters = new QueryTroubleshootingParameters();
    parameters.withTargetResourceId(targetResourceId);
    Observable<Response<ResponseBody>> observable = service.getTroubleshootingResult(resourceGroupName, networkWatcherName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<TroubleshootingResultInner>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) QueryTroubleshootingParameters(com.microsoft.azure.management.network.QueryTroubleshootingParameters)

Aggregations

ResponseBody (okhttp3.ResponseBody)18 Request (okhttp3.Request)16 Test (org.junit.Test)16 Query (retrofit2.http.Query)14 Path (retrofit2.http.Path)4 List (java.util.List)3 Retrofit (retrofit2.Retrofit)3 QueryTroubleshootingParameters (com.microsoft.azure.management.network.QueryTroubleshootingParameters)2 ServiceResponse (com.microsoft.rest.ServiceResponse)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Response (retrofit2.Response)2 FieldMap (retrofit2.http.FieldMap)2 HeaderMap (retrofit2.http.HeaderMap)2 PartMap (retrofit2.http.PartMap)2 QueryMap (retrofit2.http.QueryMap)2 Observable (rx.Observable)2 ContentUris (android.content.ContentUris)1 Context (android.content.Context)1