use of software.amazon.awssdk.services.sts.model.GetSessionTokenRequest in project aws-doc-sdk-examples by awsdocs.
the class GetSessionToken method getToken.
// snippet-start:[sts.java2.get_session_token.main]
public static void getToken(StsClient stsClient) {
try {
GetSessionTokenRequest tokenRequest = GetSessionTokenRequest.builder().durationSeconds(1500).build();
GetSessionTokenResponse tokenResponse = stsClient.getSessionToken(tokenRequest);
System.out.println("The token value is " + tokenResponse.credentials().sessionToken());
} catch (StsException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations