This commit is contained in:
garnier-quentin 2019-10-11 08:55:22 +02:00
parent d91983c974
commit 3b435ca5e7
2 changed files with 30 additions and 22 deletions

View File

@ -41,20 +41,21 @@ sub new {
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
"aws-secret-key:s" => { name => 'aws_secret_key' },
"aws-access-key:s" => { name => 'aws_access_key' },
"endpoint-url:s" => { name => 'endpoint_url' },
"region:s" => { name => 'region' },
"timeframe:s" => { name => 'timeframe' },
"period:s" => { name => 'period' },
"statistic:s@" => { name => 'statistic' },
"zeroed" => { name => 'zeroed' },
"timeout:s" => { name => 'timeout', default => 50 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'aws' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '' },
"proxyurl:s" => { name => 'proxyurl' },
'aws-secret-key:s' => { name => 'aws_secret_key' },
'aws-access-key:s' => { name => 'aws_access_key' },
'aws-profile:s' => { name => 'aws_profile' },
'endpoint-url:s' => { name => 'endpoint_url' },
'region:s' => { name => 'region' },
'timeframe:s' => { name => 'timeframe' },
'period:s' => { name => 'period' },
'statistic:s@' => { name => 'statistic' },
'zeroed' => { name => 'zeroed' },
'timeout:s' => { name => 'timeout', default => 50 },
'sudo' => { name => 'sudo' },
'command:s' => { name => 'command', default => 'aws' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '' },
'proxyurl:s' => { name => 'proxyurl' },
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'AWSCLI OPTIONS', once => 1);
@ -101,6 +102,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_profile}) && $self->{option_results}->{aws_profile} ne '') {
$ENV{AWS_PROFILE} = $self->{option_results}->{aws_profile};
}
if (!defined($self->{option_results}->{region}) || $self->{option_results}->{region} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --region option.");
@ -485,6 +489,10 @@ Set AWS secret key.
Set AWS access key.
=item B<--aws-profile>
Set AWS profile.
=item B<--endpoint-url>
Override AWS service endpoint URL if necessary.

View File

@ -42,14 +42,14 @@ sub new {
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
"aws-secret-key:s" => { name => 'aws_secret_key' },
"aws-access-key:s" => { name => 'aws_access_key' },
"region:s" => { name => 'region' },
"timeframe:s" => { name => 'timeframe' },
"period:s" => { name => 'period' },
"statistic:s@" => { name => 'statistic' },
"zeroed" => { name => 'zeroed' },
"proxyurl:s" => { name => 'proxyurl' },
'aws-secret-key:s' => { name => 'aws_secret_key' },
'aws-access-key:s' => { name => 'aws_access_key' },
'region:s' => { name => 'region' },
'timeframe:s' => { name => 'timeframe' },
'period:s' => { name => 'period' },
'statistic:s@' => { name => 'statistic' },
'zeroed' => { name => 'zeroed' },
'proxyurl:s' => { name => 'proxyurl' },
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'PAWS OPTIONS', once => 1);