class Fog::Compute::Google::Mock
XXX @ihmccreery added this mock to get the Shindo tests to pass. I don't really understand how mocks are supposed to work; I'm in the process of moving all testing over to Minitest, but in the meantime, the Shindo tests need to pass. This Mock should be considered with a lot of skepticism.
Attributes
extra_global_projects[R]
Public Class Methods
data(api_version)
click to toggle source
# File lib/fog/google/compute.rb, line 242 def self.data(api_version) @data ||= Hash.new do |hash, key| case key when 'debian-cloud' hash[key] = { :images => { "debian-6-squeeze-v20130816" => { "kind" => "compute#image", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-6-squeeze-v20130816", "id" => "14841592146580482051", "creationTimestamp" => "2013-09-04T13:21:53.292-07:00", "name" => "debian-6-squeeze-v20130816", "description" => "Debian GNU/Linux 6.0.7 (squeeze) built on 2013-08-16", "sourceType" => "RAW", "rawDisk" => { "containerType" => "TAR", "source" => "" }, "status" => "READY" }, "debian-7-wheezy-v20130816" => { "kind" => "compute#image", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20130816", "id" => "4213305957435180899", "creationTimestamp" => "2013-09-04T13:24:30.479-07:00", "name" => "debian-7-wheezy-v20130816", "description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-08-16", "sourceType" => "RAW", "rawDisk" => { "containerType" => "TAR", "source" => "" }, "status" => "READY" }, "debian-7-wheezy-v20131014" => { "kind" => "compute#image", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131014", "id" => "4213305957435180899", "creationTimestamp" => "2013-09-04T13:24:30.479-07:00", "name" => "debian-7-wheezy-v20131014", "description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-10-14", "sourceType" => "RAW", "rawDisk" => { "containerType" => "TAR", "source" => "" }, "status" => "READY" }, "debian-7-wheezy-v20140408" => { "kind" => "compute#image", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20140408", "id" => "17312518942796567788", "creationTimestamp" => "2013-11-25T15:17:00.436-08:00", "name" => "debian-7-wheezy-v20131120", "description" => "Debian GNU/Linux 7.2 (wheezy) built on 2013-11-20", "sourceType" => "RAW", "rawDisk" => { "containerType" => "TAR", "source" => "" }, "status" => "READY", "archiveSizeBytes" => "341857472" } } } when 'centos-cloud' hash[key] = { :images => { "centos-6-v20130813" => { "kind" => "compute#image", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/centos-cloud/global/images/centos-6-v20130813", "id" => "4670523370938782739", "creationTimestamp" => "2013-08-19T11:56:47.004-07:00", "name" => "centos-6-v20130813", "description" => "SCSI-enabled CentOS 6; Created Tue, 13 Aug 2013 00:00:00 +0000", "sourceType" => "RAW", "rawDisk" => { "containerType" => "TAR", "source" => "" }, "status" => "READY" } } } else hash[key] = { :target_http_proxies => { "test-target-http-proxy" => { "kind" => "compute#targetHttpProxy", "id" => "1361932147851415729", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', "name" => "test-target-http-proxy", "description" => '', "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/test-target-http-proxy", "urlMap" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/test-url-map" } }, :url_maps => { "test-url-map" => { "kind" => "compute#urlMap", "id" => "1361932147851415729", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', "name" => 'test-url-map', "description" => '', "hostRules" => [], "pathMatchers" => [], "tests" => [], "defaultService" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/fog-backend-service-test", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/test-url-map" } }, :target_pools => { "test-target-pool" => { 'kind' => "compute#targetPool", "id" => "1361932147851415729", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/targetPools/test-target-pool", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', 'name' => "test-target-pool", "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1", "healthChecks" => ["https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/test-check"], "instances" => ["https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/instances/test-instance"], } }, :http_health_checks => { "test-http-health-check" => { "checkIntervalSec" => 5, "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', "healthyThreshold" => 2, "id" => "1361932147851415729", "kind" => "compute#httphealthCheck", "name" => "test-http-health-check", "port" => 80, "requestPath" => '/', "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/test-http-health-check", "timeoutSec" => 5, "unhealthyThreshold" => 2 } }, :global_forwarding_rules => { "test-global-forwarding-rule" => { "kind" => "compute#forwardingRule", "id" => "1361932147851415729", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', "name" => 'test-global-forwarding-rule', "IPAddress" => '107.178.255.155', "IPProtocol" => 'TCP', "portRange" => '80-80', "target" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/proxy", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardngRules/test-global-forwarding-rule" } }, :forwarding_rules => { "test-forwarding-rule" => { "kind" => "compute#forwardingRule", "id" => "1361932147851415729", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', "name" => 'test-forwarding-rule', "IPAddress" => '107.178.255.155', "IPProtocol" => 'TCP', "portRange" => '80-80', "target" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/targetPools/target_pool", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/forwardngRules/test-forwarding-rule", "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1" } }, :target_instances => { "test-target-instance" => { "kind" => "compute#targetInstance", "name" => "test-target-instance", "natPolicy" => "NO_NAT", "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a", "instance" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/instances/test-instance", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/targetInstances/test-target-instance", "id" => "1361932147851415729", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', } }, :backend_services =>{ "test-backend-service" => { "kind" => "compute#backend_service", "id" => "1361932147851415729", "creationTimestamp" => '2014-08-23T10:06:13.951-07:00', "name" => "test-backend-service", "description" => '', "backends" => [ { "description" => '', "group" => "https://www.googleapis.com/resourceviews/v1beta1/projects#{@project}/zones/us-central1-a/zoneViews/name", "balancingMode" => "RATE", "capacityScaler" => 1.1, "maxRate" => 0.5, }], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/test-backend-service" } }, :servers => { "fog-1" => { "kind" => "compute#instance", "id" => "1361932147851415727", "creationTimestamp" => "2013-09-26T04:55:43.881-07:00", "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a", "status" => "RUNNING", "name" => "fog-1380196541", "tags" => { "fingerprint" => "42WmSpB8rSM=" }, "machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/machineTypes/n1-standard-1", "canIpForward" => false, "networkInterfaces" => [ { "network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/global/networks/default", "networkIP" => "10.240.121.54", "name" => "nic0", "accessConfigs" => [ { "kind" => "compute#accessConfig", "type" => "ONE_TO_ONE_NAT", "name" => "External NAT", "natIP" => "108.59.81.28" } ] } ], "disks" => [ { "kind" => "compute#attachedDisk", "index" => 0, "type" => "PERSISTENT", "mode" => "READ_WRITE", "source" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1", "deviceName" => "persistent-disk-0", "boot" => true } ], "metadata" => { "kind" => "compute#metadata", "fingerprint" => "5_hasd_gC3E=", "items" => [ { "key" => "sshKeys", "value" => "sysadmin:ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA1zc7mx+0H8Roywet/L0aVX6MUdkDfzd/17kZhprAbpUXYOILv9AG4lIzQk6xGxDIltghytjfVGme/4A42Sb0Z9LN0pxB4KnWTNoOSHPJtp6jbXpq6PdN9r3Z5NKQg0A/Tfw7gt2N0GDsj6vpK8VbHHdW78JAVUxql18ootJxjaksdocsiHNK8iA6/v9qiLRhX3fOgtK7KpxxdZxLRzFg9vkp8jcGISgpZt27kOgXWhR5YLhi8pRJookzphO5O4yhflgoHoAE65XkfrsRCe0HU5QTbY2jH88rBVkq0KVlZh/lEsuwfmG4d77kEqaCGGro+j1Wrvo2K3DSQ+rEcvPp2CYRUySjhaeLF18UzQLtxNeoN14QOYqlm9ITdkCnmq5w4Wn007MjSOFp8LEq2RekrnddGXjg1/vgmXtaVSGzJAlXwtVfZor3dTRmF0JCpr7DsiupBaDFtLUlGFFlSKmPDVMPOOB5wajexmcvSp2Vu4U3yP8Lai/9/ZxMdsGPhpdCsWVL83B5tF4oYj1HVIycbYIxIIfFqOxZcCru3CMfe9jmzKgKLv2UtkfOS8jpS/Os2gAiB3wPweH3agvtwYAYBVMDwt5cnrhgHYWoOz7ABD8KgmCrD7Y9HikiCqIUNkgUFd9YmjcYi5FkU5rFXIawN7efs341lsdf923lsdf923fs= johndoe@acme" } ] }, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/instances/fog-1380196541" } }, :zones => { "europe-west1-a" => { "kind" => "compute#zone", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-a", "id" => "10419676573632995924", "creationTimestamp" => "2013-09-26T02:56:13.115-07:00", "name" => "europe-west1-a", "description" => "europe-west1-a", "status" => "UP", "maintenanceWindows" => [ { "name" => "2014-01-18-planned-outage", "description" => "maintenance zone", "beginTime" => "2014-01-18T12:00:00.000-08:00", "endTime" => "2014-02-02T12:00:00.000-08:00" } ], "quotas" => [ {"metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0}, {"metric" => "CPUS", "limit" => 24.0, "usage" => 0.0}, {"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0}, {"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0} ], "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/europe-west1" }, "us-central1-a" => { "kind" => "compute#zone", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a", "id" => "6562457277909136262", "creationTimestamp" => "2013-09-26T02:56:13.116-07:00", "name" => "us-central1-a", "description" => "us-central1-a", "status" => "UP", "maintenanceWindows" => nil, "quotas" => [ {"metric" => "INSTANCES", "limit" => 16.0, "usage" => 1.0}, {"metric" => "CPUS", "limit" => 24.0, "usage" => 1.0}, {"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0}, {"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0} ], "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1" }, "us-central1-b" => { "kind" => "compute#zone", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-b", "id" => "8701502109626061015", "creationTimestamp" => "2013-09-26T02:56:13.124-07:00", "name" => "us-central1-b", "description" => "us-central1-b", "status" => "UP", "maintenanceWindows" => [{"name" => "2013-10-26-planned-outage", "description" => "maintenance zone", "beginTime" => "2013-10-26T12:00:00.000-07:00", "endTime" => "2013-11-10T12:00:00.000-08:00"}], "quotas" => [ {"metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0}, {"metric" => "CPUS", "limit" => 24.0, "usage" => 0.0}, {"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0}, {"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0} ], "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1" }, "us-central2-a" => { "kind" => "compute#zone", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central2-a", "id" => "13611654493253680292", "creationTimestamp" => "2013-09-26T02:56:13.125-07:00", "name" => "us-central2-a", "description" => "us-central2-a", "status" => "UP", "maintenanceWindows" => [ { "name" => "2013-10-12-planned-outage", "description" => "maintenance zone", "beginTime" => "2013-10-12T12:00:00.000-07:00", "endTime" => "2013-10-27T12:00:00.000-07:00" } ], "quotas" => [ {"metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0}, {"metric" => "CPUS", "limit" => 24.0, "usage" => 0.0}, {"metric" => "DISKS", "limit" => 16.0, "usage" => 0.0}, {"metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0} ], "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central2" } }, :regions => { "us-central1" => { "creationTimestamp" => '2014-01-21T10:30:54.895-08:00', "description" => 'us-central1', "id" => '18201118976141502843', "kind" => "compute#region", "name" =>"us-central1", "quotas" => [ {"metric" =>"CPUS", "limit" => 1050.0, "usage" => 28.0}, {"metric" =>"DISKS_TOTAL_GB", "limit" => 10000.0, "usage" => 292.0}, {"metric" =>"STATIC_ADDRESSES", "limit" => 10.0, "usage" => 0.0}, {"metric" =>"IN_USE_ADDRESSES", "limit" => 1050.0, "usage" => 30.0}, {"metric" =>"SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0} ], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1", "status" => "UP", "zones" => [ "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a", "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-b", "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-f", ] }, "europe-west1" => { "creationTimestamp" => '2014-01-21T10:30:54.891-08:00', "description" => 'europe-west1', "id" => '18201118976141502843', "kind" => "compute#region", "name" =>"europe-west1", "quotas" => [ {"metric" =>"CPUS", "limit" => 24.0, "usage" => 0.0}, {"metric" =>"DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0}, {"metric" =>"STATIC_ADDRESSES", "limit" => 7.0, "usage" => 0.0}, {"metric" =>"IN_USE_ADDRESSES", "limit" => 23.0, "usage" => 0.0}, {"metric" =>"SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0} ], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/erope-west1", "status" => "UP", "zones" => [ "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-a", "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-b", ] }, "asia-east1" => { "creationTimestamp" => '2014-01-21T10:30:54.895-08:00', "description" => 'asia-east1', "id" => '18201118976141502843', "kind" => "compute#region", "name" =>"asia-east1", "quotas" => [ {"metric" =>"CPUS", "limit" => 1050.0, "usage" => 28.0}, {"metric" =>"DISKS_TOTAL_GB", "limit" => 10000.0, "usage" => 292.0}, {"metric" =>"STATIC_ADDRESSES", "limit" => 10.0, "usage" => 0.0}, {"metric" =>"IN_USE_ADDRESSES", "limit" => 1050.0, "usage" => 30.0}, {"metric" =>"SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0} ], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/asia-east1", "status" => "UP", "zones" => [ "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-a", "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-b", "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-c", ] } }, :machine_types => Hash.new do |machine_types_hash, zone| machine_types_hash[zone] = { "f1-micro" => { "kind" => "compute#machineType", "id" => "4618642685664990776", "creationTimestamp" => "2013-04-25T13:32:49.088-07:00", "name" => "f1-micro", "description" => "1 vCPU (shared physical core) and 0.6 GB RAM", "guestCpus" => 1, "memoryMb" => 614, "imageSpaceGb" => 0, "maximumPersistentDisks" => 4, "maximumPersistentDisksSizeGb" => "3072", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/f1-micro" }, "g1-small" => { "kind" => "compute#machineType", "id" => "7224129552184485774", "creationTimestamp" => "2013-04-25T13:32:45.550-07:00", "name" => "g1-small", "description" => "1 vCPU (shared physical core) and 1.7 GB RAM", "guestCpus" => 1, "memoryMb" => 1740, "imageSpaceGb" => 0, "maximumPersistentDisks" => 4, "maximumPersistentDisksSizeGb" => "3072", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/g1-small" }, "n1-highcpu-2" => { "kind" => "compute#machineType", "id" => "13043554592196512955", "creationTimestamp" => "2012-11-16T11:46:10.572-08:00", "name" => "n1-highcpu-2", "description" => "2 vCPUs, 1.8 GB RAM", "guestCpus" => 2, "memoryMb" => 1843, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-2" }, "n1-highcpu-2-d" => { "kind" => "compute#machineType", "id" => "13043555176034896271", "creationTimestamp" => "2012-11-16T11:47:07.825-08:00", "name" => "n1-highcpu-2-d", "description" => "2 vCPUs, 1.8 GB RAM, 1 scratch disk (870 GB)", "guestCpus" => 2, "memoryMb" => 1843, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 870 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-2-d" }, "n1-highcpu-4" => { "kind" => "compute#machineType", "id" => "13043555705736970382", "creationTimestamp" => "2012-11-16T11:48:06.087-08:00", "name" => "n1-highcpu-4", "description" => "4 vCPUs, 3.6 GB RAM", "guestCpus" => 4, "memoryMb" => 3686, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-4" }, "n1-highcpu-4-d" => { "kind" => "compute#machineType", "id" => "13043556330284250611", "creationTimestamp" => "2012-11-16T11:49:07.563-08:00", "name" => "n1-highcpu-4-d", "description" => "4 vCPUS, 3.6 GB RAM, 1 scratch disk (1770 GB)", "guestCpus" => 4, "memoryMb" => 3686, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 1770 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-4-d" }, "n1-highcpu-8" => { "kind" => "compute#machineType", "id" => "13043556949665240937", "creationTimestamp" => "2012-11-16T11:50:15.128-08:00", "name" => "n1-highcpu-8", "description" => "8 vCPUs, 7.2 GB RAM", "guestCpus" => 8, "memoryMb" => 7373, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-8" }, "n1-highcpu-8-d" => { "kind" => "compute#machineType", "id" => "13043557458004959701", "creationTimestamp" => "2012-11-16T11:51:04.549-08:00", "name" => "n1-highcpu-8-d", "description" => "8 vCPUS, 7.2 GB RAM, 2 scratch disks (1770 GB, 1770 GB)", "guestCpus" => 8, "memoryMb" => 7373, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 1770 }, { "diskGb" => 1770 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-8-d" }, "n1-highmem-2" => { "kind" => "compute#machineType", "id" => "13043551079318055993", "creationTimestamp" => "2012-11-16T11:40:06.129-08:00", "name" => "n1-highmem-2", "description" => "2 vCPUs, 13 GB RAM", "guestCpus" => 2, "memoryMb" => 13312, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-2" }, "n1-highmem-2-d" => { "kind" => "compute#machineType", "id" => "13043551625558644085", "creationTimestamp" => "2012-11-16T11:40:59.630-08:00", "name" => "n1-highmem-2-d", "description" => "2 vCPUs, 13 GB RAM, 1 scratch disk (870 GB)", "guestCpus" => 2, "memoryMb" => 13312, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 870 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-2-d" }, "n1-highmem-4" => { "kind" => "compute#machineType", "id" => "13043552263604939569", "creationTimestamp" => "2012-11-16T11:42:08.983-08:00", "name" => "n1-highmem-4", "description" => "4 vCPUs, 26 GB RAM", "guestCpus" => 4, "memoryMb" => 26624, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-4" }, "n1-highmem-4-d" => { "kind" => "compute#machineType", "id" => "13043552953632709737", "creationTimestamp" => "2012-11-16T11:43:17.400-08:00", "name" => "n1-highmem-4-d", "description" => "4 vCPUs, 26 GB RAM, 1 scratch disk (1770 GB)", "guestCpus" => 4, "memoryMb" => 26624, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 1770 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-4-d" }, "n1-highmem-8" => { "kind" => "compute#machineType", "id" => "13043553584275586275", "creationTimestamp" => "2012-11-16T11:44:25.985-08:00", "name" => "n1-highmem-8", "description" => "8 vCPUs, 52 GB RAM", "guestCpus" => 8, "memoryMb" => 53248, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-8" }, "n1-highmem-8-d" => { "kind" => "compute#machineType", "id" => "13043554021673472746", "creationTimestamp" => "2012-11-16T11:45:08.195-08:00", "name" => "n1-highmem-8-d", "description" => "8 vCPUs, 52 GB RAM, 2 scratch disks (1770 GB, 1770 GB)", "guestCpus" => 8, "memoryMb" => 53248, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 1770 }, { "diskGb" => 1770 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-8-d" }, "n1-standard-1" => { "kind" => "compute#machineType", "id" => "12907738072351752276", "creationTimestamp" => "2012-06-07T13:48:14.670-07:00", "name" => "n1-standard-1", "description" => "1 vCPU, 3.75 GB RAM", "guestCpus" => 1, "memoryMb" => 3840, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-1" }, "n1-standard-1-d" => { "kind" => "compute#machineType", "id" => "12908559201265214706", "creationTimestamp" => "2012-06-07T13:48:34.258-07:00", "name" => "n1-standard-1-d", "description" => "1 vCPU, 3.75 GB RAM, 1 scratch disk (420 GB)", "guestCpus" => 1, "memoryMb" => 3840, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 420 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-1-d" }, "n1-standard-2" => { "kind" => "compute#machineType", "id" => "12908559320241551184", "creationTimestamp" => "2012-06-07T13:48:56.867-07:00", "name" => "n1-standard-2", "description" => "2 vCPUs, 7.5 GB RAM", "guestCpus" => 2, "memoryMb" => 7680, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-2" }, "n1-standard-2-d" => { "kind" => "compute#machineType", "id" => "12908559582417967837", "creationTimestamp" => "2012-06-07T13:49:19.448-07:00", "name" => "n1-standard-2-d", "description" => "2 vCPUs, 7.5 GB RAM, 1 scratch disk (870 GB)", "guestCpus" => 2, "memoryMb" => 7680, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 870 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-2-d" }, "n1-standard-4" => { "kind" => "compute#machineType", "id" => "12908559692070444049", "creationTimestamp" => "2012-06-07T13:49:40.050-07:00", "name" => "n1-standard-4", "description" => "4 vCPUs, 15 GB RAM", "guestCpus" => 4, "memoryMb" => 15360, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-4" }, "n1-standard-4-d" => { "kind" => "compute#machineType", "id" => "12908559991903153608", "creationTimestamp" => "2012-06-07T13:50:05.677-07:00", "name" => "n1-standard-4-d", "description" => "4 vCPUs, 15 GB RAM, 1 scratch disk (1770 GB)", "guestCpus" => 4, "memoryMb" => 15360, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 1770 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-4-d" }, "n1-standard-8" => { "kind" => "compute#machineType", "id" => "12908560197989714867", "creationTimestamp" => "2012-06-07T13:50:42.334-07:00", "name" => "n1-standard-8", "description" => "8 vCPUs, 30 GB RAM", "guestCpus" => 8, "memoryMb" => 30720, "imageSpaceGb" => 10, "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-8" }, "n1-standard-8-d" => { "kind" => "compute#machineType", "id" => "12908560709887590691", "creationTimestamp" => "2012-06-07T13:51:19.936-07:00", "name" => "n1-standard-8-d", "description" => "8 vCPUs, 30 GB RAM, 2 scratch disks (1770 GB, 1770 GB)", "guestCpus" => 8, "memoryMb" => 30720, "imageSpaceGb" => 10, "scratchDisks" => [ { "diskGb" => 1770 }, { "diskGb" => 1770 } ], "maximumPersistentDisks" => 16, "maximumPersistentDisksSizeGb" => "10240", "zone" => zone, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-8-d" } } end, :images => {}, :disks => { "fog-1" => { "kind" => "compute#disk", "id" => "3338131294770784461", "creationTimestamp" => "2013-12-18T19:47:10.583-08:00", "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a", "status" => "READY", "name" => "fog-1", "sizeGb" => "10", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1", "sourceImage" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131120", "sourceImageId" => "17312518942796567788", "type" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/diskTypes/pd-standard", }, "fog-2" => { "kind" => "compute#disk", "id" => "3338131294770784462", "creationTimestamp" => "2013-12-18T19:47:10.583-08:00", "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a", "status" => "READY", "name" => "fog-2", "sizeGb" => "10", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1", "type" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/diskTypes/pd-ssd", } }, :operations => {} } end end end
new(options)
click to toggle source
# File lib/fog/google/compute.rb, line 237 def initialize(options) shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL) @extra_global_projects = options[:google_extra_global_projects] || [] end
reset()
click to toggle source
# File lib/fog/google/compute.rb, line 1045 def self.reset @data = nil end
Public Instance Methods
add_backend_service_backends(backend_service, new_backends)
click to toggle source
# File lib/fog/google/requests/compute/add_backend_service_backends.rb, line 5 def add_backend_service_backends(backend_service, new_backends) Fog::Mock.not_implemented end
add_instance_group_instance(group_name, zone, instances)
click to toggle source
# File lib/fog/google/requests/compute/add_instance_group_instance.rb, line 5 def add_instance_group_instance(group_name, zone, instances) Fog::Mock.not_implemented end
add_region_view_resources(region_view, resources)
click to toggle source
# File lib/fog/google/requests/compute/add_region_view_resources.rb, line 5 def add_region_view_resources(region_view, resources) Fog::Mock.not_implemented end
add_server_access_config(identity, zone, nic, options = {})
click to toggle source
# File lib/fog/google/requests/compute/add_server_access_config.rb, line 5 def add_server_access_config(identity, zone, nic, options = {}) Fog::Mock.not_implemented end
add_target_pool_health_checks(target_pool, health_checks)
click to toggle source
# File lib/fog/google/requests/compute/add_target_pool_health_checks.rb, line 5 def add_target_pool_health_checks(target_pool, health_checks) Fog::Mock.not_implemented end
add_target_pool_instances(target_pool, instances)
click to toggle source
# File lib/fog/google/requests/compute/add_target_pool_instances.rb, line 5 def add_target_pool_instances(target_pool, instances) Fog::Mock.not_implemented end
add_url_map_host_rules(url_map, host_rules)
click to toggle source
# File lib/fog/google/requests/compute/add_url_map_host_rules.rb, line 5 def add_url_map_host_rules(url_map, host_rules) Fog::Mock.not_implemented end
add_url_map_path_matchers(url_map, path_matchers)
click to toggle source
# File lib/fog/google/requests/compute/add_url_map_path_matchers.rb, line 5 def add_url_map_path_matchers(url_map, path_matchers) Fog::Mock.not_implemented end
add_zone_view_resources(zone_view, resources)
click to toggle source
# File lib/fog/google/requests/compute/add_zone_view_resources.rb, line 5 def add_zone_view_resources(zone_view, resources) Fog::Mock.not_implemented end
attach_disk(instance, zone, source, options = {})
click to toggle source
# File lib/fog/google/requests/compute/attach_disk.rb, line 5 def attach_disk(instance, zone, source, options = {}) Fog::Mock.not_implemented end
data(project=@project)
click to toggle source
# File lib/fog/google/compute.rb, line 1049 def data(project=@project) self.class.data(api_version)[project] end
delete_address(address_name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_address.rb, line 5 def delete_address(address_name, region_name) Fog::Mock.not_implemented end
delete_backend_service(backend_service_name, zone_name= nil)
click to toggle source
# File lib/fog/google/requests/compute/delete_backend_service.rb, line 5 def delete_backend_service(backend_service_name, zone_name= nil) get_backend_service(backend_service_name) backend_service = self.data[:backend_services][backend_service_name] backend_service["mock-deletionTimestamp"] = Time.now.iso8601 backend_service["status"] = "DONE" operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/#{backend_service_name}", "targetId" => self.data[:backend_services][backend_service_name]["id"], "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_disk(disk_name, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_disk.rb, line 5 def delete_disk(disk_name, zone_name) get_disk(disk_name, zone_name) operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}", "targetId" => self.data[:disks][disk_name]["id"], "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/#{operation}" } self.data[:disks].delete disk_name build_excon_response(self.data[:operations][operation]) end
delete_firewall(firewall_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_firewall.rb, line 5 def delete_firewall(firewall_name) Fog::Mock.not_implemented end
delete_forwarding_rule(name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_forwarding_rule.rb, line 5 def delete_forwarding_rule(name, region_name) get_forwarding_rule(name, region_name) id = Fog::Mock.random_numbers(19).to_s operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/forwardingRules/#{name}", "targetId" => id, "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_global_forwarding_rule(name, region_name = 'global')
click to toggle source
# File lib/fog/google/requests/compute/delete_global_forwarding_rule.rb, line 5 def delete_global_forwarding_rule(name, region_name = 'global') get_global_forwarding_rule(name) global_forwarding_rule = self.data[:global_forwarding_rules][name] global_forwarding_rule["mock-deletionTimestamp"] = Time.now.iso8601 global_forwarding_rule["status"] = "DONE" operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardingRules/#{name}", "targetId" => self.data[:global_forwarding_rules][name]["id"], "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_global_operation(operation)
click to toggle source
# File lib/fog/google/requests/compute/delete_global_operation.rb, line 5 def delete_global_operation(operation) Fog::Mock.not_implemented end
delete_http_health_check(name)
click to toggle source
# File lib/fog/google/requests/compute/delete_http_health_check.rb, line 5 def delete_http_health_check(name) get_http_health_check(name) check = self.data[:http_health_checks][name] operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/#{name}", "targetId" => self.data[:http_health_checks][name]["id"], "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_image(image_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_image.rb, line 5 def delete_image(image_name) get_image(image_name) operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/images/#{image_name}", "targetId" => self.data[:images][image_name]["id"], "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } self.data[:images].delete image_name build_excon_response(self.data[:operations][operation]) end
delete_instance_group(group_name, zone)
click to toggle source
# File lib/fog/google/requests/compute/delete_instance_group.rb, line 5 def delete_instance_group(group_name, zone) Fog::Mock.not_implemented end
delete_network(network_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_network.rb, line 5 def delete_network(network_name) Fog::Mock.not_implemented end
delete_region_operation(region, operation)
click to toggle source
# File lib/fog/google/requests/compute/delete_region_operation.rb, line 5 def delete_region_operation(region, operation) Fog::Mock.not_implemented end
delete_region_view(region_view)
click to toggle source
# File lib/fog/google/requests/compute/delete_region_view.rb, line 5 def delete_region_view(region_view) Fog::Mock.not_implemented end
delete_route(identity)
click to toggle source
# File lib/fog/google/requests/compute/delete_route.rb, line 5 def delete_route(identity) Fog::Mock.not_implemented end
delete_server(server_name, zone_name=nil)
click to toggle source
# File lib/fog/google/requests/compute/delete_server.rb, line 24 def delete_server(server_name, zone_name=nil) zone_name = find_zone(zone_name) get_server(server_name, zone_name) server = self.data[:servers][server_name] server["status"] = "STOPPED" server["mock-deletionTimestamp"] = Time.now.iso8601 operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances/#{server_name}", "targetId" => self.data[:servers][server_name]["id"], "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_server_access_config(identity, zone, nic, options = {})
click to toggle source
# File lib/fog/google/requests/compute/delete_server_access_config.rb, line 5 def delete_server_access_config(identity, zone, nic, options = {}) Fog::Mock.not_implemented end
delete_snapshot(snapshot_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_snapshot.rb, line 5 def delete_snapshot(snapshot_name) Fog::Mock.not_implemented end
delete_target_http_proxy(name)
click to toggle source
# File lib/fog/google/requests/compute/delete_target_http_proxy.rb, line 5 def delete_target_http_proxy(name) get_target_http_proxy(name) target_http_proxy = self.data[:target_http_proxies][name] target_http_proxy["mock-deletionTimestamp"] = Time.now.iso8601 target_http_proxy["status"] = "DONE" operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/#{name}", "targetId" => self.data[:target_http_proxies][name]["id"], "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_target_instance(name, zone)
click to toggle source
# File lib/fog/google/requests/compute/delete_target_instance.rb, line 5 def delete_target_instance(name, zone) get_target_instance(name, zone) target_instance = self.data[:target_instances][name] target_instance["mock-deletionTimestamp"] = Time.now.iso8601 target_instance["status"] = "DONE" operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}/targetInstances/#{name}", "targetId" => self.data[:target_instances][name]["id"], "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_target_pool(name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/delete_target_pool.rb, line 5 def delete_target_pool(name, region_name) get_target_pool(name, region_name) id = Fog::Mock.random_numbers(19).to_s operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/targetPools/#{name}", "targetId" => id, "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_url_map(name)
click to toggle source
# File lib/fog/google/requests/compute/delete_url_map.rb, line 5 def delete_url_map(name) get_url_map(name) url_map = self.data[:url_maps][name] url_map["mock-deletionTimestamp"] = Time.now.iso8601 url_map["status"] = "DONE" operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "delete", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/#{name}", "targetId" => self.data[:url_maps][name]["id"], "status" => "DONE", "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
delete_zone_operation(zone, operation)
click to toggle source
# File lib/fog/google/requests/compute/delete_zone_operation.rb, line 5 def delete_zone_operation(zone, operation) Fog::Mock.not_implemented end
delete_zone_view(zone_view)
click to toggle source
# File lib/fog/google/requests/compute/delete_zone_view.rb, line 5 def delete_zone_view(zone_view) Fog::Mock.not_implemented end
detach_disk(instance, zone, deviceName)
click to toggle source
# File lib/fog/google/requests/compute/detach_disk.rb, line 5 def detach_disk(instance, zone, deviceName) Fog::Mock.not_implemented end
get_address(address_name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/get_address.rb, line 5 def get_address(address_name, region_name) Fog::Mock.not_implemented end
get_backend_service(service_name)
click to toggle source
# File lib/fog/google/requests/compute/get_backend_service.rb, line 5 def get_backend_service(service_name) backend_service = self.data[:backend_services][service_name] if backend_service.nil? return nil end build_excon_response(backend_service) end
get_backend_service_health(backend_service)
click to toggle source
# File lib/fog/google/requests/compute/get_backend_service_health.rb, line 5 def get_backend_service_health(backend_service) Fog::Mock.not_implemented end
get_backend_services(service_name)
click to toggle source
# File lib/fog/google/requests/compute/get_backend_services.rb, line 5 def get_backend_services(service_name) Fog::Mock::not_implemented end
get_disk(disk_name, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/get_disk.rb, line 5 def get_disk(disk_name, zone_name) disk = self.data[:disks][disk_name] if zone_name.start_with? 'http' zone_name = zone_name.split('/')[-1] end get_zone(zone_name) zone = self.data[:zones][zone_name] if disk.nil? or disk["zone"] != zone["selfLink"] return build_excon_response({ "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}' was not found" } }) end # TODO transition the disk through the states build_excon_response(disk) end
get_disk_type(identity, zone)
click to toggle source
# File lib/fog/google/requests/compute/get_disk_type.rb, line 5 def get_disk_type(identity, zone) disk_types = list_disk_types(zone).body['items'] disk_type = disk_types.select { |dt| dt['name'] == identity } || [] if disk_type.empty? return build_excon_response({ 'error' => { 'errors' => [ { 'domain' => 'global', 'reason' => 'notFound', 'message' => "The resource 'projects/#{@project}/zones/#{zone}/diskTypes/#{identity}' was not found", } ], 'code' => 404, 'message' => "The resource 'projects/#{@project}/zones/#{zone}/diskTypes/#{identity}' was not found", } }) end build_excon_response(disk_type.first) end
get_firewall(firewall_name)
click to toggle source
# File lib/fog/google/requests/compute/get_firewall.rb, line 5 def get_firewall(firewall_name) Fog::Mock.not_implemented end
get_forwarding_rule(name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/get_forwarding_rule.rb, line 5 def get_forwarding_rule(name, region_name) forwarding_rule = self.data[:forwarding_rules][name] region_name = get_region(region_name).body["name"] region = self.data[:regions][region_name] if forwarding_rule.nil? or forwarding_rule["region"] != region["selfLink"] return build_excon_response({ "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{@project}/regions/#{region_name}/forwarding_rules/#{name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{@project}/regions/#{region_name}/forwarding_rules/#{name}' was not found" } }) end build_excon_response(forwarding_rule) end
get_global_forwarding_rule(name, region_name = 'global')
click to toggle source
# File lib/fog/google/requests/compute/get_global_forwarding_rule.rb, line 5 def get_global_forwarding_rule(name, region_name = 'global') global_forwarding_rule = self.data[:global_forwarding_rules][name] if global_forwarding_rule.nil? return nil end build_excon_response(global_forwarding_rule) end
get_global_operation(operation)
click to toggle source
# File lib/fog/google/requests/compute/get_global_operation.rb, line 5 def get_global_operation(operation) operation = self.data[:operations][operation] if operation case operation["status"] when Fog::Compute::Google::Operation::PENDING_STATE operation["status"] = Fog::Compute::Google::Operation::RUNNING_STATE operation["progress"] = 50 else operation["status"] = Fog::Compute::Google::Operation::DONE_STATE operation["progress"] = 100 end else operation = { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/global/operations/#{operation}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{project}/global/operations/#{operation}' was not found" } } end build_excon_response(operation) end
get_http_health_check(name)
click to toggle source
# File lib/fog/google/requests/compute/get_http_health_check.rb, line 5 def get_http_health_check(name) http_health_check = self.data[:http_health_checks][name] if http_health_check.nil? return build_excon_response({ "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{@project}/global/httpHealthChecks/#{name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{@project}/global/httpHealthChecks/#{name}' was not found" } }) end build_excon_response(http_health_check) end
get_image(image_name, project=@project)
click to toggle source
# File lib/fog/google/requests/compute/get_image.rb, line 5 def get_image(image_name, project=@project) image = data(project)[:images][image_name] || { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/global/images/#{image_name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{project}/global/images/#{image_name}' was not found" } } build_excon_response(image) end
get_instance_group(group_name, zone, project=@project)
click to toggle source
# File lib/fog/google/requests/compute/get_instance_group.rb, line 5 def get_instance_group(group_name, zone, project=@project) Fog::Mock.not_implemented end
get_machine_type(machine_type_name, zone_name = nil)
click to toggle source
# File lib/fog/google/requests/compute/get_machine_type.rb, line 5 def get_machine_type(machine_type_name, zone_name = nil) zone_name = self.data[:zones].keys.first if zone_name.nil? get_zone(zone_name) machine_type = self.data[:machine_types][zone_name][machine_type_name] || { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{@project}/zones/#{zone_name}/machineTypes/#{machine_type_name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{@project}/zones/#{zone_name}/machineTypes/#{machine_type_name}' was not found" } } build_excon_response(machine_type) end
get_network(network_name)
click to toggle source
# File lib/fog/google/requests/compute/get_network.rb, line 5 def get_network(network_name) Fog::Mock.not_implemented end
get_project(identity)
click to toggle source
# File lib/fog/google/requests/compute/get_project.rb, line 5 def get_project(identity) Fog::Mock.not_implemented end
get_region(identity)
click to toggle source
# File lib/fog/google/requests/compute/get_region.rb, line 5 def get_region(identity) rname = identity.split('/')[-1] region = self.data[:regions][rname] || { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/regions/#{rname}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{project}/regions/#{rname}' was not found" } } build_excon_response(region) end
get_region_operation(region_name, operation)
click to toggle source
# File lib/fog/google/requests/compute/get_region_operation.rb, line 5 def get_region_operation(region_name, operation) operation = self.data[:operations][operation] if operation case operation["status"] when Fog::Compute::Google::Operation::PENDING_STATE operation["status"] = Fog::Compute::Google::Operation::RUNNING_STATE operation["progress"] = 50 else operation["status"] = Fog::Compute::Google::Operation::DONE_STATE operation["progress"] = 100 end else operation = { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/regions/#{region_name}/operations/#{operation}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{project}/regions/#{region_name}/operations/#{operation}' was not found" } } end build_excon_response(operation) end
get_region_view(region_view_name, region)
click to toggle source
# File lib/fog/google/requests/compute/get_region_view.rb, line 5 def get_region_view(region_view_name, region) Fog::Mock.not_implemented end
get_route(identity)
click to toggle source
# File lib/fog/google/requests/compute/get_route.rb, line 5 def get_route(identity) Fog::Mock.not_implemented end
get_server(server_name, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/get_server.rb, line 5 def get_server(server_name, zone_name) server = self.data[:servers][server_name] get_zone(zone_name) zone = self.data[:zones][zone_name] if server.nil? or server["zone"] != zone["selfLink"] return build_excon_response({ "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{@project}/zones/#{zone_name}/instances/#{server_name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{@project}/zones/#{zone_name}/instances/#{server_name}' was not found" } }) end # transition the server through the provisioning -> staging -> running states creation_time = Time.iso8601(server['creationTimestamp']) case server['status'] when 'PROVISIONING' if Time.now - creation_time > Fog::Mock.delay/2 server['status'] = 'STAGING' end when 'STAGING' if Time.now - creation_time > Fog::Mock.delay server['status'] = 'RUNNING' end when 'STOPPED' if server['mock-deletionTimestamp'] # stopped -> terminated if Time.now - Time.iso8601(server['mock-deletionTimestamp']) > Fog::Mock.delay server['status'] = 'TERMINATED' end else # TODO stopped -> provisioning end when 'TERMINATED' if Time.now - Time.iso8601(server['mock-deletionTimestamp']) > Fog::Mock.delay self.data[:servers][server_name] = nil end end build_excon_response(server) end
get_server_serial_port_output(identity, zone)
click to toggle source
# File lib/fog/google/requests/compute/get_server_serial_port_output.rb, line 5 def get_server_serial_port_output(identity, zone) Fog::Mock.not_implemented end
get_snapshot(snap_name)
click to toggle source
# File lib/fog/google/requests/compute/get_snapshot.rb, line 5 def get_snapshot(snap_name) Fog::Mock.not_implemented end
get_target_http_proxy(name)
click to toggle source
# File lib/fog/google/requests/compute/get_target_http_proxy.rb, line 5 def get_target_http_proxy(name) proxy = self.data[:target_http_proxies][name] if proxy.nil? return nil end build_excon_response(proxy) end
get_target_instance(name, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/get_target_instance.rb, line 5 def get_target_instance(name, zone_name) target_instance = self.data[:target_instances][name] if target_instance.nil? return nil end build_excon_response(target_instance) end
get_target_pool(name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/get_target_pool.rb, line 5 def get_target_pool(name, region_name) region = get_region(region_name) target_pool = self.data[:target_pools][name] || { "error" => { "errors" => [{ "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/regions/#{region_name}/targetPools/#{name}' was not found" }], "code" => 404, "message" => "The resource 'projects/#{project}/regions/#{region_name}/targetPools/#{name}' was not found" } } build_excon_response(target_pool) end
get_target_pool_health(target_pool)
click to toggle source
# File lib/fog/google/requests/compute/get_target_pool_health.rb, line 5 def get_target_pool_health(target_pool) Fog::Mock.not_implemented end
get_url_map(name)
click to toggle source
# File lib/fog/google/requests/compute/get_url_map.rb, line 5 def get_url_map(name) url_map = self.data[:url_maps][name] if url_map.nil? return nil end build_excon_response(url_map) end
get_zone(zone_name)
click to toggle source
# File lib/fog/google/requests/compute/get_zone.rb, line 5 def get_zone(zone_name) zone = self.data[:zones][zone_name] || { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/zones/#{zone_name}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{project}/zones/#{zone_name}' was not found" } } build_excon_response(zone) end
get_zone_operation(zone_name, operation)
click to toggle source
# File lib/fog/google/requests/compute/get_zone_operation.rb, line 5 def get_zone_operation(zone_name, operation) operation = self.data[:operations][operation] if operation case operation["status"] when Fog::Compute::Google::Operation::PENDING_STATE operation["status"] = Fog::Compute::Google::Operation::RUNNING_STATE operation["progress"] = 50 else operation["status"] = Fog::Compute::Google::Operation::DONE_STATE operation["progress"] = 100 end else operation = { "error" => { "errors" => [ { "domain" => "global", "reason" => "notFound", "message" => "The resource 'projects/#{project}/zones/#{zone_name}/operations/#{operation}' was not found" } ], "code" => 404, "message" => "The resource 'projects/#{project}/zones/#{zone_name}/operations/#{operation}' was not found" } } end build_excon_response(operation) end
get_zone_view(zone_view)
click to toggle source
# File lib/fog/google/requests/compute/get_zone_view.rb, line 5 def get_zone_view(zone_view) Fog::Mock.not_implemented end
handle_disks(options, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/insert_server.rb, line 7 def handle_disks(options, zone_name) disks = [] i = 0 options.delete('disks').each do |disk| disk = Disk.new(disk) unless disk.is_a? Disk disks << { "kind"=>"compute#attachedDisk", "index"=>i, "type"=>"PERSISTENT", "mode"=>"READ_WRITE", "source"=>"https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk.name}", "deviceName"=>"persistent-disk-#{i}", "boot"=>true } i+=1 end disks end
insert_address(address_name, region_name, options = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_address.rb, line 5 def insert_address(address_name, region_name, options = {}) Fog::Mock.not_implemented end
insert_backend_service(backend_service_name, opts ={})
click to toggle source
# File lib/fog/google/requests/compute/insert_backend_service.rb, line 5 def insert_backend_service(backend_service_name, opts ={}) id = Fog::Mock.random_numbers(19).to_s self.data[:backend_services][backend_service_name] = { "kind" => "compute#backendService", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => backend_service_name, "description" => '', "backends" => [ { "description" => '', "group" => 'https://www.googleapis.com/resourceviews/v1beta1/projects#{@project}/zones/us-central1-a/zoneViews/name', "balancingMode" => "RATE", "capacityScaler" => 1.1, "maxRate" => 0.5, }], "healthChecks" => [ opts["health_check"] ], "timeoutSec" => 30, "port" => 80, "protocol" => "TCP", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/#{backend_service_name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServces/#{backend_service_name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_disk(disk_name, zone_name, image_name=nil, options={})
click to toggle source
# File lib/fog/google/requests/compute/insert_disk.rb, line 5 def insert_disk(disk_name, zone_name, image_name=nil, options={}) # check that image and zone exist image = nil if image_name image = images.get(image_name) raise ArgumentError.new("Invalid image specified: #{image_name}") unless image end get_zone(zone_name) id = Fog::Mock.random_numbers(19).to_s object = { "kind" => "compute#disk", "id" => id, "creationTimestamp" => Time.now.iso8601, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}", "status" => "READY", "name" => disk_name, "sizeGb" => options['sizeGb'] || "10", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}" } if image object.merge({ "sourceImage" => image.self_link, "sourceImageId" => image.id }) end self.data[:disks][disk_name] = object if image object.merge!({ "sourceImage" => image.self_link, "sourceImageId" => image.id }) end if disk_type = options.delete(:type) object["type"] = type else object["type"] = "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/diskTypes/pd-standard" end self.data[:disks][disk_name] = object operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => object["zone"], "operationType" => "insert", "targetLink" => object["selfLink"], "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "#{object["zone"]}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_firewall(firewall_name, allowed, network = GOOGLE_COMPUTE_DEFAULT_NETWORK, options = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_firewall.rb, line 5 def insert_firewall(firewall_name, allowed, network = GOOGLE_COMPUTE_DEFAULT_NETWORK, options = {}) Fog::Mock.not_implemented end
insert_forwarding_rule(name, region_name, opts = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_forwarding_rule.rb, line 5 def insert_forwarding_rule(name, region_name, opts = {}) # check that region exists get_region(region_name) id = Fog::Mock.random_numbers(19).to_s self.data[:forwarding_rules][name] = { "kind" => "compute#forwardingRule", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => name, "description" => '', "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}", "IPAddress" => '', "IPProtocol" => '', "portRange" => '', "target" => opts['target'], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/forwardingRules/#{name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/forwardingRules/#{name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_global_forwarding_rule(name, opts = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_global_forwarding_rule.rb, line 5 def insert_global_forwarding_rule(name, opts = {}) id = Fog::Mock.random_numbers(19).to_s self.data[:global_forwarding_rules][name] = { "kind" => "compute#forwardingRule", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => name, "description" => '', "region" => 'global', "IPAddress" => '', "IPProtocol" => '', "portRange" => '', "target" => opts['target'], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardingRules/#{name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardingRules/#{name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_http_health_check(name, options={})
click to toggle source
# File lib/fog/google/requests/compute/insert_http_health_check.rb, line 5 def insert_http_health_check(name, options={}) id = Fog::Mock.random_numbers(19).to_s self.data[:http_health_checks][name] = { "kind" => "compute#httpHealthCheck", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => name, "description" => '', "host" => '0.00.0.0', "requestPath" => '/', "port" => 80, "checkIntervalSec" => 5, "timeoutSec" => 5, "unhealthyThreshold" => 2, "healthyThreshold" => 2, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/#{name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/#{name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_image(image_name, options={})
click to toggle source
# File lib/fog/google/requests/compute/insert_image.rb, line 5 def insert_image(image_name, options={}) id = Fog::Mock.random_numbers(19).to_s object = { "kind" => "compute#image", "id" => id, "creationTimestamp" => Time.now.iso8601, "sourceType" => '', "rawDisk" => { "source" => options ["source"], "shal1Checksum" => '', "containerType" => '' }, "status" => "READY", "name" => image_name, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/images/#{image_name}" } self.data[:images][image_name] = object operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "operationType" => "insert", "targetLink" => object["selfLink"], "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_instance_group(group_name, zone, options = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_instance_group.rb, line 5 def insert_instance_group(group_name, zone, options = {}) Fog::Mock.not_implemented end
insert_network(network_name, ip_range, options = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_network.rb, line 5 def insert_network(network_name, ip_range, options = {}) Fog::Mock.not_implemented end
insert_region_view(region_view_name, region_name)
click to toggle source
# File lib/fog/google/requests/compute/insert_region_view.rb, line 5 def insert_region_view(region_view_name, region_name) Fog::Mock.not_implemented end
insert_route(name, network, dest_range, priority, options = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_route.rb, line 5 def insert_route(name, network, dest_range, priority, options = {}) Fog::Mock.not_implemented end
insert_server(server_name, zone_name, options={}, *deprecated_args)
click to toggle source
# File lib/fog/google/requests/compute/insert_server.rb, line 26 def insert_server(server_name, zone_name, options={}, *deprecated_args) # check that zone exists get_zone(zone_name) if options['disks'].nil? or options['disks'].empty? raise ArgumentError.new "Empty value for field 'disks'. Boot disk must be specified" end id = Fog::Mock.random_numbers(19).to_s self.data[:servers][server_name] = { "kind" => "compute#instance", "id" => id, "creationTimestamp" => Time.now.iso8601, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}", "status" => "PROVISIONING", "name" => server_name, "tags" => { "fingerprint" => "42WmSpB8rSM=" }, "machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/machineTypes/#{options['machineType']}", "canIpForward" => false, "networkInterfaces" => [ { "network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/networks/default", "networkIP" => Fog::Mock.random_ip, "name" => "nic0", "accessConfigs" => [ { "kind" => "compute#accessConfig", "type" => "ONE_TO_ONE_NAT", "name" => "External NAT", "natIP" => Fog::Mock.random_ip } ] } ], "disks" => handle_disks(options, zone_name), "metadata" => { "kind" => "compute#metadata", "fingerprint" => "5_hasd_gC3E=", "items" => [ { "key" => "sshKeys", "value" => "sysadmin:ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA1zc7mx+0H8Roywet/L0aVX6MUdkDfzd/17kZhprAbpUXYOILv9AG4lIzQk6xGxDIltghytjfVGme/4A42Sb0Z9LN0pxB4KnWTNoOSHPJtp6jbXpq6PdN9r3Z5NKQg0A/Tfw7gt2N0GDsj6vpK8VbHHdW78JAVUxql18ootJxjaksdocsiHNK8iA6/v9qiLRhX3fOgtK7KpxxdZxLRzFg9vkp8jcGISgpZt27kOgXWhR5YLhi8pRJookzphO5O4yhflgoHoAE65XkfrsRCe0HU5QTbY2jH88rBVkq0KVlZh/lEsuwfmG4d77kEqaCGGro+j1Wrvo2K3DSQ+rEcvPp2CYRUySjhaeLF18UzQLtxNeoN14QOYqlm9ITdkCnmq5w4Wn007MjSOFp8LEq2RekrnddGXjg1/vgmXtaVSGzJAlXwtVfZor3dTRmF0JCpr7DsiupBaDFtLUlGFFlSKmPDVMPOOB5wajexmcvSp2Vu4U3yP8Lai/9/ZxMdsGPhpdCsWVL83B5tF4oYj1HVIycbYIxIIfFqOxZcCru3CMfe9jmzKgKLv2UtkfOS8jpS/Os2gAiB3wPweH3agvtwYAYBVMDwt5cnrhgHYWoOz7ABD8KgmCrD7Y9HikiCqIUNkgUFd9YmjcYi5FkU5rFXIawN7efs341lsdf923lsdf923fs= johndoe@acme" } ] }, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances/#{server_name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances/#{server_name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_snapshot(snap_name)
click to toggle source
# File lib/fog/google/requests/compute/insert_snapshot.rb, line 5 def insert_snapshot(snap_name) Fog::Mock.not_implemented end
insert_target_http_proxy(name, options={})
click to toggle source
# File lib/fog/google/requests/compute/insert_target_http_proxy.rb, line 5 def insert_target_http_proxy(name, options={}) id = Fog::Mock.random_numbers(19).to_s self.data[:target_http_proxies][name] = { "kind" => "compute#targetHttpProxy", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => name, "description" => '', "urlMap" => options["urlMap"], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/#{name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/#{name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_target_instance(target_instance, zone_name, opts = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_target_instance.rb, line 5 def insert_target_instance(target_instance, zone_name, opts = {}) id = Fog::Mock.random_numbers(19).to_s self.data[:target_instances][target_instance] = { "kind" => "compute#targetInstance", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => target_instance, "description" => '', "natPolicy" => '', "zone" => zone_name, "instance" => opts['instance'], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/targetInstances/#{target_instance}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/targetInstances/#{target_instance}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_target_pool(name, region_name, opts = {})
click to toggle source
# File lib/fog/google/requests/compute/insert_target_pool.rb, line 5 def insert_target_pool(name, region_name, opts = {}) # check that region exists get_region(region_name) id = Fog::Mock.random_numbers(19).to_s self.data[:target_pools][name] = { "kind" => "compute#targetPools", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => name, "description" => '', "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}", "instances" => opts['instances'], "healthChecks" => opts['healthChecks'], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/targetPools/#{name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/targetPools/#{name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_url_map(url_map_name, opts)
click to toggle source
# File lib/fog/google/requests/compute/insert_url_map.rb, line 5 def insert_url_map(url_map_name, opts) id = Fog::Mock.random_numbers(19).to_s self.data[:url_maps][url_map_name] = { "kind" => "compute#urlMap", "id" => id, "creationTimestamp" => Time.now.iso8601, "name" => url_map_name, "description" => '', "hostRules" => [], "pathMatchers" => [], "tests" => [], "defaultService" => opts['defaultService'], "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/#{url_map_name}" } operation = self.random_operation self.data[:operations][operation] = { "kind" => "compute#operation", "id" => Fog::Mock.random_numbers(19).to_s, "name" => operation, "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global", "operationType" => "insert", "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/#{url_map_name}", "targetId" => id, "status" => Fog::Compute::Google::Operation::PENDING_STATE, "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com", "progress" => 0, "insertTime" => Time.now.iso8601, "startTime" => Time.now.iso8601, "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/operations/#{operation}" } build_excon_response(self.data[:operations][operation]) end
insert_zone_view(zone_view_name, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/insert_zone_view.rb, line 5 def insert_zone_view(zone_view_name, zone_name) Fog::Mock.not_implemented end
list_addresses(region_name)
click to toggle source
# File lib/fog/google/requests/compute/list_addresses.rb, line 5 def list_addresses(region_name) Fog::Mock.not_implemented end
list_aggregated_addresses(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_addresses.rb, line 5 def list_aggregated_addresses(options = {}) Fog::Mock.not_implemented end
list_aggregated_disk_types(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_disk_types.rb, line 5 def list_aggregated_disk_types(options = {}) disk_types_items = {} if options[:filter] disk_type = options[:filter].gsub(/name eq \.\*/, '') self.data[:zones].keys.each do |zone| disk_types = list_disk_types(zone).body['items'].select { |dt| dt['name'] == disk_type } || [] disk_types_items["zones/#{zone}"] = { 'diskTypes' => disk_types } unless disk_types.empty? end else self.data[:zones].keys.each do |zone| disk_types = list_disk_types(zone).body['items'] disk_types_items["zones/#{zone}"] = { 'diskTypes' => disk_types } end end build_excon_response({ 'kind' => 'compute#diskTypeAggregatedList', 'selfLink' => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/aggregated/diskTypes", 'items' => disk_types_items, }) end
list_aggregated_disks(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_disks.rb, line 5 def list_aggregated_disks(options = {}) # Create a Hash of unique zones from the disks Array previously filled when disks are created zones = Hash[self.data[:disks].values.map { |disk| ["zones/#{disk['zone'].split('/')[-1]}", {'disks' => [] }] }] if options[:filter] # Look up for the disk name disk = self.data[:disks][options[:filter].gsub(/name eq \.\*/, '')] # Fill the zones Hash with the disk (if it's found) zones["zones/#{disk['zone'].split('/')[-1]}"]['disks'].concat([disk]) if disk else # Fill the zones Hash with the disks attached to each zone self.data[:disks].values.each { |disk| zones["zones/#{disk['zone'].split('/')[-1]}"]['disks'].concat([disk]) } end build_excon_response({ "kind" => "compute#diskAggregatedList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/aggregated/disks", "id" => "projects/#{@project}/aggregated/disks", "items" => zones }) end
list_aggregated_instance_groups(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_instance_groups.rb, line 5 def list_aggregated_instance_groups(options = {}) Fog::Mock.not_implemented end
list_aggregated_machine_types()
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_machine_types.rb, line 5 def list_aggregated_machine_types Fog::Mock.not_implemented end
list_aggregated_servers(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_servers.rb, line 5 def list_aggregated_servers(options = {}) # Create a Hash of unique zones from the servers Array previously filled when servers are created zones = Hash[self.data[:servers].values.map { |server| ["zones/#{server['zone'].split('/')[-1]}", {'instances' => [] }] }] if options[:filter] # Look up for the server name server = self.data[:servers][options[:filter].gsub(/name eq \.\*/, '')] # Fill the zones Hash with the server (if it's found) zones["zones/#{server['zone'].split('/')[-1]}"]['instances'].concat([server]) if server else # Fill the zones Hash with the servers attached to each zone self.data[:servers].values.each { |server| zones["zones/#{server['zone'].split('/')[-1]}"]['instances'].concat([server]) } end build_excon_response({ "kind" => "compute#instanceAggregatedList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/aggregated/instances", "id" => "projects/#{@project}/aggregated/instances", "items" => zones }) end
list_aggregated_target_instances(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_aggregated_target_instances.rb, line 7 def list_aggregated_target_instances(options = {}) # Create a Hash of unique zones from the target_instances Array previously filled when target_instances are created zones = Hash[self.data[:target_instances].values.map { |target_instance| ["zones/#{target_instance['zone'].split('/')[-1]}", {'targetInstances' => [] }] }] if options[:filter] # Look up for the target_instance name target_instance = self.data[:target_instances][options[:filter].gsub(/name eq \.\*/, '')] # Fill the zones Hash with the target_instance (if it's found) zones["zones/#{target_instance['zone'].split('/')[-1]}"]['targetInstances'].concat([target_instance]) if target_instance else # Fill the zones Hash with the target_instances attached to each zone self.data[:target_instances].values.each { |target_instance| zones["zones/#{target_instance['zone'].split('/')[-1]}"]['targetInstances'].concat([target_instance]) } end build_excon_response({ "kind" => "compute#targetInstanceAggregatedList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/aggregated/targetInstances", "id" => "projects/#{@project}/aggregated/targetInstances", "items" => zones }) end
list_backend_services()
click to toggle source
# File lib/fog/google/requests/compute/list_backend_services.rb, line 5 def list_backend_services backend_services = self.data[:backend_services].values build_excon_response({ "kind" => "compute#backendServiceList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices", "id" => "projects/#{@project}/global/backendServices", "items" => backend_services }) end
list_disk_types(zone)
click to toggle source
# File lib/fog/google/requests/compute/list_disk_types.rb, line 5 def list_disk_types(zone) build_excon_response({ 'kind' => 'compute#diskTypeList', 'selfLink' => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}/diskTypes", 'items' => [ { 'kind' => 'compute#diskType', 'creationTimestamp' => '2014-06-02T18:07:28.530Z', 'name' => 'pd-standard', 'description' => 'Standard Persistent Disk', 'validDiskSize' => '10GB-10TB', 'zone' => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}", 'selfLink' => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}/diskTypes/pd-standard", }, { 'kind' => 'compute#diskType', 'creationTimestamp' => '2014-06-02T18:07:28.529Z', 'name' => 'pd-ssd', 'description' => 'SSD Persistent Disk', 'validDiskSize' => '10GB-1TB', "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}/diskTypes/pd-ssd", } ] }) end
list_disks(zone_name)
click to toggle source
# File lib/fog/google/requests/compute/list_disks.rb, line 5 def list_disks(zone_name) disks = self.data[:disks].values.select{|d| d["zone"].split("/")[-1] == zone_name} build_excon_response({ "kind" => "compute#diskList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks", "id" => "projects/#{@project}/zones/#{zone_name}/disks", "items" => disks }) end
list_firewalls()
click to toggle source
# File lib/fog/google/requests/compute/list_firewalls.rb, line 5 def list_firewalls Fog::Mock.not_implemented end
list_forwarding_rules(region_name)
click to toggle source
# File lib/fog/google/requests/compute/list_forwarding_rules.rb, line 5 def list_forwarding_rules(region_name) forwarding_rules = self.data[:forwarding_rules].values.select{|d| d["region"].split("/")[-1] == region_name} build_excon_response({ "kind" => "compute#forwardingRuleList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/forwardingRules", "id" => "projects/#{@project}/regions/#{region_name}/regions", "items" => forwarding_rules }) end
list_global_forwarding_rules(region_name = 'global')
click to toggle source
# File lib/fog/google/requests/compute/list_global_forwarding_rules.rb, line 5 def list_global_forwarding_rules(region_name = 'global') global_forwarding_rules = self.data[:global_forwarding_rules].values build_excon_response({ "kind" => "compute#forwardingRuleList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardingRules", "id" => "projects/#{@project}/global/forwardingRules", "items" => global_forwarding_rules }) end
list_global_operations()
click to toggle source
# File lib/fog/google/requests/compute/list_global_operations.rb, line 5 def list_global_operations Fog::Mock.not_implemented end
list_http_health_checks()
click to toggle source
# File lib/fog/google/requests/compute/list_http_health_checks.rb, line 5 def list_http_health_checks health_checks = self.data[:http_health_checks].values build_excon_response({ "kind" => "compute#urlMapList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks", "id" => "projects/#{@project}/global/httpHealthChecks", "items" => health_checks }) end
list_images(project=@project)
click to toggle source
# File lib/fog/google/requests/compute/list_images.rb, line 5 def list_images(project=@project) images = data(project)[:images].values build_excon_response({ "kind" => "compute#imageList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{project}/global/images", "id" => "projects/#{project}/global/images", "items" => images }) end
list_instance_group_instances(group, zone)
click to toggle source
# File lib/fog/google/requests/compute/list_instance_group_instances.rb, line 5 def list_instance_group_instances(group, zone) Fog::Mock.not_implemented end
list_instance_groups(zone)
click to toggle source
# File lib/fog/google/requests/compute/list_instance_groups.rb, line 5 def list_instance_groups(zone) Fog::Mock.not_implemented end
list_machine_types(zone_name)
click to toggle source
# File lib/fog/google/requests/compute/list_machine_types.rb, line 5 def list_machine_types(zone_name) get_zone(zone_name) machine_types = data[:machine_types][zone_name].values build_excon_response({ "kind" => "compute#machineTypeList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/machineTypes", "id" => "projects/high-cistern-340/zones/us-central1-a/machineTypes", "items" => machine_types }) end
list_networks()
click to toggle source
# File lib/fog/google/requests/compute/list_networks.rb, line 5 def list_networks Fog::Mock.not_implemented end
list_region_operations(region)
click to toggle source
# File lib/fog/google/requests/compute/list_region_operations.rb, line 5 def list_region_operations(region) Fog::Mock.not_implemented end
list_region_view_resources(region_view)
click to toggle source
# File lib/fog/google/requests/compute/list_region_view_resources.rb, line 5 def list_region_view_resources(region_view) Fog::Mock.not_implemented end
list_region_views(region_name)
click to toggle source
# File lib/fog/google/requests/compute/list_region_views.rb, line 5 def list_region_views(region_name) Fog::Mock.not_implemented end
list_regions()
click to toggle source
# File lib/fog/google/requests/compute/list_regions.rb, line 5 def list_regions build_excon_response({ "kind" => "compute#regionList", "selfLink" => "https://www.googleapis.com/compute/v1/projects/#{@project}/regions", "id" => "projects/#{@project}/regions", "items" => [ { "kind" => "compute#region", "selfLink" => "https://www.googleapis.com/compute/v1/projects/#{@project}/regions/asia-east1", "id" => "2699746309412936080", "creationTimestamp" => "2014-01-28T04:12:16.138-08:00", "name" => "asia-east1", "description" => "asia-east1", "status" => "UP", "zones" => [ "https://www.googleapis.com/compute/v1/projects/#{@project}/zones/asia-east1-a", "https://www.googleapis.com/compute/v1/projects/#{@project}/zones/asia-east1-b" ], "quotas" => [ { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 }, { "metric" => "DISKS_TOTAL_GB", "limit" => 5120.0, "usage" => 0.0 }, { "metric" => "STATIC_ADDRESSES", "limit" => 7.0, "usage" => 0.0 }, { "metric" => "IN_USE_ADDRESSES", "limit" => 23.0, "usage" => 0.0 } ] }, { "kind" => "compute#region", "selfLink" => "https://www.googleapis.com/compute/v1/projects/#{@project}/regions/europe-west1", "id" => "10546209748879352030", "creationTimestamp" => "2014-01-14T18:36:29.094-08:00", "name" => "europe-west1", "description" => "europe-west1", "status" => "UP", "zones" => [ "https://www.googleapis.com/compute/v1/projects/#{@project}/zones/europe-west1-a", "https://www.googleapis.com/compute/v1/projects/#{@project}/zones/europe-west1-b" ], "quotas" => [ { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 }, { "metric" => "DISKS_TOTAL_GB", "limit" => 5120.0, "usage" => 0.0 }, { "metric" => "STATIC_ADDRESSES", "limit" => 7.0, "usage" => 0.0 }, { "metric" => "IN_USE_ADDRESSES", "limit" => 23.0, "usage" => 0.0 } ] }, { "kind" => "compute#region", "selfLink" => "https://www.googleapis.com/compute/v1/projects/#{@project}/regions/us-central1", "id" => "17971001795365542305", "creationTimestamp" => "2014-01-14T18:36:29.094-08:00", "name" => "us-central1", "description" => "us-central1", "status" => "UP", "zones" => [ "https://www.googleapis.com/compute/v1/projects/#{@project}/zones/us-central1-a", "https://www.googleapis.com/compute/v1/projects/#{@project}/zones/us-central1-b" ], "quotas" => [ { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 }, { "metric" => "DISKS_TOTAL_GB", "limit" => 5120.0, "usage" => 0.0 }, { "metric" => "STATIC_ADDRESSES", "limit" => 7.0, "usage" => 0.0 }, { "metric" => "IN_USE_ADDRESSES", "limit" => 23.0, "usage" => 0.0 } ] } ] }) end
list_routes(options = {})
click to toggle source
# File lib/fog/google/requests/compute/list_routes.rb, line 5 def list_routes(options = {}) Fog::Mock.not_implemented end
list_servers(zone_name)
click to toggle source
# File lib/fog/google/requests/compute/list_servers.rb, line 5 def list_servers(zone_name) get_zone(zone_name) zone = self.data[:zones][zone_name] servers = self.data[:servers].values.select{|s| s["zone"] == zone["selfLink"]} build_excon_response({ "kind" => "compute#instanceList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances", "id" => "projects/#{@project}/zones/#{zone_name}/instances", "items" => servers }) end
list_snapshots()
click to toggle source
# File lib/fog/google/requests/compute/list_snapshots.rb, line 5 def list_snapshots Fog::Mock.not_implemented end
list_target_http_proxies()
click to toggle source
# File lib/fog/google/requests/compute/list_target_http_proxies.rb, line 5 def list_target_http_proxies proxies = self.data[:target_http_proxies].values build_excon_response({ "kind" => "compute#targetHttpProxyList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies", "id" => "projects/#{@project}/global/targetHttpProxies", "items" => proxies }) end
list_target_instances(zone_name='us-central1-a')
click to toggle source
# File lib/fog/google/requests/compute/list_target_instances.rb, line 5 def list_target_instances(zone_name='us-central1-a') zone = self.data[:zones][zone_name] target_instances = self.data[:target_instances].values.select{|s| s["zone"] == zone_name} build_excon_response({ "kind" => "compute#targetInstanceList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/targetInstances", "id" => "projects/#{@project}/zones/#{zone_name}/targetInstances", "items" => target_instances }) end
list_target_pools(region_name)
click to toggle source
# File lib/fog/google/requests/compute/list_target_pools.rb, line 5 def list_target_pools(region_name) target_pools = self.data[:target_pools].values.select{|d| d["region"].split("/")[-1] == region_name} build_excon_response({ "kind" => "compute#forwardingRuleList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/targetPools", "id" => "projects/#{@project}/regions/#{region_name}/regions", "items" => target_pools }) end
list_url_maps()
click to toggle source
# File lib/fog/google/requests/compute/list_url_maps.rb, line 5 def list_url_maps url_maps = self.data[:url_maps].values build_excon_response({ "kind" => "compute#urlMapList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps", "id" => "projects/#{@project}/global/urlMaps", "items" => url_maps }) end
list_zone_operations(zone)
click to toggle source
# File lib/fog/google/requests/compute/list_zone_operations.rb, line 5 def list_zone_operations(zone) Fog::Mock.not_implemented end
list_zone_view_resources(zone_view)
click to toggle source
# File lib/fog/google/requests/compute/list_zone_view_resources.rb, line 5 def list_zone_view_resources(zone_view) Fog::Mock.not_implemented end
list_zone_views(zone_name)
click to toggle source
# File lib/fog/google/requests/compute/list_zone_views.rb, line 5 def list_zone_views(zone_name) Fog::Mock.not_implemented end
list_zones()
click to toggle source
# File lib/fog/google/requests/compute/list_zones.rb, line 5 def list_zones zones = self.data[:zones].values build_excon_response({ "kind" => "compute#zoneList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones", "id" => "projects/#{@project}/zones", "items" => zones }) end
random_operation()
click to toggle source
# File lib/fog/google/compute.rb, line 1058 def random_operation "operation-#{Fog::Mock.random_numbers(13)}-#{Fog::Mock.random_hex(13)}-#{Fog::Mock.random_hex(8)}" end
remove_instance_group_instance(group_name, zone, instances)
click to toggle source
# File lib/fog/google/requests/compute/remove_instance_group_instance.rb, line 5 def remove_instance_group_instance(group_name, zone, instances) Fog::Mock.not_implemented end
remove_target_pool_health_checks(target_pool, health_checks)
click to toggle source
# File lib/fog/google/requests/compute/remove_target_pool_health_checks.rb, line 5 def remove_target_pool_health_checks(target_pool, health_checks) Fog::Mock.not_implemented end
remove_target_pool_instances(target_pool, instances)
click to toggle source
# File lib/fog/google/requests/compute/remove_target_pool_instances.rb, line 5 def remove_target_pool_instances(target_pool, instances) Fog::Mock.not_implemented end
reset_data()
click to toggle source
# File lib/fog/google/compute.rb, line 1053 def reset_data # not particularly useful because it deletes zones self.class.data(api_version).delete(@project) end
reset_server(identity, zone)
click to toggle source
# File lib/fog/google/requests/compute/reset_server.rb, line 5 def reset_server(identity, zone) Fog::Mock.not_implemented end
set_common_instance_metadata(identity, current_fingerprint, metadata = {})
click to toggle source
# File lib/fog/google/requests/compute/set_common_instance_metadata.rb, line 5 def set_common_instance_metadata(identity, current_fingerprint, metadata = {}) Fog::Mock.not_implemented end
set_forwarding_rule_target(rule, target)
click to toggle source
# File lib/fog/google/requests/compute/set_forwarding_rule_target.rb, line 5 def set_forwarding_rule_target(rule, target) Fog::Mock.not_implemented end
set_global_forwarding_rule_target(rule, target)
click to toggle source
# File lib/fog/google/requests/compute/set_global_forwarding_rule_target.rb, line 5 def set_global_forwarding_rule_target(rule, target) Fog::Mock.not_implemented end
set_metadata(instance, zone, fingerprint, metadata={})
click to toggle source
# File lib/fog/google/requests/compute/remove_target_pool_instance.rb, line 5 def set_metadata(instance, zone, fingerprint, metadata={}) Fog::Mock.not_implemented end
set_server_disk_auto_delete(identity, zone, auto_delete, device_name)
click to toggle source
# File lib/fog/google/requests/compute/set_server_disk_auto_delete.rb, line 5 def set_server_disk_auto_delete(identity, zone, auto_delete, device_name) Fog::Mock.not_implemented end
set_server_scheduling(identity, zone, on_host_maintenance, automatic_restart, preemptible)
click to toggle source
# File lib/fog/google/requests/compute/set_server_scheduling.rb, line 5 def set_server_scheduling(identity, zone, on_host_maintenance, automatic_restart, preemptible) Fog::Mock.not_implemented end
set_target_http_proxy_url_map(target_http_proxy, url_map)
click to toggle source
# File lib/fog/google/requests/compute/set_target_http_proxy_url_map.rb, line 5 def set_target_http_proxy_url_map(target_http_proxy, url_map) Fog::Mock.not_implemented end
start_server(identity, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/start_server.rb, line 5 def start_server(identity, zone_name) Fog::Mock.not_implemented end
stop_server(identity, zone_name)
click to toggle source
# File lib/fog/google/requests/compute/stop_server.rb, line 5 def stop_server(identity, zone_name) Fog::Mock.not_implemented end
update_url_map(url_map, host_rules)
click to toggle source
# File lib/fog/google/requests/compute/update_url_map.rb, line 5 def update_url_map(url_map, host_rules) Fog::Mock.not_implemented end
validate_url_map(url_map)
click to toggle source
# File lib/fog/google/requests/compute/validate_url_map.rb, line 5 def validate_url_map(url_map) Fog::Mock::not_implemented end