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

View File

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