Class: Aws::AutoScaling::AutoScalingGroup
- Inherits:
-
Object
- Object
- Aws::AutoScaling::AutoScalingGroup
- Extended by:
- Deprecations
- Defined in:
- 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_zones ⇒ Array<String>
One or more Availability Zones for the group.
-
#capacity_rebalance ⇒ Boolean
Indicates whether Capacity Rebalancing is enabled.
-
#context ⇒ String
Reserved.
-
#created_time ⇒ Time
The date and time the group was created.
-
#default_cooldown ⇒ Integer
The duration of the default cooldown period, in seconds.
-
#default_instance_warmup ⇒ Integer
The duration of the default instance warmup, in seconds.
-
#desired_capacity ⇒ Integer
The desired size of the 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 group.
-
#health_check_grace_period ⇒ Integer
The duration of the health check grace period, in seconds.
-
#health_check_type ⇒ String
A comma-separated value string of one or more health check types.
-
#launch_configuration_name ⇒ String
The name of the associated launch configuration.
-
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the 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 instance can be in service.
-
#max_size ⇒ Integer
The maximum size of the group.
-
#min_size ⇒ Integer
The minimum size of the 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 instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
-
#placement_group ⇒ String
The name of the placement group into which to launch your instances, if any.
-
#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 group when the DeleteAutoScalingGroup operation is in progress.
-
#suspended_processes ⇒ Array<Types::SuspendedProcess>
The suspended processes associated with the 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 group.
-
#traffic_sources ⇒ Array<Types::TrafficSourceIdentifier>
The traffic sources associated with this Auto Scaling group.
-
#vpc_zone_identifier ⇒ String
One or more subnet IDs, if applicable, separated by commas.
-
#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
- #identifiers ⇒ Object deprecated private Deprecated.
- #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 ‘true` if this resource is loaded.
-
#exists?(options = {}) ⇒ Boolean
Returns ‘true` if 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 '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
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1480 def activities( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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
454 455 456 457 458 459 460 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 454 def attach_instances( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 40 def auto_scaling_group_arn data[:auto_scaling_group_arn] end |
#availability_zones ⇒ Array<String>
One or more Availability Zones for the group.
95 96 97 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 95 def availability_zones data[:availability_zones] end |
#capacity_rebalance ⇒ Boolean
Indicates whether Capacity Rebalancing is enabled.
194 195 196 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 194 def capacity_rebalance data[:capacity_rebalance] end |
#client ⇒ Client
239 240 241 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 239 def client @client end |
#context ⇒ String
Reserved.
212 213 214 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 212 def context data[:context] end |
#created_time ⇒ Time
The date and time the group was created.
126 127 128 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 126 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`.
261 262 263 264 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 261 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
269 270 271 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 269 def data_loaded? !!@data end |
#default_cooldown ⇒ Integer
The duration of the default cooldown period, in seconds.
89 90 91 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 89 def default_cooldown data[:default_cooldown] end |
#default_instance_warmup ⇒ Integer
The duration of the default instance warmup, in seconds.
226 227 228 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 226 def default_instance_warmup data[:default_instance_warmup] end |
#delete(options = {}) ⇒ EmptyStructure
474 475 476 477 478 479 480 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 474 def delete( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') do @client.delete_auto_scaling_group() end resp.data end |
#desired_capacity ⇒ Integer
The desired size of the group.
76 77 78 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 76 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.
220 221 222 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 220 def desired_capacity_type data[:desired_capacity_type] end |
#detach_instances(options = {}) ⇒ Activity::Collection
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 495 def detach_instances( = {}) batch = [] = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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
571 572 573 574 575 576 577 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 571 def disable_metrics_collection( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') do @client.disable_metrics_collection() end resp.data end |
#enable_metrics_collection(options = {}) ⇒ EmptyStructure
644 645 646 647 648 649 650 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 644 def enable_metrics_collection( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') do @client.enable_metrics_collection() end resp.data end |
#enabled_metrics ⇒ Array<Types::EnabledMetric>
The metrics enabled for the group.
151 152 153 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 151 def enabled_metrics data[:enabled_metrics] end |
#exists?(options = {}) ⇒ Boolean
Returns ‘true` if the AutoScalingGroup exists.
276 277 278 279 280 281 282 283 284 285 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 276 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.
120 121 122 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 120 def health_check_grace_period data[:health_check_grace_period] end |
#health_check_type ⇒ String
A comma-separated value string of one or more health check types.
114 115 116 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 114 def health_check_type data[:health_check_type] end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1741 1742 1743 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1741 def identifiers { name: @name } end |
#instances ⇒ Instance::Collection
1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1502 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?
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1516 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.
46 47 48 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 46 def launch_configuration_name data[:launch_configuration_name] end |
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the group.
52 53 54 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 52 def launch_template data[:launch_template] end |
#lifecycle_hook(name) ⇒ LifecycleHook
1529 1530 1531 1532 1533 1534 1535 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1529 def lifecycle_hook(name) LifecycleHook.new( group_name: @name, name: name, client: @client ) end |
#lifecycle_hooks(options = {}) ⇒ LifecycleHook::Collection
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1547 def lifecycle_hooks( = {}) batches = Enumerator.new do |y| batch = [] = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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
249 250 251 252 253 254 255 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 249 def load resp = Aws::Plugins::UserAgent.feature('resource') do @client.describe_auto_scaling_groups(auto_scaling_group_names: [@name]) end @data = resp.auto_scaling_groups[0] self end |
#load_balancer(name) ⇒ LoadBalancer
1569 1570 1571 1572 1573 1574 1575 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1569 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.
101 102 103 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 101 def load_balancer_names data[:load_balancer_names] end |
#load_balancers(options = {}) ⇒ LoadBalancer::Collection
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1582 def load_balancers( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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 instance can be in service.
Valid Range: Minimum value of 0.
188 189 190 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 188 def max_instance_lifetime data[:max_instance_lifetime] end |
#max_size ⇒ Integer
The maximum size of the group.
70 71 72 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 70 def max_size data[:max_size] end |
#min_size ⇒ Integer
The minimum size of the group.
64 65 66 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 64 def min_size data[:min_size] end |
#mixed_instances_policy ⇒ Types::MixedInstancesPolicy
The mixed instances policy for the group.
58 59 60 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 58 def mixed_instances_policy data[:mixed_instances_policy] end |
#name ⇒ String Also known as: auto_scaling_group_name
33 34 35 |
# File '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 instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
171 172 173 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 171 def new_instances_protected_from_scale_in data[:new_instances_protected_from_scale_in] end |
#notification_configurations(options = {}) ⇒ NotificationConfiguration::Collection
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1609 def notification_configurations( = {}) batches = Enumerator.new do |y| = Aws::Util.deep_merge(, auto_scaling_group_names: [@name]) resp = Aws::Plugins::UserAgent.feature('resource') 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 |
#placement_group ⇒ String
The name of the placement group into which to launch your instances, if any.
139 140 141 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 139 def placement_group data[:placement_group] end |
#policies(options = {}) ⇒ ScalingPolicy::Collection
1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1650 def policies( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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.
83 84 85 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 83 def predicted_capacity data[:predicted_capacity] end |
#put_scaling_policy(options = {}) ⇒ ScalingPolicy
962 963 964 965 966 967 968 969 970 971 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 962 def put_scaling_policy( = {}) = .merge(auto_scaling_group_name: @name) Aws::Plugins::UserAgent.feature('resource') do @client.put_scaling_policy() end ScalingPolicy.new( name: [:policy_name], client: @client ) end |
#put_scheduled_update_group_action(options = {}) ⇒ ScheduledAction
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1044 def put_scheduled_update_group_action( = {}) = .merge(auto_scaling_group_name: @name) Aws::Plugins::UserAgent.feature('resource') do @client.put_scheduled_update_group_action() end ScheduledAction.new( name: [:scheduled_action_name], client: @client ) end |
#resume_processes(options = {}) ⇒ EmptyStructure
1084 1085 1086 1087 1088 1089 1090 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1084 def resume_processes( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') do @client.resume_processes() end resp.data end |
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1692 def scheduled_actions( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') 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.
179 180 181 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 179 def service_linked_role_arn data[:service_linked_role_arn] end |
#set_desired_capacity(options = {}) ⇒ EmptyStructure
1110 1111 1112 1113 1114 1115 1116 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1110 def set_desired_capacity( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') do @client.set_desired_capacity() end resp.data end |
#status ⇒ String
The current state of the group when the DeleteAutoScalingGroup operation is in progress.
158 159 160 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 158 def status data[:status] end |
#suspend_processes(options = {}) ⇒ EmptyStructure
1147 1148 1149 1150 1151 1152 1153 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1147 def suspend_processes( = {}) = .merge(auto_scaling_group_name: @name) resp = Aws::Plugins::UserAgent.feature('resource') do @client.suspend_processes() end resp.data end |
#suspended_processes ⇒ Array<Types::SuspendedProcess>
The suspended processes associated with the group.
132 133 134 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 132 def suspended_processes data[:suspended_processes] end |
#tag(key) ⇒ Tag
1715 1716 1717 1718 1719 1720 1721 1722 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1715 def tag(key) Tag.new( key: key, resource_id: @name, resource_type: "auto-scaling-group", client: @client ) end |
#tags ⇒ Tag::Collection
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1725 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.
108 109 110 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 108 def target_group_arns data[:target_group_arns] end |
#termination_policies ⇒ Array<String>
The termination policies for the group.
164 165 166 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 164 def termination_policies data[:termination_policies] end |
#traffic_sources ⇒ Array<Types::TrafficSourceIdentifier>
The traffic sources associated with this Auto Scaling group.
232 233 234 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 232 def traffic_sources data[:traffic_sources] end |
#update(options = {}) ⇒ AutoScalingGroup
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1448 def update( = {}) = .merge(auto_scaling_group_name: @name) Aws::Plugins::UserAgent.feature('resource') do @client.update_auto_scaling_group() end AutoScalingGroup.new( name: [:auto_scaling_group_name], client: @client ) end |
#vpc_zone_identifier ⇒ String
One or more subnet IDs, if applicable, separated by commas.
145 146 147 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 145 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
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 424 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.feature('resource') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ AutoScalingGroup
293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 293 def wait_until_exists( = {}, &block) , params = () waiter = Waiters::GroupExists.new() yield_waiter_and_warn(waiter, &block) if block_given? Aws::Plugins::UserAgent.feature('resource') 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
312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 312 def wait_until_in_service( = {}, &block) , params = () waiter = Waiters::GroupInService.new() yield_waiter_and_warn(waiter, &block) if block_given? Aws::Plugins::UserAgent.feature('resource') 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
331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 331 def wait_until_not_exists( = {}, &block) , params = () waiter = Waiters::GroupNotExists.new() yield_waiter_and_warn(waiter, &block) if block_given? Aws::Plugins::UserAgent.feature('resource') 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.
200 201 202 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 200 def warm_pool_configuration data[:warm_pool_configuration] end |
#warm_pool_size ⇒ Integer
The current size of the warm pool.
206 207 208 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 206 def warm_pool_size data[:warm_pool_size] end |