lib/fog/oraclecloud/database.rb in fog-oraclecloud-0.1.1 vs lib/fog/oraclecloud/database.rb in fog-oraclecloud-0.1.2
- old
+ new
@@ -40,11 +40,11 @@
}.merge!(params[:headers] || {})
}), &block)
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
- Fog::Oracle::Database::NotFound.slurp(error)
+ Fog::OracleCloud::Database::NotFound.slurp(error)
else
error
end
end
#https://jaas.oraclecloud.com/paas/service/jcs/api/v1.1/instances/agriculture/status/create/job/2781084
@@ -60,54 +60,25 @@
class Mock
def initialize(options={})
@username = options[:oracle_username]
@password = options[:oracle_password]
@identity_domain = options[:oracle_domain]
-
- @connection = Fog::XML::Connection.new("https://dbaas.oraclecloud.com")
end
- def self.data
- @data ||= Hash.new do |hash, key|
- hash[key] = {
- :instances => {}
- }
- end
+ def self.data
+ @data ||= {
+ :instances => {},
+ :deleted_at => {},
+ :created_at => {}
+ }
end
- def data
- self.class.data[@oracle_username]
+ def self.reset
+ @data = nil
end
-
- # Remove, jsut for testing
- def auth_header
- auth_header ||= 'Basic ' + Base64.encode64("#{@username}:#{@password}").gsub("\n",'')
- end
- def request(params, parse_json = true, &block)
- begin
- response = @connection.request(params.merge!({
- :headers => {
- 'Authorization' => auth_header,
- 'X-ID-TENANT-NAME' => @identity_domain,
- 'Content-Type' => 'application/json',
- #'Accept' => 'application/json'
- }.merge!(params[:headers] || {})
- }), &block)
- rescue Excon::Errors::HTTPStatusError => error
- raise case error
- when Excon::Errors::NotFound
- Fog::OracleCloud::Database::NotFound.slurp(error)
- else
- error
- end
- end
- #https://jaas.oraclecloud.com/paas/service/jcs/api/v1.1/instances/agriculture/status/create/job/2781084
- if !response.body.empty? && parse_json
- # The Oracle Cloud doesn't return the Content-Type header as application/json, rather as application/vnd.com.oracle.oracloud.provisioning.Pod+json
- # Should add check here to validate, but not sure if this might change in future
- response.body = Fog::JSON.decode(response.body)
- end
- response
+
+ def data
+ self.class.data
end
end
end
end
end