Class: DrawCloud::ASGroup
Constant Summary collapse
- NOTIFY_EC2_INSTANCE_LAUNCH =
"autoscaling:EC2_INSTANCE_LAUNCH"- NOTIFY_EC2_INSTANCE_LAUNCH_ERROR =
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR"- NOTIFY_EC2_INSTANCE_TERMINATE =
"autoscaling:EC2_INSTANCE_TERMINATE"- NOTIFY_EC2_INSTANCE_TERMINATE_ERROR =
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR"- NOTIFY_EC2_TEST_NOTIFICATION =
"autoscaling:TEST_NOTIFICATION"- ALL_NOTIFICATIONS =
[ NOTIFY_EC2_INSTANCE_LAUNCH, NOTIFY_EC2_INSTANCE_LAUNCH_ERROR, NOTIFY_EC2_INSTANCE_TERMINATE, NOTIFY_EC2_INSTANCE_TERMINATE_ERROR, NOTIFY_EC2_TEST_NOTIFICATION ]
- ALL_ERRORS =
[ NOTIFY_EC2_INSTANCE_LAUNCH_ERROR, NOTIFY_EC2_INSTANCE_TERMINATE_ERROR ]
- ALL_ACTIVITY =
[ NOTIFY_EC2_INSTANCE_LAUNCH, NOTIFY_EC2_INSTANCE_LAUNCH_ERROR, NOTIFY_EC2_INSTANCE_TERMINATE, NOTIFY_EC2_INSTANCE_TERMINATE_ERROR ]
Instance Attribute Summary collapse
-
#availability_zones ⇒ Object
Returns the value of attribute availability_zones.
-
#cooldown ⇒ Object
Returns the value of attribute cooldown.
-
#desired_capacity ⇒ Object
Returns the value of attribute desired_capacity.
-
#launch_configuration_name ⇒ Object
(also: #launch_configuration)
Returns the value of attribute launch_configuration_name.
-
#max_size ⇒ Object
Returns the value of attribute max_size.
-
#min_size ⇒ Object
Returns the value of attribute min_size.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notification_configuration ⇒ Object
Returns the value of attribute notification_configuration.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#vpc_zone_identifier ⇒ Object
(also: #subnets)
Returns the value of attribute vpc_zone_identifier.
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, #vpcs, #wait_handles
Instance Method Summary collapse
- #as_group ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ ASGroup
constructor
A new instance of ASGroup.
- #load_into_config(config) ⇒ Object
- #notify(topic_arn, notification_types) ⇒ 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
Methods included from Utilities
#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name
Constructor Details
#initialize(name, options = {}, &block) ⇒ ASGroup
Returns a new instance of ASGroup.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/draw_cloud/as_group.rb', line 41 def initialize(name, ={}, &block) @name = name @availability_zones = .fetch(:availability_zones, []) @cooldown = .fetch(:cooldown, nil) @launch_configuration_name = .fetch(:launch_configuration_name, nil) @max_size = .fetch(:max_size, nil) @min_size = .fetch(:min_size, nil) @notification_configuration = .fetch(:notification_configuration, nil) @desired_capacity = .fetch(:desired_capacity, nil) = .fetch(:tags, []) @vpc_zone_identifier = .fetch(:vpc_zone_identifier, nil) super(, &block) end |
Instance Attribute Details
#availability_zones ⇒ Object
Returns the value of attribute availability_zones.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def availability_zones @availability_zones end |
#cooldown ⇒ Object
Returns the value of attribute cooldown.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def cooldown @cooldown end |
#desired_capacity ⇒ Object
Returns the value of attribute desired_capacity.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def desired_capacity @desired_capacity end |
#launch_configuration_name ⇒ Object Also known as: launch_configuration
Returns the value of attribute launch_configuration_name.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def launch_configuration_name @launch_configuration_name end |
#max_size ⇒ Object
Returns the value of attribute max_size.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def max_size @max_size end |
#min_size ⇒ Object
Returns the value of attribute min_size.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def min_size @min_size end |
#name ⇒ Object
Returns the value of attribute name.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def name @name end |
#notification_configuration ⇒ Object
Returns the value of attribute notification_configuration.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def notification_configuration @notification_configuration end |
#tags ⇒ Object
Returns the value of attribute tags.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def end |
#vpc_zone_identifier ⇒ Object Also known as: subnets
Returns the value of attribute vpc_zone_identifier.
37 38 39 |
# File 'lib/draw_cloud/as_group.rb', line 37 def vpc_zone_identifier @vpc_zone_identifier end |
Instance Method Details
#as_group ⇒ Object
55 56 57 |
# File 'lib/draw_cloud/as_group.rb', line 55 def as_group self end |
#load_into_config(config) ⇒ Object
71 72 73 74 |
# File 'lib/draw_cloud/as_group.rb', line 71 def load_into_config(config) config.cf_add_resource resource_name, self super(config) end |
#notify(topic_arn, notification_types) ⇒ Object
59 60 61 |
# File 'lib/draw_cloud/as_group.rb', line 59 def notify(topic_arn, notification_types) self.notification_configuration = {:arn => topic_arn, :types => notification_types} end |
#resource_name ⇒ Object
76 77 78 |
# File 'lib/draw_cloud/as_group.rb', line 76 def resource_name resource_style(name) + "AS" end |
#to_h ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/draw_cloud/as_group.rb', line 80 def to_h h = { "Type" => "AWS::AutoScaling::AutoScalingGroup", "Properties" => { "AvailabilityZones" => availability_zones.collect {|g| DrawCloud.ref(g) }, "LaunchConfigurationName" => DrawCloud.ref(launch_configuration_name), "MaxSize" => max_size, "MinSize" => min_size, "Tags" => [], # FIXME } } p = h["Properties"] p["AvailabilityZones"] = DrawCloud.ref(availability_zones) if cooldown p["Cooldown"] = DrawCloud.ref(cooldown) if cooldown p["DesiredCapacity"] = DrawCloud.ref(desired_capacity) if desired_capacity p["VPCZoneIdentifier"] = vpc_zone_identifier.collect {|z| DrawCloud.ref(z) } p["NotificationConfiguration"] = { "TopicARN" => DrawCloud.ref(self.notification_configuration[:arn]), "NotificationTypes" => self.notification_configuration[:types], } if self.notification_configuration add_standard_properties(h) end |