lib/fog/oraclecloud/requests/database/backup_instance.rb in fog-oraclecloud-0.1.12 vs lib/fog/oraclecloud/requests/database/backup_instance.rb in fog-oraclecloud-0.1.13

- old
+ new

@@ -1,45 +1,45 @@ -module Fog - module OracleCloud - class Database - class Real - - def backup_instance(service_name) - # Oracle Cloud requires an empty JSON object in the body - body_data = {} - - response = request( - :method => 'POST', - :expects => 202, - :path => "/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}/#{service_name}/backups", - :body => Fog::JSON.encode(body_data), - ) - response.database_id = service_name - response - end - end - - class Mock - def backup_instance(service_name) - response = Excon::Response.new - - if !self.data[:backups][service_name].is_a? Array - self.data[:backups][service_name] = [] - end - self.data[:backups][service_name].push({ - 'backupCompleteDate'=>Time.now.strftime('%d-%b-%Y %H:%M:%S UTC'), - 'dbTag'=>'TAG' + Time.now.strftime('%Y%m%dT%H%M%S'), - 'status'=>'IN PROGRESS', - 'database_id'=>service_name - }) - if !self.data[:created_at][:backups] - self.data[:created_at][:backups] = {} - self.data[:created_at][:backups][service_name] = [] - end - self.data[:created_at][:backups][service_name].push(Time.now) - response.status = 202 - response - end - end - end - end -end +module Fog + module OracleCloud + class Database + class Real + + def backup_instance(service_name) + # Oracle Cloud requires an empty JSON object in the body + body_data = {} + + response = request( + :method => 'POST', + :expects => 202, + :path => "/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}/#{service_name}/backups", + :body => Fog::JSON.encode(body_data), + ) + response.database_id = service_name + response + end + end + + class Mock + def backup_instance(service_name) + response = Excon::Response.new + + if !self.data[:backups][service_name].is_a? Array + self.data[:backups][service_name] = [] + end + self.data[:backups][service_name].push({ + 'backupCompleteDate'=>Time.now.strftime('%d-%b-%Y %H:%M:%S UTC'), + 'dbTag'=>'TAG' + Time.now.strftime('%Y%m%dT%H%M%S'), + 'status'=>'IN PROGRESS', + 'database_id'=>service_name + }) + if !self.data[:created_at][:backups] + self.data[:created_at][:backups] = {} + self.data[:created_at][:backups][service_name] = [] + end + self.data[:created_at][:backups][service_name].push(Time.now) + response.status = 202 + response + end + end + end + end +end