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.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +10 -0
- data/.github/scripts/setup_creds.sh +10 -0
- data/.github/workflows/integration.yml +225 -0
- data/.github/workflows/stale.yml +23 -0
- data/.github/workflows/unit.yml +26 -0
- data/CHANGELOG.md +65 -1
- data/README.md +11 -1
- data/fog-google.gemspec +12 -3
- data/lib/fog/compute/google/models/address.rb +1 -1
- data/lib/fog/compute/google/models/addresses.rb +6 -6
- data/lib/fog/compute/google/models/backend_service.rb +1 -1
- data/lib/fog/compute/google/models/disk.rb +3 -3
- data/lib/fog/compute/google/models/disk_types.rb +2 -2
- data/lib/fog/compute/google/models/disks.rb +2 -2
- data/lib/fog/compute/google/models/firewall.rb +2 -2
- data/lib/fog/compute/google/models/firewalls.rb +1 -1
- data/lib/fog/compute/google/models/forwarding_rules.rb +2 -2
- data/lib/fog/compute/google/models/global_addresses.rb +1 -1
- data/lib/fog/compute/google/models/global_forwarding_rules.rb +1 -1
- data/lib/fog/compute/google/models/http_health_check.rb +2 -2
- data/lib/fog/compute/google/models/instance_group_managers.rb +2 -2
- data/lib/fog/compute/google/models/machine_types.rb +2 -2
- data/lib/fog/compute/google/models/network.rb +1 -1
- data/lib/fog/compute/google/models/operations.rb +3 -3
- data/lib/fog/compute/google/models/region.rb +0 -0
- data/lib/fog/compute/google/models/regions.rb +0 -0
- data/lib/fog/compute/google/models/servers.rb +7 -4
- data/lib/fog/compute/google/models/subnetwork.rb +0 -0
- data/lib/fog/compute/google/models/subnetworks.rb +2 -2
- data/lib/fog/compute/google/models/target_instances.rb +2 -2
- data/lib/fog/compute/google/models/target_pools.rb +2 -2
- data/lib/fog/compute/google/models/url_maps.rb +1 -1
- data/lib/fog/compute/google/requests/abandon_instances.rb +1 -1
- data/lib/fog/compute/google/requests/add_instance_group_instances.rb +3 -3
- data/lib/fog/compute/google/requests/add_server_access_config.rb +3 -3
- data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +2 -2
- data/lib/fog/compute/google/requests/add_target_pool_instances.rb +2 -2
- data/lib/fog/compute/google/requests/attach_disk.rb +1 -1
- data/lib/fog/compute/google/requests/create_disk_snapshot.rb +1 -1
- data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +1 -1
- data/lib/fog/compute/google/requests/get_backend_service_health.rb +1 -1
- data/lib/fog/compute/google/requests/get_region.rb +0 -0
- data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +2 -2
- data/lib/fog/compute/google/requests/get_target_pool_health.rb +1 -1
- data/lib/fog/compute/google/requests/insert_address.rb +2 -2
- data/lib/fog/compute/google/requests/insert_backend_service.rb +1 -1
- data/lib/fog/compute/google/requests/insert_disk.rb +1 -1
- data/lib/fog/compute/google/requests/insert_firewall.rb +1 -1
- data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +1 -1
- data/lib/fog/compute/google/requests/insert_global_address.rb +1 -1
- data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +1 -1
- data/lib/fog/compute/google/requests/insert_http_health_check.rb +1 -1
- data/lib/fog/compute/google/requests/insert_image.rb +1 -1
- data/lib/fog/compute/google/requests/insert_instance_group.rb +3 -3
- data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +7 -7
- data/lib/fog/compute/google/requests/insert_instance_template.rb +3 -3
- data/lib/fog/compute/google/requests/insert_network.rb +2 -12
- data/lib/fog/compute/google/requests/insert_route.rb +10 -10
- data/lib/fog/compute/google/requests/insert_server.rb +9 -9
- data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +4 -4
- data/lib/fog/compute/google/requests/insert_subnetwork.rb +1 -1
- data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +3 -3
- data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +4 -4
- data/lib/fog/compute/google/requests/insert_target_instance.rb +1 -1
- data/lib/fog/compute/google/requests/insert_target_pool.rb +1 -1
- data/lib/fog/compute/google/requests/insert_url_map.rb +1 -1
- data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +1 -1
- data/lib/fog/compute/google/requests/list_addresses.rb +4 -4
- data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +1 -1
- data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +2 -2
- data/lib/fog/compute/google/requests/list_aggregated_disks.rb +2 -2
- data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +2 -2
- data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +4 -4
- data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +1 -1
- data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +2 -2
- data/lib/fog/compute/google/requests/list_aggregated_servers.rb +2 -2
- data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +4 -4
- data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +4 -4
- data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +4 -4
- data/lib/fog/compute/google/requests/list_disk_types.rb +2 -2
- data/lib/fog/compute/google/requests/list_disks.rb +2 -2
- data/lib/fog/compute/google/requests/list_firewalls.rb +4 -4
- data/lib/fog/compute/google/requests/list_forwarding_rules.rb +2 -2
- data/lib/fog/compute/google/requests/list_global_addresses.rb +5 -5
- data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +2 -2
- data/lib/fog/compute/google/requests/list_global_operations.rb +4 -4
- data/lib/fog/compute/google/requests/list_http_health_checks.rb +2 -2
- data/lib/fog/compute/google/requests/list_images.rb +2 -2
- data/lib/fog/compute/google/requests/list_instance_group_managers.rb +2 -2
- data/lib/fog/compute/google/requests/list_instance_templates.rb +4 -4
- data/lib/fog/compute/google/requests/list_machine_types.rb +4 -4
- data/lib/fog/compute/google/requests/list_networks.rb +4 -4
- data/lib/fog/compute/google/requests/list_subnetworks.rb +4 -4
- data/lib/fog/compute/google/requests/list_target_pools.rb +4 -4
- data/lib/fog/compute/google/requests/list_url_maps.rb +2 -2
- data/lib/fog/compute/google/requests/patch_firewall.rb +1 -1
- data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +3 -3
- data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +2 -2
- data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +2 -2
- data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +2 -2
- data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +2 -2
- data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +1 -1
- data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +1 -1
- data/lib/fog/compute/google/requests/set_server_metadata.rb +2 -2
- data/lib/fog/compute/google/requests/set_server_tags.rb +2 -2
- data/lib/fog/compute/google/requests/set_snapshot_labels.rb +2 -2
- data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +1 -1
- data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +1 -1
- data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +1 -1
- data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +1 -1
- data/lib/fog/compute/google/requests/set_target_pool_backup.rb +2 -2
- data/lib/fog/compute/google/requests/update_firewall.rb +1 -1
- data/lib/fog/compute/google/requests/update_http_health_check.rb +1 -1
- data/lib/fog/compute/google/requests/update_url_map.rb +1 -1
- data/lib/fog/compute/google/requests/validate_url_map.rb +1 -1
- data/lib/fog/dns/google/requests/create_change.rb +2 -2
- data/lib/fog/google/models/sql/instance.rb +2 -2
- data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +8 -8
- data/lib/fog/google/requests/monitoring/create_timeseries.rb +1 -1
- data/lib/fog/google/requests/monitoring/list_timeseries.rb +1 -1
- data/lib/fog/google/requests/pubsub/acknowledge_subscription.rb +1 -1
- data/lib/fog/google/requests/pubsub/create_subscription.rb +3 -3
- data/lib/fog/google/requests/sql/clone_instance.rb +4 -4
- data/lib/fog/google/requests/sql/export_instance.rb +3 -3
- data/lib/fog/google/requests/sql/import_instance.rb +2 -2
- data/lib/fog/google/requests/sql/insert_backup_run.rb +1 -1
- data/lib/fog/google/requests/sql/insert_instance.rb +2 -2
- data/lib/fog/google/requests/sql/insert_ssl_cert.rb +1 -1
- data/lib/fog/google/requests/sql/insert_user.rb +1 -1
- data/lib/fog/google/requests/sql/restore_instance_backup.rb +4 -4
- data/lib/fog/google/requests/sql/update_instance.rb +2 -2
- data/lib/fog/google/shared.rb +3 -3
- data/lib/fog/google/version.rb +1 -1
- data/lib/fog/storage/google_json/models/directories.rb +1 -1
- data/lib/fog/storage/google_json/models/directory.rb +1 -1
- data/lib/fog/storage/google_json/models/file.rb +11 -2
- data/lib/fog/storage/google_json/models/files.rb +3 -3
- data/lib/fog/storage/google_json/real.rb +4 -4
- data/lib/fog/storage/google_json/requests/copy_object.rb +11 -1
- data/lib/fog/storage/google_json/requests/get_object.rb +6 -3
- data/lib/fog/storage/google_json/requests/get_object_url.rb +2 -2
- data/lib/fog/storage/google_json/requests/list_buckets.rb +4 -4
- data/lib/fog/storage/google_json/requests/list_objects.rb +1 -1
- data/lib/fog/storage/google_json/requests/put_bucket.rb +1 -1
- data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +1 -1
- data/lib/fog/storage/google_json/requests/put_object.rb +1 -1
- data/lib/fog/storage/google_json/requests/put_object_acl.rb +1 -1
- data/lib/fog/storage/google_json/utils.rb +5 -1
- data/lib/fog/storage/google_xml/models/file.rb +1 -1
- data/test/helpers/integration_test_helper.rb +2 -2
- data/test/helpers/test_helper.rb +7 -3
- data/test/integration/compute/core_compute/test_servers.rb +2 -2
- data/test/integration/compute/core_networking/test_networks.rb +0 -11
- data/test/integration/factories/networks_factory.rb +4 -6
- data/test/integration/monitoring/test_metric_descriptors.rb +1 -1
- data/test/integration/storage/storage_shared.rb +7 -2
- data/test/integration/storage/test_objects.rb +23 -1
- data/test/unit/storage/test_json_requests.rb +8 -0
- metadata +103 -31
- data/.travis.yml +0 -33
- data/ci/.gitignore +0 -1
- data/ci/README.md +0 -65
- data/ci/build-head-pipeline.yml +0 -173
- data/ci/credentials.yml.template +0 -28
- data/ci/docker-image/Dockerfile +0 -18
- data/ci/integration-pipeline.yml +0 -226
- data/ci/pipeline-dev.yml +0 -58
- data/ci/tasks/run-int.sh +0 -53
- data/ci/tasks/run-int.yml +0 -18
- data/ci/tasks/utils.sh +0 -10
@@ -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
|
-
:
|
17
|
+
url_map: ::Google::Apis::ComputeV1::UrlMap.new(**url_map)
|
18
18
|
)
|
19
19
|
)
|
20
20
|
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(:
|
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(:
|
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
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
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
|
-
:
|
14
|
+
time_series: timeseries
|
15
15
|
)
|
16
16
|
@monitoring.create_project_time_series("projects/#{@project}", request)
|
17
17
|
end
|
@@ -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
|
-
:
|
22
|
-
:
|
23
|
-
:
|
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
|
-
:
|
19
|
-
:
|
20
|
-
:
|
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
|
-
:
|
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
|
-
:
|
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
|
-
:
|
29
|
+
import_context: ::Google::Apis::SqladminV1beta4::ImportContext.new(**data)
|
30
30
|
)
|
31
31
|
)
|
32
32
|
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
|
@@ -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
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
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(:
|
17
|
+
::Google::Apis::SqladminV1beta4::DatabaseInstance.new(settings: settings)
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
data/lib/fog/google/shared.rb
CHANGED
@@ -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]
|
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,
|
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]
|
data/lib/fog/google/version.rb
CHANGED
@@ -45,7 +45,16 @@ module Fog
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def body
|
48
|
-
|
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
|
-
|
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
|
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
|
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
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
14
|
+
max_results: max_results,
|
15
|
+
page_token: page_token,
|
16
|
+
prefix: prefix,
|
17
|
+
projection: projection
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
@@ -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
|
@@ -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
|
-
|
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
|
26
|
-
TEST_RAW_DISK_SOURCE = "https://storage.googleapis.com/fog-
|
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
|
data/test/helpers/test_helper.rb
CHANGED
@@ -17,8 +17,12 @@ end
|
|
17
17
|
# See https://github.com/seattlerb/minitest/#install
|
18
18
|
gem "minitest"
|
19
19
|
require "minitest/autorun"
|
20
|
-
|
21
|
-
|
22
|
-
|
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-
|
139
|
-
:size_gb =>
|
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
|
-
{
|
14
|
-
:
|
9
|
+
{
|
10
|
+
:name => resource_name,
|
11
|
+
:auto_create_subnetworks => true
|
12
|
+
}
|
15
13
|
end
|
16
14
|
end
|