Class: RenderCFN::SecurityGroup

Inherits:
AwsObject show all
Defined in:
lib/renderCFN/securityGroup.rb

Instance Method Summary collapse

Methods inherited from AwsObject

#get, #name

Constructor Details

#initialize(arguments) ⇒ SecurityGroup

Returns a new instance of SecurityGroup.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/renderCFN/securityGroup.rb', line 5

def initialize( arguments)
  @name = "#{arguments[:name]}SecurityGroup"
  @awsObject = { 
    @name => {
      'Type' => 'AWS::EC2::SecurityGroup', 
      'Properties' => {
        'GroupDescription' => arguments[:desc],
        'VpcId' => arguments[:vpcID],
        'SecurityGroupIngress' => [ 
        ]
      }
    }
  }
end

Instance Method Details

#addPort(protocol, ip, from, to = from) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/renderCFN/securityGroup.rb', line 20

def addPort( protocol, ip, from, to=from)

  entry = { 'IpProtocol' => protocol,
          'CidrIp' => ip,
          'FromPort' => from,
          'ToPort' =>  to
        }
  @awsObject[@name]['Properties']['SecurityGroupIngress'].push( entry)
end