File Coverage

blib/lib/Cfn/Resource/AWS/IAM/Policy.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1 2     2   1258 use Moose::Util::TypeConstraints;
  2         5  
  2         40  
2              
3             coerce 'Cfn::Resource::Properties::AWS::IAM::Policy',
4             from 'HashRef',
5             via { Cfn::Resource::Properties::AWS::IAM::Policy->new( %$_ ) };
6              
7             package Cfn::Resource::AWS::IAM::Policy {
8 2     2   3977 use Moose;
  2         5  
  2         14  
9 2     2   9285 use Moose::Util::TypeConstraints qw/find_type_constraint/;
  2         7  
  2         11  
10             extends 'Cfn::Resource';
11             has Properties => (isa => 'Cfn::Resource::Properties::AWS::IAM::Policy', is => 'rw', coerce => 1, required => 1);
12              
13             sub addStatement {
14 1     1 0 4 my ($self, @args) = @_;
15 1         4 my @statements = map { find_type_constraint('Cfn::Value')->coerce($_) } @args;
  1         4  
16 1         1136 push @{ $self->Properties->PolicyDocument->Value->{Statement}->Value }, @statements;
  1         30  
17             }
18             }
19              
20             package Cfn::Resource::Properties::AWS::IAM::Policy {
21 2     2   1378 use Moose;
  2         5  
  2         11  
22 2     2   12764 use MooseX::StrictConstructor;
  2         14582  
  2         15  
23             extends 'Cfn::Resource::Properties';
24             has Groups => (isa => 'Cfn::Value::Array|Cfn::Value::Function', is => 'rw', coerce => 1);
25             has PolicyDocument => (isa => 'Cfn::Value', is => 'rw', coerce => 1, required => 1);
26             has PolicyName => (isa => 'Cfn::Value', is => 'rw', coerce => 1, required => 1);
27             has Roles => (isa => 'Cfn::Value::Array|Cfn::Value::Function', is => 'rw', coerce => 1);
28             has Users => (isa => 'Cfn::Value::Array|Cfn::Value::Function', is => 'rw', coerce => 1);
29             }
30              
31             1;