fog-google 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -1
- data/lib/fog/compute/google.rb +20 -0
- data/lib/fog/compute/google/models/images.rb +0 -1
- data/lib/fog/compute/google/models/instance_group_manager.rb +51 -0
- data/lib/fog/compute/google/models/instance_group_managers.rb +42 -0
- data/lib/fog/compute/google/models/instance_template.rb +47 -0
- data/lib/fog/compute/google/models/instance_templates.rb +23 -0
- data/lib/fog/compute/google/requests/abandon_instances.rb +26 -0
- data/lib/fog/compute/google/requests/delete_instance_group_manager.rb +17 -0
- data/lib/fog/compute/google/requests/delete_instance_template.rb +17 -0
- data/lib/fog/compute/google/requests/get_instance_group_manager.rb +17 -0
- data/lib/fog/compute/google/requests/get_instance_template.rb +17 -0
- data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +29 -0
- data/lib/fog/compute/google/requests/insert_instance_template.rb +36 -0
- data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +24 -0
- data/lib/fog/compute/google/requests/list_instance_group_managers.rb +20 -0
- data/lib/fog/compute/google/requests/list_instance_templates.rb +24 -0
- data/lib/fog/compute/google/requests/recreate_instances.rb +26 -0
- data/lib/fog/compute/google/requests/set_instance_template.rb +26 -0
- data/lib/fog/google/version.rb +1 -1
- data/test/integration/compute/test_instance_group_managers.rb +11 -0
- data/test/integration/compute/test_instance_templates.rb +11 -0
- data/test/integration/factories/instance_group_manager_factory.rb +22 -0
- data/test/integration/factories/instance_template_factory.rb +23 -0
- metadata +26 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95802f48e4fa5a610c96521c65d0a9bb2b33ce54
|
4
|
+
data.tar.gz: 6ae1e7e9a6c7ed8a5a05736857219a6144a4e443
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b8f524b235aaf667a4ecaf256a19ca038de9ca6db80e486a29c805dabc73d0cc5b2b95f6a5b17198c268c193a3939825ba6182f6122946ef2ba0ff5bb617c62
|
7
|
+
data.tar.gz: cfa889ab0a734fd5165447f4b7b8234c14287f0e87f2ebae833fa9b34d355f218dcdca6abc89923af196b79c6f6c7ce9ab8c641021699e2a296488e37d144d41
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,39 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
4
4
|
|
5
|
+
## 1.5.0
|
6
|
+
|
7
|
+
### User-facing
|
8
|
+
|
9
|
+
- \#348 Added Instance Group Manager and Instance Templates [bpaquet]
|
10
|
+
|
11
|
+
- `Fog::Compute::Google::InstanceGroupManager` model and associated requests:
|
12
|
+
- `:get_instance_group_manager`
|
13
|
+
- `:insert_instance_group_manager`
|
14
|
+
- `:delete_instance_group_manager`
|
15
|
+
- `:list_instance_group_managers`
|
16
|
+
- `:list_aggregated_instance_group_managers`
|
17
|
+
- `:recreate_instances`
|
18
|
+
- `:abandon_instances`
|
19
|
+
|
20
|
+
- `Fog::Compute::Google::InstanceTemplate` model and associated requests:
|
21
|
+
- `:list_instance_templates`
|
22
|
+
- `:get_instance_template`
|
23
|
+
- `:insert_instance_template`
|
24
|
+
- `:delete_instance_template`
|
25
|
+
- `:set_instance_template`
|
26
|
+
|
27
|
+
#### Fixed
|
28
|
+
|
29
|
+
- \#356 Hotfix - removing buggy deprecated 'google-containers' project, causing 403 errors
|
30
|
+
on `images.all` call. [tumido]
|
31
|
+
|
32
|
+
### Development changes
|
33
|
+
|
34
|
+
#### Added
|
35
|
+
|
36
|
+
- \#350 Added InstanceGroupManager and InstanceTemplate integration tests [temikus]
|
37
|
+
|
5
38
|
## 1.4.0
|
6
39
|
|
7
40
|
### User-facing
|
@@ -76,4 +109,4 @@ PRs that change functionality: #212, #215, #203, #198, #201, #221, #222, #216
|
|
76
109
|
## 0.5.2
|
77
110
|
|
78
111
|
Rapid-releasing 0.5.2 due to regression fixed by #190 still present in v0.5.1
|
79
|
-
We encourage people using 0.5.1 to upgrade.
|
112
|
+
We encourage people using 0.5.1 to upgrade.
|
data/lib/fog/compute/google.rb
CHANGED
@@ -196,6 +196,20 @@ module Fog
|
|
196
196
|
request :invalidate_url_map_cache
|
197
197
|
request :validate_url_map
|
198
198
|
|
199
|
+
request :get_instance_group_manager
|
200
|
+
request :insert_instance_group_manager
|
201
|
+
request :delete_instance_group_manager
|
202
|
+
request :list_instance_templates
|
203
|
+
request :list_instance_group_managers
|
204
|
+
request :get_instance_template
|
205
|
+
request :insert_instance_template
|
206
|
+
request :delete_instance_template
|
207
|
+
|
208
|
+
request :list_aggregated_instance_group_managers
|
209
|
+
request :set_instance_template
|
210
|
+
request :recreate_instances
|
211
|
+
request :abandon_instances
|
212
|
+
|
199
213
|
request :deprecate_image
|
200
214
|
|
201
215
|
model_path "fog/compute/google/models"
|
@@ -277,6 +291,12 @@ module Fog
|
|
277
291
|
model :subnetwork
|
278
292
|
collection :subnetworks
|
279
293
|
|
294
|
+
model :instance_template
|
295
|
+
collection :instance_templates
|
296
|
+
|
297
|
+
model :instance_group_manager
|
298
|
+
collection :instance_group_managers
|
299
|
+
|
280
300
|
model :ssl_certificate
|
281
301
|
collection :ssl_certificates
|
282
302
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class InstanceGroupManager < Fog::Model
|
5
|
+
identity :name
|
6
|
+
|
7
|
+
attribute :kind
|
8
|
+
attribute :self_link, :aliases => "selfLink"
|
9
|
+
attribute :description
|
10
|
+
attribute :zone
|
11
|
+
attribute :region
|
12
|
+
attribute :instance_group, :aliases => "instanceGroup"
|
13
|
+
attribute :instance_template, :aliases => "instanceTemplate"
|
14
|
+
attribute :target_pools, :aliases => "targetPools"
|
15
|
+
attribute :base_instance_name, :aliases => "baseInstanceName"
|
16
|
+
attribute :current_actions, :aliases => "currentActions"
|
17
|
+
attribute :target_size, :aliases => "targetSize"
|
18
|
+
attribute :named_ports, :aliases => "namedPorts"
|
19
|
+
|
20
|
+
def save
|
21
|
+
requires :name, :zone, :base_instance_name, :target_size, :instance_template
|
22
|
+
|
23
|
+
data = service.insert_instance_group_manager(name, zone.split("/")[-1], instance_template, base_instance_name,
|
24
|
+
target_size, target_pools, named_ports, description)
|
25
|
+
operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name, zone.split("/")[-1])
|
26
|
+
operation.wait_for { !pending? }
|
27
|
+
reload
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy(async = true)
|
31
|
+
requires :name, :zone
|
32
|
+
operation = service.delete_instance_group_manager(name, zone.split("/")[-1])
|
33
|
+
operation.wait_for { ready? } unless async
|
34
|
+
operation
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_instance_template(instance_template)
|
38
|
+
service.set_instance_template self, instance_template
|
39
|
+
end
|
40
|
+
|
41
|
+
def recreate_instances(instances)
|
42
|
+
service.recreate_instances self, instances
|
43
|
+
end
|
44
|
+
|
45
|
+
def abandon_instances(instances)
|
46
|
+
service.abandon_instances self, instances
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class InstanceGroupManagers < Fog::Collection
|
5
|
+
model Fog::Compute::Google::InstanceGroupManager
|
6
|
+
|
7
|
+
def all(zone: nil, filter: nil, max_results: nil,
|
8
|
+
order_by: nil, page_token: nil)
|
9
|
+
opts = {
|
10
|
+
:filter => filter,
|
11
|
+
:max_results => max_results,
|
12
|
+
:order_by => order_by,
|
13
|
+
:page_token => page_token
|
14
|
+
}
|
15
|
+
data = []
|
16
|
+
if zone
|
17
|
+
data += service.list_instance_group_managers(zone, opts).items || []
|
18
|
+
else
|
19
|
+
service.list_aggregated_instance_group_managers(opts).items.each_value do |group|
|
20
|
+
data.concat(group.instance_group_managers) if group.instance_group_managers
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
load(data.map(&:to_h))
|
25
|
+
end
|
26
|
+
|
27
|
+
def get(identity, zone = nil)
|
28
|
+
if zone
|
29
|
+
if instance_group_manager = service.get_instance_group_manager(identity, zone)
|
30
|
+
new(instance_group_manager.to_h)
|
31
|
+
end
|
32
|
+
else
|
33
|
+
all(:filter => "name eq .*#{identity}").first
|
34
|
+
end
|
35
|
+
rescue ::Google::Apis::ClientError => e
|
36
|
+
raise e unless e.status_code == 404
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class InstanceTemplate < Fog::Model
|
5
|
+
identity :name
|
6
|
+
|
7
|
+
attribute :kind
|
8
|
+
attribute :self_link, :aliases => "selfLink"
|
9
|
+
attribute :description
|
10
|
+
# Properties is a hash describing the templates
|
11
|
+
# A minimal example is
|
12
|
+
# :properties => {
|
13
|
+
# :machine_type => TEST_MACHINE_TYPE,
|
14
|
+
# :disks => [{
|
15
|
+
# :boot => true,
|
16
|
+
# :initialize_params => {
|
17
|
+
# :source_image => "projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20180522"}
|
18
|
+
# }],
|
19
|
+
# :network_interfaces => [{
|
20
|
+
# :network => "global/networks/default"
|
21
|
+
# }]
|
22
|
+
# }
|
23
|
+
# }
|
24
|
+
# @see https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates/insert
|
25
|
+
attribute :properties
|
26
|
+
|
27
|
+
def save
|
28
|
+
requires :name
|
29
|
+
requires :properties
|
30
|
+
|
31
|
+
data = service.insert_instance_template(name, properties, description)
|
32
|
+
operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
|
33
|
+
operation.wait_for { !pending? }
|
34
|
+
reload
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy(async = true)
|
38
|
+
requires :name
|
39
|
+
data = service.delete_instance_template(name)
|
40
|
+
operation = Fog::Compute::Google::Operations.new(:service => service).get(data.name)
|
41
|
+
operation.wait_for { ready? } unless async
|
42
|
+
operation
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class InstanceTemplates < Fog::Collection
|
5
|
+
model Fog::Compute::Google::InstanceTemplate
|
6
|
+
|
7
|
+
def all
|
8
|
+
data = service.list_instance_templates.items || []
|
9
|
+
load(data.map(&:to_h))
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(identity)
|
13
|
+
if instance_template = service.get_instance_template(identity)
|
14
|
+
new(instance_template.to_h)
|
15
|
+
end
|
16
|
+
rescue ::Google::Apis::ClientError => e
|
17
|
+
raise e unless e.status_code == 404
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def abandon_instances(_instance_group_manager, _instances)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def abandon_instances(instance_group_manager, instances)
|
12
|
+
request = ::Google::Apis::ComputeV1::InstanceGroupManagersAbandonInstancesRequest.new(
|
13
|
+
:instances => instances.map{ |i| i.class == String ? i : i.self_link }
|
14
|
+
)
|
15
|
+
if instance_group_manager.zone
|
16
|
+
zone = instance_group_manager.zone.split("/")[-1]
|
17
|
+
@compute.abandon_instance_group_manager_instances(@project, zone, instance_group_manager.name, request)
|
18
|
+
else
|
19
|
+
region = instance_group_manager.region.split("/")[-1]
|
20
|
+
@compute.abandon_region_instance_group_manager_instances(@project, region, instance_group_manager.name, request)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def delete_instance_group_manager(_name, _zone)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def delete_instance_group_manager(name, zone)
|
12
|
+
@compute.delete_instance_group_manager(@project, zone, name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def delete_instance_template(_name)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def delete_instance_template(name)
|
12
|
+
@compute.delete_instance_template(@project, name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def get_instance_group_manager(_name, _zone)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def get_instance_group_manager(name, zone)
|
12
|
+
@compute.get_instance_group_manager(@project, zone, name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def get_instance_template(_name)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def get_instance_template(name)
|
12
|
+
@compute.get_instance_template(@project, name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def insert_instance_group_manager(_name, _zone, _instance_template, _base_instance_name,
|
6
|
+
_target_size, _target_pools, _named_ports, _description)
|
7
|
+
Fog::Mock.not_implemented
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Real
|
12
|
+
def insert_instance_group_manager(name, zone, instance_template, base_instance_name,
|
13
|
+
target_size, target_pools, named_ports, description)
|
14
|
+
instance_group_manager = ::Google::Apis::ComputeV1::InstanceGroupManager.new(
|
15
|
+
:description => description,
|
16
|
+
:name => name,
|
17
|
+
:instance_template => instance_template.self_link,
|
18
|
+
:base_instance_name => base_instance_name,
|
19
|
+
:target_size => target_size,
|
20
|
+
:named_ports => named_ports || [],
|
21
|
+
:target_pools => target_pools || [],
|
22
|
+
)
|
23
|
+
|
24
|
+
@compute.insert_instance_group_manager(@project, zone, instance_group_manager)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def insert_instance_template(_name, _properties, _description)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
##
|
12
|
+
# Create a new template.
|
13
|
+
#
|
14
|
+
# @param name [String]
|
15
|
+
# Name to assign to the created template. Must be unique.
|
16
|
+
# @param descrption [String]
|
17
|
+
# Optional description of the template
|
18
|
+
# @param properties [Hash]
|
19
|
+
# Template attributes. You can use any of the options documented at
|
20
|
+
# https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates/insert
|
21
|
+
# @see https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates/insert
|
22
|
+
# @return [::Google::Apis::ComputeV1::Operation]
|
23
|
+
# response object that represents the insertion operation.
|
24
|
+
def insert_instance_template(name, properties, description)
|
25
|
+
instance_template = ::Google::Apis::ComputeV1::InstanceTemplate.new(
|
26
|
+
:description => description,
|
27
|
+
:name => name,
|
28
|
+
:properties => properties,
|
29
|
+
)
|
30
|
+
|
31
|
+
@compute.insert_instance_template(@project, instance_template)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def list_aggregated_instance_group_managers(_opts = {})
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def list_aggregated_instance_group_managers(filter: nil, max_results: nil,
|
12
|
+
order_by: nil, page_token: nil)
|
13
|
+
@compute.list_aggregated_instance_group_managers(
|
14
|
+
@project,
|
15
|
+
:filter => filter,
|
16
|
+
:max_results => max_results,
|
17
|
+
:order_by => order_by,
|
18
|
+
:page_token => page_token
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def list_instance_group_managers(_zone, _opts = {})
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def list_instance_group_managers(zone, filter: nil, max_results: nil,
|
12
|
+
order_by: nil, page_token: nil)
|
13
|
+
@compute.list_instance_group_managers(
|
14
|
+
@project, zone, :filter => filter, :max_results => max_results,
|
15
|
+
:order_by => order_by, :page_token => page_token)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def list_instance_templates
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def list_instance_templates(filter: nil, max_results: nil,
|
12
|
+
order_by: nil, page_token: nil)
|
13
|
+
@compute.list_instance_templates(
|
14
|
+
@project,
|
15
|
+
:filter => filter,
|
16
|
+
:max_results => max_results,
|
17
|
+
:order_by => order_by,
|
18
|
+
:page_token => page_token
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def recreate_instances(_instance_group_manager, _instances)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def recreate_instances(instance_group_manager, instances)
|
12
|
+
request = ::Google::Apis::ComputeV1::InstanceGroupManagersAbandonInstancesRequest.new(
|
13
|
+
:instances => instances.map{ |i| i.class == String ? i : i.self_link }
|
14
|
+
)
|
15
|
+
if instance_group_manager.zone
|
16
|
+
zone = instance_group_manager.zone.split("/")[-1]
|
17
|
+
@compute.recreate_instance_group_manager_instances(@project, zone, instance_group_manager.name, request)
|
18
|
+
else
|
19
|
+
region = instance_group_manager.region.split("/")[-1]
|
20
|
+
@compute.recreate_region_instance_group_manager_instances(@project, region, instance_group_manager.name, request)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def set_instance_template(_instance_group_manager, _instance_template)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def set_instance_template(instance_group_manager, instance_template)
|
12
|
+
request = ::Google::Apis::ComputeV1::InstanceGroupManagersSetInstanceTemplateRequest.new(
|
13
|
+
:instance_template => instance_template.class == String ? instance_template : instance_template.self_link
|
14
|
+
)
|
15
|
+
if instance_group_manager.zone
|
16
|
+
zone = instance_group_manager.zone.split("/")[-1]
|
17
|
+
@compute.set_instance_group_manager_instance_template(@project, zone, instance_group_manager.name, request)
|
18
|
+
else
|
19
|
+
region = instance_group_manager.region.split("/")[-1]
|
20
|
+
@compute.set_region_instance_group_manager_instance_template(@project, region, instance_group_manager.name, request)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/fog/google/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/factories/instance_group_manager_factory"
|
3
|
+
|
4
|
+
class TestInstanceGroupManager < FogIntegrationTest
|
5
|
+
include TestCollection
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@subject = Fog::Compute[:google].instance_group_managers
|
9
|
+
@factory = InstanceGroupManagerFactory.new(namespaced_name)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "helpers/integration_test_helper"
|
2
|
+
require "integration/factories/instance_template_factory"
|
3
|
+
|
4
|
+
class TestInstanceTemplates < FogIntegrationTest
|
5
|
+
include TestCollection
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@subject = Fog::Compute[:google].instance_templates
|
9
|
+
@factory = InstanceTemplateFactory.new(namespaced_name)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
require "integration/factories/instance_template_factory"
|
3
|
+
|
4
|
+
class InstanceGroupManagerFactory < CollectionFactory
|
5
|
+
def initialize(example)
|
6
|
+
super(Fog::Compute[:google].instance_group_managers, example)
|
7
|
+
@instance_template = InstanceTemplateFactory.new(example)
|
8
|
+
end
|
9
|
+
|
10
|
+
def cleanup
|
11
|
+
super
|
12
|
+
@instance_template.cleanup
|
13
|
+
end
|
14
|
+
|
15
|
+
def params
|
16
|
+
{ :name => resource_name,
|
17
|
+
:zone => TEST_ZONE,
|
18
|
+
:base_instance_name => resource_name,
|
19
|
+
:target_size => 1,
|
20
|
+
:instance_template => @instance_template.create }
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "integration/factories/collection_factory"
|
2
|
+
|
3
|
+
class InstanceTemplateFactory < CollectionFactory
|
4
|
+
def initialize(example)
|
5
|
+
super(Fog::Compute[:google].instance_templates, example)
|
6
|
+
end
|
7
|
+
|
8
|
+
def params
|
9
|
+
{
|
10
|
+
:name => resource_name,
|
11
|
+
# TODO: Properties config is convoluted, needs to be refactored
|
12
|
+
:properties => {
|
13
|
+
:machine_type => TEST_MACHINE_TYPE,
|
14
|
+
:disks => [{
|
15
|
+
:boot => true,
|
16
|
+
:initialize_params =>
|
17
|
+
{ :source_image => "projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20180522" }
|
18
|
+
}],
|
19
|
+
:network_interfaces => [{ :network => "global/networks/default" }]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Welch
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog-core
|
@@ -316,7 +316,11 @@ files:
|
|
316
316
|
- lib/fog/compute/google/models/image.rb
|
317
317
|
- lib/fog/compute/google/models/images.rb
|
318
318
|
- lib/fog/compute/google/models/instance_group.rb
|
319
|
+
- lib/fog/compute/google/models/instance_group_manager.rb
|
320
|
+
- lib/fog/compute/google/models/instance_group_managers.rb
|
319
321
|
- lib/fog/compute/google/models/instance_groups.rb
|
322
|
+
- lib/fog/compute/google/models/instance_template.rb
|
323
|
+
- lib/fog/compute/google/models/instance_templates.rb
|
320
324
|
- lib/fog/compute/google/models/machine_type.rb
|
321
325
|
- lib/fog/compute/google/models/machine_types.rb
|
322
326
|
- lib/fog/compute/google/models/network.rb
|
@@ -350,6 +354,7 @@ files:
|
|
350
354
|
- lib/fog/compute/google/models/zone.rb
|
351
355
|
- lib/fog/compute/google/models/zones.rb
|
352
356
|
- lib/fog/compute/google/real.rb
|
357
|
+
- lib/fog/compute/google/requests/abandon_instances.rb
|
353
358
|
- lib/fog/compute/google/requests/add_backend_service_backends.rb
|
354
359
|
- lib/fog/compute/google/requests/add_instance_group_instances.rb
|
355
360
|
- lib/fog/compute/google/requests/add_server_access_config.rb
|
@@ -368,6 +373,8 @@ files:
|
|
368
373
|
- lib/fog/compute/google/requests/delete_http_health_check.rb
|
369
374
|
- lib/fog/compute/google/requests/delete_image.rb
|
370
375
|
- lib/fog/compute/google/requests/delete_instance_group.rb
|
376
|
+
- lib/fog/compute/google/requests/delete_instance_group_manager.rb
|
377
|
+
- lib/fog/compute/google/requests/delete_instance_template.rb
|
371
378
|
- lib/fog/compute/google/requests/delete_network.rb
|
372
379
|
- lib/fog/compute/google/requests/delete_region_operation.rb
|
373
380
|
- lib/fog/compute/google/requests/delete_route.rb
|
@@ -399,6 +406,8 @@ files:
|
|
399
406
|
- lib/fog/compute/google/requests/get_image.rb
|
400
407
|
- lib/fog/compute/google/requests/get_image_from_family.rb
|
401
408
|
- lib/fog/compute/google/requests/get_instance_group.rb
|
409
|
+
- lib/fog/compute/google/requests/get_instance_group_manager.rb
|
410
|
+
- lib/fog/compute/google/requests/get_instance_template.rb
|
402
411
|
- lib/fog/compute/google/requests/get_machine_type.rb
|
403
412
|
- lib/fog/compute/google/requests/get_network.rb
|
404
413
|
- lib/fog/compute/google/requests/get_project.rb
|
@@ -428,6 +437,8 @@ files:
|
|
428
437
|
- lib/fog/compute/google/requests/insert_http_health_check.rb
|
429
438
|
- lib/fog/compute/google/requests/insert_image.rb
|
430
439
|
- lib/fog/compute/google/requests/insert_instance_group.rb
|
440
|
+
- lib/fog/compute/google/requests/insert_instance_group_manager.rb
|
441
|
+
- lib/fog/compute/google/requests/insert_instance_template.rb
|
431
442
|
- lib/fog/compute/google/requests/insert_network.rb
|
432
443
|
- lib/fog/compute/google/requests/insert_route.rb
|
433
444
|
- lib/fog/compute/google/requests/insert_server.rb
|
@@ -444,6 +455,7 @@ files:
|
|
444
455
|
- lib/fog/compute/google/requests/list_aggregated_disk_types.rb
|
445
456
|
- lib/fog/compute/google/requests/list_aggregated_disks.rb
|
446
457
|
- lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb
|
458
|
+
- lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb
|
447
459
|
- lib/fog/compute/google/requests/list_aggregated_instance_groups.rb
|
448
460
|
- lib/fog/compute/google/requests/list_aggregated_machine_types.rb
|
449
461
|
- lib/fog/compute/google/requests/list_aggregated_servers.rb
|
@@ -461,7 +473,9 @@ files:
|
|
461
473
|
- lib/fog/compute/google/requests/list_http_health_checks.rb
|
462
474
|
- lib/fog/compute/google/requests/list_images.rb
|
463
475
|
- lib/fog/compute/google/requests/list_instance_group_instances.rb
|
476
|
+
- lib/fog/compute/google/requests/list_instance_group_managers.rb
|
464
477
|
- lib/fog/compute/google/requests/list_instance_groups.rb
|
478
|
+
- lib/fog/compute/google/requests/list_instance_templates.rb
|
465
479
|
- lib/fog/compute/google/requests/list_machine_types.rb
|
466
480
|
- lib/fog/compute/google/requests/list_networks.rb
|
467
481
|
- lib/fog/compute/google/requests/list_region_operations.rb
|
@@ -480,6 +494,7 @@ files:
|
|
480
494
|
- lib/fog/compute/google/requests/list_zones.rb
|
481
495
|
- lib/fog/compute/google/requests/patch_firewall.rb
|
482
496
|
- lib/fog/compute/google/requests/patch_url_map.rb
|
497
|
+
- lib/fog/compute/google/requests/recreate_instances.rb
|
483
498
|
- lib/fog/compute/google/requests/remove_instance_group_instances.rb
|
484
499
|
- lib/fog/compute/google/requests/remove_target_pool_health_checks.rb
|
485
500
|
- lib/fog/compute/google/requests/remove_target_pool_instance.rb
|
@@ -488,6 +503,7 @@ files:
|
|
488
503
|
- lib/fog/compute/google/requests/set_common_instance_metadata.rb
|
489
504
|
- lib/fog/compute/google/requests/set_forwarding_rule_target.rb
|
490
505
|
- lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb
|
506
|
+
- lib/fog/compute/google/requests/set_instance_template.rb
|
491
507
|
- lib/fog/compute/google/requests/set_server_disk_auto_delete.rb
|
492
508
|
- lib/fog/compute/google/requests/set_server_metadata.rb
|
493
509
|
- lib/fog/compute/google/requests/set_server_scheduling.rb
|
@@ -694,6 +710,8 @@ files:
|
|
694
710
|
- test/integration/compute/test_global_forwarding_rules.rb
|
695
711
|
- test/integration/compute/test_http_health_checks.rb
|
696
712
|
- test/integration/compute/test_images.rb
|
713
|
+
- test/integration/compute/test_instance_group_managers.rb
|
714
|
+
- test/integration/compute/test_instance_templates.rb
|
697
715
|
- test/integration/compute/test_regions.rb
|
698
716
|
- test/integration/compute/test_servers.rb
|
699
717
|
- test/integration/compute/test_snapshots.rb
|
@@ -708,6 +726,8 @@ files:
|
|
708
726
|
- test/integration/factories/global_forwarding_rules_factory.rb
|
709
727
|
- test/integration/factories/http_health_checks_factory.rb
|
710
728
|
- test/integration/factories/images_factory.rb
|
729
|
+
- test/integration/factories/instance_group_manager_factory.rb
|
730
|
+
- test/integration/factories/instance_template_factory.rb
|
711
731
|
- test/integration/factories/servers_factory.rb
|
712
732
|
- test/integration/factories/target_http_proxies_factory.rb
|
713
733
|
- test/integration/factories/target_instances_factory.rb
|
@@ -774,6 +794,8 @@ test_files:
|
|
774
794
|
- test/integration/compute/test_global_forwarding_rules.rb
|
775
795
|
- test/integration/compute/test_http_health_checks.rb
|
776
796
|
- test/integration/compute/test_images.rb
|
797
|
+
- test/integration/compute/test_instance_group_managers.rb
|
798
|
+
- test/integration/compute/test_instance_templates.rb
|
777
799
|
- test/integration/compute/test_regions.rb
|
778
800
|
- test/integration/compute/test_servers.rb
|
779
801
|
- test/integration/compute/test_snapshots.rb
|
@@ -788,6 +810,8 @@ test_files:
|
|
788
810
|
- test/integration/factories/global_forwarding_rules_factory.rb
|
789
811
|
- test/integration/factories/http_health_checks_factory.rb
|
790
812
|
- test/integration/factories/images_factory.rb
|
813
|
+
- test/integration/factories/instance_group_manager_factory.rb
|
814
|
+
- test/integration/factories/instance_template_factory.rb
|
791
815
|
- test/integration/factories/servers_factory.rb
|
792
816
|
- test/integration/factories/target_http_proxies_factory.rb
|
793
817
|
- test/integration/factories/target_instances_factory.rb
|