class AWS::AutoScaling::ScheduledAction

@attr_reader [Integer] desired_capacity

@attr_reader [String] recurrence

@attr_reader [Time] start_time

@attr_reader [Time] end_time

@attr_reader [Integer] min_size

@attr_reader [Integer] max_size

@attr_reader [String] arn

Attributes

group[R]
name[R]

@return [String]

Public Class Methods

new(group, name, options = {}) click to toggle source

@api private

Calls superclass method AWS::Core::Resource.new
# File lib/aws/auto_scaling/scheduled_action.rb, line 36
def initialize group, name, options = {}
  @group = group
  @name = name
  super
end

Public Instance Methods

auto_scaling_group_name() click to toggle source

@return [String]

# File lib/aws/auto_scaling/scheduled_action.rb, line 48
def auto_scaling_group_name
  group.name
end
delete() click to toggle source

Deletes the current scheduled action. @return [nil]

# File lib/aws/auto_scaling/scheduled_action.rb, line 118
def delete
  client.delete_scheduled_action(resource_options)
  nil
end
exists?() click to toggle source

@return [Boolean]

# File lib/aws/auto_scaling/scheduled_action.rb, line 106
def exists?
  client_opts = {}
  client_opts[:scheduled_action_names] = [name]
  client_opts[:auto_scaling_group_name] = auto_scaling_group_name
  resp = client.describe_scheduled_actions(client_opts)
  !resp.scheduled_update_group_actions.empty?
rescue Errors::ValidationError
  false
end
put(options = {})
Alias for: update
update(options = {}) click to toggle source

Updates the scheduled action. If you omit an option, the corresponding value remains unchanged in the Auto Scaling group.

@param [Hash] options

@option options [Integer] :desired_capacity

@option options [String] :recurrence

@option options [Time,String] :start_time

@option options [Time,String] :end_time

@option options [Integer] :min_size

@option options [Integer] :max_size

@return [nil]

# File lib/aws/auto_scaling/scheduled_action.rb, line 92
def update options = {}
  options.update(resource_options)
  # convert times to formatted strings
  [:start_time, :end_time].each do |opt|
    if options[opt].is_a?(Time)
      options[opt] = options[opt].iso8601
    end
  end
  client.put_scheduled_update_group_action(options)
  nil
end
Also aliased as: put

Protected Instance Methods

get_resource(attr_name = nil) click to toggle source
# File lib/aws/auto_scaling/scheduled_action.rb, line 132
def get_resource attr_name = nil
  client_opts = {}
  client_opts[:scheduled_action_names] = [name]
  client_opts[:auto_scaling_group_name] = auto_scaling_group_name
  client.describe_scheduled_actions(client_opts)
end
resource_identifiers() click to toggle source
# File lib/aws/auto_scaling/scheduled_action.rb, line 125
def resource_identifiers
  [
    [:auto_scaling_group_name, auto_scaling_group_name],
    [:scheduled_action_name, name],
  ]
end