lib/fog/oraclecloud/requests/compute/create_instance.rb in fog-oraclecloud-0.1.12 vs lib/fog/oraclecloud/requests/compute/create_instance.rb in fog-oraclecloud-0.1.13
- old
+ new
@@ -1,53 +1,53 @@
-module Fog
- module Compute
- class OracleCloud
- class Real
- def create_instance (name, shape, imagelist, label, sshkeys)
- # This will create an instance using a Launchplan. Consider using an orchestration plan for more control
- # Just in case it's already set
- name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
- body_data = {
- 'instances' => [{
- 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
- 'shape' => shape,
- 'imagelist' => imagelist,
- 'label' => label,
- 'sshkeys' => sshkeys
- }]
- }
- body_data = body_data.reject {|key, value| value.nil?}
- request(
- :method => 'POST',
- :expects => 201,
- :path => "/launchplan/",
- :body => Fog::JSON.encode(body_data),
- :headers => {
- 'Content-Type' => 'application/oracle-compute-v3+json'
- }
- )
- end
- end
-
- class Mock
- def create_instance (name, shape, imagelist, label, sshkeys)
- response = Excon::Response.new
- name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
-
- self.data[:instances][name] = {
- 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
- 'shape' => shape,
- 'imagelist' => imagelist,
- 'label' => label,
- 'sshkeys' => sshkeys,
- 'state' => 'running'
- }
- response.status = 201
- response.body = {
- 'instances' => [self.data[:instances][name]]
- }
- response
- end
- end
- end
- end
-end
+module Fog
+ module Compute
+ class OracleCloud
+ class Real
+ def create_instance (name, shape, imagelist, label, sshkeys)
+ # This will create an instance using a Launchplan. Consider using an orchestration plan for more control
+ # Just in case it's already set
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
+ body_data = {
+ 'instances' => [{
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
+ 'shape' => shape,
+ 'imagelist' => imagelist,
+ 'label' => label,
+ 'sshkeys' => sshkeys
+ }]
+ }
+ body_data = body_data.reject {|key, value| value.nil?}
+ request(
+ :method => 'POST',
+ :expects => 201,
+ :path => "/launchplan/",
+ :body => Fog::JSON.encode(body_data),
+ :headers => {
+ 'Content-Type' => 'application/oracle-compute-v3+json'
+ }
+ )
+ end
+ end
+
+ class Mock
+ def create_instance (name, shape, imagelist, label, sshkeys)
+ response = Excon::Response.new
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
+
+ self.data[:instances][name] = {
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
+ 'shape' => shape,
+ 'imagelist' => imagelist,
+ 'label' => label,
+ 'sshkeys' => sshkeys,
+ 'state' => 'running'
+ }
+ response.status = 201
+ response.body = {
+ 'instances' => [self.data[:instances][name]]
+ }
+ response
+ end
+ end
+ end
+ end
+end