class Fog::Compute::ProfitBricks::Mock
Public Class Methods
data()
click to toggle source
# File lib/fog/profitbricks/compute.rb, line 183 def self.data dc_1_id = Fog::UUID.uuid dc_2_id = Fog::UUID.uuid serv_1_id = Fog::UUID.uuid vol_1_id = Fog::UUID.uuid vol_2_id = Fog::UUID.uuid req_1_id = Fog::UUID.uuid req_2_id = Fog::UUID.uuid nic_1_id = Fog::UUID.uuid nic_2_id = Fog::UUID.uuid ipb_1_id = Fog::UUID.uuid ipb_2_id = Fog::UUID.uuid fwr_1_id = Fog::UUID.uuid fwr_2_id = Fog::UUID.uuid lb_1_id = Fog::UUID.uuid lb_2_id = Fog::UUID.uuid @data ||= Hash.new do |hash, key| hash[key] = { :datacenters => { "id" => "datacenters", "type" => "collection", "href" => "https://api.profitbricks.com/rest/v2/datacenters", "items" => [ { 'id' => dc_1_id, 'type' => 'datacenter', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8702', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'dc_1', 'description' => 'testing fog rest implementation', 'location' => 'us/las', 'version' => 1, 'features' => ["SSD", "MULTIPLE_CPU"] } }, { 'id' => dc_2_id, 'type' => 'datacenter', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_2_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8702', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' =>{ 'name' => 'dc_2', 'description' => 'testing fog rest implementation', 'location' => 'de/fkb', 'version' => 1, 'features' => ["SSD", "MULTIPLE_CPU"] } } ] }, :servers => { 'id' => 'servers', 'type' => 'collection', "href" => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers", 'items' => [ { 'id' => serv_1_id, 'type' => 'server', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}", 'metadata' => { 'createdDate' => '2014-10-20T21:20:46Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '0018832d7a7ba455db74ac41ae9f11fe', 'lastModifiedDate' => '2015-03-18T21:31:10Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogTestServer_1', 'cores' => 1, 'ram' => 1024, 'availabilityZone' => 'AUTO', 'vmState' => 'RUNNING', 'bootVolume' => { 'id' => 'c04a2198-7e60-4bc0-b869-6e9c9dbcb8e1', 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/c04a2198-7e60-4bc0-b869-6e9c9dbcb8e1", 'metadata' => { 'createdDate' => '2014-10-20T21:20:46Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '7a539b539d8ca9e08c5ac5e63c9c4c8f', 'lastModifiedDate' => '2014-10-20T21:20:46Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Storage', 'type' => 'HDD', 'size' => 50, 'image' => '4f363db0-4955-11e4-b362-52540066fee9', 'bus' => 'VIRTIO', 'licenceType' => 'LINUX', 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'true', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 1 } }, 'cpuFamily' => 'AMD_OPTERON' }, 'entities' => { 'cdroms' => { 'id' => "#{serv_1_id}/cdroms", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/cdroms", 'items' => [ ] }, 'volumes' => { 'id' => "#{serv_1_id}/volumes", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/volumes", 'items' => [ { 'id' => 'c04a2198-7e60-4bc0-b869-6e9c9dbcb8e1', 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/c04a2198-7e60-4bc0-b869-6e9c9dbcb8e1", 'metadata' => { 'createdDate' => '2014-10-20T21:20:46Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '7a539b539d8ca9e08c5ac5e63c9c4c8f', 'lastModifiedDate' => '2014-10-20T21:20:46Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Storage', 'type' => 'HDD', 'size' => 50, 'image' => '4f363db0-4955-11e4-b362-52540066fee9', 'bus' => 'VIRTIO', 'licenceType' => 'LINUX', 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'true', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 1 } }, { 'id' => '5c4d37ca-d620-4546-8b24-f92e3c608c2c', 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/5c4d37ca-d620-4546-8b24-f92e3c608c2c", 'metadata' => { 'createdDate' => '2015-03-18T21:31:10Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '0018832d7a7ba455db74ac41ae9f11fe', 'lastModifiedDate' => '2015-03-18T21:31:10Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Docker Registry Volume', 'type' => 'HDD', 'size' => 50, 'bus' => 'VIRTIO', 'licenceType' => 'OTHER', 'cpuHotPlug' => 'false', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'false', 'nicHotUnplug' => 'false', 'discVirtioHotPlug' => 'false', 'discVirtioHotUnplug' => 'false', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 2 } } ] }, 'nics' => { 'id' => "#{serv_1_id}/nics", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics", 'items' => [ { 'id' => '01ea3bd9-047c-4941-85cf-ed6b7a2d1d7d', 'type' => 'nic', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/01ea3bd9-047c-4941-85cf-ed6b7a2d1d7d", 'metadata' => { 'createdDate' => '2015-02-09T22:46:38Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'b4854a82738079d2c7f43b5324bd92e3', 'lastModifiedDate' => '2015-02-09T22:46:38Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'mac' => '00:02:94:9e:f4:b0', 'ips' => [ '210.94.35.77' ], 'dhcp' => 'true', 'lan' => 1, 'firewallActive' => 'false' }, 'entities' => { 'firewallrules' => { 'id' => '01ea3bd9-047c-4941-85cf-ed6b7a2d1d7d/firewallrules', 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/664f0f1c-7384-462b-8f0c-cfc4c3f6e2a3/nics/01ea3bd9-047c-4941-85cf-ed6b7a2d1d7d/firewallrules", 'items' => [ ] } } } ] } }, 'datacenter_id' => dc_1_id } ] }, :locations => { "id" => "locations", "type" => "collection", "href" => "https://api.profitbricks.com/rest/v2/locations", "items" => [ { 'id' => 'de/fkb', 'type' => 'location', 'href' => 'https://api.profitbricks.com/rest/v2/locations/de/fkb', 'properties' => { 'name' => 'karlsruhe', 'features' => [ "SSD", "MULTIPLE_CPU" ] } }, { 'id' => 'de/fra', 'type' => 'location', 'href' => 'https://api.profitbricks.com/rest/v2/locations/de/fra', 'properties' => { 'name' => 'frankfurt', 'features' => [ "SSD", "MULTIPLE_CPU" ] } }, { 'id' => 'us/las', 'type' => 'location', 'href' => 'https://api.profitbricks.com/rest/v2/locations/us/las', 'properties' => { 'name' => 'lasvegas', 'features' => [ "SSD", "MULTIPLE_CPU" ] } } ] }, :images => { "id" => "images", "type" => "collection", "href" => "https://api.profitbricks.com/rest/v2/images", "items" => [ { 'id' => 'dfcb40db-28b5-11e6-9336-52540005ab80', 'type' => 'image', 'href' => 'https=>//api.profitbricks.com/rest/v2/images/dfcb40db-28b5-11e6-9336-52540005ab80', 'metadata' => { 'createdDate' => '2016-06-02T11:33:49Z', 'createdBy' => 'System', 'etag' => '9909709d99655c6f31aca789998d7d89', 'lastModifiedDate' => '2016-06-02T11:33:49Z', 'lastModifiedBy' => 'System', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'CentOS-6.8-x86_64-netinstall.iso', 'description' => '', 'location' => 'us/las', 'size' => 0.23, 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'true', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'licenceType' => 'LINUX', 'imageType' => 'CDROM', 'public' => 'true' } }, { 'id' => '05cadf29-6c12-11e4-beeb-52540066fee9', 'type' => 'image', 'href' => 'https=>//api.profitbricks.com/rest/v2/images/05cadf29-6c12-11e4-beeb-52540066fee9', 'metadata' => { 'createdDate' => '2014-11-14T15:22:19Z', 'createdBy' => 'System', 'etag' => '957e0eac7456fa7554e73bf0d18860eb', 'lastModifiedDate' => '2014-11-14T15=>22=>19Z', 'lastModifiedBy' => 'System', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Microsoft-SQL-2012-Full-trial-english.iso', 'description' => '', 'location' => 'us/las', 'size' => 4, 'cpuHotPlug' => 'false', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'false', 'nicHotUnplug' => 'false', 'discVirtioHotPlug' => 'false', 'discVirtioHotUnplug' => 'false', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'licenceType' => 'OTHER', 'imageType' => 'CDROM', 'public' => 'true' } } ] }, :flavors => [ { 'flavorId' => Fog::UUID.uuid, 'flavorName' => 'Micro', 'ram' => 1024, 'disk' => 50, 'cores' => 1 }, { 'flavorId' => Fog::UUID.uuid, 'flavorName' => 'Small', 'ram' => 2048, 'disk' => 50, 'cores' => 1 } ], :volumes => { "id" => "#{dc_1_id}/volumes", "type" => 'collection', "href" => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes", "items" => [ { 'id' => vol_1_id, 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/#{vol_1_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'c4a2fde6ba91a038ff953b939cc21efe', 'lastModifiedDate' => '2015-03-18T19=>00=>51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'master 1 Storage', 'type' => 'HDD', 'size' => 50, 'image' => '681673e7-bfc2-11e4-850c-52540066fee9', 'bus' => 'VIRTIO', 'licenceType' => 'OTHER', 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 1 }, 'datacenter_id' => dc_1_id }, { 'id' => vol_2_id, 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/#{vol_2_id}", 'metadata' => { 'createdDate' => '2015-03-18T21:31:10Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '0018832d7a7ba455db74ac41ae9f11fe', 'lastModifiedDate' => '2015-03-18T21:31:10Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Docker Registry Volume', 'type' => 'HDD', 'size' => 50, 'bus' => 'VIRTIO', 'licenceType' => 'OTHER', 'cpuHotPlug' => 'false', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'false', 'nicHotUnplug' => 'false', 'discVirtioHotPlug' => 'false', 'discVirtioHotUnplug' => 'false', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 2 }, 'datacenter_id' => dc_1_id } ] }, :lans => { 'id' => "#{dc_1_id}/lans", 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/lans", 'items' => [ { 'id' => '9', 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/lans/9", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f1', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogTestLAN_1', 'public' => 'true' }, 'entities' => { 'nics' => { 'id' => '9/nics', 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/lans/9/nics", 'items' => [ ] } }, 'datacenter_id' => dc_1_id } ] }, :nics => { 'id' => "#{serv_1_id}/nics", 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics", 'items' => [ { 'id' => nic_1_id, 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f1', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogTestNIC_1', 'mac' => '02:01:36:5f:09:da', 'ips' => [ '10.9.194.12'], 'dhcp' => 'true', 'lan' => 2, 'firewallActive' => 'false' }, 'entities' => { 'firewallrules' => { 'id' => "#{nic_1_id}/firewallrules", 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}/firewallrules", 'items' => [ ] } }, 'datacenter_id' => dc_1_id }, { 'id' => nic_2_id, 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_2_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f1', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogTestNIC_2', 'mac' => '03:01:60:bf:d4:8a', 'ips' => [ '192.96.159.188' ], 'dhcp' => 'true', 'lan' => 1, 'firewallActive' => 'false' }, 'entities'=> { 'firewallrules'=> { 'id'=> 'cf6d01d3-295d-48bd-8d07-568cce63cbbc/firewallrules', 'type'=> 'collection', 'href'=> "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_2_id}/firewallrules", 'items'=> [ ] } }, 'datacenter_id' => dc_1_id } ] }, :snapshots => { 'id' => 'snapshots', 'type' => 'collection', 'href' => 'https =>//api.profitbricks.com/rest/v2/snapshots', 'items' => [ { 'id' => '3d52b13d-bec4-49de-ad05-fd2f8c687be6', 'type' => 'snapshot', 'href' => 'https =>//api.profitbricks.com/rest/v2/snapshots/3d52b13d-bec4-49de-ad05-fd2f8c687be6', 'metadata' => { 'createdDate' => '2016-08-07T22:28:38Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '83ad78a4757ab0d9bdeaebc3a6485dcf', 'lastModifiedDate' => '2016-08-07T22:28:38Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogTestSnapshot', 'description' => 'Testing fog create volume snapshot', 'location' => 'de/fkb', 'size' => 5, 'cpuHotPlug' => 'false', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'false', 'nicHotUnplug' => 'false', 'discVirtioHotPlug' => 'false', 'discVirtioHotUnplug' => 'false', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'licenceType' => 'LINUX' } } ] }, :requests => { 'id' => 'requests', 'type' => 'collection', 'href' => 'https=>//api.profitbricks.com/rest/v2/requests', 'items' => [ { 'id' => req_1_id, 'type' => 'request', 'href' => "https=>//api.profitbricks.com/rest/v2/requests/#{req_1_id}", 'metadata' => { 'createdDate' => '2016-08-07T23:32:17Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '37a6259cc0c1dae299a7866489dff0bd', 'requestStatus' => { 'id' => "#{req_1_id}/status", 'type' => 'request-status', 'href' => "https://api.profitbricks.com/rest/v2/requests/#{req_1_id}/status" } }, 'properties' => { 'method' => 'POST', 'headers' => { 'content-type' => 'application/x-www-form-urlencoded', 'connection' => 'Keep-Alive', 'host' => 'api.profitbricks.com', 'x-forwarded-for' => '100.00.00.01', 'content-length' => '47', 'x-forwarded-host' => 'api.profitbricks.com', 'x-reseller' => 'pb.domain', 'user-agent' => 'fog-core/1.42.0', 'x-forwarded-server' => 'my.profitbricks.com' }, 'body' => '{\snapshotId\: \3d52b13d-bec4-49de-ad05-fd2f8c687be6\}', 'url' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/#{vol_1_id}/restore-snapshot" } }, { 'id' => req_2_id, 'type' => 'request', 'href' => "https=>//api.profitbricks.com/rest/v2/requests/#{req_2_id}", 'metadata' => { 'createdDate' => '2016-08-07T23:32:17Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '37a6259cc0c1dae299a7866489dff0bd', 'requestStatus' => { 'id' => "#{req_2_id}/status", 'type' => 'request-status', 'href' => "https://api.profitbricks.com/rest/v2/requests/#{req_2_id}/status" } }, 'properties' => { 'method' => 'POST', 'headers' => { 'content-type' => 'application/x-www-form-urlencoded', 'connection' => 'Keep-Alive', 'host' => 'api.profitbricks.com', 'x-forwarded-for' => '100.00.00.01', 'content-length' => '47', 'x-forwarded-host' => 'api.profitbricks.com', 'x-reseller' => 'pb.domain', 'user-agent' => 'fog-core/1.42.0', 'x-forwarded-server' => 'my.profitbricks.com' }, 'body' => '{\snapshotId\: \3d52b13d-bec4-49de-ad05-fd2f8c687be6\}', 'url' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/volumes/#{vol_2_id}/restore-snapshot" } } ] }, :request_status => { 'id' => "#{req_1_id}/status", 'type' => 'request-status', 'href' => "https=>//api.profitbricks.com/rest/v2/requests/#{req_1_id}/status", 'metadata' => { 'status' => 'DONE', 'message' => 'Request has been successfully executed', 'etag' => '2ba22e58ca17bb728d522bba36cf8350', 'targets' => [ { 'target' => { 'id' => '752df03a-b9a6-48ee-b9f5-58433184aa1a', 'type' => 'volume', 'href' => 'TO_BE_INJECTED' }, 'status' => 'DONE' } ] } }, :ip_blocks => { 'id' => 'ipblocks', 'type' => 'collection', 'href' => 'https://api.profitbricks.com/rest/v2/ipblocks', 'items' => [ { 'id' => ipb_1_id, 'type' => 'ipblock', 'href' => "https://api.profitbricks.com/rest/v2/ipblocks/#{ipb_1_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8702', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'ips' => ["111.111.111.111", "222.222.222.222"], 'location' => 'us/las', 'size' => 2, 'name' => 'Fog test IP Block 1' } }, { 'id' => ipb_2_id, 'type' => 'ipblock', 'href' => "https://api.profitbricks.com/rest/v2/ipblocks/#{ipb_2_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8702', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'ips' => ["333.333.333.333"], 'location' => 'us/las', 'size' => 1, 'name' => 'Fog test IP Block 2' } } ] }, :firewall_rules => { 'id' => "#{nic_1_id}/firewallrules", 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}/firewallrules", 'items' => [ { 'id' => fwr_1_id, 'type' => 'firewall-rule', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}/firewallrules/#{fwr_1_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8703', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Fog test Firewall Rule 1', 'protocol' => 'TCP', 'sourceMac' => 'null', 'sourceIp' => 'null', 'targetIp' => 'null', 'icmpCode' => 'null', 'icmpType' => 'null', 'portRangeStart' => 22, 'portRangeEnd' => 22 }, 'datacenter_id' => dc_1_id, 'server_id' => serv_1_id, 'nic_id' => nic_1_id }, { 'id' => fwr_2_id, 'type' => 'firewall-rule', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}/firewallrules/#{fwr_2_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8701', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Fog test Firewall Rule 2', 'protocol' => 'TCP', 'sourceMac' => 'null', 'sourceIp' => 'null', 'targetIp' => 'null', 'icmpCode' => 'null', 'icmpType' => 'null', 'portRangeStart' => 24, 'portRangeEnd' => 25 }, 'datacenter_id' => dc_1_id, 'server_id' => serv_1_id, 'nic_id' => nic_1_id } ] }, :load_balancers => { 'id' => "#{dc_1_id}/loadbalancers", 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/loadbalancers", 'items' => [ { 'id' => lb_1_id, 'type' => 'loadbalancer', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/loadbalancers/#{lb_1_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8723', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'Fog test Load Balancer 1', 'ip' => 'null', 'dhcp' => 'true' }, 'entities' => { 'balancednics' => { 'id' => "#{lb_1_id}/balancednics", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/loadbalancers/#{lb_1_id}/balancednics", 'items' => [ { 'id' => nic_1_id, 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f1', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogTestLoadBalancedNIC_1', 'mac' => '02:01:36:5f:09:da', 'ips' => [ '10.9.194.12'], 'dhcp' => 'true', 'lan' => 2, 'firewallActive' => 'false' }, 'entities' => { 'firewallrules' => { 'id' => "#{nic_1_id}/firewallrules", 'type' => 'collection', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/servers/#{serv_1_id}/nics/#{nic_1_id}/firewallrules", 'items' => [ ] } }, 'datacenter_id' => dc_1_id, 'load_balancer_id' => lb_1_id } ] } }, 'datacenter_id' => dc_1_id }, { 'id' => lb_2_id, 'type' => 'loadbalancer', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/loadbalancers/#{lb_2_id}", 'metadata' => { 'createdDate' => '2016-07-31T15:41:27Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '5b91832ee85a758568d4523a86bd8721', 'lastModifiedDate' => '2016-07-31T15:41:27Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'INACTIVE' }, 'properties' => { 'name' => 'Fog test Load Balancer 2', 'ip' => 'null', 'dhcp' => 'false' }, 'entities' => { 'balancednics' => { 'id' => "#{lb_2_id}/balancednics", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{dc_1_id}/loadbalancers/#{lb_2_id}/balancednics", 'items' => [ ] } }, 'datacenter_id' => dc_1_id } ] } } end end
new(options={})
click to toggle source
# File lib/fog/profitbricks/compute.rb, line 1067 def initialize(options={}) @profitbricks_username = options[:profitbricks_username] @profitbricks_password = options[:profitbricks_password] end
reset()
click to toggle source
# File lib/fog/profitbricks/compute.rb, line 1063 def self.reset @data = nil end
Public Instance Methods
create_firewall_rule(datacenter_id, server_id, nic_id, options={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/create_firewall_rule.rb, line 72 def create_firewall_rule(datacenter_id, server_id, nic_id, options={}) response = Excon::Response.new response.status = 202 firewall_rule_id = Fog::UUID.uuid firewall_rule = { 'id' => firewall_rule_id, 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules/#{firewall_rule_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f2', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => options, 'datacenter_id' => datacenter_id, 'server_id' => server_id, 'nic_id' => nic_id, } self.data[:firewall_rules]['items'] << firewall_rule response.body = firewall_rule response end
create_flavor(flavor_name, ram, cores)
click to toggle source
# File lib/fog/profitbricks/requests/compute/create_flavor.rb, line 22 def create_flavor(flavor_name, ram, cores) response = Excon::Response.new response.status = 200 flavor = { 'id' => Fog::UUID.uuid, 'name' => flavor_name, 'ram' => ram, 'cores' => cores } self.data[:flavors] << flavor response.body = { 'createFlavorResponse' => flavor } response end
create_load_balancer(datacenter_id, properties={}, entities={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/create_load_balancer.rb, line 57 def create_load_balancer(datacenter_id, properties={}, entities={}) response = Excon::Response.new response.status = 202 load_balancer_id = Fog::UUID.uuid load_balancer = { 'id' => load_balancer_id, 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f2', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => properties, 'entities' => entities, 'datacenter_id' => datacenter_id } self.data[:load_balancers]['items'] << load_balancer response.body = load_balancer response end
create_nic(datacenter_id, server_id, options={}, entities={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/create_nic.rb, line 93 def create_nic(datacenter_id, server_id, options={}, entities={}) response = Excon::Response.new response.status = 202 nic_id = Fog::UUID.uuid nic = { 'id' => nic_id, 'type' => 'nic', 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}", 'metadata' => { 'createdDate' => '2015-03-18T19:00:51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'faa67fbacb1c0e2e02cf9650657251f2', 'lastModifiedDate' => '2015-03-18T19:00:51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => options, 'entities' => entities, 'datacenter_id' => datacenter_id, 'server_id' => server_id } self.data[:nics]['items'] << nic response.body = nic response end
create_server(datacenter_id, properties={}, entities={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/create_server.rb, line 137 def create_server(datacenter_id, properties={}, entities={}) server_id = Fog::UUID.uuid volume_id = entities[:volumes]['items'][0]['id'] server = { 'id' => server_id, 'type' => 'server', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{server_id}", 'metadata' => { 'createdDate' => '2014-10-20T21:20:46Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => '0018832d7a7ba455db74ac41ae9f11fe', 'lastModifiedDate' => '2015-03-18T21:31:10Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => properties[:name], 'cores' => properties[:cores], 'ram' => properties[:ram], 'availabilityZone' => properties[:availabilityZone], 'vmState' => 'RUNNING', 'cpuFamily' => properties[:cpuFamily] }, 'entities' => { 'volumes' => { 'id' => "#{server_id}/volumes", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{server_id}/volumes", 'items' => [ { 'id' => volume_id, 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/volumes/#{volume_id}", 'metadata' => { 'createdDate' => '2015-03-18T19=>00=>51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'c4a2fde6ba91a038ff953b939cc21efe', 'lastModifiedDate' => '2015-03-18T19=>00=>51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'FogRestTestVolume', 'type' => 'HDD', 'size' => 5, 'image' => '4f363db0-4955-11e4-b362-52540066fee9', 'bus' => 'VIRTIO', 'licenceType' => 'OTHER', 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 1 } } ] }, 'cdroms' => { 'id' => "#{server_id}/cdroms", 'type' => 'collection', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{server_id}/cdroms", 'items' => [ { 'id' => 'dfcb40db-28b5-11e6-9336-52540005ab80', 'type' => 'image', 'href' => 'https=>//api.profitbricks.com/rest/v2/images/dfcb40db-28b5-11e6-9336-52540005ab80', 'metadata' => { 'createdDate' => '2016-06-02T11:33:49Z', 'createdBy' => 'System', 'etag' => '9909709d99655c6f31aca789998d7d89', 'lastModifiedDate' => '2016-06-02T11:33:49Z', 'lastModifiedBy' => 'System', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => 'CentOS-6.8-x86_64-netinstall.iso', 'description' => '', 'location' => 'us/las', 'size' => 0.23, 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'true', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'licenceType' => 'LINUX', 'imageType' => 'CDROM', 'public' => 'true' } } ] } }, 'datacenter_id' => datacenter_id } self.data[:servers]['items'] << server response = Excon::Response.new response.status = 202 response.body = server response end
create_volume(datacenter_id, options={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/create_volume.rb, line 77 def create_volume(datacenter_id, options={}) response = Excon::Response.new response.status = 202 if datacenter = self.data[:datacenters]['items'].find { |attrib| attrib['id'] == datacenter_id } datacenter['properties']['version'] += 1 else raise Fog::Errors::NotFound.new('Data center resource could not be found') end volume_id = Fog::UUID.uuid volume = { 'id' => volume_id, 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter['id']}/volumes/#{volume_id}", 'metadata' => { 'createdDate' => '2015-03-18T19=>00=>51Z', 'createdBy' => 'test@stackpointcloud.com', 'etag' => 'c4a2fde6ba91a038ff953b939cc21efe', 'lastModifiedDate' => '2015-03-18T19=>00=>51Z', 'lastModifiedBy' => 'test@stackpointcloud.com', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => options[:name], 'type' => options[:type], 'size' => options[:size], 'image' => options[:image], 'bus' => 'VIRTIO', 'licenceType' => 'OTHER', 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 1 }, 'datacenter_id' => datacenter['id'] } self.data[:volumes]['items'] << volume response.body = volume response end
data()
click to toggle source
# File lib/fog/profitbricks/compute.rb, line 1072 def data self.class.data[@profitbricks_username] end
delete_datacenter(datacenter_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_datacenter.rb, line 27 def delete_datacenter(datacenter_id) response = Excon::Response.new response.status = 202 if dc = self.data[:datacenters]["items"].find { |datacenter| datacenter["id"] == datacenter_id } else raise Fog::Errors::NotFound.new("The requested resource could not be found") end response end
delete_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb, line 30 def delete_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id) response = Excon::Response.new response.status = 202 if firewall_rule = self.data[:firewall_rules]["items"].find { |attribute| attribute["datacenter_id"] == datacenter_id && attribute["server_id"] == server_id && attribute["nic_id"] == nic_id && attribute["id"] == firewall_rule_id } else raise Fog::Errors::NotFound.new("The requested firewall rule resource could not be found") end response end
delete_image(image_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_image.rb, line 27 def delete_image(image_id) response = Excon::Response.new response.status = 202 if img = self.data[:images]["items"].find { |image| image["id"] == image_id } else raise Fog::Errors::NotFound.new("The requested resource could not be found") end response end
delete_ip_block(ip_block_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_ip_block.rb, line 27 def delete_ip_block(ip_block_id) response = Excon::Response.new response.status = 202 if ip_block = self.data[:ip_blocks]["items"].find { |attribute| attribute["id"] == ip_block_id } else raise Fog::Errors::NotFound.new("The requested IP Block could not be found") end response end
delete_lan(datacenter_id, lan_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_lan.rb, line 28 def delete_lan(datacenter_id, lan_id) response = Excon::Response.new response.status = 202 if lan = self.data[:lans]["items"].find { |attribute| attribute["datacenter_id"] == datacenter_id && attribute["id"] == lan_id } else raise Fog::Errors::NotFound.new("The requested lan could not be found") end response end
delete_load_balancer(datacenter_id, load_balancer_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_load_balancer.rb, line 28 def delete_load_balancer(datacenter_id, load_balancer_id) response = Excon::Response.new response.status = 202 if lb = self.data[:load_balancers]["items"].find { |attribute| attribute["datacenter_id"] == datacenter_id && attribute["id"] == load_balancer_id } else raise Fog::Errors::NotFound.new("The requested resource could not be found") end response end
delete_nic(datacenter_id, server_id, nic_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_nic.rb, line 29 def delete_nic(datacenter_id, server_id, nic_id) response = Excon::Response.new response.status = 202 if nic = self.data[:nics]["items"].find { |attribute| attribute["datacenter_id"] == datacenter_id && attribute["server_id"] == server_id && attribute["id"] == nic_id } else raise Fog::Errors::NotFound.new("The requested nic resource could not be found") end response end
delete_server(datacenter_id, server_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_server.rb, line 30 def delete_server(datacenter_id, server_id) if server = self.data[:servers]['items'].find { |attrib| attrib['datacenter_id'] == datacenter_id && attrib['id'] == server_id } self.data[:servers].delete(server) else raise Fog::Errors::NotFound.new( 'The requested server resource could not be found' ) end response = Excon::Response.new response.status = 202 response end
delete_snapshot(snapshot_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_snapshot.rb, line 27 def delete_snapshot(snapshot_id) response = Excon::Response.new response.status = 202 if snapshot = self.data[:snapshots]['items'].find { |attrib| attrib['id'] == snapshot_id } else raise Fog::Errors::NotFound.new('The requested resource could not be found') end response end
delete_volume(datacenter_id, volume_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/delete_volume.rb, line 28 def delete_volume(datacenter_id, volume_id) response = Excon::Response.new response.status = 202 if vlm = self.data[:volumes]["items"].find { |volume| volume["id"] == volume_id && volume["datacenter_id"] == datacenter_id } else raise Fog::Errors::NotFound.new("The requested resource could not be found") end response end
detach_cdrom(datacenter_id, server_id, cdrom_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/detach_cdrom.rb, line 29 def detach_cdrom(datacenter_id, server_id, cdrom_id) response = Excon::Response.new response.status = 202 if server = self.data[:servers]['items'].find { |serv| serv['datacenter_id'] == datacenter_id && serv['id'] == server_id } else raise Fog::Errors::NotFound.new("The server resource could not be found") end if cdrom = server['entities']['cdroms']['items'].find { |cd| cd['id'] == cdrom_id } else raise Fog::Errors::NotFound.new("The attached volume resource could not be found") end response end
detach_volume(datacenter_id, server_id, volume_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/detach_volume.rb, line 30 def detach_volume(datacenter_id, server_id, volume_id) response = Excon::Response.new response.status = 202 if server = self.data[:servers]['items'].find { |serv| serv['datacenter_id'] == datacenter_id && serv['id'] == server_id } else raise Fog::Errors::NotFound.new("The server resource could not be found") end if volume = server['entities']['volumes']['items'].find { |vlm| vlm['id'] == volume_id } else raise Fog::Errors::NotFound.new("The attached volume resource could not be found") end response end
get_all_flavors()
click to toggle source
# File lib/fog/profitbricks/requests/compute/get_all_flavors.rb, line 65 def get_all_flavors data = self.data[:flavors] response = Excon::Response.new response.status = 200 response.body = { 'getAllFlavorsResponse' => self.data[:flavors] } response end
get_flavor(flavor_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/get_flavor.rb, line 65 def get_flavor(flavor_id) response = Excon::Response.new response.status = 200 if flavor = self.data[:flavors].find { |attrib| attrib["flavorId"] == flavor_id } else raise Fog::Errors::NotFound.new("The requested flavor could not be found") end response.body = { "getFlavorResponse" => flavor } response end
reboot_server(datacenter_id, server_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/reboot_server.rb, line 30 def reboot_server(datacenter_id, server_id) if server = self.data[:servers]['items'].find { |attrib| attrib['datacenter_id'] == datacenter_id && attrib['id'] == server_id } else raise Fog::Errors::NotFound.new( 'The requested server resource could not be found' ) end response = Excon::Response.new response.status = 202 response end
remove_nic_association(datacenter_id, load_balancer_id, nic_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/remove_nic_association.rb, line 29 def remove_nic_association(datacenter_id, load_balancer_id, nic_id) if load_balancer = self.data[:load_balancers]['items'].find { |lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id } else raise Fog::Errors::NotFound.new("The requested resource could not be found") end response = Excon::Response.new response.status = 202 response end
reset_data()
click to toggle source
# File lib/fog/profitbricks/compute.rb, line 1076 def reset_data self.class.data.delete(@profitbricks_username) end
restore_volume_snapshot(datacenter_id, volume_id, options={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb, line 38 def restore_volume_snapshot(datacenter_id, volume_id, options={}) response = Excon::Response.new response.status = 202 if datacenter = self.data[:datacenters]['items'].find { |attrib| attrib['id'] == datacenter_id } else raise Fog::Errors::NotFound.new('Data center resource could not be found') end if volume = self.data[:volumes]['items'].find { |attrib| attrib['id'] == volume_id && attrib['datacenter_id'] == datacenter_id } else raise Fog::Errors::NotFound.new('Volume resource could not be found') end response end
start_server(datacenter_id, server_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/start_server.rb, line 29 def start_server(datacenter_id, server_id) if server = self.data[:servers]['items'].find { |attrib| attrib['datacenter_id'] == datacenter_id && attrib['id'] == server_id } else raise Fog::Errors::NotFound.new( 'The requested server resource could not be found' ) end server['vm_state'] = 'RUNNING' server['state'] = 'AVAILABLE' response = Excon::Response.new response.status = 202 response end
stop_server(datacenter_id, server_id)
click to toggle source
# File lib/fog/profitbricks/requests/compute/stop_server.rb, line 30 def stop_server(datacenter_id, server_id) if server = self.data[:servers]['items'].find { |attrib| attrib['datacenter_id'] == datacenter_id && attrib['id'] == server_id } else raise Fog::Errors::NotFound.new( 'The requested server resource could not be found' ) end server['vm_state'] = 'SHUTOFF' server['state'] = 'INACTIVE' response = Excon::Response.new response.status = 202 response end
update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {})
click to toggle source
# File lib/fog/profitbricks/requests/compute/update_firewall_rule.rb, line 67 def update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {}) if firewall_rule = self.data[:firewall_rules]['items'].find { |attribute| attribute["datacenter_id"] == datacenter_id && attribute["server_id"] == server_id && attribute["nic_id"] == nic_id && attribute["id"] == firewall_rule_id } options.each do |key, value| firewall_rule[key] = value end else raise Fog::Errors::NotFound.new('The requested resource could not be found') end response = Excon::Response.new response.status = 202 response.body = firewall_rule response end
update_image(image_id, options={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/update_image.rb, line 70 def update_image(image_id, options={}) if img = self.data[:images]["items"].find { |image| image["id"] == image_id } img['name'] = options[:name] img['description'] = options[:description] img['discVirtioHotPlug'] = options[:disc_virtio_hotplug] else raise Fog::Errors::NotFound.new("The requested resource could not be found") end response = Excon::Response.new response.status = 202 response.body = img response end
update_server(datacenter_id, server_id, properties={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/update_server.rb, line 127 def update_server(datacenter_id, server_id, properties={}) if server = self.data[:servers]['items'].find { |attrib| attrib['id'] == server_id } properties.each do |key, value| server[key] = value end else raise Fog::Errors::NotFound.new('The requested server resource could not be found') end response = Excon::Response.new response.status = 202 response.body = server response end
update_snapshot(snapshot_id, options={})
click to toggle source
# File lib/fog/profitbricks/requests/compute/update_snapshot.rb, line 69 def update_snapshot(snapshot_id, options={}) if snapshot = self.data[:snapshots]['items'].find { |snpsht| snpsht["id"] == snapshot_id } options.each do |key, value| snapshot[key] = value end else raise Fog::Errors::NotFound.new('The requested resource could not be found') end response = Excon::Response.new response.status = 202 response.body = snapshot response end