add aws_session_token

This commit is contained in:
garnier-quentin 2020-06-02 14:21:46 +02:00
parent b4e98dca33
commit ae9f0dd0bb
2 changed files with 18 additions and 2 deletions

View File

@ -43,6 +43,7 @@ sub new {
$options{options}->add_options(arguments => {
'aws-secret-key:s' => { name => 'aws_secret_key' },
'aws-access-key:s' => { name => 'aws_access_key' },
'aws-session-token:s' => { name => 'aws_session_token' },
'aws-profile:s' => { name => 'aws_profile' },
'endpoint-url:s' => { name => 'endpoint_url' },
'region:s' => { name => 'region' },
@ -55,7 +56,7 @@ sub new {
'command:s' => { name => 'command', default => 'aws' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '' },
'proxyurl:s' => { name => 'proxyurl' },
'proxyurl:s' => { name => 'proxyurl' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'AWSCLI OPTIONS', once => 1);
@ -108,6 +109,9 @@ sub check_options {
if (defined($self->{option_results}->{aws_access_key}) && $self->{option_results}->{aws_access_key} ne '') {
$ENV{AWS_ACCESS_KEY_ID} = $self->{option_results}->{aws_access_key};
}
if (defined($self->{option_results}->{aws_session_token}) && $self->{option_results}->{aws_session_token} ne '') {
$ENV{AWS_SESSION_TOKEN} = $self->{option_results}->{aws_session_token};
}
if (defined($self->{option_results}->{aws_profile}) && $self->{option_results}->{aws_profile} ne '') {
$ENV{AWS_PROFILE} = $self->{option_results}->{aws_profile};
}
@ -674,6 +678,10 @@ Set AWS secret key.
Set AWS access key.
=item B<--aws-session-token>
Set AWS session token.
=item B<--aws-profile>
Set AWS profile.

View File

@ -44,12 +44,13 @@ sub new {
$options{options}->add_options(arguments => {
'aws-secret-key:s' => { name => 'aws_secret_key' },
'aws-access-key:s' => { name => 'aws_access_key' },
'aws-session-token:s' => { name => 'aws_session_token' },
'region:s' => { name => 'region' },
'timeframe:s' => { name => 'timeframe' },
'period:s' => { name => 'period' },
'statistic:s@' => { name => 'statistic' },
'zeroed' => { name => 'zeroed' },
'proxyurl:s' => { name => 'proxyurl' },
'proxyurl:s' => { name => 'proxyurl' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'PAWS OPTIONS', once => 1);
@ -102,6 +103,9 @@ sub check_options {
if (defined($self->{option_results}->{aws_access_key}) && $self->{option_results}->{aws_access_key} ne '') {
$ENV{AWS_ACCESS_KEY} = $self->{option_results}->{aws_access_key};
}
if (defined($self->{option_results}->{aws_session_token}) && $self->{option_results}->{aws_session_token} ne '') {
$ENV{AWS_SESSION_TOKEN} = $self->{option_results}->{aws_session_token};
}
if (!defined($self->{option_results}->{region}) || $self->{option_results}->{region} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --region option.");
@ -581,6 +585,10 @@ Set AWS secret key.
Set AWS access key.
=item B<--aws-session-token>
Set AWS session token.
=item B<--region>
Set the region name (Required).