google-cloud-compute-v1 1.5.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/lib/google/cloud/compute/v1/accelerator_types/rest/service_stub.rb +8 -8
  4. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +87 -0
  5. data/lib/google/cloud/compute/v1/addresses/rest/service_stub.rb +74 -13
  6. data/lib/google/cloud/compute/v1/autoscalers/rest/service_stub.rb +17 -17
  7. data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +18 -18
  8. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +151 -0
  9. data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +142 -23
  10. data/lib/google/cloud/compute/v1/compute_pb.rb +357 -0
  11. data/lib/google/cloud/compute/v1/disk_types/rest/service_stub.rb +8 -8
  12. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +37 -37
  13. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/service_stub.rb +12 -12
  14. data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +17 -17
  15. data/lib/google/cloud/compute/v1/firewalls/rest/service_stub.rb +12 -12
  16. data/lib/google/cloud/compute/v1/forwarding_rules/rest/service_stub.rb +22 -22
  17. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +82 -0
  18. data/lib/google/cloud/compute/v1/global_addresses/rest/service_stub.rb +68 -8
  19. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/service_stub.rb +14 -14
  20. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/service_stub.rb +14 -14
  21. data/lib/google/cloud/compute/v1/global_operations/rest/service_stub.rb +10 -10
  22. data/lib/google/cloud/compute/v1/global_operations/rest.rb +1 -0
  23. data/lib/google/cloud/compute/v1/global_operations.rb +0 -1
  24. data/lib/google/cloud/compute/v1/global_organization_operations/rest/service_stub.rb +4 -4
  25. data/lib/google/cloud/compute/v1/global_organization_operations/rest.rb +1 -0
  26. data/lib/google/cloud/compute/v1/global_organization_operations.rb +0 -1
  27. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/service_stub.rb +10 -10
  28. data/lib/google/cloud/compute/v1/health_checks/rest/service_stub.rb +13 -13
  29. data/lib/google/cloud/compute/v1/image_family_views/rest/service_stub.rb +5 -5
  30. data/lib/google/cloud/compute/v1/images/rest/service_stub.rb +22 -22
  31. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +1 -1
  32. data/lib/google/cloud/compute/v1/instance_group_managers/rest/service_stub.rb +58 -58
  33. data/lib/google/cloud/compute/v1/instance_groups/rest/service_stub.rb +25 -25
  34. data/lib/google/cloud/compute/v1/instance_templates/rest/service_stub.rb +14 -14
  35. data/lib/google/cloud/compute/v1/instances/rest/client.rb +1 -1
  36. data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +132 -132
  37. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +87 -0
  38. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/service_stub.rb +77 -16
  39. data/lib/google/cloud/compute/v1/interconnect_locations/rest/service_stub.rb +5 -5
  40. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +82 -0
  41. data/lib/google/cloud/compute/v1/interconnects/rest/service_stub.rb +72 -12
  42. data/lib/google/cloud/compute/v1/license_codes/rest/service_stub.rb +6 -6
  43. data/lib/google/cloud/compute/v1/licenses/rest/service_stub.rb +14 -14
  44. data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +14 -14
  45. data/lib/google/cloud/compute/v1/machine_types/rest/service_stub.rb +8 -8
  46. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/service_stub.rb +14 -14
  47. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/service_stub.rb +25 -25
  48. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/service_stub.rb +32 -32
  49. data/lib/google/cloud/compute/v1/networks/rest/service_stub.rb +22 -22
  50. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +37 -37
  51. data/lib/google/cloud/compute/v1/node_templates/rest/service_stub.rb +22 -22
  52. data/lib/google/cloud/compute/v1/node_types/rest/service_stub.rb +8 -8
  53. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/service_stub.rb +19 -19
  54. data/lib/google/cloud/compute/v1/projects/rest/service_stub.rb +15 -15
  55. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/service_stub.rb +10 -10
  56. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/service_stub.rb +16 -16
  57. data/lib/google/cloud/compute/v1/region_autoscalers/rest/service_stub.rb +16 -16
  58. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +155 -0
  59. data/lib/google/cloud/compute/v1/region_backend_services/rest/service_stub.rb +142 -21
  60. data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +13 -13
  61. data/lib/google/cloud/compute/v1/region_disk_types/rest/service_stub.rb +7 -7
  62. data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +36 -36
  63. data/lib/google/cloud/compute/v1/region_health_check_services/rest/service_stub.rb +15 -15
  64. data/lib/google/cloud/compute/v1/region_health_checks/rest/service_stub.rb +18 -18
  65. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +1 -1
  66. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/service_stub.rb +57 -57
  67. data/lib/google/cloud/compute/v1/region_instance_groups/rest/service_stub.rb +13 -13
  68. data/lib/google/cloud/compute/v1/region_instances/rest/service_stub.rb +4 -4
  69. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/service_stub.rb +12 -12
  70. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/service_stub.rb +50 -50
  71. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/service_stub.rb +12 -12
  72. data/lib/google/cloud/compute/v1/region_operations/rest/service_stub.rb +13 -13
  73. data/lib/google/cloud/compute/v1/region_operations/rest.rb +1 -0
  74. data/lib/google/cloud/compute/v1/region_operations.rb +0 -1
  75. data/lib/google/cloud/compute/v1/region_security_policies/rest/service_stub.rb +15 -15
  76. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/service_stub.rb +12 -12
  77. data/lib/google/cloud/compute/v1/region_ssl_policies/credentials.rb +52 -0
  78. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +759 -0
  79. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/service_stub.rb +408 -0
  80. data/lib/google/cloud/compute/v1/region_ssl_policies/rest.rb +33 -0
  81. data/lib/google/cloud/compute/v1/region_ssl_policies.rb +47 -0
  82. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/service_stub.rb +15 -15
  83. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/service_stub.rb +21 -21
  84. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/credentials.rb +52 -0
  85. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +587 -0
  86. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/service_stub.rb +288 -0
  87. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest.rb +33 -0
  88. data/lib/google/cloud/compute/v1/region_target_tcp_proxies.rb +47 -0
  89. data/lib/google/cloud/compute/v1/region_url_maps/rest/service_stub.rb +21 -21
  90. data/lib/google/cloud/compute/v1/regions/rest/service_stub.rb +5 -5
  91. data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +28 -28
  92. data/lib/google/cloud/compute/v1/resource_policies/rest/service_stub.rb +22 -22
  93. data/lib/google/cloud/compute/v1/routers/rest/service_stub.rb +28 -28
  94. data/lib/google/cloud/compute/v1/routes/rest/service_stub.rb +8 -8
  95. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +82 -0
  96. data/lib/google/cloud/compute/v1/security_policies/rest/service_stub.rb +80 -20
  97. data/lib/google/cloud/compute/v1/service_attachments/rest/service_stub.rb +25 -25
  98. data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +16 -16
  99. data/lib/google/cloud/compute/v1/ssl_certificates/rest/service_stub.rb +9 -9
  100. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +86 -0
  101. data/lib/google/cloud/compute/v1/ssl_policies/rest/service_stub.rb +69 -11
  102. data/lib/google/cloud/compute/v1/subnetworks/rest/service_stub.rb +32 -32
  103. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/service_stub.rb +10 -10
  104. data/lib/google/cloud/compute/v1/target_http_proxies/rest/service_stub.rb +13 -13
  105. data/lib/google/cloud/compute/v1/target_https_proxies/rest/service_stub.rb +21 -21
  106. data/lib/google/cloud/compute/v1/target_instances/rest/service_stub.rb +13 -13
  107. data/lib/google/cloud/compute/v1/target_pools/rest/service_stub.rb +31 -31
  108. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/service_stub.rb +18 -18
  109. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/service_stub.rb +12 -12
  110. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +87 -0
  111. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/service_stub.rb +74 -13
  112. data/lib/google/cloud/compute/v1/url_maps/rest/service_stub.rb +17 -17
  113. data/lib/google/cloud/compute/v1/version.rb +1 -1
  114. data/lib/google/cloud/compute/v1/vpn_gateways/rest/service_stub.rb +22 -22
  115. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +87 -0
  116. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/service_stub.rb +74 -13
  117. data/lib/google/cloud/compute/v1/zone_operations/rest/service_stub.rb +13 -13
  118. data/lib/google/cloud/compute/v1/zone_operations/rest.rb +1 -0
  119. data/lib/google/cloud/compute/v1/zone_operations.rb +0 -1
  120. data/lib/google/cloud/compute/v1/zones/rest/service_stub.rb +5 -5
  121. data/lib/google/cloud/compute/v1.rb +2 -0
  122. data/proto_docs/google/cloud/compute/v1/compute.rb +968 -39
  123. metadata +12 -2
@@ -86,6 +86,8 @@ module Google
86
86
 
87
87
  default_config.rpcs.patch.timeout = 600.0
88
88
 
89
+ default_config.rpcs.set_labels.timeout = 600.0
90
+
89
91
  default_config
90
92
  end
91
93
  yield @configure if block_given?
@@ -604,6 +606,84 @@ module Google
604
606
  raise ::Google::Cloud::Error.from_error(gapic_error)
605
607
  end
606
608
 
609
+ ##
610
+ # Sets the labels on an InterconnectAttachment. To learn more about labels, read the Labeling Resources documentation.
611
+ #
612
+ # @overload set_labels(request, options = nil)
613
+ # Pass arguments to `set_labels` via a request object, either of type
614
+ # {::Google::Cloud::Compute::V1::SetLabelsInterconnectAttachmentRequest} or an equivalent Hash.
615
+ #
616
+ # @param request [::Google::Cloud::Compute::V1::SetLabelsInterconnectAttachmentRequest, ::Hash]
617
+ # A request object representing the call parameters. Required. To specify no
618
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
619
+ # @param options [::Gapic::CallOptions, ::Hash]
620
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
621
+ # Note: currently retry functionality is not implemented. While it is possible
622
+ # to set it using ::Gapic::CallOptions, it will not be applied
623
+ #
624
+ # @overload set_labels(project: nil, region: nil, region_set_labels_request_resource: nil, request_id: nil, resource: nil)
625
+ # Pass arguments to `set_labels` via keyword arguments. Note that at
626
+ # least one keyword argument is required. To specify no parameters, or to keep all
627
+ # the default parameter values, pass an empty Hash as a request object (see above).
628
+ #
629
+ # @param project [::String]
630
+ # Project ID for this request.
631
+ # @param region [::String]
632
+ # The region for this request.
633
+ # @param region_set_labels_request_resource [::Google::Cloud::Compute::V1::RegionSetLabelsRequest, ::Hash]
634
+ # The body resource for this request
635
+ # @param request_id [::String]
636
+ # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
637
+ # @param resource [::String]
638
+ # Name or id of the resource for this request.
639
+ # @yield [result, response] Access the result along with the Faraday response object
640
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
641
+ # @yieldparam response [::Faraday::Response]
642
+ #
643
+ # @return [::Gapic::GenericLRO::Operation]
644
+ #
645
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
646
+ def set_labels request, options = nil
647
+ raise ::ArgumentError, "request must be provided" if request.nil?
648
+
649
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsInterconnectAttachmentRequest
650
+
651
+ # Converts hash and nil to an options object
652
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
653
+
654
+ # Customize the options with defaults
655
+ call_metadata = @config.rpcs.set_labels.metadata.to_h
656
+
657
+ # Set x-goog-api-client header
658
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
659
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
660
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
661
+ transports_version_send: [:rest]
662
+
663
+ options.apply_defaults timeout: @config.rpcs.set_labels.timeout,
664
+ metadata: call_metadata
665
+
666
+ options.apply_defaults timeout: @config.timeout,
667
+ metadata: @config.metadata
668
+
669
+ @interconnect_attachments_stub.set_labels request, options do |result, response|
670
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
671
+ operation: result,
672
+ client: region_operations,
673
+ request_values: {
674
+ "project" => request.project,
675
+ "region" => request.region
676
+ },
677
+ options: options
678
+ )
679
+ yield result, response if block_given?
680
+ return result
681
+ end
682
+ rescue ::Faraday::Error => e
683
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
684
+ raise ::Google::Cloud::Error.from_error(gapic_error)
685
+ end
686
+
607
687
  ##
608
688
  # Configuration class for the InterconnectAttachments REST API.
609
689
  #
@@ -733,6 +813,11 @@ module Google
733
813
  # @return [::Gapic::Config::Method]
734
814
  #
735
815
  attr_reader :patch
816
+ ##
817
+ # RPC-specific configuration for `set_labels`
818
+ # @return [::Gapic::Config::Method]
819
+ #
820
+ attr_reader :set_labels
736
821
 
737
822
  # @private
738
823
  def initialize parent_rpcs = nil
@@ -748,6 +833,8 @@ module Google
748
833
  @list = ::Gapic::Config::Method.new list_config
749
834
  patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch
750
835
  @patch = ::Gapic::Config::Method.new patch_config
836
+ set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
837
+ @set_labels = ::Gapic::Config::Method.new set_labels_config
751
838
 
752
839
  yield self if block_given?
753
840
  end
@@ -26,8 +26,8 @@ module Google
26
26
  module Rest
27
27
  ##
28
28
  # REST service stub for the InterconnectAttachments service.
29
- # service stub contains baseline method implementations
30
- # including transcoding, making the REST call and deserialing the response
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
33
  def initialize endpoint:, credentials:
@@ -260,6 +260,43 @@ module Google
260
260
  result
261
261
  end
262
262
 
263
+ ##
264
+ # Baseline implementation for the set_labels REST call
265
+ #
266
+ # @param request_pb [::Google::Cloud::Compute::V1::SetLabelsInterconnectAttachmentRequest]
267
+ # A request object representing the call parameters. Required.
268
+ # @param options [::Gapic::CallOptions]
269
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
270
+ #
271
+ # @yield [result, response] Access the result along with the Faraday response object
272
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
273
+ # @yieldparam response [::Faraday::Response]
274
+ #
275
+ # @return [::Google::Cloud::Compute::V1::Operation]
276
+ # A result object deserialized from the server's reply
277
+ def set_labels request_pb, options = nil
278
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
279
+
280
+ verb, uri, query_string_params, body = transcode_set_labels_request request_pb
281
+ query_string_params = if query_string_params.any?
282
+ query_string_params.to_h { |p| p.split("=", 2) }
283
+ else
284
+ {}
285
+ end
286
+
287
+ response = @client_stub.make_http_request(
288
+ verb,
289
+ uri: uri,
290
+ body: body || "",
291
+ params: query_string_params,
292
+ options: options
293
+ )
294
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
295
+
296
+ yield result, response if block_given?
297
+ result
298
+ end
299
+
263
300
 
264
301
  private
265
302
 
@@ -278,7 +315,7 @@ module Google
278
315
  uri_method: :get,
279
316
  uri_template: "/compute/v1/projects/{project}/aggregated/interconnectAttachments",
280
317
  matches: [
281
- ["project", %r{[^/]+}, false]
318
+ ["project", %r{^[^/]+/?$}, false]
282
319
  ]
283
320
  )
284
321
  transcoder.transcode request_pb
@@ -299,9 +336,9 @@ module Google
299
336
  uri_method: :delete,
300
337
  uri_template: "/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{interconnect_attachment}",
301
338
  matches: [
302
- ["project", %r{[^/]+}, false],
303
- ["region", %r{[^/]+}, false],
304
- ["interconnect_attachment", %r{[^/]+}, false]
339
+ ["project", %r{^[^/]+/?$}, false],
340
+ ["region", %r{^[^/]+/?$}, false],
341
+ ["interconnect_attachment", %r{^[^/]+/?$}, false]
305
342
  ]
306
343
  )
307
344
  transcoder.transcode request_pb
@@ -322,9 +359,9 @@ module Google
322
359
  uri_method: :get,
323
360
  uri_template: "/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{interconnect_attachment}",
324
361
  matches: [
325
- ["project", %r{[^/]+}, false],
326
- ["region", %r{[^/]+}, false],
327
- ["interconnect_attachment", %r{[^/]+}, false]
362
+ ["project", %r{^[^/]+/?$}, false],
363
+ ["region", %r{^[^/]+/?$}, false],
364
+ ["interconnect_attachment", %r{^[^/]+/?$}, false]
328
365
  ]
329
366
  )
330
367
  transcoder.transcode request_pb
@@ -346,8 +383,8 @@ module Google
346
383
  uri_template: "/compute/v1/projects/{project}/regions/{region}/interconnectAttachments",
347
384
  body: "interconnect_attachment_resource",
348
385
  matches: [
349
- ["project", %r{[^/]+}, false],
350
- ["region", %r{[^/]+}, false]
386
+ ["project", %r{^[^/]+/?$}, false],
387
+ ["region", %r{^[^/]+/?$}, false]
351
388
  ]
352
389
  )
353
390
  transcoder.transcode request_pb
@@ -368,8 +405,8 @@ module Google
368
405
  uri_method: :get,
369
406
  uri_template: "/compute/v1/projects/{project}/regions/{region}/interconnectAttachments",
370
407
  matches: [
371
- ["project", %r{[^/]+}, false],
372
- ["region", %r{[^/]+}, false]
408
+ ["project", %r{^[^/]+/?$}, false],
409
+ ["region", %r{^[^/]+/?$}, false]
373
410
  ]
374
411
  )
375
412
  transcoder.transcode request_pb
@@ -391,9 +428,33 @@ module Google
391
428
  uri_template: "/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{interconnect_attachment}",
392
429
  body: "interconnect_attachment_resource",
393
430
  matches: [
394
- ["project", %r{[^/]+}, false],
395
- ["region", %r{[^/]+}, false],
396
- ["interconnect_attachment", %r{[^/]+}, false]
431
+ ["project", %r{^[^/]+/?$}, false],
432
+ ["region", %r{^[^/]+/?$}, false],
433
+ ["interconnect_attachment", %r{^[^/]+/?$}, false]
434
+ ]
435
+ )
436
+ transcoder.transcode request_pb
437
+ end
438
+
439
+ ##
440
+ # @private
441
+ #
442
+ # GRPC transcoding helper method for the set_labels REST call
443
+ #
444
+ # @param request_pb [::Google::Cloud::Compute::V1::SetLabelsInterconnectAttachmentRequest]
445
+ # A request object representing the call parameters. Required.
446
+ # @return [Array(String, [String, nil], Hash{String => String})]
447
+ # Uri, Body, Query string parameters
448
+ def transcode_set_labels_request request_pb
449
+ transcoder = Gapic::Rest::GrpcTranscoder.new
450
+ .with_bindings(
451
+ uri_method: :post,
452
+ uri_template: "/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{resource}/setLabels",
453
+ body: "region_set_labels_request_resource",
454
+ matches: [
455
+ ["project", %r{^[^/]+/?$}, false],
456
+ ["region", %r{^[^/]+/?$}, false],
457
+ ["resource", %r{^[^/]+/?$}, false]
397
458
  ]
398
459
  )
399
460
  transcoder.transcode request_pb
@@ -26,8 +26,8 @@ module Google
26
26
  module Rest
27
27
  ##
28
28
  # REST service stub for the InterconnectLocations service.
29
- # service stub contains baseline method implementations
30
- # including transcoding, making the REST call and deserialing the response
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
33
  def initialize endpoint:, credentials:
@@ -130,8 +130,8 @@ module Google
130
130
  uri_method: :get,
131
131
  uri_template: "/compute/v1/projects/{project}/global/interconnectLocations/{interconnect_location}",
132
132
  matches: [
133
- ["project", %r{[^/]+}, false],
134
- ["interconnect_location", %r{[^/]+}, false]
133
+ ["project", %r{^[^/]+/?$}, false],
134
+ ["interconnect_location", %r{^[^/]+/?$}, false]
135
135
  ]
136
136
  )
137
137
  transcoder.transcode request_pb
@@ -152,7 +152,7 @@ module Google
152
152
  uri_method: :get,
153
153
  uri_template: "/compute/v1/projects/{project}/global/interconnectLocations",
154
154
  matches: [
155
- ["project", %r{[^/]+}, false]
155
+ ["project", %r{^[^/]+/?$}, false]
156
156
  ]
157
157
  )
158
158
  transcoder.transcode request_pb
@@ -86,6 +86,8 @@ module Google
86
86
 
87
87
  default_config.rpcs.patch.timeout = 600.0
88
88
 
89
+ default_config.rpcs.set_labels.timeout = 600.0
90
+
89
91
  default_config
90
92
  end
91
93
  yield @configure if block_given?
@@ -578,6 +580,79 @@ module Google
578
580
  raise ::Google::Cloud::Error.from_error(gapic_error)
579
581
  end
580
582
 
583
+ ##
584
+ # Sets the labels on an Interconnect. To learn more about labels, read the Labeling Resources documentation.
585
+ #
586
+ # @overload set_labels(request, options = nil)
587
+ # Pass arguments to `set_labels` via a request object, either of type
588
+ # {::Google::Cloud::Compute::V1::SetLabelsInterconnectRequest} or an equivalent Hash.
589
+ #
590
+ # @param request [::Google::Cloud::Compute::V1::SetLabelsInterconnectRequest, ::Hash]
591
+ # A request object representing the call parameters. Required. To specify no
592
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
593
+ # @param options [::Gapic::CallOptions, ::Hash]
594
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
595
+ # Note: currently retry functionality is not implemented. While it is possible
596
+ # to set it using ::Gapic::CallOptions, it will not be applied
597
+ #
598
+ # @overload set_labels(global_set_labels_request_resource: nil, project: nil, resource: nil)
599
+ # Pass arguments to `set_labels` via keyword arguments. Note that at
600
+ # least one keyword argument is required. To specify no parameters, or to keep all
601
+ # the default parameter values, pass an empty Hash as a request object (see above).
602
+ #
603
+ # @param global_set_labels_request_resource [::Google::Cloud::Compute::V1::GlobalSetLabelsRequest, ::Hash]
604
+ # The body resource for this request
605
+ # @param project [::String]
606
+ # Project ID for this request.
607
+ # @param resource [::String]
608
+ # Name or id of the resource for this request.
609
+ # @yield [result, response] Access the result along with the Faraday response object
610
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
611
+ # @yieldparam response [::Faraday::Response]
612
+ #
613
+ # @return [::Gapic::GenericLRO::Operation]
614
+ #
615
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
616
+ def set_labels request, options = nil
617
+ raise ::ArgumentError, "request must be provided" if request.nil?
618
+
619
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsInterconnectRequest
620
+
621
+ # Converts hash and nil to an options object
622
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
623
+
624
+ # Customize the options with defaults
625
+ call_metadata = @config.rpcs.set_labels.metadata.to_h
626
+
627
+ # Set x-goog-api-client header
628
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
629
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
630
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
631
+ transports_version_send: [:rest]
632
+
633
+ options.apply_defaults timeout: @config.rpcs.set_labels.timeout,
634
+ metadata: call_metadata
635
+
636
+ options.apply_defaults timeout: @config.timeout,
637
+ metadata: @config.metadata
638
+
639
+ @interconnects_stub.set_labels request, options do |result, response|
640
+ result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
641
+ operation: result,
642
+ client: global_operations,
643
+ request_values: {
644
+ "project" => request.project
645
+ },
646
+ options: options
647
+ )
648
+ yield result, response if block_given?
649
+ return result
650
+ end
651
+ rescue ::Faraday::Error => e
652
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
653
+ raise ::Google::Cloud::Error.from_error(gapic_error)
654
+ end
655
+
581
656
  ##
582
657
  # Configuration class for the Interconnects REST API.
583
658
  #
@@ -707,6 +782,11 @@ module Google
707
782
  # @return [::Gapic::Config::Method]
708
783
  #
709
784
  attr_reader :patch
785
+ ##
786
+ # RPC-specific configuration for `set_labels`
787
+ # @return [::Gapic::Config::Method]
788
+ #
789
+ attr_reader :set_labels
710
790
 
711
791
  # @private
712
792
  def initialize parent_rpcs = nil
@@ -722,6 +802,8 @@ module Google
722
802
  @list = ::Gapic::Config::Method.new list_config
723
803
  patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch
724
804
  @patch = ::Gapic::Config::Method.new patch_config
805
+ set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
806
+ @set_labels = ::Gapic::Config::Method.new set_labels_config
725
807
 
726
808
  yield self if block_given?
727
809
  end
@@ -26,8 +26,8 @@ module Google
26
26
  module Rest
27
27
  ##
28
28
  # REST service stub for the Interconnects service.
29
- # service stub contains baseline method implementations
30
- # including transcoding, making the REST call and deserialing the response
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
33
  def initialize endpoint:, credentials:
@@ -260,6 +260,43 @@ module Google
260
260
  result
261
261
  end
262
262
 
263
+ ##
264
+ # Baseline implementation for the set_labels REST call
265
+ #
266
+ # @param request_pb [::Google::Cloud::Compute::V1::SetLabelsInterconnectRequest]
267
+ # A request object representing the call parameters. Required.
268
+ # @param options [::Gapic::CallOptions]
269
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
270
+ #
271
+ # @yield [result, response] Access the result along with the Faraday response object
272
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
273
+ # @yieldparam response [::Faraday::Response]
274
+ #
275
+ # @return [::Google::Cloud::Compute::V1::Operation]
276
+ # A result object deserialized from the server's reply
277
+ def set_labels request_pb, options = nil
278
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
279
+
280
+ verb, uri, query_string_params, body = transcode_set_labels_request request_pb
281
+ query_string_params = if query_string_params.any?
282
+ query_string_params.to_h { |p| p.split("=", 2) }
283
+ else
284
+ {}
285
+ end
286
+
287
+ response = @client_stub.make_http_request(
288
+ verb,
289
+ uri: uri,
290
+ body: body || "",
291
+ params: query_string_params,
292
+ options: options
293
+ )
294
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
295
+
296
+ yield result, response if block_given?
297
+ result
298
+ end
299
+
263
300
 
264
301
  private
265
302
 
@@ -278,8 +315,8 @@ module Google
278
315
  uri_method: :delete,
279
316
  uri_template: "/compute/v1/projects/{project}/global/interconnects/{interconnect}",
280
317
  matches: [
281
- ["project", %r{[^/]+}, false],
282
- ["interconnect", %r{[^/]+}, false]
318
+ ["project", %r{^[^/]+/?$}, false],
319
+ ["interconnect", %r{^[^/]+/?$}, false]
283
320
  ]
284
321
  )
285
322
  transcoder.transcode request_pb
@@ -300,8 +337,8 @@ module Google
300
337
  uri_method: :get,
301
338
  uri_template: "/compute/v1/projects/{project}/global/interconnects/{interconnect}",
302
339
  matches: [
303
- ["project", %r{[^/]+}, false],
304
- ["interconnect", %r{[^/]+}, false]
340
+ ["project", %r{^[^/]+/?$}, false],
341
+ ["interconnect", %r{^[^/]+/?$}, false]
305
342
  ]
306
343
  )
307
344
  transcoder.transcode request_pb
@@ -322,8 +359,8 @@ module Google
322
359
  uri_method: :get,
323
360
  uri_template: "/compute/v1/projects/{project}/global/interconnects/{interconnect}/getDiagnostics",
324
361
  matches: [
325
- ["project", %r{[^/]+}, false],
326
- ["interconnect", %r{[^/]+}, false]
362
+ ["project", %r{^[^/]+/?$}, false],
363
+ ["interconnect", %r{^[^/]+/?$}, false]
327
364
  ]
328
365
  )
329
366
  transcoder.transcode request_pb
@@ -345,7 +382,7 @@ module Google
345
382
  uri_template: "/compute/v1/projects/{project}/global/interconnects",
346
383
  body: "interconnect_resource",
347
384
  matches: [
348
- ["project", %r{[^/]+}, false]
385
+ ["project", %r{^[^/]+/?$}, false]
349
386
  ]
350
387
  )
351
388
  transcoder.transcode request_pb
@@ -366,7 +403,7 @@ module Google
366
403
  uri_method: :get,
367
404
  uri_template: "/compute/v1/projects/{project}/global/interconnects",
368
405
  matches: [
369
- ["project", %r{[^/]+}, false]
406
+ ["project", %r{^[^/]+/?$}, false]
370
407
  ]
371
408
  )
372
409
  transcoder.transcode request_pb
@@ -388,8 +425,31 @@ module Google
388
425
  uri_template: "/compute/v1/projects/{project}/global/interconnects/{interconnect}",
389
426
  body: "interconnect_resource",
390
427
  matches: [
391
- ["project", %r{[^/]+}, false],
392
- ["interconnect", %r{[^/]+}, false]
428
+ ["project", %r{^[^/]+/?$}, false],
429
+ ["interconnect", %r{^[^/]+/?$}, false]
430
+ ]
431
+ )
432
+ transcoder.transcode request_pb
433
+ end
434
+
435
+ ##
436
+ # @private
437
+ #
438
+ # GRPC transcoding helper method for the set_labels REST call
439
+ #
440
+ # @param request_pb [::Google::Cloud::Compute::V1::SetLabelsInterconnectRequest]
441
+ # A request object representing the call parameters. Required.
442
+ # @return [Array(String, [String, nil], Hash{String => String})]
443
+ # Uri, Body, Query string parameters
444
+ def transcode_set_labels_request request_pb
445
+ transcoder = Gapic::Rest::GrpcTranscoder.new
446
+ .with_bindings(
447
+ uri_method: :post,
448
+ uri_template: "/compute/v1/projects/{project}/global/interconnects/{resource}/setLabels",
449
+ body: "global_set_labels_request_resource",
450
+ matches: [
451
+ ["project", %r{^[^/]+/?$}, false],
452
+ ["resource", %r{^[^/]+/?$}, false]
393
453
  ]
394
454
  )
395
455
  transcoder.transcode request_pb
@@ -26,8 +26,8 @@ module Google
26
26
  module Rest
27
27
  ##
28
28
  # REST service stub for the LicenseCodes service.
29
- # service stub contains baseline method implementations
30
- # including transcoding, making the REST call and deserialing the response
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
33
  def initialize endpoint:, credentials:
@@ -130,8 +130,8 @@ module Google
130
130
  uri_method: :get,
131
131
  uri_template: "/compute/v1/projects/{project}/global/licenseCodes/{license_code}",
132
132
  matches: [
133
- ["project", %r{[^/]+}, false],
134
- ["license_code", %r{[^/]+}, false]
133
+ ["project", %r{^[^/]+/?$}, false],
134
+ ["license_code", %r{^[^/]+/?$}, false]
135
135
  ]
136
136
  )
137
137
  transcoder.transcode request_pb
@@ -153,8 +153,8 @@ module Google
153
153
  uri_template: "/compute/v1/projects/{project}/global/licenseCodes/{resource}/testIamPermissions",
154
154
  body: "test_permissions_request_resource",
155
155
  matches: [
156
- ["project", %r{[^/]+}, false],
157
- ["resource", %r{[^/]+}, false]
156
+ ["project", %r{^[^/]+/?$}, false],
157
+ ["resource", %r{^[^/]+/?$}, false]
158
158
  ]
159
159
  )
160
160
  transcoder.transcode request_pb