Search in sources :

Example 1 with GetAuthorizationTokenRequest

use of software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest in project aws-greengrass-provisioner by awslabs.

the class OfficialGreengrassImageDockerClientProvider method getAuthorizationData.

@Override
public AuthorizationData getAuthorizationData() {
    Optional<List<String>> optionalRegistryIds = Optional.of(Arrays.asList(ggConstants.getOfficialGreengrassAccountId()));
    GetAuthorizationTokenRequest.Builder getAuthorizationTokenRequestBuilder = GetAuthorizationTokenRequest.builder();
    optionalRegistryIds.ifPresent(getAuthorizationTokenRequestBuilder::registryIds);
    GetAuthorizationTokenRequest getAuthorizationTokenRequest = getAuthorizationTokenRequestBuilder.build();
    GetAuthorizationTokenResponse getAuthorizationTokenResponse = getEcrClient().getAuthorizationToken(getAuthorizationTokenRequest);
    List<AuthorizationData> authorizationDataList = getAuthorizationTokenResponse.authorizationData();
    return authorizationDataList.get(0);
}
Also used : GetAuthorizationTokenResponse(software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenResponse) GetAuthorizationTokenRequest(software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest) AuthorizationData(software.amazon.awssdk.services.ecr.model.AuthorizationData) List(java.util.List)

Example 2 with GetAuthorizationTokenRequest

use of software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest in project aws-greengrass-provisioner by awslabs.

the class EcrDockerClientProvider method getAuthorizationData.

@Override
public AuthorizationData getAuthorizationData() {
    GetAuthorizationTokenRequest getAuthorizationTokenRequest = GetAuthorizationTokenRequest.builder().build();
    GetAuthorizationTokenResponse getAuthorizationTokenResponse = ecrClient.getAuthorizationToken(getAuthorizationTokenRequest);
    List<AuthorizationData> authorizationDataList = getAuthorizationTokenResponse.authorizationData();
    return authorizationDataList.get(0);
}
Also used : GetAuthorizationTokenResponse(software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenResponse) GetAuthorizationTokenRequest(software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest) AuthorizationData(software.amazon.awssdk.services.ecr.model.AuthorizationData)

Aggregations

AuthorizationData (software.amazon.awssdk.services.ecr.model.AuthorizationData)2 GetAuthorizationTokenRequest (software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest)2 GetAuthorizationTokenResponse (software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenResponse)2 List (java.util.List)1