Sha256: a78e4d520657cb03835384211b6d68443bc19587693aacbbf8495fae77e1346c

Contents?: true

Size: 744 Bytes

Versions: 15

Compression:

Stored size: 744 Bytes

Contents

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

  identity :id

  attribute :metadata
  attribute :created_at, type: :time
  attribute :updated_at, type: :time
  attribute :finished_at, type: :time

  has_one :cluster

  has_many :files, key: :backup_files

  def save!
    requires :collection

    params = {
      "url"    => self.collection.url,
      "backup" => {
        "metadata" => self.metadata,
      },
    }

    if new_record?
      merge_attributes(self.connection.create_backup(params).body["backup"])
    else raise NotImplementedError # update
    end
  end

  def finish!
    requires :id

    merge_attributes(self.connection.finish_backup("id" => self.identity).body["backup"])
  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/backup.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/models/backup.rb
ey-pro-cli-0.0.3 lib/vendor/core/ey-core/models/backup.rb