Search in sources :

Example 1 with ApiClient

use of org.broadinstitute.dsde.workbench.client.sam.ApiClient in project terra-workspace-manager by DataBiosphere.

the class SamClientUtils method buildSamClient.

private static ApiClient buildSamClient(@Nullable AccessToken accessToken, ServerSpecification server) {
    if (Strings.isNullOrEmpty(server.samUri)) {
        throw new IllegalArgumentException("Sam URI cannot be empty");
    }
    // build the client object
    ApiClient apiClient = new ApiClient();
    apiClient.setBasePath(server.samUri);
    if (accessToken != null) {
        apiClient.setAccessToken(accessToken.getTokenValue());
    }
    return apiClient;
}
Also used : ApiClient(org.broadinstitute.dsde.workbench.client.sam.ApiClient)

Example 2 with ApiClient

use of org.broadinstitute.dsde.workbench.client.sam.ApiClient in project terra-workspace-manager by DataBiosphere.

the class SamService method getApiClient.

private ApiClient getApiClient(String accessToken) {
    // OkHttpClient objects manage their own thread pools, so it's much more performant to share one
    // across requests.
    ApiClient apiClient = new ApiClient().setHttpClient(commonHttpClient).setBasePath(samConfig.getBasePath());
    apiClient.setAccessToken(accessToken);
    return apiClient;
}
Also used : ApiClient(org.broadinstitute.dsde.workbench.client.sam.ApiClient)

Example 3 with ApiClient

use of org.broadinstitute.dsde.workbench.client.sam.ApiClient in project terra-workspace-manager by DataBiosphere.

the class PrivateResourceCleanupServiceTest method buildGroupApi.

private GroupApi buildGroupApi(AuthenticatedUserRequest userRequest) {
    // Each ApiClient manages its own threadpool. If we start using this method from more than a
    // handful of tests, we should refactor this to share the ApiClient object across tests.
    ApiClient apiClient = new ApiClient().setBasePath(samConfiguration.getBasePath());
    apiClient.setAccessToken(userRequest.getRequiredToken());
    return new GroupApi(apiClient);
}
Also used : GroupApi(org.broadinstitute.dsde.workbench.client.sam.api.GroupApi) ApiClient(org.broadinstitute.dsde.workbench.client.sam.ApiClient)

Example 4 with ApiClient

use of org.broadinstitute.dsde.workbench.client.sam.ApiClient in project jade-data-repo by DataBiosphere.

the class SamIam method getApiClient.

private ApiClient getApiClient(String accessToken) {
    ApiClient apiClient = new ApiClient();
    apiClient.setAccessToken(accessToken);
    // only logs an error in sam
    apiClient.setUserAgent("OpenAPI-Generator/1.0.0 java");
    return apiClient.setBasePath(samConfig.getBasePath());
}
Also used : ApiClient(org.broadinstitute.dsde.workbench.client.sam.ApiClient)

Aggregations

ApiClient (org.broadinstitute.dsde.workbench.client.sam.ApiClient)4 GroupApi (org.broadinstitute.dsde.workbench.client.sam.api.GroupApi)1