line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
2751
|
use Moose::Util::TypeConstraints; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
44
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
coerce 'Cfn::Resource::Properties::AWS::CloudFormation::CustomResource', |
4
|
|
|
|
|
|
|
from 'HashRef', |
5
|
|
|
|
|
|
|
via { Cfn::Resource::Properties::AWS::CloudFormation::CustomResource->new( %$_ ) }; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Cfn::Resource::Properties::AWS::CloudFormation::CustomResource { |
8
|
5
|
|
|
5
|
|
9301
|
use Moose; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
33
|
|
9
|
5
|
|
|
5
|
|
32940
|
use MooseX::SlurpyConstructor; |
|
5
|
|
|
|
|
116537
|
|
|
5
|
|
|
|
|
22
|
|
10
|
|
|
|
|
|
|
extends 'Cfn::Resource::Properties'; |
11
|
|
|
|
|
|
|
# ServiceToken is the only defined property in a CustomResource. The rest of it's properties |
12
|
|
|
|
|
|
|
# are free-form, so we store them in _extra (via the slurpy attribute that MooseX::SlurpyConstructor |
13
|
|
|
|
|
|
|
# provides |
14
|
|
|
|
|
|
|
has ServiceToken => (isa => 'Cfn::Value::String', is => 'rw', coerce => 1, required => 1); |
15
|
|
|
|
|
|
|
has _extra => (isa => 'Cfn::Value::Hash', is => 'ro', coerce => 1, slurpy => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
override as_hashref => sub { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
my @args = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $ret = { ServiceToken => $self->ServiceToken->as_hashref(@args) }; |
22
|
|
|
|
|
|
|
return $ret if (not defined $self->_extra); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
foreach my $att (keys %{ $self->_extra->Value }) {; |
25
|
|
|
|
|
|
|
if (defined $self->_extra->Value->{ $att }) { |
26
|
|
|
|
|
|
|
my @ret = $self->_extra->Value->{ $att }->as_hashref(@args); |
27
|
|
|
|
|
|
|
if (@ret == 1) { |
28
|
|
|
|
|
|
|
$ret->{ $att } = $ret[0]; |
29
|
|
|
|
|
|
|
} else { |
30
|
|
|
|
|
|
|
die "A property returned an odd number of values"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
return $ret; |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package Cfn::Resource::AWS::CloudFormation::CustomResource { |
40
|
5
|
|
|
5
|
|
178177
|
use Moose; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
31
|
|
41
|
|
|
|
|
|
|
extends 'Cfn::Resource'; |
42
|
|
|
|
|
|
|
has Properties => (isa => 'Cfn::Resource::Properties::AWS::CloudFormation::CustomResource', is => 'rw', coerce => 1, required => 1); |
43
|
|
|
|
|
|
|
has Version => (isa => 'Cfn::Value', is => 'rw', coerce => 1); |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
2
|
0
|
22
|
sub AttributeList { undef } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub supported_regions { |
48
|
1
|
|
|
1
|
0
|
1142
|
require Cfn::Resource::AWS::IAM::User; |
49
|
1
|
|
|
|
|
10
|
Cfn::Resource::AWS::IAM::User->supported_regions; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# CustomResources don't have a defined set of attributes for GetAtt |
53
|
|
|
|
|
|
|
override hasAttribute => sub { |
54
|
|
|
|
|
|
|
my ($self, $attribute) = @_; |
55
|
|
|
|
|
|
|
return 1; |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
around as_hashref => sub { |
59
|
|
|
|
|
|
|
my ($orig, $self, @rest) = @_; |
60
|
|
|
|
|
|
|
my $cfn = $rest[0]; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $hash = $self->$orig(@rest); |
63
|
|
|
|
|
|
|
$hash->{ Type } = 'AWS::CloudFormation::CustomResource' if ($cfn->cfn_options->custom_resource_rename); |
64
|
|
|
|
|
|
|
$hash->{ Version } = $self->Version->as_hashref if (defined $self->Version); |
65
|
|
|
|
|
|
|
return $hash; |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |