use of software.amazon.awssdk.services.sts.STSClient in project aws-doc-sdk-examples by awsdocs.
the class GetAccessKeyInfo method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <accessKeyId> \n\n" + "Where:\n" + " accessKeyId - the identifier of an access key (for example, XXXXX3JWY3BXW7POHDLA). \n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String accessKeyId = args[0];
Region region = Region.US_EAST_1;
StsClient stsClient = StsClient.builder().region(region).build();
getKeyInfo(stsClient, accessKeyId);
stsClient.close();
}
use of software.amazon.awssdk.services.sts.STSClient in project aws-doc-sdk-examples by awsdocs.
the class GetCallerIdentity method main.
public static void main(String[] args) {
Region region = Region.US_EAST_1;
StsClient stsClient = StsClient.builder().region(region).build();
getCallerId(stsClient);
stsClient.close();
}
use of software.amazon.awssdk.services.sts.STSClient in project iep by Netflix.
the class AwsClientFactory method createAssumeRoleProvider.
private AwsCredentialsProvider createAssumeRoleProvider(Config cfg, AwsCredentialsProvider p) {
final String arn = cfg.getString("role-arn");
final String name = cfg.getString("role-session-name");
final STSClient stsClient = STSClient.builder().credentialsProvider(p).region(Region.of(region)).build();
final AssumeRoleRequest request = AssumeRoleRequest.builder().roleArn(arn).roleSessionName(name).build();
return StsAssumeRoleCredentialsProvider.builder().stsClient(stsClient).refreshRequest(request).build();
}
Aggregations