Search in sources :

Example 1 with PROVIDER_PERMISSIONS_URI

use of com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.PROVIDER_PERMISSIONS_URI in project photon-model by vmware.

the class AzureEndpointAdapterService method getPermissions.

private DeferredResult<PermissionList> getPermissions(AuthCredentialsServiceState credentials) {
    logFine(() -> String.format("Retrieving permissions for subscription with id [%s]", credentials.userLink));
    String uriStr = AdapterUriUtil.expandUriPathTemplate(PROVIDER_PERMISSIONS_URI, credentials.userLink, AUTHORIZATION_NAMESPACE);
    URI uri = UriUtils.extendUriWithQuery(UriUtils.buildUri(uriStr), QUERY_PARAM_API_VERSION, PROVIDER_REST_API_VERSION);
    Operation operation = Operation.createGet(uri);
    operation.addRequestHeader(Operation.ACCEPT_HEADER, Operation.MEDIA_TYPE_APPLICATION_JSON);
    operation.addRequestHeader(Operation.CONTENT_TYPE_HEADER, Operation.MEDIA_TYPE_APPLICATION_JSON);
    try {
        operation.addRequestHeader(Operation.AUTHORIZATION_HEADER, AUTH_HEADER_BEARER_PREFIX + getAzureConfig(credentials).getToken(AzureUtils.getAzureBaseUri()));
    } catch (IOException e) {
        return DeferredResult.failed(e);
    }
    return sendWithDeferredResult(operation, PermissionList.class);
}
Also used : Operation(com.vmware.xenon.common.Operation) IOException(java.io.IOException) PROVIDER_PERMISSIONS_URI(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.PROVIDER_PERMISSIONS_URI) URI(java.net.URI)

Aggregations

PROVIDER_PERMISSIONS_URI (com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.PROVIDER_PERMISSIONS_URI)1 Operation (com.vmware.xenon.common.Operation)1 IOException (java.io.IOException)1 URI (java.net.URI)1