Class: CfnModel
- Inherits:
-
Object
- Object
- CfnModel
- Defined in:
- lib/model/cfn_model.rb
Overview
consider a canonical form for template too… always transform optional things into more general forms.… although referencing violations becomes tricky then (a la c preprocessor)
Instance Method Summary collapse
- #bucket_policies ⇒ Object
- #dangling_ingress_or_egress_rules ⇒ Object
- #iam_users ⇒ Object
-
#initialize ⇒ CfnModel
constructor
A new instance of CfnModel.
- #parse(cfn_json_string) ⇒ Object
- #security_groups ⇒ Object
Constructor Details
#initialize ⇒ CfnModel
Returns a new instance of CfnModel.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/model/cfn_model.rb', line 11 def initialize @parser_registry = { 'AWS::EC2::SecurityGroup' => SecurityGroupParser, 'AWS::EC2::SecurityGroupIngress' => SecurityGroupXgressParser, 'AWS::EC2::SecurityGroupEgress' => SecurityGroupXgressParser, 'AWS::IAM::User' => IamUserParser, 'AWS::IAM::UserToGroupAddition' => IamUserToGroupAdditionParser, 'AWS::S3::BucketPolicy' => S3BucketPolicyParser } @dangling_ingress_or_egress_rules = [] @dangler = Object.new end |
Instance Method Details
#bucket_policies ⇒ Object
49 50 51 52 |
# File 'lib/model/cfn_model.rb', line 49 def bucket_policies bucket_policy_hash = resources_by_type('AWS::S3::BucketPolicy') bucket_policy_hash.values end |
#dangling_ingress_or_egress_rules ⇒ Object
37 38 39 40 |
# File 'lib/model/cfn_model.rb', line 37 def dangling_ingress_or_egress_rules fail 'must call parse first' unless @json_hash @dangling_ingress_or_egress_rules end |
#iam_users ⇒ Object
42 43 44 45 46 47 |
# File 'lib/model/cfn_model.rb', line 42 def iam_users fail 'must call parse first' unless @json_hash iam_users_hash = resources_by_type('AWS::IAM::User') wire_user_to_group_additions_to_users(iam_users_hash) iam_users_hash.values end |
#parse(cfn_json_string) ⇒ Object
24 25 26 27 |
# File 'lib/model/cfn_model.rb', line 24 def parse(cfn_json_string) @json_hash = JSON.load cfn_json_string self end |
#security_groups ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/model/cfn_model.rb', line 29 def security_groups fail 'must call parse first' unless @json_hash security_groups_hash = resources_by_type('AWS::EC2::SecurityGroup') wire_ingress_rules_to_security_groups(security_groups_hash) wire_egress_rules_to_security_groups(security_groups_hash) security_groups_hash.values end |