| 1 | package CloudDeploy::CommandLine::ListDeployments { | ||
| 2 | use MooseX::App; | ||
| 3 | use CloudDeploy::DeploymentCollection; | ||
| 4 | |||
| 5 | option extended => ( | ||
| 6 | is => 'ro', | ||
| 7 | isa => 'Bool', | ||
| 8 | documentation => 'If specified, will list account, status and type of deploy', | ||
| 9 | default => 0, | ||
| 10 | ); | ||
| 11 | |||
| 12 | sub run { | ||
| 13 | my ($self) = @_; | ||
| 14 | |||
| 15 | my $deployments = CloudDeploy::DeploymentCollection->new(account => $ENV{'CPSD_AWS_ACCOUNT'}); | ||
| 16 | my @list = $deployments->customer_deployments; | ||
| 17 | |||
| 18 | foreach my $deploy_name (@list) { | ||
| 19 | if ($self->extended) { | ||
| 20 | my $deploy = $deployments->get_deployment($deploy_name); | ||
| 21 | printf "%s\t%s\t%s\t%s\n", $deploy->name, $deploy->account, $deploy->status, $deploy->type | ||
| 22 | } else { | ||
| 23 | printf "%s\n", $deploy_name; | ||
| 24 | } | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; | ||
| 30 |