Class: Fog::Compute::Brightbox::DatabaseServer

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/brightbox/models/compute/database_server.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



67
68
69
70
71
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 67

def destroy
  requires :identity
  merge_attributes(service.destroy_database_server(identity))
  true
end

#ready?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 57

def ready?
  state == "active"
end

#reset_passwordObject



73
74
75
76
77
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 73

def reset_password
  requires :identity
  merge_attributes(service.reset_password_database_server(identity))
  true
end

#saveObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 33

def save
  options = {
    :name => name,
    :description => description
  }

  options[:allow_access] = allow_access if allow_access

  if persisted?
    data = update_database_server(options)
  else
    options[:snapshot] = snapshot_id if snapshot_id
    options[:engine] = database_engine if database_engine
    options[:version] = database_version if database_version
    options[:database_type] = flavor_id if flavor_id
    options[:zone] = zone_id if zone_id

    data = create_database_server(options)
  end

  merge_attributes(data)
  true
end

#snapshotObject



61
62
63
64
65
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 61

def snapshot
  requires :identity
  merge_attributes(service.snapshot_database_server(identity))
  true
end