ACM.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 56 CC 2 SCAR 10.0
CC
2
Cov
0%
describe_certificate
6.0
list_certificates
2.0
request_certificate
2.0
CRAP 2.7
1 package App::ACM;
2  
3 use strict;
4 use warnings;
5  
6 use Role::Tiny::With;
7 use JSON;
8 use File::Temp qw(tempfile);
9 use Data::Dumper;
10  
11 with 'App::AWS';
12  
13 use parent 'App::Command';
14  
15 __PACKAGE__->follow_best_practice();
16 __PACKAGE__->mk_accessors(qw(domain validation_method profile region));
17  
18 ########################################################################
19 sub list_certificates {
20 ########################################################################
21 my ($self) = @_;
22  
23 return $self->command( 'list-certificates' => [ '--query' => 'CertificateSummaryList', ] );
24 }
25  
26 ########################################################################
27 sub describe_certificate {
28 ########################################################################
29 my ( $self, $cert_arn, $query ) = @_;
30  
31 return $self->command(
32 'describe-certificate' => [
33 '--certificate-arn' => $cert_arn,
34 $query ? ( '--query' => $query ) : (),
35 ]
36 );
37 }
38  
39 ########################################################################
40 # returns the certificate arn
41 ########################################################################
42 sub request_certificate {
43 ########################################################################
44 my ($self) = @_;
45  
46 my $domain = $self->get_domain or die 'Domain not set';
47 my $method = $self->get_validation_method // 'DNS';
48  
49 return $self->command(
50 'request-certificate' => [
51 '--domain-name' => $domain,
52 '--validation-method' => $method,
53 '--output' => 'text',
54 '--query' => 'CertificateArn',
55 ]
56 );
57 }
58  
59 1;