cf_factory 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/bin/cf_factory +9 -9
  2. data/examples/base_vpc.rb +40 -40
  3. data/examples/cloudfront_private.rb +23 -23
  4. data/examples/cloudinit_script_for_one_instance.rb +77 -77
  5. data/examples/cloudinit_script_with_autoscaling.rb +85 -85
  6. data/examples/dynamodb_table.rb +24 -24
  7. data/examples/elastic_beanstalk_example.rb +23 -23
  8. data/examples/elb_with_cloudfront.rb +100 -100
  9. data/examples/instance_with_eip.rb +40 -40
  10. data/examples/instance_with_yum.rb +40 -40
  11. data/examples/just_an_instance.rb +31 -31
  12. data/examples/nat_mutual_monitoring.rb +69 -69
  13. data/examples/play_with_region_and_zones.rb +28 -28
  14. data/examples/ra_web_hosting.rb +148 -148
  15. data/examples/s3_with_cloudfront.rb +35 -35
  16. data/examples/test_vpc.rb +61 -61
  17. data/lib/cf_factory/as/cf_as_group.rb +80 -77
  18. data/lib/cf_factory/as/cf_as_launch_config.rb +55 -55
  19. data/lib/cf_factory/as/cf_as_scaling_policy.rb +35 -35
  20. data/lib/cf_factory/as/cf_as_update_policy.rb +23 -0
  21. data/lib/cf_factory/base/cf_base.rb +112 -102
  22. data/lib/cf_factory/base/cf_ec2_tag.rb +34 -34
  23. data/lib/cf_factory/base/cf_generator.rb +20 -20
  24. data/lib/cf_factory/base/cf_helper.rb +93 -93
  25. data/lib/cf_factory/base/cf_inner.rb +74 -74
  26. data/lib/cf_factory/base/cf_main.rb +103 -103
  27. data/lib/cf_factory/base/cf_mapping.rb +28 -28
  28. data/lib/cf_factory/base/cf_named_inner.rb +70 -1
  29. data/lib/cf_factory/base/cf_output.rb +26 -26
  30. data/lib/cf_factory/base/cf_parameter.rb +27 -27
  31. data/lib/cf_factory/base/cf_script_reader.rb +34 -34
  32. data/lib/cf_factory/cloudformation/cf_cloud_formation_init.rb +27 -27
  33. data/lib/cf_factory/cloudformation/cf_cloudformation_command.rb +39 -39
  34. data/lib/cf_factory/cloudformation/cf_cloudformation_commands.rb +27 -27
  35. data/lib/cf_factory/cloudformation/cf_cloudformation_config.rb +35 -35
  36. data/lib/cf_factory/cloudformation/cf_cloudformation_file.rb +40 -40
  37. data/lib/cf_factory/cloudformation/cf_cloudformation_files.rb +27 -27
  38. data/lib/cf_factory/cloudformation/cf_cloudformation_inner.rb +30 -30
  39. data/lib/cf_factory/cloudformation/cf_cloudformation_package.rb +36 -36
  40. data/lib/cf_factory/cloudformation/cf_cloudformation_packages.rb +44 -44
  41. data/lib/cf_factory/cloudformation/cf_cloudformation_sources.rb +32 -32
  42. data/lib/cf_factory/cloudformation/cf_init_script.rb +80 -80
  43. data/lib/cf_factory/cloudfront/cf_cache_behavior.rb +39 -39
  44. data/lib/cf_factory/cloudfront/cf_cache_behaviors.rb +30 -30
  45. data/lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb +66 -66
  46. data/lib/cf_factory/cloudfront/cf_custom_origin_config.rb +39 -39
  47. data/lib/cf_factory/cloudfront/cf_default_cache_behavior.rb +34 -34
  48. data/lib/cf_factory/cloudfront/cf_distribution_config.rb +33 -33
  49. data/lib/cf_factory/cloudfront/cf_forwarded_values.rb +27 -27
  50. data/lib/cf_factory/cloudfront/cf_logging.rb +26 -26
  51. data/lib/cf_factory/cloudfront/cf_origin.rb +42 -42
  52. data/lib/cf_factory/cloudfront/cf_s3_origin_config.rb +27 -27
  53. data/lib/cf_factory/cloudwatch/cf_cloud_watch_alarm.rb +60 -60
  54. data/lib/cf_factory/dynamo/cf_dynamo_table.rb +45 -45
  55. data/lib/cf_factory/eb/cd_eb_solution_stack.rb +27 -28
  56. data/lib/cf_factory/eb/cf_eb_application.rb +41 -41
  57. data/lib/cf_factory/eb/cf_eb_application_version.rb +24 -24
  58. data/lib/cf_factory/eb/cf_eb_configuration_template.rb +36 -36
  59. data/lib/cf_factory/eb/cf_eb_environment.rb +56 -56
  60. data/lib/cf_factory/eb/cf_eb_option_setting.rb +19 -19
  61. data/lib/cf_factory/ec2/cf_ebs_volume.rb +56 -56
  62. data/lib/cf_factory/ec2/cf_ec2_instance.rb +80 -66
  63. data/lib/cf_factory/ec2/cf_ec2_security_group.rb +42 -42
  64. data/lib/cf_factory/ec2/cf_ec2_security_group_egress.rb +30 -30
  65. data/lib/cf_factory/ec2/cf_ec2_security_group_ingress.rb +41 -41
  66. data/lib/cf_factory/ec2/cf_eip.rb +28 -28
  67. data/lib/cf_factory/ec2/cf_eip_association.rb +33 -31
  68. data/lib/cf_factory/ec2/cf_inner_network_interface.rb +26 -0
  69. data/lib/cf_factory/ec2/cf_network_interface.rb +40 -0
  70. data/lib/cf_factory/elb/cf_app_cookie_stickiness_policy.rb +17 -17
  71. data/lib/cf_factory/elb/cf_elb.rb +51 -51
  72. data/lib/cf_factory/elb/cf_health_check.rb +25 -25
  73. data/lib/cf_factory/elb/cf_lb_cookie_stickiness_policy.rb +17 -17
  74. data/lib/cf_factory/elb/cf_listener.rb +28 -28
  75. data/lib/cf_factory/help/fixes.rb +15 -15
  76. data/lib/cf_factory/help/ip_mask.rb +167 -167
  77. data/lib/cf_factory/help/template_validation.rb +30 -30
  78. data/lib/cf_factory/iam/cf_iam_access_key.rb +34 -34
  79. data/lib/cf_factory/iam/cf_iam_group.rb +32 -32
  80. data/lib/cf_factory/iam/cf_iam_instance_profile.rb +32 -32
  81. data/lib/cf_factory/iam/cf_iam_policy.rb +20 -20
  82. data/lib/cf_factory/iam/cf_iam_role.rb +58 -58
  83. data/lib/cf_factory/iam/cf_iam_statement.rb +25 -25
  84. data/lib/cf_factory/iam/cf_iam_user.rb +36 -36
  85. data/lib/cf_factory/iam/cf_policy_document.rb +21 -21
  86. data/lib/cf_factory/modules/base_vpc.rb +63 -63
  87. data/lib/cf_factory/rds/cf_rds_instance.rb +55 -55
  88. data/lib/cf_factory/rds/cf_rds_security_group.rb +35 -35
  89. data/lib/cf_factory/rds/cf_rds_security_group_ingress.rb +31 -31
  90. data/lib/cf_factory/rds/cf_rds_subnet_group.rb +31 -31
  91. data/lib/cf_factory/route53/cf_elb_alias_target.rb +23 -23
  92. data/lib/cf_factory/route53/cf_record_set.rb +63 -63
  93. data/lib/cf_factory/route53/cf_route53_record_set.rb +63 -63
  94. data/lib/cf_factory/route53/cf_route53_record_set_group.rb +44 -44
  95. data/lib/cf_factory/s3/cf_s3_bucket.rb +34 -34
  96. data/lib/cf_factory/s3/cf_web_site_config.rb +26 -26
  97. data/lib/cf_factory/sqs/cf_sqs_queue.rb +28 -28
  98. data/lib/cf_factory/vpc/cf_attach_gateway.rb +30 -30
  99. data/lib/cf_factory/vpc/cf_internet_gateway.rb +32 -32
  100. data/lib/cf_factory/vpc/cf_network_acl.rb +41 -41
  101. data/lib/cf_factory/vpc/cf_network_acl_association.rb +26 -26
  102. data/lib/cf_factory/vpc/cf_network_acl_entry.rb +39 -39
  103. data/lib/cf_factory/vpc/cf_route.rb +45 -45
  104. data/lib/cf_factory/vpc/cf_route_table.rb +43 -43
  105. data/lib/cf_factory/vpc/cf_route_table_association.rb +26 -26
  106. data/lib/cf_factory/vpc/cf_subnet.rb +50 -50
  107. data/lib/cf_factory/vpc/cf_vpc.rb +66 -66
  108. data/lib/cf_factory.rb +12 -12
  109. metadata +120 -91
@@ -1,167 +1,167 @@
1
- module CfFactory
2
- class IpMask
3
- attr_reader :bits, :ip_mask
4
-
5
- def initialize(ip_mask, bits = 32) #if one parameter specified, means it's not a range, it's one address
6
- @ip_mask = ip_mask
7
- @bits = bits.to_i
8
- end
9
-
10
- def self.create(ip_mask, bits = 32)
11
- cleaned = IpMask.new(ip_mask, bits)
12
- cleaned.clean_mask()
13
- end
14
-
15
- def self.create_from_cidr(cidr)
16
- #ip = cidr.split("/")[0].split(".")
17
- #bits = cidr.split("/")[1].to_i
18
- ip = cidr.split("/")[0]
19
- bits = cidr.split("/")[1]
20
- IpMask.new(ip, bits)
21
- end
22
-
23
- def self.create_from_num(number, bits)
24
- ip_bytes = []
25
- 3.downto(0) {|i|
26
- div = 256 ** i
27
- b = number/div.to_i
28
- ip_bytes << b.to_i
29
- number = number % div
30
- }
31
- ip_bytes
32
- IpMask.new(ip_bytes.join("."), bits)
33
- end
34
-
35
- def to_num
36
- sum = 0
37
- exp = 3
38
- @ip_mask.split(".").each() {|ip|
39
- sum += ip.to_i * (256 ** exp)
40
- exp -= 1
41
- }
42
- sum
43
- end
44
-
45
- def to_mask
46
- bit_string = self.to_bit_string
47
- r = bit_string.to_i(2)
48
- end
49
-
50
- def to_bit_string
51
- bit_string = ("1"*@bits+"0"*(32-@bits))
52
- #puts "#{bit_string}"
53
- bit_string
54
- end
55
-
56
- def free()
57
- (2 ** 32) / used()
58
- end
59
-
60
- def used()
61
- 2 ** @bits
62
- end
63
-
64
- def generate_free()
65
- self.to_num()
66
- end
67
-
68
- def to_s
69
- if @bits.to_i == 32
70
- "#{@ip_mask}"
71
- else
72
- "#{@ip_mask}/#{@bits}"
73
- end
74
- end
75
-
76
- def clean_mask
77
- ip_base_num = self.to_num
78
- ip_bits_num = self.to_mask()
79
- clean_mask = ip_base_num & ip_bits_num
80
- #puts "clean_mask = #{clean_mask}"
81
- IpMask.create_from_num(clean_mask,@bits)
82
- end
83
-
84
- def is_clean?
85
- comp = self.clean_mask
86
- return self.ip_mask != comp.ip_mask
87
- end
88
-
89
- def divide(number_of_addresses)
90
- possible_ranges = []
91
- bits_to_move = (Math.log(number_of_addresses+1)/Math.log(2)).to_i
92
- puts "asked to allocate #{number_of_addresses}; that corresponds to #{bits_to_move} bits"
93
- puts "#{self.free()} are free"
94
- max_subnets = self.free()/number_of_addresses
95
- puts "given that every subnet should have #{number_of_addresses} addresses, there is currently space for #{max_subnets}"
96
- 0.upto(max_subnets-1) {|i|
97
- num = self.to_num()
98
- num += i*number_of_addresses
99
- possible_range = IpMask.create_from_num(num, 32 - bits_to_move)
100
- possible_ranges << possible_range
101
- puts "possible range: #{possible_range}"
102
- }
103
- possible_ranges
104
- end
105
-
106
- # Takes an array of IP-Address-Numbers into account and allocates corresponding IP address ranges
107
- def divide_individually(array_with_number_of_addresses)
108
- possible_ranges = []
109
- num = self.to_num()
110
- bits_to_move = 32 - @bits
111
- remaining_addresses = self.free
112
- array_with_number_of_addresses.each() {|number_of_addresses_for_subnet|
113
- if (2 ** bits_to_move) < number_of_addresses_for_subnet
114
- puts "WARNING: could not allocate #{number_of_addresses_for_subnet} anymore (max #{(2 ** bits_to_move)})"
115
- next
116
- end
117
- bits_to_move = [(Math.log(number_of_addresses_for_subnet+1)/Math.log(2)).to_i, bits_to_move].min
118
- possible_range = IpMask.create_from_num(num, 32 - bits_to_move)
119
- unless self.are_all_in_range?(possible_range)
120
- puts "WARNING: the selected range '#{possible_range}' is outside the base range"
121
- next
122
- end
123
- num += number_of_addresses_for_subnet
124
- puts "[alloc #{number_of_addresses_for_subnet}] \tpossible range: #{possible_range}"
125
- possible_ranges << possible_range
126
- remaining_addresses -= (2 ** bits_to_move)
127
- #puts "[to allocate = #{number_of_addresses_for_subnet}] => free = #{possible_range.free}"
128
- }
129
- possible_ranges
130
- end
131
-
132
- def is_in_range?(ip_address)
133
- comp_mask = IpMask.new(ip_address)
134
- # transform ip address string to numerical values for bitwise operations
135
- comp_ip = comp_mask.to_num
136
- #puts "ip_address checked = #{comp_ip.to_s(2)}"
137
- ip_base_num = self.to_num
138
- #puts "range_mask = #{ip_base_num.to_s(2)}"
139
- ip_bits_num = self.to_mask
140
- #puts "bit_mask = #{ip_bits_num.to_s(2)}"
141
- # perform an AND operation to get rid of the bits in the mask that don't count
142
- clean_mask = ip_base_num & ip_bits_num
143
- #puts "cleaned range_mask = #{ip_base_num.to_s(2)}"
144
- # the ip address belongs to the range, when an AND with the bitmask equals the cleaned mask
145
- #puts "(ip_address&bits = #{(comp_ip & ip_bits_num).to_s(2)}"
146
- (comp_ip & ip_bits_num) == clean_mask
147
- end
148
-
149
- def are_all_in_range?(ip_mask)
150
- #puts "check for #{ip_mask}"
151
- return false if ip_mask.bits < self.bits
152
- #
153
- comp_ip = ip_mask.to_num
154
- ip_base_num = self.to_num
155
- ip_bits_num = self.to_mask
156
- ip_clean = ip_base_num & ip_bits_num
157
- #puts "comp = #{(comp_ip & ip_bits_num)} ip_clean = #{ip_clean} (ip_bits_num = #{ip_bits_num})"
158
- (comp_ip & ip_bits_num) == ip_clean
159
- end
160
-
161
- def ==(comp)
162
- puts "comp = #{comp.class} #{comp.inspect}"
163
- self.ip_mask == comp.ip_mask && self.bits == comp.bits
164
- end
165
-
166
- end
167
- end
1
+ module CfFactory
2
+ class IpMask
3
+ attr_reader :bits, :ip_mask
4
+
5
+ def initialize(ip_mask, bits = 32) #if one parameter specified, means it's not a range, it's one address
6
+ @ip_mask = ip_mask
7
+ @bits = bits.to_i
8
+ end
9
+
10
+ def self.create(ip_mask, bits = 32)
11
+ cleaned = IpMask.new(ip_mask, bits)
12
+ cleaned.clean_mask()
13
+ end
14
+
15
+ def self.create_from_cidr(cidr)
16
+ #ip = cidr.split("/")[0].split(".")
17
+ #bits = cidr.split("/")[1].to_i
18
+ ip = cidr.split("/")[0]
19
+ bits = cidr.split("/")[1]
20
+ IpMask.new(ip, bits)
21
+ end
22
+
23
+ def self.create_from_num(number, bits)
24
+ ip_bytes = []
25
+ 3.downto(0) {|i|
26
+ div = 256 ** i
27
+ b = number/div.to_i
28
+ ip_bytes << b.to_i
29
+ number = number % div
30
+ }
31
+ ip_bytes
32
+ IpMask.new(ip_bytes.join("."), bits)
33
+ end
34
+
35
+ def to_num
36
+ sum = 0
37
+ exp = 3
38
+ @ip_mask.split(".").each() {|ip|
39
+ sum += ip.to_i * (256 ** exp)
40
+ exp -= 1
41
+ }
42
+ sum
43
+ end
44
+
45
+ def to_mask
46
+ bit_string = self.to_bit_string
47
+ r = bit_string.to_i(2)
48
+ end
49
+
50
+ def to_bit_string
51
+ bit_string = ("1"*@bits+"0"*(32-@bits))
52
+ #puts "#{bit_string}"
53
+ bit_string
54
+ end
55
+
56
+ def free()
57
+ (2 ** 32) / used()
58
+ end
59
+
60
+ def used()
61
+ 2 ** @bits
62
+ end
63
+
64
+ def generate_free()
65
+ self.to_num()
66
+ end
67
+
68
+ def to_s
69
+ if @bits.to_i == 32
70
+ "#{@ip_mask}"
71
+ else
72
+ "#{@ip_mask}/#{@bits}"
73
+ end
74
+ end
75
+
76
+ def clean_mask
77
+ ip_base_num = self.to_num
78
+ ip_bits_num = self.to_mask()
79
+ clean_mask = ip_base_num & ip_bits_num
80
+ #puts "clean_mask = #{clean_mask}"
81
+ IpMask.create_from_num(clean_mask,@bits)
82
+ end
83
+
84
+ def is_clean?
85
+ comp = self.clean_mask
86
+ return self.ip_mask != comp.ip_mask
87
+ end
88
+
89
+ def divide(number_of_addresses)
90
+ possible_ranges = []
91
+ bits_to_move = (Math.log(number_of_addresses+1)/Math.log(2)).to_i
92
+ puts "asked to allocate #{number_of_addresses}; that corresponds to #{bits_to_move} bits"
93
+ puts "#{self.free()} are free"
94
+ max_subnets = self.free()/number_of_addresses
95
+ puts "given that every subnet should have #{number_of_addresses} addresses, there is currently space for #{max_subnets}"
96
+ 0.upto(max_subnets-1) {|i|
97
+ num = self.to_num()
98
+ num += i*number_of_addresses
99
+ possible_range = IpMask.create_from_num(num, 32 - bits_to_move)
100
+ possible_ranges << possible_range
101
+ puts "possible range: #{possible_range}"
102
+ }
103
+ possible_ranges
104
+ end
105
+
106
+ # Takes an array of IP-Address-Numbers into account and allocates corresponding IP address ranges
107
+ def divide_individually(array_with_number_of_addresses)
108
+ possible_ranges = []
109
+ num = self.to_num()
110
+ bits_to_move = 32 - @bits
111
+ remaining_addresses = self.free
112
+ array_with_number_of_addresses.each() {|number_of_addresses_for_subnet|
113
+ if (2 ** bits_to_move) < number_of_addresses_for_subnet
114
+ puts "WARNING: could not allocate #{number_of_addresses_for_subnet} anymore (max #{(2 ** bits_to_move)})"
115
+ next
116
+ end
117
+ bits_to_move = [(Math.log(number_of_addresses_for_subnet+1)/Math.log(2)).to_i, bits_to_move].min
118
+ possible_range = IpMask.create_from_num(num, 32 - bits_to_move)
119
+ unless self.are_all_in_range?(possible_range)
120
+ puts "WARNING: the selected range '#{possible_range}' is outside the base range"
121
+ next
122
+ end
123
+ num += number_of_addresses_for_subnet
124
+ puts "[alloc #{number_of_addresses_for_subnet}] \tpossible range: #{possible_range}"
125
+ possible_ranges << possible_range
126
+ remaining_addresses -= (2 ** bits_to_move)
127
+ #puts "[to allocate = #{number_of_addresses_for_subnet}] => free = #{possible_range.free}"
128
+ }
129
+ possible_ranges
130
+ end
131
+
132
+ def is_in_range?(ip_address)
133
+ comp_mask = IpMask.new(ip_address)
134
+ # transform ip address string to numerical values for bitwise operations
135
+ comp_ip = comp_mask.to_num
136
+ #puts "ip_address checked = #{comp_ip.to_s(2)}"
137
+ ip_base_num = self.to_num
138
+ #puts "range_mask = #{ip_base_num.to_s(2)}"
139
+ ip_bits_num = self.to_mask
140
+ #puts "bit_mask = #{ip_bits_num.to_s(2)}"
141
+ # perform an AND operation to get rid of the bits in the mask that don't count
142
+ clean_mask = ip_base_num & ip_bits_num
143
+ #puts "cleaned range_mask = #{ip_base_num.to_s(2)}"
144
+ # the ip address belongs to the range, when an AND with the bitmask equals the cleaned mask
145
+ #puts "(ip_address&bits = #{(comp_ip & ip_bits_num).to_s(2)}"
146
+ (comp_ip & ip_bits_num) == clean_mask
147
+ end
148
+
149
+ def are_all_in_range?(ip_mask)
150
+ #puts "check for #{ip_mask}"
151
+ return false if ip_mask.bits < self.bits
152
+ #
153
+ comp_ip = ip_mask.to_num
154
+ ip_base_num = self.to_num
155
+ ip_bits_num = self.to_mask
156
+ ip_clean = ip_base_num & ip_bits_num
157
+ #puts "comp = #{(comp_ip & ip_bits_num)} ip_clean = #{ip_clean} (ip_bits_num = #{ip_bits_num})"
158
+ (comp_ip & ip_bits_num) == ip_clean
159
+ end
160
+
161
+ def ==(comp)
162
+ puts "comp = #{comp.class} #{comp.inspect}"
163
+ self.ip_mask == comp.ip_mask && self.bits == comp.bits
164
+ end
165
+
166
+ end
167
+ end
@@ -1,30 +1,30 @@
1
- require 'aws'
2
-
3
- module CfFactory
4
- class TemplateValidation
5
- def initialize(template_string, config_options)
6
- @template_string = template_string
7
- @config_options = config_options
8
- end
9
-
10
- def validate
11
- cf = AWS::CloudFormation.new(@config_options)
12
- response = cf.validate_template(@template_string)
13
- if response[:code] == "ValidationError"
14
- puts "Validation failed: #{response[:message]}"
15
- else
16
- puts "Validation successful"
17
- end
18
- response
19
- end
20
-
21
- def apply(parameters = {})
22
- cf = AWS::CloudFormation.new(@config_options)
23
- stack_name = "StackStartedFromEclipse#{Time.new.to_i}"
24
- puts "going to start stack #{stack_name} with parameters #{parameters.inspect}"
25
- stack = cf.stacks.create(stack_name, @template_string, :parameters => parameters, :capabilities => ["CAPABILITY_IAM"])
26
- puts "started stack with parameters: #{stack.parameters}"
27
- end
28
-
29
- end
30
- end
1
+ require 'aws'
2
+
3
+ module CfFactory
4
+ class TemplateValidation
5
+ def initialize(template_string, config_options)
6
+ @template_string = template_string
7
+ @config_options = config_options
8
+ end
9
+
10
+ def validate
11
+ cf = AWS::CloudFormation.new(@config_options)
12
+ response = cf.validate_template(@template_string)
13
+ if response[:code] == "ValidationError"
14
+ puts "Validation failed: #{response[:message]}"
15
+ else
16
+ puts "Validation successful"
17
+ end
18
+ response
19
+ end
20
+
21
+ def apply(parameters = {})
22
+ cf = AWS::CloudFormation.new(@config_options)
23
+ stack_name = "StackStartedFromEclipse#{Time.new.to_i}"
24
+ puts "going to start stack #{stack_name} with parameters #{parameters.inspect}"
25
+ stack = cf.stacks.create(stack_name, @template_string, :parameters => parameters, :capabilities => ["CAPABILITY_IAM"])
26
+ puts "started stack with parameters: #{stack.parameters}"
27
+ end
28
+
29
+ end
30
+ end
@@ -1,34 +1,34 @@
1
- require 'cf_factory/base/cf_base'
2
- require 'cf_factory/base/cf_helper'
3
- require 'cf_factory/iam/cf_iam_instance_profile'
4
-
5
- module CfFactory
6
- class CfIamAccessKey
7
- include CfBase
8
-
9
- def initialize(name, user_name, status, options = {})
10
- @name = name
11
- @status = status
12
- @user_name = user_name
13
- @serial = options[:serial]
14
- end
15
-
16
- def get_cf_type
17
- "AWS::IAM::AccessKey"
18
- end
19
-
20
- def get_cf_attributes
21
- {}
22
- end
23
-
24
- def get_cf_properties
25
- result = {
26
- "Status" => @status,
27
- "UserName" => @user_name
28
- }
29
- result["Serial"] = @serial unless @serial.nil?
30
- result
31
- end
32
-
33
- end
34
- end
1
+ require 'cf_factory/base/cf_base'
2
+ require 'cf_factory/base/cf_helper'
3
+ require 'cf_factory/iam/cf_iam_instance_profile'
4
+
5
+ module CfFactory
6
+ class CfIamAccessKey
7
+ include CfBase
8
+
9
+ def initialize(name, user_name, status, options = {})
10
+ @name = name
11
+ @status = status
12
+ @user_name = user_name
13
+ @serial = options[:serial]
14
+ end
15
+
16
+ def get_cf_type
17
+ "AWS::IAM::AccessKey"
18
+ end
19
+
20
+ def get_cf_attributes
21
+ {}
22
+ end
23
+
24
+ def get_cf_properties
25
+ result = {
26
+ "Status" => @status,
27
+ "UserName" => @user_name
28
+ }
29
+ result["Serial"] = @serial unless @serial.nil?
30
+ result
31
+ end
32
+
33
+ end
34
+ end
@@ -1,32 +1,32 @@
1
- require 'cf_factory/base/cf_base'
2
- require 'cf_factory/base/cf_helper'
3
- require 'cf_factory/iam/cf_iam_instance_profile'
4
-
5
- module CfFactory
6
- class CfIamGroup
7
- include CfBase
8
-
9
- def initialize(name, path, options)
10
- @name = name
11
- @path = path
12
- @policies = options[:policies]
13
- end
14
-
15
- def get_cf_type
16
- "AWS::IAM::Group"
17
- end
18
-
19
- def get_cf_attributes
20
- {}
21
- end
22
-
23
- def get_cf_properties
24
- result = {
25
- "Path" => @path
26
- }
27
- result["Policies"] = CfHelper.generate_inner_array(@policies) unless @policies.nil?
28
- result
29
- end
30
-
31
- end
32
- end
1
+ require 'cf_factory/base/cf_base'
2
+ require 'cf_factory/base/cf_helper'
3
+ require 'cf_factory/iam/cf_iam_instance_profile'
4
+
5
+ module CfFactory
6
+ class CfIamGroup
7
+ include CfBase
8
+
9
+ def initialize(name, path, options)
10
+ @name = name
11
+ @path = path
12
+ @policies = options[:policies]
13
+ end
14
+
15
+ def get_cf_type
16
+ "AWS::IAM::Group"
17
+ end
18
+
19
+ def get_cf_attributes
20
+ {}
21
+ end
22
+
23
+ def get_cf_properties
24
+ result = {
25
+ "Path" => @path
26
+ }
27
+ result["Policies"] = CfHelper.generate_inner_array(@policies) unless @policies.nil?
28
+ result
29
+ end
30
+
31
+ end
32
+ end
@@ -1,32 +1,32 @@
1
- require 'cf_factory/base/cf_base'
2
- require 'cf_factory/base/cf_helper'
3
- require 'cf_factory/elb/cf_app_cookie_stickiness_policy'
4
-
5
- module CfFactory
6
- class CfIamInstanceProfile
7
- include CfBase
8
-
9
- def initialize(name, path, roles)
10
- @name = name
11
- @path = path
12
- @roles = roles
13
- end
14
-
15
- def get_cf_type
16
- "AWS::IAM::InstanceProfile"
17
- end
18
-
19
- def get_cf_attributes
20
- {}
21
- end
22
-
23
- def get_cf_properties
24
- result = {
25
- "Path" => @path,
26
- "Roles" => "["+@roles.collect() {|r| CfHelper.generate_ref(r)}.join(",")+"]"
27
- }
28
- result
29
- end
30
-
31
- end
32
- end
1
+ require 'cf_factory/base/cf_base'
2
+ require 'cf_factory/base/cf_helper'
3
+ require 'cf_factory/elb/cf_app_cookie_stickiness_policy'
4
+
5
+ module CfFactory
6
+ class CfIamInstanceProfile
7
+ include CfBase
8
+
9
+ def initialize(name, path, roles)
10
+ @name = name
11
+ @path = path
12
+ @roles = roles
13
+ end
14
+
15
+ def get_cf_type
16
+ "AWS::IAM::InstanceProfile"
17
+ end
18
+
19
+ def get_cf_attributes
20
+ {}
21
+ end
22
+
23
+ def get_cf_properties
24
+ result = {
25
+ "Path" => @path,
26
+ "Roles" => "["+@roles.collect() {|r| CfHelper.generate_ref(r)}.join(",")+"]"
27
+ }
28
+ result
29
+ end
30
+
31
+ end
32
+ end
@@ -1,20 +1,20 @@
1
- require 'cf_factory/base/cf_inner'
2
- require 'cf_factory/iam/cf_policy_document'
3
-
4
- module CfFactory
5
- class CfIamPolicy
6
- include CfInner
7
-
8
- def initialize(policy_name, policy_doc)
9
- @policy_name = policy_name
10
- @policy_doc = policy_doc
11
- end
12
-
13
- def get_cf_attributes
14
- {"PolicyName" => @policy_name,
15
- "PolicyDocument" => @policy_doc.generate
16
- }
17
- end
18
-
19
- end
20
- end
1
+ require 'cf_factory/base/cf_inner'
2
+ require 'cf_factory/iam/cf_policy_document'
3
+
4
+ module CfFactory
5
+ class CfIamPolicy
6
+ include CfInner
7
+
8
+ def initialize(policy_name, policy_doc)
9
+ @policy_name = policy_name
10
+ @policy_doc = policy_doc
11
+ end
12
+
13
+ def get_cf_attributes
14
+ {"PolicyName" => @policy_name,
15
+ "PolicyDocument" => @policy_doc.generate
16
+ }
17
+ end
18
+
19
+ end
20
+ end