Class: Ey::Core::Client::AutoScalingGroup

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/auto_scaling_group.rb

Instance Method Summary collapse

Methods included from Associations

assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader

Methods inherited from Model

range_parser, #save, #to_s, #update!, #url

Instance Method Details

#destroyObject



18
19
20
# File 'lib/ey-core/models/auto_scaling_group.rb', line 18

def destroy
  connection.requests.new(connection.destroy_auto_scaling_group("id" => self.identity).body["request"])
end

#save!Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ey-core/models/auto_scaling_group.rb', line 22

def save!
  if new_record?
    requires :maximum_size, :minimum_size, :environment

    params = {
      "url"                => self.collection.url,
      "environment"        => self.environment_id,
      "auto_scaling_group" => {
        "maximum_size" => self.maximum_size,
        "minimum_size" => self.minimum_size,
      }
    }

    connection.requests.new(connection.create_auto_scaling_group(params).body["request"])
  else
    requires :identity

    params = {
      "id" => self.identity,
      "auto_scaling_group" => {
        "maximum_size" => self.maximum_size,
        "minimum_size" => self.minimum_size,
        "desired_capacity" => self.desired_capacity
      }
    }

    connection.requests.new(connection.update_auto_scaling_group(params).body["request"])
  end
end

#simple_auto_scaling_policiesObject



52
53
54
# File 'lib/ey-core/models/auto_scaling_group.rb', line 52

def simple_auto_scaling_policies
  auto_scaling_policies("simple")
end

#step_auto_scaling_policiesObject



56
57
58
# File 'lib/ey-core/models/auto_scaling_group.rb', line 56

def step_auto_scaling_policies
  auto_scaling_policies("step")
end

#target_auto_scaling_policiesObject



60
61
62
# File 'lib/ey-core/models/auto_scaling_group.rb', line 60

def target_auto_scaling_policies
  auto_scaling_policies("target")
end