You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

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)

Returns the current value of arn

Returns:

  • (String)

    the current value of arn



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def arn
  @arn
end

#desired_capacityInteger (readonly)

Returns the current value of desired_capacity

Returns:

  • (Integer)

    the current value of desired_capacity



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def desired_capacity
  @desired_capacity
end

#end_timeTime (readonly)

Returns the current value of end_time

Returns:

  • (Time)

    the current value of end_time



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def end_time
  @end_time
end

#groupObject (readonly)

Returns the value of attribute group



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

def group
  @group
end

#max_sizeInteger (readonly)

Returns the current value of max_size

Returns:

  • (Integer)

    the current value of max_size



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def max_size
  @max_size
end

#min_sizeInteger (readonly)

Returns the current value of min_size

Returns:

  • (Integer)

    the current value of min_size



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def min_size
  @min_size
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#recurrenceString (readonly)

Returns the current value of recurrence

Returns:

  • (String)

    the current value of recurrence



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def recurrence
  @recurrence
end

#start_timeTime (readonly)

Returns the current value of start_time

Returns:

  • (Time)

    the current value of start_time



33
34
35
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 33

def start_time
  @start_time
end

Instance Method Details

#auto_scaling_group_nameString

Returns:

  • (String)


48
49
50
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 48

def auto_scaling_group_name
  group.name
end

#deletenil

Deletes the current scheduled action.

Returns:

  • (nil)


118
119
120
121
# File 'lib/aws/auto_scaling/scheduled_action.rb', line 118

def delete
  client.delete_scheduled_action(resource_options)
  nil
end

#exists?Boolean

Returns:

  • (Boolean)


106
107
108
109
110
111
112
113
114
# 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

#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.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

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

Returns:

  • (nil)


92
93
94
95
96
97
98
99
100
101
102
# 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