fog-google 1.12.1 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +10 -0
  3. data/.github/scripts/setup_creds.sh +10 -0
  4. data/.github/workflows/integration.yml +225 -0
  5. data/.github/workflows/stale.yml +23 -0
  6. data/.github/workflows/unit.yml +26 -0
  7. data/CHANGELOG.md +65 -1
  8. data/README.md +11 -1
  9. data/fog-google.gemspec +12 -3
  10. data/lib/fog/compute/google/models/address.rb +1 -1
  11. data/lib/fog/compute/google/models/addresses.rb +6 -6
  12. data/lib/fog/compute/google/models/backend_service.rb +1 -1
  13. data/lib/fog/compute/google/models/disk.rb +3 -3
  14. data/lib/fog/compute/google/models/disk_types.rb +2 -2
  15. data/lib/fog/compute/google/models/disks.rb +2 -2
  16. data/lib/fog/compute/google/models/firewall.rb +2 -2
  17. data/lib/fog/compute/google/models/firewalls.rb +1 -1
  18. data/lib/fog/compute/google/models/forwarding_rules.rb +2 -2
  19. data/lib/fog/compute/google/models/global_addresses.rb +1 -1
  20. data/lib/fog/compute/google/models/global_forwarding_rules.rb +1 -1
  21. data/lib/fog/compute/google/models/http_health_check.rb +2 -2
  22. data/lib/fog/compute/google/models/instance_group_managers.rb +2 -2
  23. data/lib/fog/compute/google/models/machine_types.rb +2 -2
  24. data/lib/fog/compute/google/models/network.rb +1 -1
  25. data/lib/fog/compute/google/models/operations.rb +3 -3
  26. data/lib/fog/compute/google/models/region.rb +0 -0
  27. data/lib/fog/compute/google/models/regions.rb +0 -0
  28. data/lib/fog/compute/google/models/servers.rb +7 -4
  29. data/lib/fog/compute/google/models/subnetwork.rb +0 -0
  30. data/lib/fog/compute/google/models/subnetworks.rb +2 -2
  31. data/lib/fog/compute/google/models/target_instances.rb +2 -2
  32. data/lib/fog/compute/google/models/target_pools.rb +2 -2
  33. data/lib/fog/compute/google/models/url_maps.rb +1 -1
  34. data/lib/fog/compute/google/requests/abandon_instances.rb +1 -1
  35. data/lib/fog/compute/google/requests/add_instance_group_instances.rb +3 -3
  36. data/lib/fog/compute/google/requests/add_server_access_config.rb +3 -3
  37. data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +2 -2
  38. data/lib/fog/compute/google/requests/add_target_pool_instances.rb +2 -2
  39. data/lib/fog/compute/google/requests/attach_disk.rb +1 -1
  40. data/lib/fog/compute/google/requests/create_disk_snapshot.rb +1 -1
  41. data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +1 -1
  42. data/lib/fog/compute/google/requests/get_backend_service_health.rb +1 -1
  43. data/lib/fog/compute/google/requests/get_region.rb +0 -0
  44. data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +2 -2
  45. data/lib/fog/compute/google/requests/get_target_pool_health.rb +1 -1
  46. data/lib/fog/compute/google/requests/insert_address.rb +2 -2
  47. data/lib/fog/compute/google/requests/insert_backend_service.rb +1 -1
  48. data/lib/fog/compute/google/requests/insert_disk.rb +1 -1
  49. data/lib/fog/compute/google/requests/insert_firewall.rb +1 -1
  50. data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +1 -1
  51. data/lib/fog/compute/google/requests/insert_global_address.rb +1 -1
  52. data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +1 -1
  53. data/lib/fog/compute/google/requests/insert_http_health_check.rb +1 -1
  54. data/lib/fog/compute/google/requests/insert_image.rb +1 -1
  55. data/lib/fog/compute/google/requests/insert_instance_group.rb +3 -3
  56. data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +7 -7
  57. data/lib/fog/compute/google/requests/insert_instance_template.rb +3 -3
  58. data/lib/fog/compute/google/requests/insert_network.rb +2 -12
  59. data/lib/fog/compute/google/requests/insert_route.rb +10 -10
  60. data/lib/fog/compute/google/requests/insert_server.rb +9 -9
  61. data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +4 -4
  62. data/lib/fog/compute/google/requests/insert_subnetwork.rb +1 -1
  63. data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +3 -3
  64. data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +4 -4
  65. data/lib/fog/compute/google/requests/insert_target_instance.rb +1 -1
  66. data/lib/fog/compute/google/requests/insert_target_pool.rb +1 -1
  67. data/lib/fog/compute/google/requests/insert_url_map.rb +1 -1
  68. data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +1 -1
  69. data/lib/fog/compute/google/requests/list_addresses.rb +4 -4
  70. data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +1 -1
  71. data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +2 -2
  72. data/lib/fog/compute/google/requests/list_aggregated_disks.rb +2 -2
  73. data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +2 -2
  74. data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +4 -4
  75. data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +1 -1
  76. data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +2 -2
  77. data/lib/fog/compute/google/requests/list_aggregated_servers.rb +2 -2
  78. data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +4 -4
  79. data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +4 -4
  80. data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +4 -4
  81. data/lib/fog/compute/google/requests/list_disk_types.rb +2 -2
  82. data/lib/fog/compute/google/requests/list_disks.rb +2 -2
  83. data/lib/fog/compute/google/requests/list_firewalls.rb +4 -4
  84. data/lib/fog/compute/google/requests/list_forwarding_rules.rb +2 -2
  85. data/lib/fog/compute/google/requests/list_global_addresses.rb +5 -5
  86. data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +2 -2
  87. data/lib/fog/compute/google/requests/list_global_operations.rb +4 -4
  88. data/lib/fog/compute/google/requests/list_http_health_checks.rb +2 -2
  89. data/lib/fog/compute/google/requests/list_images.rb +2 -2
  90. data/lib/fog/compute/google/requests/list_instance_group_managers.rb +2 -2
  91. data/lib/fog/compute/google/requests/list_instance_templates.rb +4 -4
  92. data/lib/fog/compute/google/requests/list_machine_types.rb +4 -4
  93. data/lib/fog/compute/google/requests/list_networks.rb +4 -4
  94. data/lib/fog/compute/google/requests/list_subnetworks.rb +4 -4
  95. data/lib/fog/compute/google/requests/list_target_pools.rb +4 -4
  96. data/lib/fog/compute/google/requests/list_url_maps.rb +2 -2
  97. data/lib/fog/compute/google/requests/patch_firewall.rb +1 -1
  98. data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +3 -3
  99. data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +2 -2
  100. data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +2 -2
  101. data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +2 -2
  102. data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +2 -2
  103. data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +1 -1
  104. data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +1 -1
  105. data/lib/fog/compute/google/requests/set_server_metadata.rb +2 -2
  106. data/lib/fog/compute/google/requests/set_server_tags.rb +2 -2
  107. data/lib/fog/compute/google/requests/set_snapshot_labels.rb +2 -2
  108. data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +1 -1
  109. data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +1 -1
  110. data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +1 -1
  111. data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +1 -1
  112. data/lib/fog/compute/google/requests/set_target_pool_backup.rb +2 -2
  113. data/lib/fog/compute/google/requests/update_firewall.rb +1 -1
  114. data/lib/fog/compute/google/requests/update_http_health_check.rb +1 -1
  115. data/lib/fog/compute/google/requests/update_url_map.rb +1 -1
  116. data/lib/fog/compute/google/requests/validate_url_map.rb +1 -1
  117. data/lib/fog/dns/google/requests/create_change.rb +2 -2
  118. data/lib/fog/google/models/sql/instance.rb +2 -2
  119. data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +8 -8
  120. data/lib/fog/google/requests/monitoring/create_timeseries.rb +1 -1
  121. data/lib/fog/google/requests/monitoring/list_timeseries.rb +1 -1
  122. data/lib/fog/google/requests/pubsub/acknowledge_subscription.rb +1 -1
  123. data/lib/fog/google/requests/pubsub/create_subscription.rb +3 -3
  124. data/lib/fog/google/requests/sql/clone_instance.rb +4 -4
  125. data/lib/fog/google/requests/sql/export_instance.rb +3 -3
  126. data/lib/fog/google/requests/sql/import_instance.rb +2 -2
  127. data/lib/fog/google/requests/sql/insert_backup_run.rb +1 -1
  128. data/lib/fog/google/requests/sql/insert_instance.rb +2 -2
  129. data/lib/fog/google/requests/sql/insert_ssl_cert.rb +1 -1
  130. data/lib/fog/google/requests/sql/insert_user.rb +1 -1
  131. data/lib/fog/google/requests/sql/restore_instance_backup.rb +4 -4
  132. data/lib/fog/google/requests/sql/update_instance.rb +2 -2
  133. data/lib/fog/google/shared.rb +3 -3
  134. data/lib/fog/google/version.rb +1 -1
  135. data/lib/fog/storage/google_json/models/directories.rb +1 -1
  136. data/lib/fog/storage/google_json/models/directory.rb +1 -1
  137. data/lib/fog/storage/google_json/models/file.rb +11 -2
  138. data/lib/fog/storage/google_json/models/files.rb +3 -3
  139. data/lib/fog/storage/google_json/real.rb +4 -4
  140. data/lib/fog/storage/google_json/requests/copy_object.rb +11 -1
  141. data/lib/fog/storage/google_json/requests/get_object.rb +6 -3
  142. data/lib/fog/storage/google_json/requests/get_object_url.rb +2 -2
  143. data/lib/fog/storage/google_json/requests/list_buckets.rb +4 -4
  144. data/lib/fog/storage/google_json/requests/list_objects.rb +1 -1
  145. data/lib/fog/storage/google_json/requests/put_bucket.rb +1 -1
  146. data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +1 -1
  147. data/lib/fog/storage/google_json/requests/put_object.rb +1 -1
  148. data/lib/fog/storage/google_json/requests/put_object_acl.rb +1 -1
  149. data/lib/fog/storage/google_json/utils.rb +5 -1
  150. data/lib/fog/storage/google_xml/models/file.rb +1 -1
  151. data/test/helpers/integration_test_helper.rb +2 -2
  152. data/test/helpers/test_helper.rb +7 -3
  153. data/test/integration/compute/core_compute/test_servers.rb +2 -2
  154. data/test/integration/compute/core_networking/test_networks.rb +0 -11
  155. data/test/integration/factories/networks_factory.rb +4 -6
  156. data/test/integration/monitoring/test_metric_descriptors.rb +1 -1
  157. data/test/integration/storage/storage_shared.rb +7 -2
  158. data/test/integration/storage/test_objects.rb +23 -1
  159. data/test/unit/storage/test_json_requests.rb +8 -0
  160. metadata +103 -31
  161. data/.travis.yml +0 -33
  162. data/ci/.gitignore +0 -1
  163. data/ci/README.md +0 -65
  164. data/ci/build-head-pipeline.yml +0 -173
  165. data/ci/credentials.yml.template +0 -28
  166. data/ci/docker-image/Dockerfile +0 -18
  167. data/ci/integration-pipeline.yml +0 -226
  168. data/ci/pipeline-dev.yml +0 -58
  169. data/ci/tasks/run-int.sh +0 -53
  170. data/ci/tasks/run-int.yml +0 -18
  171. data/ci/tasks/utils.sh +0 -10
@@ -15,7 +15,7 @@ module Fog
15
15
  @project,
16
16
  check_name,
17
17
  ::Google::Apis::ComputeV1::HttpHealthCheck.new(
18
- opts.merge(:name => check_name)
18
+ **opts.merge(:name => check_name)
19
19
  )
20
20
  )
21
21
  end
@@ -18,7 +18,7 @@ module Fog
18
18
  @compute.update_url_map(
19
19
  @project, url_map_name,
20
20
  ::Google::Apis::ComputeV1::UrlMap.new(
21
- url_map.merge(:name => url_map_name)
21
+ url_map.merge(name: url_map_name)
22
22
  )
23
23
  )
24
24
  end
@@ -14,7 +14,7 @@ module Fog
14
14
  @compute.validate_url_map(
15
15
  @project, url_map_name,
16
16
  ::Google::Apis::ComputeV1::ValidateUrlMapsRequest.new(
17
- :url_map => ::Google::Apis::ComputeV1::UrlMap.new(url_map)
17
+ url_map: ::Google::Apis::ComputeV1::UrlMap.new(**url_map)
18
18
  )
19
19
  )
20
20
  end
@@ -10,8 +10,8 @@ module Fog
10
10
  @dns.create_change(
11
11
  @project, zone_name_or_id,
12
12
  ::Google::Apis::DnsV1::Change.new(
13
- :additions => additions,
14
- :deletions => deletions
13
+ additions: additions,
14
+ deletions: deletions
15
15
  )
16
16
  )
17
17
  end
@@ -98,7 +98,7 @@ module Fog
98
98
  requires :identity
99
99
 
100
100
  data = service.insert_instance(identity, attributes[:tier], attributes)
101
- operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
101
+ operation = Fog::Google::SQL::Operations.new(service: service).get(data.name)
102
102
  operation.wait_for { ready? } unless async
103
103
  reload
104
104
  end
@@ -271,7 +271,7 @@ module Fog
271
271
  requires :identity
272
272
 
273
273
  data = service.restore_instance_backup(identity, backup_run_id)
274
- operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)
274
+ operation = Fog::Google::SQL::Operations.new(service: service).get(data.name)
275
275
  operation.tap { |o| o.wait_for { ready? } unless async }
276
276
  end
277
277
 
@@ -25,14 +25,14 @@ module Fog
25
25
  def create_metric_descriptor(metric_type: nil, unit: nil, value_type: nil,
26
26
  description: nil, display_name: nil, labels: [], metric_kind: nil)
27
27
  metric_descriptor = ::Google::Apis::MonitoringV3::MetricDescriptor.new(
28
- :name => "projects/#{@project}/metricDescriptors/#{metric_type}",
29
- :type => metric_type,
30
- :unit => unit,
31
- :value_type => value_type,
32
- :description => description,
33
- :display_name => display_name,
34
- :labels => labels.map { |l| ::Google::Apis::MonitoringV3::LabelDescriptor.new(l) },
35
- :metric_kind => metric_kind
28
+ name: "projects/#{@project}/metricDescriptors/#{metric_type}",
29
+ type: metric_type,
30
+ unit: unit,
31
+ value_type: value_type,
32
+ description: description,
33
+ display_name: display_name,
34
+ labels: labels.map { |l| ::Google::Apis::MonitoringV3::LabelDescriptor.new(**l) },
35
+ metric_kind: metric_kind
36
36
  )
37
37
 
38
38
  @monitoring.create_project_metric_descriptor("projects/#{@project}", metric_descriptor)
@@ -11,7 +11,7 @@ module Fog
11
11
  #
12
12
  def create_timeseries(timeseries: [])
13
13
  request = ::Google::Apis::MonitoringV3::CreateTimeSeriesRequest.new(
14
- :time_series => timeseries
14
+ time_series: timeseries
15
15
  )
16
16
  @monitoring.create_project_time_series("projects/#{@project}", request)
17
17
  end
@@ -39,7 +39,7 @@ module Fog
39
39
  end
40
40
  end
41
41
 
42
- @monitoring.list_project_time_series("projects/#{@project}", options)
42
+ @monitoring.list_project_time_series("projects/#{@project}", **options)
43
43
  end
44
44
  end
45
45
 
@@ -12,7 +12,7 @@ module Fog
12
12
  ack_ids = [ack_ids]
13
13
  end
14
14
  ack_request = ::Google::Apis::PubsubV1::AcknowledgeRequest.new(
15
- :ack_ids => ack_ids
15
+ ack_ids: ack_ids
16
16
  )
17
17
 
18
18
  @pubsub.acknowledge_subscription(subscription, ack_request)
@@ -18,9 +18,9 @@ module Fog
18
18
  # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/create
19
19
  def create_subscription(subscription_name, topic, push_config = {}, ack_deadline_seconds = nil)
20
20
  subscription = ::Google::Apis::PubsubV1::Subscription.new(
21
- :topic => topic,
22
- :ack_deadline_seconds => ack_deadline_seconds,
23
- :push_config => push_config
21
+ topic: topic,
22
+ ack_deadline_seconds: ack_deadline_seconds,
23
+ push_config: push_config
24
24
  )
25
25
 
26
26
  @pubsub.create_subscription(subscription_name, subscription)
@@ -15,14 +15,14 @@ module Fog
15
15
 
16
16
  unless log_filename.nil? || log_position.nil?
17
17
  context[:bin_log_coordinates] = ::Google::Apis::SqladminV1beta4::BinLogCoordinates.new(
18
- :kind => "sql#binLogCoordinates",
19
- :log_filename => log_filename,
20
- :log_position => log_position
18
+ kind: "sql#binLogCoordinates",
19
+ log_filename: log_filename,
20
+ log_position: log_position
21
21
  )
22
22
  end
23
23
 
24
24
  clone_request = ::Google::Apis::SqladminV1beta4::CloneInstancesRequest.new(
25
- :clone_context => ::Google::Apis::SqladminV1beta4::CloneContext.new(context)
25
+ clone_context: ::Google::Apis::SqladminV1beta4::CloneContext.new(**context)
26
26
  )
27
27
 
28
28
  @sql.clone_instance(@project, instance_id, clone_request)
@@ -24,12 +24,12 @@ module Fog
24
24
 
25
25
  unless csv_export_options.empty?
26
26
  data[:csv_export_options] =
27
- ::Google::Apis::SqladminV1beta4::ExportContext::CsvExportOptions.new(csv_export_options)
27
+ ::Google::Apis::SqladminV1beta4::ExportContext::CsvExportOptions.new(**csv_export_options)
28
28
  end
29
29
 
30
30
  unless sql_export_options.nil?
31
31
  data[:sql_export_options] =
32
- ::Google::Apis::SqladminV1beta4::ExportContext::SqlExportOptions.new(sql_export_options)
32
+ ::Google::Apis::SqladminV1beta4::ExportContext::SqlExportOptions.new(**sql_export_options)
33
33
  end
34
34
 
35
35
  export_context = ::Google::Apis::SqladminV1beta4::ExportContext.new(export_context)
@@ -37,7 +37,7 @@ module Fog
37
37
  @project,
38
38
  instance_id,
39
39
  ::Google::Apis::SqladminV1beta4::ExportInstancesRequest.new(
40
- :export_context => export_context
40
+ export_context: export_context
41
41
  )
42
42
  )
43
43
  end
@@ -19,14 +19,14 @@ module Fog
19
19
  data[:import_user] = import_user unless import_user.nil?
20
20
  unless csv_import_options.nil?
21
21
  data[:csv_import_options] =
22
- ::Google::Apis::SqladminV1beta4::ImportContext::CsvImportOptions.new(csv_import_options)
22
+ ::Google::Apis::SqladminV1beta4::ImportContext::CsvImportOptions.new(**csv_import_options)
23
23
  end
24
24
 
25
25
  @sql.import_instance(
26
26
  @project,
27
27
  instance_id,
28
28
  ::Google::Apis::SqladminV1beta4::ImportInstancesRequest.new(
29
- :import_context => ::Google::Apis::SqladminV1beta4::ImportContext.new(data)
29
+ import_context: ::Google::Apis::SqladminV1beta4::ImportContext.new(**data)
30
30
  )
31
31
  )
32
32
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  @sql.insert_backup_run(
12
12
  @project,
13
13
  instance_id,
14
- ::Google::Apis::SqladminV1beta4::BackupRun.new(backup_run)
14
+ ::Google::Apis::SqladminV1beta4::BackupRun.new(**backup_run)
15
15
  )
16
16
  end
17
17
  end
@@ -8,9 +8,9 @@ module Fog
8
8
 
9
9
  class Real
10
10
  def insert_instance(name, tier, options = {})
11
- instance = ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(options)
11
+ instance = ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(**options)
12
12
  instance.name = name
13
- instance.settings = ::Google::Apis::SqladminV1beta4::Settings.new(instance.settings || {})
13
+ instance.settings = ::Google::Apis::SqladminV1beta4::Settings.new(**instance.settings || {})
14
14
  instance.settings.tier = tier
15
15
  @sql.insert_instance(@project, instance)
16
16
  end
@@ -12,7 +12,7 @@ module Fog
12
12
  @project,
13
13
  instance_id,
14
14
  ::Google::Apis::SqladminV1beta4::InsertSslCertsRequest.new(
15
- :common_name => common_name
15
+ common_name: common_name
16
16
  )
17
17
  )
18
18
  end
@@ -9,7 +9,7 @@ module Fog
9
9
  class Real
10
10
  def insert_user(instance_id, user)
11
11
  @sql.insert_user(@project, instance_id,
12
- ::Google::Apis::SqladminV1beta4::User.new(user))
12
+ ::Google::Apis::SqladminV1beta4::User.new(**user))
13
13
  end
14
14
  end
15
15
 
@@ -9,10 +9,10 @@ module Fog
9
9
  class Real
10
10
  def restore_instance_backup(instance_id, backup_run_id)
11
11
  request = ::Google::Apis::SqladminV1beta4::RestoreInstancesBackupRequest.new(
12
- :restore_backup_context => ::Google::Apis::SqladminV1beta4::RestoreBackupContext.new(
13
- :backup_run_id => backup_run_id,
14
- :instance_id => instance_id,
15
- :kind => "sql#restoreBackupContext"
12
+ restore_backup_context: ::Google::Apis::SqladminV1beta4::RestoreBackupContext.new(
13
+ backup_run_id: backup_run_id,
14
+ instance_id: instance_id,
15
+ kind: "sql#restoreBackupContext"
16
16
  )
17
17
  )
18
18
  @sql.restore_instance_backup(@project, instance_id, request)
@@ -7,14 +7,14 @@ module Fog
7
7
  # @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/update
8
8
  class Real
9
9
  def update_instance(instance_id, settings_version, tier, settings = {})
10
- settings = ::Google::Apis::SqladminV1beta4::Settings.new(settings)
10
+ settings = ::Google::Apis::SqladminV1beta4::Settings.new(**settings)
11
11
  settings.tier = tier
12
12
  settings.settings_version = settings_version
13
13
 
14
14
  @sql.update_instance(
15
15
  @project,
16
16
  instance_id,
17
- ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(:settings => settings)
17
+ ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(settings: settings)
18
18
  )
19
19
  end
20
20
  end
@@ -87,10 +87,10 @@ module Fog
87
87
  # Applies given options to the client instance
88
88
  #
89
89
  # @param [Google::Apis::Core::BaseService] service API service client instance
90
- # @param [Hash] google_client_options Service client options to apply
91
- # @param [Hash] _ignored Rest of the options (for convenience, ignored)
90
+ # @param [Hash] options (all ignored a.t.m., except :google_client_options)
92
91
  # @return [void]
93
- def apply_client_options(service, google_client_options: nil, **_ignored)
92
+ def apply_client_options(service, options = {})
93
+ google_client_options = options[:google_client_options]
94
94
  return if google_client_options.nil? || google_client_options.empty?
95
95
  (service.client_options.members & google_client_options.keys).each do |option|
96
96
  service.client_options[option] = google_client_options[option]
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Google
3
- VERSION = "1.12.1".freeze
3
+ VERSION = "1.16.0".freeze
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ module Fog
5
5
  model Fog::Storage::GoogleJSON::Directory
6
6
 
7
7
  def all(opts = {})
8
- data = service.list_buckets(opts).to_h[:items] || []
8
+ data = service.list_buckets(**opts).to_h[:items] || []
9
9
  load(data)
10
10
  end
11
11
 
@@ -52,7 +52,7 @@ module Fog
52
52
 
53
53
  def save
54
54
  requires :key
55
- service.put_bucket(key, attributes)
55
+ service.put_bucket(key, **attributes)
56
56
  true
57
57
  end
58
58
  end
@@ -45,7 +45,16 @@ module Fog
45
45
  end
46
46
 
47
47
  def body
48
- last_modified && (file = collection.get(identity)) ? attributes[:body] ||= file.body : attributes[:body] ||= ""
48
+ return attributes[:body] if attributes.key?(:body)
49
+
50
+ file = collection.get(identity)
51
+
52
+ attributes[:body] =
53
+ if file
54
+ file.attributes[:body]
55
+ else
56
+ ""
57
+ end
49
58
  end
50
59
 
51
60
  def body=(new_body)
@@ -105,7 +114,7 @@ module Fog
105
114
 
106
115
  options[:predefined_acl] ||= @predefined_acl
107
116
 
108
- service.put_object(directory.key, key, body, options)
117
+ service.put_object(directory.key, key, body, **options)
109
118
  self.content_length = Fog::Storage.get_body_size(body)
110
119
  self.content_type ||= Fog::Storage.get_content_type(body)
111
120
  true
@@ -33,7 +33,7 @@ module Fog
33
33
 
34
34
  def get(key, options = {}, &block)
35
35
  requires :directory
36
- data = service.get_object(directory.key, key, options, &block).to_h
36
+ data = service.get_object(directory.key, key, **options, &block).to_h
37
37
  new(data)
38
38
  rescue ::Google::Apis::ClientError => e
39
39
  raise e unless e.status_code == 404
@@ -42,12 +42,12 @@ module Fog
42
42
 
43
43
  def get_https_url(key, expires, options = {})
44
44
  requires :directory
45
- service.get_object_https_url(directory.key, key, expires, options)
45
+ service.get_object_https_url(directory.key, key, expires, **options)
46
46
  end
47
47
 
48
48
  def metadata(key, options = {})
49
49
  requires :directory
50
- data = service.get_object_metadata(directory.key, key, options).to_h
50
+ data = service.get_object_metadata(directory.key, key, **options).to_h
51
51
  new(data)
52
52
  rescue ::Google::Apis::ClientError
53
53
  nil
@@ -156,12 +156,12 @@ DATA
156
156
  # See https://cloud.google.com/storage/docs/access-control/signed-urls-v2
157
157
  # @return [String] Signature binary blob
158
158
  def iam_signer(string_to_sign)
159
- request = {
160
- "payload": string_to_sign
161
- }
159
+ request = ::Google::Apis::IamcredentialsV1::SignBlobRequest.new(
160
+ payload: string_to_sign
161
+ )
162
162
 
163
163
  resource = "projects/-/serviceAccounts/#{google_access_id}"
164
- response = @iam_service.sign_service_account_blob resource, request, {}
164
+ response = @iam_service.sign_service_account_blob(resource, request)
165
165
 
166
166
  return response.signed_blob
167
167
  end
@@ -15,9 +15,19 @@ module Fog
15
15
  target_bucket, target_object, options = {})
16
16
  request_options = ::Google::Apis::RequestOptions.default.merge(options)
17
17
 
18
+ object = ::Google::Apis::StorageV1::Object.new(**options)
19
+
18
20
  @storage_json.copy_object(source_bucket, source_object,
19
21
  target_bucket, target_object,
20
- request_options, **options)
22
+ object, options: request_options, **filter_keyword_args(options))
23
+ end
24
+
25
+ private
26
+
27
+ def filter_keyword_args(options)
28
+ method = @storage_json.method(:copy_object)
29
+ allowed = method.parameters.filter { |param| %i(key keyreq).include?(param[0]) }.map { |param| param[1] }.compact
30
+ options.filter { |key, _| allowed.include?(key) }
21
31
  end
22
32
  end
23
33
 
@@ -39,6 +39,8 @@ module Fog
39
39
  raise ArgumentError.new("object_name is required") unless object_name
40
40
 
41
41
  buf = Tempfile.new("fog-google-storage-temp")
42
+ buf.binmode
43
+ buf.unlink
42
44
 
43
45
  # Two requests are necessary, first for metadata, then for content.
44
46
  # google-api-ruby-client doesn't allow fetching both metadata and content
@@ -53,18 +55,19 @@ module Fog
53
55
  :options => request_options
54
56
  }
55
57
 
56
- object = @storage_json.get_object(bucket_name, object_name, all_opts).to_h
58
+ object = @storage_json.get_object(bucket_name, object_name, **all_opts).to_h
57
59
  @storage_json.get_object(
58
60
  bucket_name,
59
61
  object_name,
60
- all_opts.merge(:download_dest => buf.path)
62
+ **all_opts.merge(:download_dest => buf)
61
63
  )
62
64
 
65
+ buf.seek(0)
66
+
63
67
  if block_given?
64
68
  yield buf.read, nil, nil
65
69
  else
66
70
  object[:body] = buf.read
67
- buf.unlink
68
71
  end
69
72
 
70
73
  object
@@ -6,14 +6,14 @@ module Fog
6
6
  # Deprecated, redirects to get_object_https_url.rb
7
7
  def get_object_url(bucket_name, object_name, expires, options = {})
8
8
  Fog::Logger.deprecation("Fog::Storage::Google => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller(0..0)})")
9
- get_object_https_url(bucket_name, object_name, expires, options)
9
+ get_object_https_url(bucket_name, object_name, expires, **options)
10
10
  end
11
11
  end
12
12
 
13
13
  class Mock # :nodoc:all
14
14
  def get_object_url(bucket_name, object_name, expires, options = {})
15
15
  Fog::Logger.deprecation("Fog::Storage::Google => #get_object_url is deprecated, use #get_object_https_url instead[/] [light_black](#{caller(0..0)})")
16
- get_object_https_url(bucket_name, object_name, expires, options)
16
+ get_object_https_url(bucket_name, object_name, expires, **options)
17
17
  end
18
18
  end
19
19
  end
@@ -11,10 +11,10 @@ module Fog
11
11
  prefix: nil, projection: nil)
12
12
  @storage_json.list_buckets(
13
13
  @project,
14
- :max_results => max_results,
15
- :page_token => page_token,
16
- :prefix => prefix,
17
- :projection => projection
14
+ max_results: max_results,
15
+ page_token: page_token,
16
+ prefix: prefix,
17
+ projection: projection
18
18
  )
19
19
  end
20
20
  end
@@ -31,7 +31,7 @@ module Fog
31
31
 
32
32
  @storage_json.list_objects(
33
33
  bucket,
34
- options.select { |k, _| allowed_opts.include? k }
34
+ **options.select { |k, _| allowed_opts.include? k }
35
35
  )
36
36
  end
37
37
  end
@@ -19,7 +19,7 @@ module Fog
19
19
  predefined_default_object_acl: nil,
20
20
  **options)
21
21
  bucket = ::Google::Apis::StorageV1::Bucket.new(
22
- options.merge(:name => bucket_name)
22
+ **options.merge(:name => bucket_name)
23
23
  )
24
24
 
25
25
  @storage_json.insert_bucket(
@@ -12,7 +12,7 @@ module Fog
12
12
  raise ArgumentError.new("bucket_name is required") unless bucket_name
13
13
  raise ArgumentError.new("acl is required") unless acl
14
14
 
15
- acl_update = ::Google::Apis::StorageV1::BucketAccessControl.new(acl)
15
+ acl_update = ::Google::Apis::StorageV1::BucketAccessControl.new(**acl)
16
16
  @storage_json.insert_bucket_access_control(bucket_name, acl_update)
17
17
  end
18
18
  end
@@ -51,7 +51,7 @@ module Fog
51
51
  data, options = normalize_data(data, options)
52
52
 
53
53
  object_config = ::Google::Apis::StorageV1::Object.new(
54
- options.merge(:name => object_name)
54
+ **options.merge(:name => object_name)
55
55
  )
56
56
 
57
57
  @storage_json.insert_object(
@@ -15,7 +15,7 @@ module Fog
15
15
  raise ArgumentError.new("object_name is required") unless object_name
16
16
  raise ArgumentError.new("acl is required") unless acl
17
17
 
18
- acl_object = ::Google::Apis::StorageV1::ObjectAccessControl.new(acl)
18
+ acl_object = ::Google::Apis::StorageV1::ObjectAccessControl.new(**acl)
19
19
 
20
20
  @storage_json.insert_object_access_control(
21
21
  bucket_name, object_name, acl_object
@@ -19,7 +19,11 @@ module Fog
19
19
 
20
20
  def host_path_query(params, expires)
21
21
  params[:headers]["Date"] = expires.to_i
22
- params[:path] = URI.encode(params[:path]).gsub("%2F", "/")
22
+ # implementation from CGI.escape, but without ' ' to '+' conversion
23
+ params[:path] = params[:path].b.gsub(/([^a-zA-Z0-9_.\-~]+)/) { |m|
24
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase
25
+ }.gsub("%2F", "/")
26
+
23
27
  query = []
24
28
 
25
29
  if params[:query]
@@ -109,7 +109,7 @@ module Fog
109
109
  options["Expires"] = expires if expires
110
110
  options.merge!(metadata)
111
111
 
112
- data = service.put_object(directory.key, key, body, options)
112
+ data = service.put_object(directory.key, key, body, **options)
113
113
  merge_attributes(data.headers.reject { |key, _value| ["Content-Length", "Content-Type"].include?(key) })
114
114
  self.content_length = Fog::Storage.get_body_size(body)
115
115
  self.content_type ||= Fog::Storage.get_content_type(body)
@@ -22,8 +22,8 @@ TEST_IMAGE_PROJECT = "debian-cloud".freeze
22
22
  TEST_IMAGE_FAMILY = "debian-9".freeze
23
23
 
24
24
  # XXX This depends on a public image in gs://fog-test-bucket; there may be a better way to do this
25
- # The image was created like so: https://cloud.google.com/compute/docs/images#export_an_image_to_google_cloud_storage
26
- TEST_RAW_DISK_SOURCE = "https://storage.googleapis.com/fog-testing-bucket/fog-test-raw-disk-source.image.tar.gz".freeze
25
+ # The image was created like so: https://cloud.google.com/compute/docs/images/export-image
26
+ TEST_RAW_DISK_SOURCE = "https://storage.googleapis.com/fog-test-assets-bucket/fog-test-raw-disk-source.image.tar.gz".freeze
27
27
 
28
28
  TEST_SQL_TIER = "db-n1-standard-1".freeze
29
29
  TEST_SQL_REGION = TEST_REGION
@@ -17,8 +17,12 @@ end
17
17
  # See https://github.com/seattlerb/minitest/#install
18
18
  gem "minitest"
19
19
  require "minitest/autorun"
20
- # Custom formatters
21
- require "minitest/reporters"
22
- Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
20
+
21
+ # This is a workaround for RubyMine debugger that doesn't play nice with Minitest::Reporters
22
+ unless ENV['RM_INFO']
23
+ # Custom formatters to make the tests more legible in CI
24
+ require "minitest/reporters"
25
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
26
+ end
23
27
 
24
28
  require File.join(File.dirname(__FILE__), "../../lib/fog/google")
@@ -135,8 +135,8 @@ class TestServers < FogIntegrationTest
135
135
  def test_reset_windows_password
136
136
  win_disk = @disks.create(
137
137
  :name => "fog-test-1-testservers-test-reset-windows-password-2",
138
- :source_image => "windows-server-1909-dc-core-v20200310",
139
- :size_gb => 32
138
+ :source_image => "windows-server-2019-dc-v20210713",
139
+ :size_gb => 64
140
140
  )
141
141
  server = @factory.create(:disks => [win_disk])
142
142
  server.wait_for { ready? }
@@ -17,17 +17,6 @@ class TestNetworks < FogIntegrationTest
17
17
  super
18
18
  end
19
19
 
20
- def test_valid_range
21
- network = @factory.create
22
-
23
- octet = /\d{,2}|1\d{2}|2[0-4]\d|25[0-5]/
24
- netmask = /(\d{1}|1[0-9]|2[0-9]|3[0-2])/
25
- re = /\A#{octet}\.#{octet}\.#{octet}\.#{octet}\/#{netmask}\z/
26
-
27
- assert_match(re, network.ipv4_range,
28
- "Network range should be valid")
29
- end
30
-
31
20
  def test_run_instance
32
21
  network = @factory.create
33
22
  server = @servers.create(:network_interfaces => [network.get_as_interface_config])
@@ -2,15 +2,13 @@ require "integration/factories/collection_factory"
2
2
 
3
3
  class NetworksFactory < CollectionFactory
4
4
  def initialize(example)
5
- # We cannot have 2 networks with the same IP range so instantiating a
6
- # class variable holding a generator, ensuring that the factory gives
7
- # us a new network every time it's called
8
- @octet_generator = (0..255).each
9
5
  super(Fog::Compute[:google].networks, example)
10
6
  end
11
7
 
12
8
  def params
13
- { :name => resource_name,
14
- :ipv4_range => "172.16.#{@octet_generator.next}.0/24" }
9
+ {
10
+ :name => resource_name,
11
+ :auto_create_subnetworks => true
12
+ }
15
13
  end
16
14
  end