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);
}
Aggregations