fog-google 1.22.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/integration-compute-core.yml +14 -5
  3. data/.github/workflows/integration-compute-instance_groups.yml +13 -4
  4. data/.github/workflows/integration-compute-loadbalancing.yml +13 -4
  5. data/.github/workflows/integration-compute-networking.yml +12 -4
  6. data/.github/workflows/integration-monitoring.yml +12 -4
  7. data/.github/workflows/integration-pubsub.yml +12 -4
  8. data/.github/workflows/integration-sql.yml +12 -4
  9. data/.github/workflows/integration-storage.yml +12 -4
  10. data/.github/workflows/stale.yml +1 -1
  11. data/.github/workflows/unit.yml +7 -2
  12. data/.ruby-version +1 -0
  13. data/CHANGELOG.md +41 -0
  14. data/README.md +2 -2
  15. data/examples/create_instance_and_attach_disk_later.rb +86 -0
  16. data/fog-google.gemspec +3 -3
  17. data/lib/fog/compute/google/models/addresses.rb +17 -8
  18. data/lib/fog/compute/google/models/disk_types.rb +17 -7
  19. data/lib/fog/compute/google/models/disks.rb +23 -8
  20. data/lib/fog/compute/google/models/firewalls.rb +11 -2
  21. data/lib/fog/compute/google/models/forwarding_rules.rb +16 -10
  22. data/lib/fog/compute/google/models/global_addresses.rb +11 -2
  23. data/lib/fog/compute/google/models/global_forwarding_rules.rb +11 -2
  24. data/lib/fog/compute/google/models/http_health_checks.rb +12 -3
  25. data/lib/fog/compute/google/models/images.rb +15 -8
  26. data/lib/fog/compute/google/models/instance_group_managers.rb +17 -9
  27. data/lib/fog/compute/google/models/instance_groups.rb +16 -8
  28. data/lib/fog/compute/google/models/instance_templates.rb +12 -3
  29. data/lib/fog/compute/google/models/machine_types.rb +17 -8
  30. data/lib/fog/compute/google/models/networks.rb +12 -3
  31. data/lib/fog/compute/google/models/operations.rb +22 -8
  32. data/lib/fog/compute/google/models/regions.rb +12 -3
  33. data/lib/fog/compute/google/models/routes.rb +12 -3
  34. data/lib/fog/compute/google/models/server.rb +3 -3
  35. data/lib/fog/compute/google/models/servers.rb +22 -8
  36. data/lib/fog/compute/google/models/ssl_certificates.rb +12 -3
  37. data/lib/fog/compute/google/models/subnetworks.rb +16 -8
  38. data/lib/fog/compute/google/models/target_http_proxies.rb +12 -3
  39. data/lib/fog/compute/google/models/target_https_proxies.rb +12 -3
  40. data/lib/fog/compute/google/models/target_instances.rb +16 -8
  41. data/lib/fog/compute/google/models/target_pools.rb +16 -8
  42. data/lib/fog/compute/google/models/url_maps.rb +12 -3
  43. data/lib/fog/compute/google/models/zones.rb +12 -3
  44. data/lib/fog/compute/google/requests/stop_server.rb +2 -2
  45. data/lib/fog/google/version.rb +1 -1
  46. data/test/helpers/integration_test_helper.rb +1 -1
  47. data/test/integration/compute/core_compute/test_servers.rb +86 -0
  48. data/test/integration/storage/test_objects.rb +1 -0
  49. data/test/unit/compute/test_common_collections.rb +1 -1
  50. data/test/unit/compute/test_common_models.rb +1 -1
  51. data/test/unit/compute/test_disk.rb +26 -0
  52. data/test/unit/compute/test_server.rb +1 -1
  53. data/test/unit/dns/test_common_collections.rb +1 -1
  54. data/test/unit/monitoring/test_comon_collections.rb +1 -1
  55. data/test/unit/pubsub/test_common_collections.rb +1 -1
  56. data/test/unit/sql/test_common_collections.rb +1 -1
  57. data/test/unit/storage/test_common_json_collections.rb +1 -1
  58. data/test/unit/storage/test_common_xml_collections.rb +1 -1
  59. data/test/unit/storage/test_json_requests.rb +1 -1
  60. data/test/unit/storage/test_xml_requests.rb +1 -1
  61. metadata +19 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e49aa08d9838df47172778f5e6564e4fe9c9c81d77d024815c4cb9152b3d1fa
4
- data.tar.gz: 39ae0f71215fe16c34d92a01722eff57a299bbeb03f132aff7057515b25a54cc
3
+ metadata.gz: 419c2fcd50b3c90ffe65c7a284bfc75479b1da059e0ea01b187a9f8f03721784
4
+ data.tar.gz: 470db0019a0de386752a1ca9c1a8cdb092e34037ef3e53a6a456a1ea033e6033
5
5
  SHA512:
6
- metadata.gz: 98c43a20f68c38596e455fea9c58fb2db26916a71c89da10773424d8a74a58819354e66e0a8f68f1eb7c571dd5cf6ae3f4e1cc6a2204504260451d7a12a3e43b
7
- data.tar.gz: 6e1996d144177a3fca9e582d4eb113e54e60016af45483dc9e8be0bc48370ba0f786dd4d811f862cd07775ef08d248e65f8e7504c5dc763b96ed863a7ec2dfcc
6
+ metadata.gz: af159d5054ca5ceb4e391f8bbc019ad813c1e9163f11eeeb67dd3f57ccdfb157497d39451303210a7aa3e7b01f7295be937d445e97552f4fd8c9f1f42ca98c84
7
+ data.tar.gz: 00eb0b6200ad0fd56ea680e2dd1824548fe34d67da6e7469a872e27462281cf335f3aa23ede4956cea95433efa3e382c85c0ad60a732c0c96965b3830fac56f0
@@ -2,7 +2,7 @@
2
2
  # is no need to run them if SQL code or deps haven't changed and you cannot
3
3
  # trigger jobs based on file changes in the same workflow.
4
4
  # See: https://github.com/actions/runner/issues/456
5
- name: integration-tests-compute-instance_groups
5
+ name: integration-tests-compute-core
6
6
 
7
7
  on:
8
8
  push:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/compute/**'
@@ -22,18 +22,27 @@ on:
22
22
  - 'lib/fog/google.rb'
23
23
  # Trigger workflow on version upgrade
24
24
  - 'lib/fog/google/version.rb'
25
+ # Trigger when workflow itself is updated
26
+ - '.github/workflows/integration-compute-core.yml'
27
+
28
+ # Setting hard concurrency limit for the project due to cleanup
29
+ # TODO(fog-google#626): remove this once cleanup is fixed
30
+ concurrency:
31
+ group: ${{ github.workflow }}
32
+ cancel-in-progress: false
25
33
 
26
34
  jobs:
27
35
  test-compute:
28
- runs-on: self-hosted
36
+ runs-on: fog-arc-runner
29
37
  strategy:
30
38
  matrix:
31
- ruby-version: [ '2.7', '3.0', '3.1' ]
39
+ ruby-version: [ '3.0', '3.1', '3.2' ]
32
40
  # Integration tests from the same task cannot run in parallel yet due to cleanup
41
+ # TODO(fog-google#626): remove this once cleanup is fixed
33
42
  max-parallel: 1
34
43
 
35
44
  steps:
36
- - uses: actions/checkout@v3
45
+ - uses: actions/checkout@v4
37
46
  - name: Set up Ruby
38
47
  uses: ruby/setup-ruby@v1
39
48
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/compute/**'
@@ -22,18 +22,27 @@ on:
22
22
  - 'lib/fog/google.rb'
23
23
  # Trigger workflow on version upgrade
24
24
  - 'lib/fog/google/version.rb'
25
+ # Trigger when workflow itself is updated
26
+ - '.github/workflows/integration-compute-instance_groups.yml'
27
+
28
+ # Setting hard concurrency limit for the project due to cleanup
29
+ # TODO(fog-google#626): remove this once cleanup is fixed
30
+ concurrency:
31
+ group: ${{ github.workflow }}
32
+ cancel-in-progress: false
33
+
25
34
 
26
35
  jobs:
27
36
  test:
28
- runs-on: self-hosted
37
+ runs-on: fog-arc-runner
29
38
  strategy:
30
39
  matrix:
31
- ruby-version: [ '2.7', '3.0', '3.1' ]
40
+ ruby-version: [ '3.0', '3.1', '3.2' ]
32
41
  # Integration tests from the same task cannot run in parallel yet due to cleanup
33
42
  max-parallel: 1
34
43
 
35
44
  steps:
36
- - uses: actions/checkout@v3
45
+ - uses: actions/checkout@v4
37
46
  - name: Set up Ruby
38
47
  uses: ruby/setup-ruby@v1
39
48
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/compute/**'
@@ -22,18 +22,27 @@ on:
22
22
  - 'lib/fog/google.rb'
23
23
  # Trigger workflow on version upgrade
24
24
  - 'lib/fog/google/version.rb'
25
+ # Trigger when workflow itself is updated
26
+ - '.github/workflows/integration-compute-loadbalancing.yml'
27
+
28
+ # Setting hard concurrency limit for the project due to cleanup
29
+ # TODO(fog-google#626): remove this once cleanup is fixed
30
+ concurrency:
31
+ group: ${{ github.workflow }}
32
+ cancel-in-progress: false
33
+
25
34
 
26
35
  jobs:
27
36
  test:
28
- runs-on: self-hosted
37
+ runs-on: fog-arc-runner
29
38
  strategy:
30
39
  matrix:
31
- ruby-version: [ '2.7', '3.0', '3.1' ]
40
+ ruby-version: [ '3.0', '3.1', '3.2' ]
32
41
  # Integration tests from the same task cannot run in parallel yet due to cleanup
33
42
  max-parallel: 1
34
43
 
35
44
  steps:
36
- - uses: actions/checkout@v3
45
+ - uses: actions/checkout@v4
37
46
  - name: Set up Ruby
38
47
  uses: ruby/setup-ruby@v1
39
48
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/compute/**'
@@ -22,18 +22,26 @@ on:
22
22
  - 'lib/fog/google.rb'
23
23
  # Trigger workflow on version upgrade
24
24
  - 'lib/fog/google/version.rb'
25
+ # Trigger when workflow itself is updated
26
+ - '.github/workflows/integration-compute-networking.yml'
27
+
28
+ # Setting hard concurrency limit for the project due to cleanup
29
+ # TODO(fog-google#626): remove this once cleanup is fixed
30
+ concurrency:
31
+ group: ${{ github.workflow }}
32
+ cancel-in-progress: false
25
33
 
26
34
  jobs:
27
35
  test:
28
- runs-on: self-hosted
36
+ runs-on: fog-arc-runner
29
37
  strategy:
30
38
  matrix:
31
- ruby-version: [ '2.7', '3.0', '3.1' ]
39
+ ruby-version: [ '3.0', '3.1', '3.2' ]
32
40
  # Integration tests from the same task cannot run in parallel yet due to cleanup
33
41
  max-parallel: 1
34
42
 
35
43
  steps:
36
- - uses: actions/checkout@v3
44
+ - uses: actions/checkout@v4
37
45
  - name: Set up Ruby
38
46
  uses: ruby/setup-ruby@v1
39
47
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/google/monitoring.rb'
@@ -23,18 +23,26 @@ on:
23
23
  - 'lib/fog/google.rb'
24
24
  # Trigger workflow on version upgrade
25
25
  - 'lib/fog/google/version.rb'
26
+ # Trigger when workflow itself is updated
27
+ - '.github/workflows/integration-monitoring.yml'
28
+
29
+ # Setting hard concurrency limit for the project due to cleanup
30
+ # TODO(fog-google#626): remove this once cleanup is fixed
31
+ concurrency:
32
+ group: ${{ github.workflow }}
33
+ cancel-in-progress: false
26
34
 
27
35
  jobs:
28
36
  test:
29
- runs-on: self-hosted
37
+ runs-on: fog-arc-runner
30
38
  strategy:
31
39
  matrix:
32
- ruby-version: [ '2.7', '3.0', '3.1' ]
40
+ ruby-version: [ '3.0', '3.1', '3.2' ]
33
41
  # Integration tests from the same task cannot run in parallel yet due to cleanup
34
42
  max-parallel: 1
35
43
 
36
44
  steps:
37
- - uses: actions/checkout@v3
45
+ - uses: actions/checkout@v4
38
46
  - name: Set up Ruby
39
47
  uses: ruby/setup-ruby@v1
40
48
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/google/pubsub.rb'
@@ -23,18 +23,26 @@ on:
23
23
  - 'lib/fog/google.rb'
24
24
  # Trigger workflow on version upgrade
25
25
  - 'lib/fog/google/version.rb'
26
+ # Trigger when workflow itself is updated
27
+ - '.github/workflows/integration-pubsub.yml'
28
+
29
+ # Setting hard concurrency limit for the project due to cleanup
30
+ # TODO(fog-google#626): remove this once cleanup is fixed
31
+ concurrency:
32
+ group: ${{ github.workflow }}
33
+ cancel-in-progress: false
26
34
 
27
35
  jobs:
28
36
  test:
29
- runs-on: self-hosted
37
+ runs-on: fog-arc-runner
30
38
  strategy:
31
39
  matrix:
32
- ruby-version: [ '2.7', '3.0', '3.1' ]
40
+ ruby-version: [ '3.0', '3.1', '3.2' ]
33
41
  # Integration tests from the same task cannot run in parallel yet due to cleanup
34
42
  max-parallel: 1
35
43
 
36
44
  steps:
37
- - uses: actions/checkout@v3
45
+ - uses: actions/checkout@v4
38
46
  - name: Set up Ruby
39
47
  uses: ruby/setup-ruby@v1
40
48
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/google/sql.rb'
@@ -23,18 +23,26 @@ on:
23
23
  - 'lib/fog/google.rb'
24
24
  # Trigger workflow on version upgrade
25
25
  - 'lib/fog/google/version.rb'
26
+ # Trigger when workflow itself is updated
27
+ - '.github/workflows/integration-sql.yml'
28
+
29
+ # Setting hard concurrency limit for the project due to cleanup
30
+ # TODO(fog-google#626): remove this once cleanup is fixed
31
+ concurrency:
32
+ group: ${{ github.workflow }}
33
+ cancel-in-progress: false
26
34
 
27
35
  jobs:
28
36
  test:
29
- runs-on: self-hosted
37
+ runs-on: fog-arc-runner
30
38
  strategy:
31
39
  matrix:
32
- ruby-version: [ '2.7', '3.0', '3.1' ]
40
+ ruby-version: [ '3.0', '3.1', '3.2' ]
33
41
  # Integration tests from the same task cannot run in parallel yet due to cleanup
34
42
  max-parallel: 1
35
43
 
36
44
  steps:
37
- - uses: actions/checkout@v3
45
+ - uses: actions/checkout@v4
38
46
  - name: Set up Ruby
39
47
  uses: ruby/setup-ruby@v1
40
48
  with:
@@ -10,7 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches: [ master ]
12
12
  types: [ assigned, opened, synchronize, reopened, labeled ]
13
- # Only run SQL integration tests if SQL code or deps have changed
13
+ # Only run integration tests if relevant code or deps have changed
14
14
  paths:
15
15
  # Module-specific paths
16
16
  - 'lib/fog/google/storage.rb'
@@ -24,18 +24,26 @@ on:
24
24
  - 'lib/fog/google.rb'
25
25
  # Trigger workflow on version upgrade
26
26
  - 'lib/fog/google/version.rb'
27
+ # Trigger when workflow itself is updated
28
+ - '.github/workflows/integration-storage.yml'
29
+
30
+ # Setting hard concurrency limit for the project due to cleanup
31
+ # TODO(fog-google#626): remove this once cleanup is fixed
32
+ concurrency:
33
+ group: ${{ github.workflow }}
34
+ cancel-in-progress: false
27
35
 
28
36
  jobs:
29
37
  test:
30
- runs-on: self-hosted
38
+ runs-on: fog-arc-runner
31
39
  strategy:
32
40
  matrix:
33
- ruby-version: [ '2.7', '3.0', '3.1' ]
41
+ ruby-version: [ '3.0', '3.1', '3.2' ]
34
42
  # Integration tests from the same task cannot run in parallel yet due to cleanup
35
43
  max-parallel: 1
36
44
 
37
45
  steps:
38
- - uses: actions/checkout@v3
46
+ - uses: actions/checkout@v4
39
47
  - name: Set up Ruby
40
48
  uses: ruby/setup-ruby@v1
41
49
  with:
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
 
12
12
  steps:
13
- - uses: actions/stale@v7
13
+ - uses: actions/stale@v9
14
14
  with:
15
15
  repo-token: ${{ secrets.GITHUB_TOKEN }}
16
16
  days-before-stale: 360
@@ -6,15 +6,20 @@ on:
6
6
  pull_request:
7
7
  branches: [ master ]
8
8
 
9
+ # Cancel in-progress jobs of the same ref or run_id
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
12
+ cancel-in-progress: true
13
+
9
14
  jobs:
10
15
  test-unit:
11
16
  runs-on: ubuntu-latest
12
17
  strategy:
13
18
  matrix:
14
- ruby-version: ['2.7', '3.0', '3.1', 'head', 'truffleruby-head']
19
+ ruby-version: [ '3.0', '3.1', '3.2', 'head', 'truffleruby-head']
15
20
 
16
21
  steps:
17
- - uses: actions/checkout@v3
22
+ - uses: actions/checkout@v4
18
23
  - name: Set up Ruby
19
24
  uses: ruby/setup-ruby@v1
20
25
  with:
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -6,6 +6,47 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
6
6
 
7
7
  ## Next
8
8
 
9
+
10
+ ### User-facing
11
+
12
+ #### Added
13
+
14
+ - #613 Spruce up attaching and detaching disks on running servers [rchekaluk]
15
+ - #621 Added support for discard_local_ssd when stopping an instance [rchekaluk]
16
+
17
+ ### Development changes
18
+
19
+ ### Added
20
+
21
+ - #618 Deprecated Ruby-2.0 support [temikus]
22
+ - #624 Migrated the Integration tests to new ARC runners [temikus]
23
+ - #625 Fixed 'Ostruct' errors in storage tests [temikus]
24
+ - #627 Added concurrency groups to integration test workfows [temikus]
25
+
26
+ #### Fixed
27
+
28
+ - #604 Updated pry requirement from = 0.13.0 to = 0.14.2 [dependabot]
29
+ - #619 Updated google-cloud-env requirement from ~> 1.2 to >= 1.2, < 3.0 [dependabot]
30
+ - #620 Bump actions/stale from 8 to 9 [dependabot]
31
+ - #622 Updated fog-core requirement from < 2.3 to < 2.5 [dependabot]
32
+
33
+ ## 1.23.0
34
+
35
+ ### User-facing
36
+
37
+ #### Fixed
38
+
39
+ - #609 Fixed missing paging on all models [agrare]
40
+ - #608 Fixed `Fog::Compute::Google::Servers#all` paging [agrare]
41
+
42
+ ### Development changes
43
+
44
+ #### Fixed
45
+
46
+ - #606 Use `Minitest::Test` instead of `MiniTest::Test` [chubchenko]
47
+ - #605 Bump actions/checkout from 3 to 4 [dependabot]
48
+ - #602 Bump actions/stale from 6 to 8 [dependabot]
49
+
9
50
  ## 1.22.0
10
51
 
11
52
  ### User-facing
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Fog::Google
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/fog-google.svg)](http://badge.fury.io/rb/fog-google) [![Build Status](https://github.com/fog/fog-google/actions/workflows/ruby.yml/badge.svg)](https://github.com/fog/fog-google/actions/workflows/ruby.yml) [![codecov](https://codecov.io/gh/fog/fog-google/branch/master/graph/badge.svg)](https://codecov.io/gh/fog/fog-google) ![Dependabot Status](https://flat.badgen.net/github/dependabot/fog/fog-google) [![Doc coverage](https://inch-ci.org/github/fog/fog-google.svg?branch=master)](https://inch-ci.org/github/fog/fog-google)
3
+ [![Gem Version](https://badge.fury.io/rb/fog-google.svg)](http://badge.fury.io/rb/fog-google) [![Build Status](https://github.com/fog/fog-google/actions/workflows/unit.yml/badge.svg)](https://github.com/fog/fog-google/actions/workflows/unit.yml) [![codecov](https://codecov.io/gh/fog/fog-google/branch/master/graph/badge.svg)](https://codecov.io/gh/fog/fog-google) ![Dependabot Status](https://flat.badgen.net/github/dependabot/fog/fog-google) [![Doc coverage](https://inch-ci.org/github/fog/fog-google.svg?branch=master)](https://inch-ci.org/github/fog/fog-google)
4
4
 
5
5
  The main maintainers for the Google sections are @icco, @Temikus and @plribeiro3000. Please send pull requests to them.
6
6
 
@@ -175,7 +175,7 @@ $ bundle exec pry
175
175
 
176
176
  ## Supported Ruby Versions
177
177
 
178
- Fog-google is currently supported on Ruby 2.7+.
178
+ Fog-google is currently supported on Ruby 3.0+.
179
179
 
180
180
  In general we support (and run our CI) for Ruby versions that are actively supported
181
181
  by Ruby Core - that is, Ruby versions that are not end of life. Older versions of
@@ -0,0 +1,86 @@
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # More info on it can be found here: http://fog.io/about/getting_started.html
3
+
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
6
+
7
+ ZONE = "us-central1-f"
8
+ PROJECT = Fog.credentials[:google_project]
9
+
10
+ def example
11
+ p "Connecting to Google API"
12
+ connection = Fog::Compute.new(:provider => "Google")
13
+
14
+ p "Creating disk"
15
+ disk = connection.disks.create(
16
+ :name => "fog-smoke-test-#{Time.now.to_i}",
17
+ :size_gb => 10,
18
+ :zone => ZONE,
19
+ :source_image => "debian-11-bullseye-v20220920"
20
+ )
21
+
22
+ p "Creating a second disk"
23
+ attached_disk = connection.disks.create(
24
+ :name => "fog-smoke-test-#{Time.now.to_i}",
25
+ :size_gb => 10,
26
+ :zone => ZONE
27
+ )
28
+
29
+ p "Waiting for disks to be ready"
30
+ disk.wait_for { ready? }
31
+ attached_disk.wait_for { ready? }
32
+
33
+ p "Creating a server"
34
+ server = connection.servers.create(
35
+ :name => "fog-smoke-test-#{Time.now.to_i}",
36
+ :disks => [disk.attached_disk_obj(boot: true, auto_delete: true)],
37
+ :machine_type => "n1-standard-1",
38
+ :private_key_path => File.expand_path("~/.ssh/id_rsa"),
39
+ :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"),
40
+ :zone => ZONE,
41
+ # Will be simplified, see https://github.com/fog/fog-google/issues/360
42
+ :network_interfaces => [{ :network => "global/networks/default",
43
+ :access_configs => [{
44
+ :name => "External NAT",
45
+ :type => "ONE_TO_ONE_NAT"
46
+ }] }],
47
+ :username => ENV["USER"]
48
+ )
49
+
50
+ p "Attach second disk to the running server"
51
+ device_name = "fog-smoke-test-device-#{Time.now.to_i}"
52
+ # See https://github.com/fog/fog-google/blob/master/lib/fog/compute/google/models/disk.rb#L75-L107
53
+ # See https://github.com/fog/fog-google/blob/master/lib/fog/compute/google/models/server.rb#L35-L50
54
+ config_hash = {
55
+ :device_name => device_name,
56
+ :source => "https://www.googleapis.com/compute/v1/projects/#{PROJECT}/zones/#{ZONE}/disks/#{attached_disk.name}"
57
+ }
58
+ raise "Could not attach second disk" unless connection.attach_disk(server.name, ZONE, config_hash)
59
+
60
+ p "Waiting for disk to be attached"
61
+ attached_disk.wait_for { ! users.nil? && users != []}
62
+
63
+ p "Detach second disk"
64
+ raise "Could not detach second disk" unless connection.detach_disk(server.name, ZONE, device_name)
65
+
66
+ p "Waiting for second disk to be detached"
67
+ attached_disk.wait_for { users.nil? || users == []}
68
+
69
+ p "Deleting server"
70
+ raise "Could not delete server." unless server.destroy
71
+
72
+ p "Destroying second disk"
73
+ raise "Could not delete second disk." unless attached_disk.destroy
74
+
75
+ p "Waiting for second disk to be destroyed"
76
+ begin
77
+ rc = attached_disk.wait_for { status.nil? || status == 'DELETING' }
78
+
79
+ rescue => e
80
+ if e.message !~ /not found/ && e.message !~ /notFound/
81
+ raise e
82
+ end
83
+ end
84
+ end
85
+
86
+ example
data/fog-google.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  # As of 0.1.1
21
21
  spec.required_ruby_version = ">= 2.0"
22
22
 
23
- spec.add_dependency "fog-core", "< 2.3"
23
+ spec.add_dependency "fog-core", "< 2.5"
24
24
  spec.add_dependency "fog-json", "~> 1.2"
25
25
  spec.add_dependency "fog-xml", "~> 0.1.0"
26
26
 
@@ -32,14 +32,14 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "google-apis-pubsub_v1", "~> 0.30"
33
33
  spec.add_dependency "google-apis-sqladmin_v1beta4", "~> 0.38"
34
34
 
35
- spec.add_dependency "google-cloud-env", "~> 1.2"
35
+ spec.add_dependency "google-cloud-env", ">= 1.2", "< 3.0"
36
36
 
37
37
  spec.add_dependency "addressable", ">= 2.7.0"
38
38
 
39
39
  # Debugger
40
40
  # Locked because pry-byebug is broken with 13+
41
41
  # see: https://github.com/deivid-rodriguez/pry-byebug/issues/343
42
- spec.add_development_dependency "pry", "= 0.13.0"
42
+ spec.add_development_dependency "pry", "= 0.14.2"
43
43
 
44
44
  # Testing gems
45
45
  spec.add_development_dependency "retriable"
@@ -11,16 +11,25 @@ module Fog
11
11
  :order_by => order_by,
12
12
  :page_token => page_token
13
13
  }
14
-
15
- if region
16
- data = service.list_addresses(region, **opts).items || []
17
- else
18
- data = []
19
- service.list_aggregated_addresses(**opts).items.each_value do |scoped_list|
20
- data.concat(scoped_list.addresses) if scoped_list && scoped_list.addresses
14
+ items = []
15
+ next_page_token = nil
16
+ loop do
17
+ if region
18
+ data = service.list_addresses(region, **opts)
19
+ next_items = data.items || []
20
+ items.concat(next_items)
21
+ next_page_token = data.next_page_token
22
+ else
23
+ data = service.list_aggregated_addresses(**opts)
24
+ data.items.each_value do |scoped_list|
25
+ items.concat(scoped_list.addresses) if scoped_list && scoped_list.addresses
26
+ end
27
+ next_page_token = data.next_page_token
21
28
  end
29
+ break if next_page_token.nil? || next_page_token.empty?
30
+ opts[:page_token] = next_page_token
22
31
  end
23
- load(data.map(&:to_h))
32
+ load(items.map(&:to_h))
24
33
  end
25
34
 
26
35
  def get(identity, region = nil)
@@ -12,15 +12,25 @@ module Fog
12
12
  :order_by => order_by,
13
13
  :page_token => page_token
14
14
  }
15
- if zone
16
- data = service.list_disk_types(zone, **opts).items
17
- else
18
- data = []
19
- service.list_aggregated_disk_types(**opts).items.each_value do |scoped_lst|
20
- data.concat(scoped_lst.disk_types) if scoped_lst && scoped_lst.disk_types
15
+ items = []
16
+ next_page_token = nil
17
+ loop do
18
+ if zone
19
+ data = service.list_disk_types(zone, **opts)
20
+ next_items = data.items || []
21
+ items.concat(next_items)
22
+ next_page_token = data.next_page_token
23
+ else
24
+ data = service.list_aggregated_disk_types(**opts)
25
+ data.items.each_value do |scoped_lst|
26
+ items.concat(scoped_lst.disk_types) if scoped_lst && scoped_lst.disk_types
27
+ end
28
+ next_page_token = data.next_page_token
21
29
  end
30
+ break if next_page_token.nil? || next_page_token.empty?
31
+ opts[:page_token] = next_page_token
22
32
  end
23
- load(data.map(&:to_h))
33
+ load(items.map(&:to_h))
24
34
  end
25
35
 
26
36
  def get(identity, zone = nil)