lib/fog/oraclecloud/models/database/instance.rb in fog-oraclecloud-0.1.1 vs lib/fog/oraclecloud/models/database/instance.rb in fog-oraclecloud-0.1.2
- old
+ new
@@ -4,11 +4,10 @@
module OracleCloud
class Database
class Instance < Fog::Model
identity :service_name
- attribute :service_name, :aliases => 'display_name'
attribute :version
attribute :status
attribute :description
attribute :identity_domain
attribute :creation_time
@@ -43,20 +42,31 @@
attribute :level
attribute :subscriptionType
attribute :vmPublicKey
attribute :parameters
+ def clean_name
+ name.sub %r{\/.*\/}, ''
+ end
def save
#identity ? update : create
create
end
def ready?
status == "Running"
end
+ def stopping?
+ status == 'Maintenance' || status == 'Terminating'
+ end
+
+ def stopped?
+ status == 'Stopped'
+ end
+
def ip_address
# TODO: Replace with regex
content_url.sub('http://', '')
end
@@ -66,17 +76,15 @@
end
private
def create
- requires :service_name, :edition, :vmPublicKey, :parameters
- data = service.create_instance(service_name, edition, vmPublicKey, parameters,
+ requires :service_name, :edition, :vmPublicKey, :shape, :version
+ data = service.create_instance(service_name, edition, vmPublicKey, shape, version,
:level => level,
:subscriptionType => subscriptionType,
:description => description,
- :version => version,
- :edition => edition,
- :shape => shape)
+ :edition => edition)
end
end
end
end