Class: Fog::Sql::AzureRM::SqlDatabase

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/azurerm/models/sql/sql_database.rb

Overview

Sql Database model for Database Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(database) ⇒ Object



28
29
30
31
32
33
# File 'lib/fog/azurerm/models/sql/sql_database.rb', line 28

def self.parse(database)
  database_hash = get_hash_from_object(database)
  database_hash['resource_group'] = get_resource_group_from_id(database.id)
  database_hash['server_name'] = get_resource_from_resource_id(database.id, 8)
  database_hash
end

Instance Method Details

#destroyObject



41
42
43
# File 'lib/fog/azurerm/models/sql/sql_database.rb', line 41

def destroy
  service.delete_database(resource_group, server_name, name)
end

#saveObject



35
36
37
38
39
# File 'lib/fog/azurerm/models/sql/sql_database.rb', line 35

def save
  requires :resource_group, :server_name, :name, :location
  sql_database = service.create_or_update_database(format_database_params)
  merge_attributes(Fog::Sql::AzureRM::SqlDatabase.parse(sql_database))
end