in local-container-endpoints/handlers/credentials_handler.go [181:201]
func (service *CredentialService) getRoleCredentialsFromArn(roleArn, roleName string) (*CredentialResponse, error) {
logrus.Debugf("Requesting credentials for role with ARN %s", roleArn)
creds, err := service.stsClient.AssumeRole(&sts.AssumeRoleInput{
RoleArn: aws.String(roleArn),
DurationSeconds: aws.Int64(temporaryCredentialsDurationInS),
RoleSessionName: aws.String(utils.Truncate(fmt.Sprintf("ecs-local-%s", roleName), roleSessionNameLength)),
})
if err != nil {
return nil, err
}
return &CredentialResponse{
AccessKeyID: aws.StringValue(creds.Credentials.AccessKeyId),
SecretAccessKey: aws.StringValue(creds.Credentials.SecretAccessKey),
RoleArn: roleArn,
Token: aws.StringValue(creds.Credentials.SessionToken),
Expiration: creds.Credentials.Expiration.Format(CredentialExpirationTimeFormat),
}, nil
}