Sha256: b3ea229de1e844a8f533c8d75ce231325623026b74eef0b00de1089380ae03ea

Contents?: true

Size: 1.37 KB

Versions: 15

Compression:

Stored size: 1.37 KB

Contents

class Ey::Core::Client::Slot < Ey::Core::Model
  extend Ey::Core::Associations

  identity :id

  attribute :created_at, type: :time
  attribute :deleted_at, type: :time
  attribute :disabled_at, type: :time
  attribute :disable_requested_at, type: :time
  attribute :flavor
  attribute :image
  attribute :name
  attribute :retired_at, type: :time
  attribute :updated_at, type: :time
  attribute :volumes, type: :array

  has_one :cluster
  has_one :server

  has_many :slot_components, aliases: "components"

  def retire
    return false if new_record?
    params = {
      "id" => id,
      "slot" => {
        "retired" => true
      }
    }

    merge_attributes(self.connection.update_slot(params).body["slot"])
  end

  def disable
    return false if new_record?
    params = {
      "id" => id,
      "slot" => {
        "disabled" => true
      }
    }

    merge_attributes(self.connection.update_slot(params).body["slot"])
  end

  def save!
    raise NotImplementedError, "Cannot create or update a single slot"
=begin
    params = {
      "cluster" => self.cluster_id,
      "url"     => self.collection.url,
      "slot"    => {
        "image"   => self.image,
        "flavor"  => self.flavor,
      },
    }

    if new_record?
      self.connections.slots.load(self.connection.create_slot(params).body["slot"])
    else raise NotImplementedError # update
    end
=end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ey-pro-cli-0.0.17 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/models/slot.rb
ey-pro-cli-0.0.3 lib/vendor/core/ey-core/models/slot.rb