Class: DrawCloud::NetworkAcl
- Inherits:
-
Base
- Object
- Base
- DrawCloud::NetworkAcl
show all
- Defined in:
- lib/draw_cloud/network_acl.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#as_groups, #as_launch_configurations, #deletion_policy, #depends_on, #ec2_instances, #elastic_ips, #gateways, #iam_access_keys, #iam_policies, #iam_users, #mappings, #metadata, #network_acls, #network_interfaces, #outputs, #parameters, #parent, #rdses, #resources, #route_tables, #security_groups, #sns_topics, #subnets, #vpcs, #wait_handles
Instance Method Summary
collapse
-
#allow_in(protocol, cidr = :any, ports_or_types = []) ⇒ Object
-
#allow_out(protocol, cidr = :any, ports_or_types = []) ⇒ Object
-
#consumes(service) ⇒ Object
-
#deny_in(protocol, cidr = :any, ports_or_types = []) ⇒ Object
-
#deny_out(protocol, cidr = :any, ports_or_types = []) ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ NetworkAcl
constructor
A new instance of NetworkAcl.
-
#load_into_config(config) ⇒ Object
-
#network_acl ⇒ Object
-
#provides(service) ⇒ Object
-
#resource_name ⇒ Object
-
#to_h ⇒ Object
Methods inherited from Base
#[], #accessor, #add_standard_properties, #create_as_group, #create_as_launch_configuration, #create_ec2_instance, #create_ec2_instance_template, #create_elastic_ip, #create_iam_access_key, #create_iam_policy, #create_iam_user, #create_mapping, #create_network_acl, #create_network_interface, #create_output, #create_parameter, #create_rds, #create_route_table, #create_security_group, #create_service, #create_sns_topic, #create_subnet, #create_vpc, #create_wait_handle, #ref
Methods included from Locations
#arn_s3
Methods included from Utilities
#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name
Constructor Details
#initialize(name, options = {}, &block) ⇒ NetworkAcl
Returns a new instance of NetworkAcl.
22
23
24
25
26
|
# File 'lib/draw_cloud/network_acl.rb', line 22
def initialize(name, options={}, &block)
@name = name
@entries = []
super(options, &block)
end
|
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries.
21
22
23
|
# File 'lib/draw_cloud/network_acl.rb', line 21
def entries
@entries
end
|
#name ⇒ Object
Returns the value of attribute name.
21
22
23
|
# File 'lib/draw_cloud/network_acl.rb', line 21
def name
@name
end
|
Instance Method Details
#allow_in(protocol, cidr = :any, ports_or_types = []) ⇒ Object
32
33
34
|
# File 'lib/draw_cloud/network_acl.rb', line 32
def allow_in(protocol, cidr=:any, ports_or_types=[])
add_entry :allow, protocol, :ingress, cidr, ports_or_types
end
|
#allow_out(protocol, cidr = :any, ports_or_types = []) ⇒ Object
36
37
38
|
# File 'lib/draw_cloud/network_acl.rb', line 36
def allow_out(protocol, cidr=:any, ports_or_types=[])
add_entry :allow, protocol, :egress, cidr, ports_or_types
end
|
#consumes(service) ⇒ Object
51
52
|
# File 'lib/draw_cloud/network_acl.rb', line 51
def consumes(service)
end
|
#deny_in(protocol, cidr = :any, ports_or_types = []) ⇒ Object
40
41
42
|
# File 'lib/draw_cloud/network_acl.rb', line 40
def deny_in(protocol, cidr=:any, ports_or_types=[])
add_entry :deny, protocol, :ingress, cidr, ports_or_types
end
|
#deny_out(protocol, cidr = :any, ports_or_types = []) ⇒ Object
44
45
46
|
# File 'lib/draw_cloud/network_acl.rb', line 44
def deny_out(protocol, cidr=:any, ports_or_types=[])
add_entry :deny, protocol, :egress, cidr, ports_or_types
end
|
#load_into_config(config) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/draw_cloud/network_acl.rb', line 60
def load_into_config(config)
config.cf_add_resource resource_name, self
ingress_index = 1
egress_index = 1
entries.each do |e|
if e.outgoing?
e.index = egress_index * 10
egress_index += 1
else
e.index = ingress_index * 10
ingress_index += 1
end
e.load_into_config(config)
end
super(config)
end
|
#network_acl ⇒ Object
28
29
30
|
# File 'lib/draw_cloud/network_acl.rb', line 28
def network_acl
self
end
|
#provides(service) ⇒ Object
48
49
|
# File 'lib/draw_cloud/network_acl.rb', line 48
def provides(service)
end
|
#resource_name ⇒ Object
78
79
80
|
# File 'lib/draw_cloud/network_acl.rb', line 78
def resource_name
resource_style(name) + "NetworkACL"
end
|
#to_h ⇒ Object
82
83
84
85
86
87
88
89
|
# File 'lib/draw_cloud/network_acl.rb', line 82
def to_h
h = {
"Type" => "AWS::EC2::NetworkAcl",
"Properties" => {}
}
h["Properties"]["VpcId"] = DrawCloud.ref(vpc) if vpc
add_standard_properties(h)
end
|