google-cloud-compute-v1 2.14.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -1
- data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +36 -4
- data/lib/google/cloud/compute/v1/accelerator_types/rest/service_stub.rb +38 -20
- data/lib/google/cloud/compute/v1/addresses/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/addresses/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/autoscalers/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +42 -13
- data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +110 -74
- data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +45 -17
- data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +142 -98
- data/lib/google/cloud/compute/v1/compute_pb.rb +57 -2
- data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +36 -4
- data/lib/google/cloud/compute/v1/disk_types/rest/service_stub.rb +38 -20
- data/lib/google/cloud/compute/v1/disks/rest/client.rb +48 -19
- data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +158 -110
- data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +38 -7
- data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +45 -19
- data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +158 -110
- data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/firewalls/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +41 -9
- data/lib/google/cloud/compute/v1/forwarding_rules/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/global_addresses/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +36 -6
- data/lib/google/cloud/compute/v1/global_operations/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +35 -4
- data/lib/google/cloud/compute/v1/global_organization_operations/rest/service_stub.rb +38 -20
- data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/health_checks/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/image_family_views/rest/client.rb +34 -2
- data/lib/google/cloud/compute/v1/image_family_views/rest/service_stub.rb +22 -8
- data/lib/google/cloud/compute/v1/images/rest/client.rb +40 -12
- data/lib/google/cloud/compute/v1/images/rest/service_stub.rb +102 -68
- data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +473 -21
- data/lib/google/cloud/compute/v1/instance_group_managers/rest/service_stub.rb +428 -120
- data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +42 -10
- data/lib/google/cloud/compute/v1/instance_groups/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/instance_settings_service/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/instance_settings_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +38 -9
- data/lib/google/cloud/compute/v1/instance_templates/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/instances/rest/client.rb +73 -50
- data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +398 -290
- data/lib/google/cloud/compute/v1/instant_snapshots/rest/client.rb +39 -10
- data/lib/google/cloud/compute/v1/instant_snapshots/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/interconnect_attachments/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/interconnect_locations/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +39 -9
- data/lib/google/cloud/compute/v1/interconnects/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/license_codes/rest/client.rb +34 -3
- data/lib/google/cloud/compute/v1/license_codes/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/licenses/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/licenses/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +36 -4
- data/lib/google/cloud/compute/v1/machine_types/rest/service_stub.rb +38 -20
- data/lib/google/cloud/compute/v1/network_attachments/rest/client.rb +39 -10
- data/lib/google/cloud/compute/v1/network_attachments/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/network_edge_security_services/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +41 -10
- data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +150 -17
- data/lib/google/cloud/compute/v1/network_firewall_policies/rest/service_stub.rb +202 -97
- data/lib/google/cloud/compute/v1/network_profiles/credentials.rb +53 -0
- data/lib/google/cloud/compute/v1/network_profiles/rest/client.rb +529 -0
- data/lib/google/cloud/compute/v1/network_profiles/rest/service_stub.rb +204 -0
- data/lib/google/cloud/compute/v1/network_profiles/rest.rb +51 -0
- data/lib/google/cloud/compute/v1/network_profiles.rb +47 -0
- data/lib/google/cloud/compute/v1/networks/rest/client.rb +43 -12
- data/lib/google/cloud/compute/v1/networks/rest/service_stub.rb +102 -68
- data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +45 -16
- data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +134 -92
- data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +38 -9
- data/lib/google/cloud/compute/v1/node_templates/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/node_types/rest/client.rb +36 -4
- data/lib/google/cloud/compute/v1/node_types/rest/service_stub.rb +38 -20
- data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +39 -8
- data/lib/google/cloud/compute/v1/packet_mirrorings/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/projects/rest/client.rb +46 -15
- data/lib/google/cloud/compute/v1/projects/rest/service_stub.rb +126 -86
- data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +41 -9
- data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/region_autoscalers/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +41 -13
- data/lib/google/cloud/compute/v1/region_backend_services/rest/service_stub.rb +110 -74
- data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/region_disk_types/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +47 -18
- data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +150 -104
- data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/region_health_check_services/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/region_health_checks/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +472 -20
- data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/service_stub.rb +420 -114
- data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +37 -5
- data/lib/google/cloud/compute/v1/region_instance_groups/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/region_instance_templates/rest/client.rb +37 -5
- data/lib/google/cloud/compute/v1/region_instance_templates/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +35 -2
- data/lib/google/cloud/compute/v1/region_instances/rest/service_stub.rb +22 -8
- data/lib/google/cloud/compute/v1/region_instant_snapshots/rest/client.rb +38 -9
- data/lib/google/cloud/compute/v1/region_instant_snapshots/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +44 -18
- data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/service_stub.rb +150 -104
- data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +37 -5
- data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +35 -5
- data/lib/google/cloud/compute/v1/region_operations/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +146 -10
- data/lib/google/cloud/compute/v1/region_security_policies/rest/service_stub.rb +149 -55
- data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +37 -5
- data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +38 -7
- data/lib/google/cloud/compute/v1/region_ssl_policies/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +37 -5
- data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +39 -8
- data/lib/google/cloud/compute/v1/region_url_maps/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/region_zones/rest/client.rb +35 -2
- data/lib/google/cloud/compute/v1/region_zones/rest/service_stub.rb +22 -8
- data/lib/google/cloud/compute/v1/regions/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/regions/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/reservations/rest/client.rb +40 -11
- data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +94 -62
- data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +39 -10
- data/lib/google/cloud/compute/v1/resource_policies/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/rest.rb +1 -0
- data/lib/google/cloud/compute/v1/routers/rest/client.rb +41 -12
- data/lib/google/cloud/compute/v1/routers/rest/service_stub.rb +102 -68
- data/lib/google/cloud/compute/v1/routes/rest/client.rb +37 -5
- data/lib/google/cloud/compute/v1/routes/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +43 -13
- data/lib/google/cloud/compute/v1/security_policies/rest/service_stub.rb +110 -74
- data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +39 -10
- data/lib/google/cloud/compute/v1/service_attachments/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +38 -9
- data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/ssl_certificates/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +39 -8
- data/lib/google/cloud/compute/v1/ssl_policies/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/storage_pool_types/rest/client.rb +36 -4
- data/lib/google/cloud/compute/v1/storage_pool_types/rest/service_stub.rb +38 -20
- data/lib/google/cloud/compute/v1/storage_pools/rest/client.rb +38 -11
- data/lib/google/cloud/compute/v1/storage_pools/rest/service_stub.rb +94 -62
- data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +42 -13
- data/lib/google/cloud/compute/v1/subnetworks/rest/service_stub.rb +110 -74
- data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +38 -6
- data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/service_stub.rb +54 -32
- data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/target_http_proxies/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +44 -12
- data/lib/google/cloud/compute/v1/target_https_proxies/rest/service_stub.rb +102 -68
- data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/target_instances/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +44 -13
- data/lib/google/cloud/compute/v1/target_pools/rest/service_stub.rb +110 -74
- data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +42 -10
- data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +40 -8
- data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/service_stub.rb +70 -44
- data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +41 -10
- data/lib/google/cloud/compute/v1/url_maps/rest/service_stub.rb +86 -56
- data/lib/google/cloud/compute/v1/version.rb +1 -1
- data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +39 -9
- data/lib/google/cloud/compute/v1/vpn_gateways/rest/service_stub.rb +78 -50
- data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +39 -7
- data/lib/google/cloud/compute/v1/vpn_tunnels/rest/service_stub.rb +62 -38
- data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +35 -5
- data/lib/google/cloud/compute/v1/zone_operations/rest/service_stub.rb +46 -26
- data/lib/google/cloud/compute/v1/zones/rest/client.rb +35 -3
- data/lib/google/cloud/compute/v1/zones/rest/service_stub.rb +30 -14
- data/lib/google/cloud/compute/v1.rb +1 -0
- data/proto_docs/google/api/client.rb +19 -0
- data/proto_docs/google/cloud/compute/v1/compute.rb +1010 -55
- metadata +11 -9
@@ -163,8 +163,28 @@ module Google
|
|
163
163
|
endpoint: @config.endpoint,
|
164
164
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
165
165
|
universe_domain: @config.universe_domain,
|
166
|
-
credentials: credentials
|
166
|
+
credentials: credentials,
|
167
|
+
logger: @config.logger
|
167
168
|
)
|
169
|
+
|
170
|
+
@disk_types_stub.logger(stub: true)&.info do |entry|
|
171
|
+
entry.set_system_name
|
172
|
+
entry.set_service
|
173
|
+
entry.message = "Created client for #{entry.service}"
|
174
|
+
entry.set_credentials_fields credentials
|
175
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
176
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
177
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# The logger used for request/response debug logging.
|
183
|
+
#
|
184
|
+
# @return [Logger]
|
185
|
+
#
|
186
|
+
def logger
|
187
|
+
@disk_types_stub.logger
|
168
188
|
end
|
169
189
|
|
170
190
|
# Service calls
|
@@ -257,7 +277,7 @@ module Google
|
|
257
277
|
@disk_types_stub.aggregated_list request, options do |result, operation|
|
258
278
|
result = ::Gapic::Rest::PagedEnumerable.new @disk_types_stub, :aggregated_list, "items", request, result, options
|
259
279
|
yield result, operation if block_given?
|
260
|
-
|
280
|
+
throw :response, result
|
261
281
|
end
|
262
282
|
rescue ::Gapic::Rest::Error => e
|
263
283
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -340,7 +360,6 @@ module Google
|
|
340
360
|
|
341
361
|
@disk_types_stub.get request, options do |result, operation|
|
342
362
|
yield result, operation if block_given?
|
343
|
-
return result
|
344
363
|
end
|
345
364
|
rescue ::Gapic::Rest::Error => e
|
346
365
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -432,7 +451,7 @@ module Google
|
|
432
451
|
@disk_types_stub.list request, options do |result, operation|
|
433
452
|
result = ::Gapic::Rest::PagedEnumerable.new @disk_types_stub, :list, "items", request, result, options
|
434
453
|
yield result, operation if block_given?
|
435
|
-
|
454
|
+
throw :response, result
|
436
455
|
end
|
437
456
|
rescue ::Gapic::Rest::Error => e
|
438
457
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -480,6 +499,13 @@ module Google
|
|
480
499
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
481
500
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
482
501
|
# * (`nil`) indicating no credentials
|
502
|
+
#
|
503
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
504
|
+
# external source for authentication to Google Cloud, you must validate it before
|
505
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
506
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
507
|
+
# For more information, refer to [Validate credential configurations from external
|
508
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
483
509
|
# @return [::Object]
|
484
510
|
# @!attribute [rw] scope
|
485
511
|
# The OAuth scopes
|
@@ -512,6 +538,11 @@ module Google
|
|
512
538
|
# default endpoint URL. The default value of nil uses the environment
|
513
539
|
# universe (usually the default "googleapis.com" universe).
|
514
540
|
# @return [::String,nil]
|
541
|
+
# @!attribute [rw] logger
|
542
|
+
# A custom logger to use for request/response debug logging, or the value
|
543
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
544
|
+
# explicitly disable logging.
|
545
|
+
# @return [::Logger,:default,nil]
|
515
546
|
#
|
516
547
|
class Configuration
|
517
548
|
extend ::Gapic::Config
|
@@ -533,6 +564,7 @@ module Google
|
|
533
564
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
534
565
|
config_attr :quota_project, nil, ::String, nil
|
535
566
|
config_attr :universe_domain, nil, ::String, nil
|
567
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
536
568
|
|
537
569
|
# @private
|
538
570
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: false,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the aggregated_list REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "aggregated_list",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Compute::V1::DiskTypeAggregatedList.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "get",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Compute::V1::DiskType.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,16 +179,18 @@ module Google
|
|
163
179
|
|
164
180
|
response = @client_stub.make_http_request(
|
165
181
|
verb,
|
166
|
-
uri:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "list",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Compute::V1::DiskTypeList.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -204,8 +204,19 @@ module Google
|
|
204
204
|
endpoint: @config.endpoint,
|
205
205
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
206
206
|
universe_domain: @config.universe_domain,
|
207
|
-
credentials: credentials
|
207
|
+
credentials: credentials,
|
208
|
+
logger: @config.logger
|
208
209
|
)
|
210
|
+
|
211
|
+
@disks_stub.logger(stub: true)&.info do |entry|
|
212
|
+
entry.set_system_name
|
213
|
+
entry.set_service
|
214
|
+
entry.message = "Created client for #{entry.service}"
|
215
|
+
entry.set_credentials_fields credentials
|
216
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
217
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
218
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
219
|
+
end
|
209
220
|
end
|
210
221
|
|
211
222
|
##
|
@@ -215,6 +226,15 @@ module Google
|
|
215
226
|
#
|
216
227
|
attr_reader :zone_operations
|
217
228
|
|
229
|
+
##
|
230
|
+
# The logger used for request/response debug logging.
|
231
|
+
#
|
232
|
+
# @return [Logger]
|
233
|
+
#
|
234
|
+
def logger
|
235
|
+
@disks_stub.logger
|
236
|
+
end
|
237
|
+
|
218
238
|
# Service calls
|
219
239
|
|
220
240
|
##
|
@@ -307,7 +327,7 @@ module Google
|
|
307
327
|
options: options
|
308
328
|
)
|
309
329
|
yield result, response if block_given?
|
310
|
-
|
330
|
+
throw :response, result
|
311
331
|
end
|
312
332
|
rescue ::Gapic::Rest::Error => e
|
313
333
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -401,7 +421,7 @@ module Google
|
|
401
421
|
@disks_stub.aggregated_list request, options do |result, operation|
|
402
422
|
result = ::Gapic::Rest::PagedEnumerable.new @disks_stub, :aggregated_list, "items", request, result, options
|
403
423
|
yield result, operation if block_given?
|
404
|
-
|
424
|
+
throw :response, result
|
405
425
|
end
|
406
426
|
rescue ::Gapic::Rest::Error => e
|
407
427
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -495,7 +515,7 @@ module Google
|
|
495
515
|
options: options
|
496
516
|
)
|
497
517
|
yield result, response if block_given?
|
498
|
-
|
518
|
+
throw :response, result
|
499
519
|
end
|
500
520
|
rescue ::Gapic::Rest::Error => e
|
501
521
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -593,7 +613,7 @@ module Google
|
|
593
613
|
options: options
|
594
614
|
)
|
595
615
|
yield result, response if block_given?
|
596
|
-
|
616
|
+
throw :response, result
|
597
617
|
end
|
598
618
|
rescue ::Gapic::Rest::Error => e
|
599
619
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -687,7 +707,7 @@ module Google
|
|
687
707
|
options: options
|
688
708
|
)
|
689
709
|
yield result, response if block_given?
|
690
|
-
|
710
|
+
throw :response, result
|
691
711
|
end
|
692
712
|
rescue ::Gapic::Rest::Error => e
|
693
713
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -770,7 +790,6 @@ module Google
|
|
770
790
|
|
771
791
|
@disks_stub.get request, options do |result, operation|
|
772
792
|
yield result, operation if block_given?
|
773
|
-
return result
|
774
793
|
end
|
775
794
|
rescue ::Gapic::Rest::Error => e
|
776
795
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -855,7 +874,6 @@ module Google
|
|
855
874
|
|
856
875
|
@disks_stub.get_iam_policy request, options do |result, operation|
|
857
876
|
yield result, operation if block_given?
|
858
|
-
return result
|
859
877
|
end
|
860
878
|
rescue ::Gapic::Rest::Error => e
|
861
879
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -951,7 +969,7 @@ module Google
|
|
951
969
|
options: options
|
952
970
|
)
|
953
971
|
yield result, response if block_given?
|
954
|
-
|
972
|
+
throw :response, result
|
955
973
|
end
|
956
974
|
rescue ::Gapic::Rest::Error => e
|
957
975
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1043,7 +1061,7 @@ module Google
|
|
1043
1061
|
@disks_stub.list request, options do |result, operation|
|
1044
1062
|
result = ::Gapic::Rest::PagedEnumerable.new @disks_stub, :list, "items", request, result, options
|
1045
1063
|
yield result, operation if block_given?
|
1046
|
-
|
1064
|
+
throw :response, result
|
1047
1065
|
end
|
1048
1066
|
rescue ::Gapic::Rest::Error => e
|
1049
1067
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1139,7 +1157,7 @@ module Google
|
|
1139
1157
|
options: options
|
1140
1158
|
)
|
1141
1159
|
yield result, response if block_given?
|
1142
|
-
|
1160
|
+
throw :response, result
|
1143
1161
|
end
|
1144
1162
|
rescue ::Gapic::Rest::Error => e
|
1145
1163
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1235,7 +1253,7 @@ module Google
|
|
1235
1253
|
options: options
|
1236
1254
|
)
|
1237
1255
|
yield result, response if block_given?
|
1238
|
-
|
1256
|
+
throw :response, result
|
1239
1257
|
end
|
1240
1258
|
rescue ::Gapic::Rest::Error => e
|
1241
1259
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1320,7 +1338,6 @@ module Google
|
|
1320
1338
|
|
1321
1339
|
@disks_stub.set_iam_policy request, options do |result, operation|
|
1322
1340
|
yield result, operation if block_given?
|
1323
|
-
return result
|
1324
1341
|
end
|
1325
1342
|
rescue ::Gapic::Rest::Error => e
|
1326
1343
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1416,7 +1433,7 @@ module Google
|
|
1416
1433
|
options: options
|
1417
1434
|
)
|
1418
1435
|
yield result, response if block_given?
|
1419
|
-
|
1436
|
+
throw :response, result
|
1420
1437
|
end
|
1421
1438
|
rescue ::Gapic::Rest::Error => e
|
1422
1439
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1512,7 +1529,7 @@ module Google
|
|
1512
1529
|
options: options
|
1513
1530
|
)
|
1514
1531
|
yield result, response if block_given?
|
1515
|
-
|
1532
|
+
throw :response, result
|
1516
1533
|
end
|
1517
1534
|
rescue ::Gapic::Rest::Error => e
|
1518
1535
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1606,7 +1623,7 @@ module Google
|
|
1606
1623
|
options: options
|
1607
1624
|
)
|
1608
1625
|
yield result, response if block_given?
|
1609
|
-
|
1626
|
+
throw :response, result
|
1610
1627
|
end
|
1611
1628
|
rescue ::Gapic::Rest::Error => e
|
1612
1629
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1700,7 +1717,7 @@ module Google
|
|
1700
1717
|
options: options
|
1701
1718
|
)
|
1702
1719
|
yield result, response if block_given?
|
1703
|
-
|
1720
|
+
throw :response, result
|
1704
1721
|
end
|
1705
1722
|
rescue ::Gapic::Rest::Error => e
|
1706
1723
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1785,7 +1802,6 @@ module Google
|
|
1785
1802
|
|
1786
1803
|
@disks_stub.test_iam_permissions request, options do |result, operation|
|
1787
1804
|
yield result, operation if block_given?
|
1788
|
-
return result
|
1789
1805
|
end
|
1790
1806
|
rescue ::Gapic::Rest::Error => e
|
1791
1807
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1884,7 +1900,7 @@ module Google
|
|
1884
1900
|
options: options
|
1885
1901
|
)
|
1886
1902
|
yield result, response if block_given?
|
1887
|
-
|
1903
|
+
throw :response, result
|
1888
1904
|
end
|
1889
1905
|
rescue ::Gapic::Rest::Error => e
|
1890
1906
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1932,6 +1948,13 @@ module Google
|
|
1932
1948
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1933
1949
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1934
1950
|
# * (`nil`) indicating no credentials
|
1951
|
+
#
|
1952
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
1953
|
+
# external source for authentication to Google Cloud, you must validate it before
|
1954
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
1955
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
1956
|
+
# For more information, refer to [Validate credential configurations from external
|
1957
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
1935
1958
|
# @return [::Object]
|
1936
1959
|
# @!attribute [rw] scope
|
1937
1960
|
# The OAuth scopes
|
@@ -1964,6 +1987,11 @@ module Google
|
|
1964
1987
|
# default endpoint URL. The default value of nil uses the environment
|
1965
1988
|
# universe (usually the default "googleapis.com" universe).
|
1966
1989
|
# @return [::String,nil]
|
1990
|
+
# @!attribute [rw] logger
|
1991
|
+
# A custom logger to use for request/response debug logging, or the value
|
1992
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1993
|
+
# explicitly disable logging.
|
1994
|
+
# @return [::Logger,:default,nil]
|
1967
1995
|
#
|
1968
1996
|
class Configuration
|
1969
1997
|
extend ::Gapic::Config
|
@@ -1985,6 +2013,7 @@ module Google
|
|
1985
2013
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1986
2014
|
config_attr :quota_project, nil, ::String, nil
|
1987
2015
|
config_attr :universe_domain, nil, ::String, nil
|
2016
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1988
2017
|
|
1989
2018
|
# @private
|
1990
2019
|
def initialize parent_config = nil
|