You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.
Class: AWS::AutoScaling::ScheduledActionCollection
- Inherits:
-
Object
- Object
- AWS::AutoScaling::ScheduledActionCollection
- Includes:
- Core::Collection::WithLimitAndNextToken
- Defined in:
- lib/aws/auto_scaling/scheduled_action_collection.rb
Instance Method Summary collapse
-
#[](name) ⇒ ScheduledAction
-
#create(name, options = {}) ⇒ ScheduledAction
(also: #put)
Creates a scheduled scaling action for an Auto Scaling group.
-
#filter(filters = {}) ⇒ ScheduledActionCollection
Returns a new ScheduledActionCollection filtered by the given options.
Methods included from Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Instance Method Details
#[](name) ⇒ ScheduledAction
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/aws/auto_scaling/scheduled_action_collection.rb', line 79 def [] name if group_name = @filters[:auto_scaling_group_name] group = Group.new(group_name, :config => config) ScheduledAction.new(group, name) else msg = 'uou must filter this collection by a group to get a ' + 'scheduled action by name' raise msg end end |
#create(name, options = {}) ⇒ ScheduledAction Also known as: put
Creates a scheduled scaling action for an Auto Scaling group. If you leave a parameter unspecified, the corresponding attribute remains unchanged in the group.
You must specify an Auto Scaling group. This can be implicit or explicit:
# given explicitly
auto_scaling.scheduled_actions.create('action-name', :group => 'group-name')
# implied by the group
group = auto_scaling.groups.first
group.scheduled_actions.create('action-name')
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/aws/auto_scaling/scheduled_action_collection.rb', line 63 def create name, = {} group = auto_scaling_group() scheduled_action = ScheduledAction.new(group, name, :auto_scaling_group_name => group.name, :config => config) scheduled_action.update() scheduled_action end |
#filter(filters = {}) ⇒ ScheduledActionCollection
Returns a new AWS::AutoScaling::ScheduledActionCollection filtered by the given options.
auto_scaling.scheduled_actions.filter(:end_time => Time.now).each do |a|
# ...
end
You can chain filter calls:
actions = auto_scaling.scheduled_actions.
filter(:group => 'auto-scaling-group-name').
filter(:start_time => Time.now - 3600).
filter(:end_time => Time.now)
actions.each {|scheduled_action| ... }
129 130 131 132 133 134 135 |
# File 'lib/aws/auto_scaling/scheduled_action_collection.rb', line 129 def filter filters = {} init_opts = {} init_opts[:config] = config init_opts[:filters] = @filters init_opts[:filters].merge!(filter_opts(filters)) ScheduledActionCollection.new(init_opts) end |