Class: Brightbox::DatabaseSnapshot

Inherits:
Api
  • Object
show all
Defined in:
lib/brightbox-cli/database_snapshot.rb

Instance Attribute Summary

Attributes inherited from Api

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Api

#attributes, cache_all!, cached_get, conn, #created_on, #exists?, find, find_all_or_warn, find_by_handle, find_or_call, #fog_attributes, #fog_model, #initialize, klass_name, #method_missing, #respond_to_missing?, #to_s

Constructor Details

This class inherits a constructor from Brightbox::Api

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Brightbox::Api

Class Method Details

.allObject



7
8
9
# File 'lib/brightbox-cli/database_snapshot.rb', line 7

def self.all
  conn.database_snapshots.all
end

.default_field_orderObject



25
26
27
# File 'lib/brightbox-cli/database_snapshot.rb', line 25

def self.default_field_order
  %i[id status created_on size name]
end

.get(id) ⇒ Object



11
12
13
# File 'lib/brightbox-cli/database_snapshot.rb', line 11

def self.get(id)
  conn.database_snapshots.get(id)
end

.require_account?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/brightbox-cli/database_snapshot.rb', line 3

def self.require_account?
  true
end

Instance Method Details

#destroyObject



21
22
23
# File 'lib/brightbox-cli/database_snapshot.rb', line 21

def destroy
  fog_model.destroy
end

#to_rowObject



29
30
31
32
33
34
35
# File 'lib/brightbox-cli/database_snapshot.rb', line 29

def to_row
  fog_attributes.merge(
    status: fog_model.state,
    locked: locked?,
    created_on: fog_model.created_at.strftime("%Y-%m-%d")
  )
end

#update(options) ⇒ Object



15
16
17
18
19
# File 'lib/brightbox-cli/database_snapshot.rb', line 15

def update(options)
  self.class.conn.update_database_snapshot(id, options)
  reload
  self
end