Class: Aws::AutoScaling::AutoScalingGroup
- Inherits:
-
Object
- Object
- Aws::AutoScaling::AutoScalingGroup
- Defined in:
- gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#auto_scaling_group_arn ⇒ String
The Amazon Resource Name (ARN) of the Auto Scaling group.
-
#availability_zone_distribution ⇒ Types::AvailabilityZoneDistribution
The EC2 instance capacity distribution across Availability Zones for the Auto Scaling group.
-
#availability_zone_ids ⇒ Array<String>
The Availability Zone IDs where the Auto Scaling group can launch instances.
-
#availability_zone_impairment_policy ⇒ Types::AvailabilityZoneImpairmentPolicy
The Availability Zone impairment policy for the Auto Scaling group.
-
#availability_zones ⇒ Array<String>
One or more Availability Zones for the Auto Scaling group.
-
#capacity_rebalance ⇒ Boolean
Indicates whether Capacity Rebalancing is enabled.
-
#capacity_reservation_specification ⇒ Types::CapacityReservationSpecification
The capacity reservation specification for the Auto Scaling group.
-
#context ⇒ String
Reserved.
-
#created_time ⇒ Time
The date and time the Auto Scaling group was created.
-
#default_cooldown ⇒ Integer
The duration of the default cooldown period, in seconds, for the Auto Scaling group.
-
#default_instance_warmup ⇒ Integer
The duration of the default EC2 instance warmup time, in seconds, for the Auto Scaling group.
-
#deletion_protection ⇒ String
The deletion protection setting for the Auto Scaling group.
-
#desired_capacity ⇒ Integer
The desired size of the Auto Scaling group.
-
#desired_capacity_type ⇒ String
The unit of measurement for the value specified for desired capacity.
-
#enabled_metrics ⇒ Array<Types::EnabledMetric>
The metrics enabled for the Auto Scaling group.
-
#health_check_grace_period ⇒ Integer
The duration of the health check grace period, in seconds, for the Auto Scaling group.
-
#health_check_type ⇒ String
One or more comma-separated health check types for the Auto Scaling group.
-
#instance_lifecycle_policy ⇒ Types::InstanceLifecyclePolicy
The instance lifecycle policy for the Auto Scaling group.
-
#instance_maintenance_policy ⇒ Types::InstanceMaintenancePolicy
An instance maintenance policy.
-
#launch_configuration_name ⇒ String
The name of the associated launch configuration for the Auto Scaling group.
-
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the Auto Scaling group.
-
#load_balancer_names ⇒ Array<String>
One or more load balancers associated with the group.
-
#max_instance_lifetime ⇒ Integer
The maximum amount of time, in seconds, that an EC2 instance can be in service for the Auto Scaling group.
-
#max_size ⇒ Integer
The maximum size of the Auto Scaling group.
-
#min_size ⇒ Integer
The minimum size of the Auto Scaling group.
-
#mixed_instances_policy ⇒ Types::MixedInstancesPolicy
The mixed instances policy for the group.
-
#name ⇒ String
(also: #auto_scaling_group_name)
-
#new_instances_protected_from_scale_in ⇒ Boolean
Indicates whether newly launched EC2 instances are protected from termination when scaling in for the Auto Scaling group.
-
#operator ⇒ Types::Operator
The entity that manages the Auto Scaling group, if applicable.
-
#placement_group ⇒ String
The name of the placement group into which to launch EC2 instances for the Auto Scaling group.
-
#predicted_capacity ⇒ Integer
The predicted capacity of the group when it has a predictive scaling policy.
-
#service_linked_role_arn ⇒ String
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon Web Services on your behalf.
-
#status ⇒ String
The current state of the Auto Scaling group when the [DeleteAutoScalingGroup][1] operation is in progress.
-
#suspended_processes ⇒ Array<Types::SuspendedProcess>
The suspended processes associated with the Auto Scaling group.
-
#target_group_arns ⇒ Array<String>
The Amazon Resource Names (ARN) of the target groups for your load balancer.
-
#termination_policies ⇒ Array<String>
The termination policies for the Auto Scaling group.
-
#traffic_sources ⇒ Array<Types::TrafficSourceIdentifier>
The traffic sources associated with this Auto Scaling group.
-
#vpc_zone_identifier ⇒ String
One or more comma-separated subnet IDs for the Auto Scaling group.
-
#warm_pool_configuration ⇒ Types::WarmPoolConfiguration
The warm pool for the group.
-
#warm_pool_size ⇒ Integer
The current size of the warm pool.
Actions collapse
-
#attach_instances(options = {}) ⇒ EmptyStructure
-
#delete(options = {}) ⇒ EmptyStructure
-
#detach_instances(options = {}) ⇒ Activity::Collection
-
#disable_metrics_collection(options = {}) ⇒ EmptyStructure
-
#enable_metrics_collection(options = {}) ⇒ EmptyStructure
-
#put_scaling_policy(options = {}) ⇒ ScalingPolicy
-
#put_scheduled_update_group_action(options = {}) ⇒ ScheduledAction
-
#resume_processes(options = {}) ⇒ EmptyStructure
-
#set_desired_capacity(options = {}) ⇒ EmptyStructure
-
#suspend_processes(options = {}) ⇒ EmptyStructure
-
#update(options = {}) ⇒ AutoScalingGroup
Associations collapse
-
#activities(options = {}) ⇒ Activity::Collection
-
#instances ⇒ Instance::Collection
-
#launch_configuration ⇒ LaunchConfiguration?
-
#lifecycle_hook(name) ⇒ LifecycleHook
-
#lifecycle_hooks(options = {}) ⇒ LifecycleHook::Collection
-
#load_balancer(name) ⇒ LoadBalancer
-
#load_balancers(options = {}) ⇒ LoadBalancer::Collection
-
#notification_configurations(options = {}) ⇒ NotificationConfiguration::Collection
-
#policies(options = {}) ⇒ ScalingPolicy::Collection
-
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
-
#tag(key) ⇒ Tag
-
#tags ⇒ Tag::Collection
Instance Method Summary collapse
-
#client ⇒ Client
-
#data ⇒ Types::AutoScalingGroup
Returns the data for this AutoScalingGroup.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#exists?(options = {}) ⇒ Boolean
Returns
trueif the AutoScalingGroup exists. -
#initialize(*args) ⇒ AutoScalingGroup
constructor
A new instance of AutoScalingGroup.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current AutoScalingGroup.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::AutoScaling::Client] #wait_until instead
-
#wait_until_exists(options = {}, &block) ⇒ AutoScalingGroup
-
#wait_until_in_service(options = {}, &block) ⇒ AutoScalingGroup
-
#wait_until_not_exists(options = {}, &block) ⇒ AutoScalingGroup
Constructor Details
#initialize(name, options = {}) ⇒ AutoScalingGroup #initialize(options = {}) ⇒ AutoScalingGroup
Returns a new instance of AutoScalingGroup.
22 23 24 25 26 27 28 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 22 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @name = extract_name(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#activities(options = {}) ⇒ Activity::Collection
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1714 def activities( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_scaling_activities() end resp.each_page do |page| batch = [] page.data.activities.each do |a| batch << Activity.new( id: a.activity_id, data: a, client: @client ) end y.yield(batch) end end Activity::Collection.new(batches) end |
#attach_instances(options = {}) ⇒ EmptyStructure
521 522 523 524 525 526 527 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 521 def attach_instances( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.attach_instances() end resp.data end |
#auto_scaling_group_arn ⇒ String
The Amazon Resource Name (ARN) of the Auto Scaling group.
40 41 42 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 40 def auto_scaling_group_arn data[:auto_scaling_group_arn] end |
#availability_zone_distribution ⇒ Types::AvailabilityZoneDistribution
The EC2 instance capacity distribution across Availability Zones for the Auto Scaling group.
273 274 275 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 273 def availability_zone_distribution data[:availability_zone_distribution] end |
#availability_zone_ids ⇒ Array<String>
The Availability Zone IDs where the Auto Scaling group can launch instances.
104 105 106 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 104 def availability_zone_ids data[:availability_zone_ids] end |
#availability_zone_impairment_policy ⇒ Types::AvailabilityZoneImpairmentPolicy
The Availability Zone impairment policy for the Auto Scaling group.
279 280 281 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 279 def availability_zone_impairment_policy data[:availability_zone_impairment_policy] end |
#availability_zones ⇒ Array<String>
One or more Availability Zones for the Auto Scaling group.
97 98 99 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 97 def availability_zones data[:availability_zones] end |
#capacity_rebalance ⇒ Boolean
Indicates whether Capacity Rebalancing is enabled.
215 216 217 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 215 def capacity_rebalance data[:capacity_rebalance] end |
#capacity_reservation_specification ⇒ Types::CapacityReservationSpecification
The capacity reservation specification for the Auto Scaling group.
285 286 287 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 285 def capacity_reservation_specification data[:capacity_reservation_specification] end |
#client ⇒ Client
306 307 308 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 306 def client @client end |
#context ⇒ String
Reserved.
233 234 235 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 233 def context data[:context] end |
#created_time ⇒ Time
The date and time the Auto Scaling group was created.
137 138 139 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 137 def created_time data[:created_time] end |
#data ⇒ Types::AutoScalingGroup
Returns the data for this Aws::AutoScaling::AutoScalingGroup. Calls
Client#describe_auto_scaling_groups if #data_loaded? is false.
328 329 330 331 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 328 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
336 337 338 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 336 def data_loaded? !!@data end |
#default_cooldown ⇒ Integer
The duration of the default cooldown period, in seconds, for the Auto Scaling group.
91 92 93 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 91 def default_cooldown data[:default_cooldown] end |
#default_instance_warmup ⇒ Integer
The duration of the default EC2 instance warmup time, in seconds, for the Auto Scaling group.
248 249 250 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 248 def default_instance_warmup data[:default_instance_warmup] end |
#delete(options = {}) ⇒ EmptyStructure
541 542 543 544 545 546 547 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 541 def delete( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_auto_scaling_group() end resp.data end |
#deletion_protection ⇒ String
The deletion protection setting for the Auto Scaling group.
266 267 268 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 266 def deletion_protection data[:deletion_protection] end |
#desired_capacity ⇒ Integer
The desired size of the Auto Scaling group.
77 78 79 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 77 def desired_capacity data[:desired_capacity] end |
#desired_capacity_type ⇒ String
The unit of measurement for the value specified for desired capacity.
Amazon EC2 Auto Scaling supports DesiredCapacityType for
attribute-based instance type selection only.
241 242 243 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 241 def desired_capacity_type data[:desired_capacity_type] end |
#detach_instances(options = {}) ⇒ Activity::Collection
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 562 def detach_instances( = {}) batch = [] = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.detach_instances() end resp.data.activities.each do |a| batch << Activity.new( id: a.activity_id, data: a, client: @client ) end Activity::Collection.new([batch], size: batch.size) end |
#disable_metrics_collection(options = {}) ⇒ EmptyStructure
638 639 640 641 642 643 644 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 638 def disable_metrics_collection( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.disable_metrics_collection() end resp.data end |
#enable_metrics_collection(options = {}) ⇒ EmptyStructure
711 712 713 714 715 716 717 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 711 def enable_metrics_collection( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.enable_metrics_collection() end resp.data end |
#enabled_metrics ⇒ Array<Types::EnabledMetric>
The metrics enabled for the Auto Scaling group.
162 163 164 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 162 def enabled_metrics data[:enabled_metrics] end |
#exists?(options = {}) ⇒ Boolean
Returns true if the AutoScalingGroup exists.
343 344 345 346 347 348 349 350 351 352 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 343 def exists?( = {}) begin wait_until_exists(.merge(max_attempts: 1)) true rescue Aws::Waiters::Errors::UnexpectedError => e raise e.error rescue Aws::Waiters::Errors::WaiterFailed false end end |
#health_check_grace_period ⇒ Integer
The duration of the health check grace period, in seconds, for the Auto Scaling group.
131 132 133 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 131 def health_check_grace_period data[:health_check_grace_period] end |
#health_check_type ⇒ String
One or more comma-separated health check types for the Auto Scaling group.
124 125 126 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 124 def health_check_type data[:health_check_type] end |
#instance_lifecycle_policy ⇒ Types::InstanceLifecyclePolicy
The instance lifecycle policy for the Auto Scaling group.
291 292 293 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 291 def instance_lifecycle_policy data[:instance_lifecycle_policy] end |
#instance_maintenance_policy ⇒ Types::InstanceMaintenancePolicy
An instance maintenance policy.
260 261 262 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 260 def instance_maintenance_policy data[:instance_maintenance_policy] end |
#instances ⇒ Instance::Collection
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1736 def instances batch = [] data[:instances].each do |d| batch << Instance.new( group_name: @name, id: d[:instance_id], data: d, client: @client ) end Instance::Collection.new([batch], size: batch.size) end |
#launch_configuration ⇒ LaunchConfiguration?
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1750 def launch_configuration if data[:launch_configuration_name] LaunchConfiguration.new( name: data[:launch_configuration_name], client: @client ) else nil end end |
#launch_configuration_name ⇒ String
The name of the associated launch configuration for the Auto Scaling group.
47 48 49 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 47 def launch_configuration_name data[:launch_configuration_name] end |
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the Auto Scaling group.
53 54 55 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 53 def launch_template data[:launch_template] end |
#lifecycle_hook(name) ⇒ LifecycleHook
1763 1764 1765 1766 1767 1768 1769 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1763 def lifecycle_hook(name) LifecycleHook.new( group_name: @name, name: name, client: @client ) end |
#lifecycle_hooks(options = {}) ⇒ LifecycleHook::Collection
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1781 def lifecycle_hooks( = {}) batches = Enumerator.new do |y| batch = [] = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_lifecycle_hooks() end resp.data.lifecycle_hooks.each do |l| batch << LifecycleHook.new( group_name: l.auto_scaling_group_name, name: l.lifecycle_hook_name, data: l, client: @client ) end y.yield(batch) end LifecycleHook::Collection.new(batches) end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::AutoScaling::AutoScalingGroup.
Returns self making it possible to chain methods.
auto_scaling_group.reload.data
316 317 318 319 320 321 322 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 316 def load resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_auto_scaling_groups(auto_scaling_group_names: [@name]) end @data = resp.auto_scaling_groups[0] self end |
#load_balancer(name) ⇒ LoadBalancer
1803 1804 1805 1806 1807 1808 1809 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1803 def load_balancer(name) LoadBalancer.new( group_name: @name, name: name, client: @client ) end |
#load_balancer_names ⇒ Array<String>
One or more load balancers associated with the group.
110 111 112 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 110 def load_balancer_names data[:load_balancer_names] end |
#load_balancers(options = {}) ⇒ LoadBalancer::Collection
1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1816 def load_balancers( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_load_balancers() end resp.each_page do |page| batch = [] page.data.load_balancers.each do |l| batch << LoadBalancer.new( group_name: @name, name: l.load_balancer_name, data: l, client: @client ) end y.yield(batch) end end LoadBalancer::Collection.new(batches) end |
#max_instance_lifetime ⇒ Integer
The maximum amount of time, in seconds, that an EC2 instance can be in service for the Auto Scaling group.
209 210 211 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 209 def max_instance_lifetime data[:max_instance_lifetime] end |
#max_size ⇒ Integer
The maximum size of the Auto Scaling group.
71 72 73 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 71 def max_size data[:max_size] end |
#min_size ⇒ Integer
The minimum size of the Auto Scaling group.
65 66 67 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 65 def min_size data[:min_size] end |
#mixed_instances_policy ⇒ Types::MixedInstancesPolicy
The mixed instances policy for the group.
59 60 61 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 59 def mixed_instances_policy data[:mixed_instances_policy] end |
#name ⇒ String Also known as: auto_scaling_group_name
33 34 35 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 33 def name @name end |
#new_instances_protected_from_scale_in ⇒ Boolean
Indicates whether newly launched EC2 instances are protected from termination when scaling in for the Auto Scaling group.
For more information about preventing instances from terminating on scale in, see Use instance scale-in protection in the Amazon EC2 Auto Scaling User Guide.
194 195 196 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 194 def new_instances_protected_from_scale_in data[:new_instances_protected_from_scale_in] end |
#notification_configurations(options = {}) ⇒ NotificationConfiguration::Collection
1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1850 def notification_configurations( = {}) batches = Enumerator.new do |y| = Aws::Util.deep_merge(, auto_scaling_group_names: [@name]) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_notification_configurations() end resp.each_page do |page| batch = [] page.data.notification_configurations.each do |n| batch << NotificationConfiguration.new( group_name: n.auto_scaling_group_name, type: n.notification_type, topic_arn: n.topic_arn, data: n, client: @client ) end y.yield(batch) end end NotificationConfiguration::Collection.new(batches) end |
#operator ⇒ Types::Operator
The entity that manages the Auto Scaling group, if applicable. When set, only the designated operator can make changes to the group configuration.
299 300 301 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 299 def operator data[:operator] end |
#placement_group ⇒ String
The name of the placement group into which to launch EC2 instances for the Auto Scaling group.
150 151 152 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 150 def placement_group data[:placement_group] end |
#policies(options = {}) ⇒ ScalingPolicy::Collection
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1896 def policies( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_policies() end resp.each_page do |page| batch = [] page.data.scaling_policies.each do |s| batch << ScalingPolicy.new( name: s.policy_name, data: s, client: @client ) end y.yield(batch) end end ScalingPolicy::Collection.new(batches) end |
#predicted_capacity ⇒ Integer
The predicted capacity of the group when it has a predictive scaling policy.
84 85 86 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 84 def predicted_capacity data[:predicted_capacity] end |
#put_scaling_policy(options = {}) ⇒ ScalingPolicy
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1034 def put_scaling_policy( = {}) = .merge(auto_scaling_group_name: @name) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.put_scaling_policy() end ScalingPolicy.new( name: [:policy_name], client: @client ) end |
#put_scheduled_update_group_action(options = {}) ⇒ ScheduledAction
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1116 def put_scheduled_update_group_action( = {}) = .merge(auto_scaling_group_name: @name) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.put_scheduled_update_group_action() end ScheduledAction.new( name: [:scheduled_action_name], client: @client ) end |
#resume_processes(options = {}) ⇒ EmptyStructure
1156 1157 1158 1159 1160 1161 1162 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1156 def resume_processes( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.resume_processes() end resp.data end |
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1943 def scheduled_actions( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_scheduled_actions() end resp.each_page do |page| batch = [] page.data.scheduled_update_group_actions.each do |s| batch << ScheduledAction.new( name: s.scheduled_action_name, data: s, client: @client ) end y.yield(batch) end end ScheduledAction::Collection.new(batches) end |
#service_linked_role_arn ⇒ String
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon Web Services on your behalf.
202 203 204 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 202 def service_linked_role_arn data[:service_linked_role_arn] end |
#set_desired_capacity(options = {}) ⇒ EmptyStructure
1182 1183 1184 1185 1186 1187 1188 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1182 def set_desired_capacity( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.set_desired_capacity() end resp.data end |
#status ⇒ String
The current state of the Auto Scaling group when the DeleteAutoScalingGroup operation is in progress.
173 174 175 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 173 def status data[:status] end |
#suspend_processes(options = {}) ⇒ EmptyStructure
1219 1220 1221 1222 1223 1224 1225 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1219 def suspend_processes( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.suspend_processes() end resp.data end |
#suspended_processes ⇒ Array<Types::SuspendedProcess>
The suspended processes associated with the Auto Scaling group.
143 144 145 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 143 def suspended_processes data[:suspended_processes] end |
#tag(key) ⇒ Tag
1966 1967 1968 1969 1970 1971 1972 1973 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1966 def tag(key) Tag.new( key: key, resource_id: @name, resource_type: "auto-scaling-group", client: @client ) end |
#tags ⇒ Tag::Collection
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1976 def batch = [] data[:tags].each do |d| batch << Tag.new( key: d[:key], resource_id: d[:resource_id], resource_type: d[:resource_type], data: d, client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#target_group_arns ⇒ Array<String>
The Amazon Resource Names (ARN) of the target groups for your load balancer.
117 118 119 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 117 def target_group_arns data[:target_group_arns] end |
#termination_policies ⇒ Array<String>
The termination policies for the Auto Scaling group.
179 180 181 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 179 def termination_policies data[:termination_policies] end |
#traffic_sources ⇒ Array<Types::TrafficSourceIdentifier>
The traffic sources associated with this Auto Scaling group.
254 255 256 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 254 def traffic_sources data[:traffic_sources] end |
#update(options = {}) ⇒ AutoScalingGroup
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1638 def update( = {}) = .merge(auto_scaling_group_name: @name) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.update_auto_scaling_group() end AutoScalingGroup.new( name: [:auto_scaling_group_name], client: @client ) end |
#vpc_zone_identifier ⇒ String
One or more comma-separated subnet IDs for the Auto Scaling group.
156 157 158 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 156 def vpc_zone_identifier data[:vpc_zone_identifier] end |
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::AutoScaling::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 491 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ AutoScalingGroup
360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 360 def wait_until_exists( = {}, &block) , params = () waiter = Waiters::GroupExists.new() yield_waiter_and_warn(waiter, &block) if block_given? Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do waiter.wait(params.merge(auto_scaling_group_names: [@name])) end AutoScalingGroup.new({ name: @name, client: @client }) end |
#wait_until_in_service(options = {}, &block) ⇒ AutoScalingGroup
379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 379 def wait_until_in_service( = {}, &block) , params = () waiter = Waiters::GroupInService.new() yield_waiter_and_warn(waiter, &block) if block_given? Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do waiter.wait(params.merge(auto_scaling_group_names: [@name])) end AutoScalingGroup.new({ name: @name, client: @client }) end |
#wait_until_not_exists(options = {}, &block) ⇒ AutoScalingGroup
398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 398 def wait_until_not_exists( = {}, &block) , params = () waiter = Waiters::GroupNotExists.new() yield_waiter_and_warn(waiter, &block) if block_given? Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do waiter.wait(params.merge(auto_scaling_group_names: [@name])) end AutoScalingGroup.new({ name: @name, client: @client }) end |
#warm_pool_configuration ⇒ Types::WarmPoolConfiguration
The warm pool for the group.
221 222 223 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 221 def warm_pool_configuration data[:warm_pool_configuration] end |
#warm_pool_size ⇒ Integer
The current size of the warm pool.
227 228 229 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 227 def warm_pool_size data[:warm_pool_size] end |