Class: AWS::AutoScaling::ScheduledAction

Inherits:
Core::Resource
  • Object
show all
Defined in:
lib/aws/auto_scaling/scheduled_action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arnString (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def arn
  @arn
end

#auto_scaling_group_nameString (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def auto_scaling_group_name
  @auto_scaling_group_name
end

#desired_capacityInteger (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def desired_capacity
  @desired_capacity
end

#end_timeTime (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def end_time
  @end_time
end

#max_sizeInteger (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def max_size
  @max_size
end

#min_sizeInteger (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def min_size
  @min_size
end

#nameString (readonly)



44
45
46
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 44

def name
  @name
end

#recurrenceString (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def recurrence
  @recurrence
end

#start_timeTime (readonly)



35
36
37
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 35

def start_time
  @start_time
end

Instance Method Details

#deletenil

Deletes the current scheduled action.



123
124
125
126
127
128
129
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 123

def delete
  client_opts = {}
  client_opts[:scheduled_action_name] = name
  client_opts[:auto_scaling_group_name] = auto_scaling_group_name
  client.delete_scheduled_action(client_opts)
  nil
end

#exists?Boolean



114
115
116
117
118
119
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 114

def exists?
  client_opts = {}  
  client_opts[:scheduled_action_names] = [name]
  resp = client.describe_scheduled_actions(client_opts)
  !resp.scheduled_update_group_actions.empty?
end

#groupGroup



69
70
71
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 69

def group
  Group.new(auto_scaling_group_name, :config => config)
end

#update(options = {}) ⇒ nil Also known as: put

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

Options Hash (options):

  • :desired_capacity (Integer)
  • :recurrence (String)
  • :start_time (Time, String)
  • :end_time (Time, String)
  • :min_size (Integer)
  • :max_size (Integer)


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 93

def update options = {}

  client_opts = options.dup
  client_opts[:scheduled_action_name] = name
  client_opts[:auto_scaling_group_name] = auto_scaling_group_name

  # convert these options to timestamps 
  [:start_time, :end_time].each do |opt|
    if client_opts[opt].is_a?(Time)
      client_opts[opt] = client_opts[opt].iso8601
    end
  end

  client.put_scheduled_update_group_action(client_opts)

  nil

end