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



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

def arn
  @arn
end

#auto_scaling_group_nameString (readonly)

Returns the current value of auto_scaling_group_name.

Returns:

  • (String)

    the current value of auto_scaling_group_name



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)

Returns the current value of desired_capacity.

Returns:

  • (Integer)

    the current value of desired_capacity



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

def desired_capacity
  @desired_capacity
end

#end_timeTime (readonly)

Returns the current value of end_time.

Returns:

  • (Time)

    the current value of end_time



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

def end_time
  @end_time
end

#max_sizeInteger (readonly)

Returns the current value of max_size.

Returns:

  • (Integer)

    the current value of max_size



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

def max_size
  @max_size
end

#min_sizeInteger (readonly)

Returns the current value of min_size.

Returns:

  • (Integer)

    the current value of min_size



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

def min_size
  @min_size
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#recurrenceString (readonly)

Returns the current value of recurrence.

Returns:

  • (String)

    the current value of recurrence



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

def recurrence
  @recurrence
end

#start_timeTime (readonly)

Returns the current value of start_time.

Returns:

  • (Time)

    the current value of start_time



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.

Returns:

  • (nil)


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

Returns:

  • (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

Returns:



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.

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)


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