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 4     4   2497 use Moose::Util::TypeConstraints;
  4         13  
  4         48  
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 4     4   9169 use Moose;
  4         12  
  4         31  
9 4     4   24425 use Moose::Util::TypeConstraints qw/find_type_constraint/;
  4         11  
  4         25  
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         3 my @statements = map { find_type_constraint('Cfn::Value')->coerce($_) } @args;
  1         5  
16 1         1353 push @{ $self->Properties->PolicyDocument->Value->{Statement}->Value }, @statements;
  1         36  
17             }
18             }
19              
20             package Cfn::Resource::Properties::AWS::IAM::Policy {
21 4     4   2475 use Moose;
  4         13  
  4         20  
22 4     4   27201 use MooseX::StrictConstructor;
  4         17417  
  4         29  
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;