google-cloud-compute-v1 0.5.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  4. data/README.md +4 -4
  5. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +2 -2
  6. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +37 -8
  7. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +59 -14
  8. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +158 -19
  9. data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +46 -0
  10. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +169 -23
  11. data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +46 -0
  12. data/lib/google/cloud/compute/v1/compute_pb.rb +534 -2
  13. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +2 -2
  14. data/lib/google/cloud/compute/v1/disks/rest/client.rb +93 -24
  15. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +44 -10
  16. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +98 -31
  17. data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +2 -2
  18. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +54 -13
  19. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +70 -17
  20. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +34 -7
  21. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +64 -16
  22. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +55 -14
  23. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +2 -2
  24. data/lib/google/cloud/compute/v1/global_operations/rest/nonstandard_lro.rb +68 -0
  25. data/lib/google/cloud/compute/v1/global_operations.rb +1 -0
  26. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +1 -1
  27. data/lib/google/cloud/compute/v1/global_organization_operations/rest/nonstandard_lro.rb +68 -0
  28. data/lib/google/cloud/compute/v1/global_organization_operations.rb +1 -0
  29. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +47 -13
  30. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +55 -14
  31. data/lib/google/cloud/compute/v1/images/rest/client.rb +64 -16
  32. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +172 -47
  33. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +71 -18
  34. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +34 -7
  35. data/lib/google/cloud/compute/v1/instances/rest/client.rb +521 -96
  36. data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +91 -0
  37. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +48 -11
  38. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +1 -1
  39. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +44 -10
  40. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +34 -7
  41. data/lib/google/cloud/compute/v1/machine_images/credentials.rb +52 -0
  42. data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +804 -0
  43. data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +363 -0
  44. data/lib/google/cloud/compute/v1/machine_images/rest.rb +33 -0
  45. data/lib/google/cloud/compute/v1/machine_images.rb +44 -0
  46. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +2 -2
  47. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +60 -15
  48. data/lib/google/cloud/compute/v1/networks/rest/client.rb +85 -23
  49. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +82 -21
  50. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +37 -8
  51. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +2 -2
  52. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +48 -11
  53. data/lib/google/cloud/compute/v1/projects/rest/client.rb +107 -31
  54. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +47 -13
  55. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +51 -14
  56. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +58 -13
  57. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +58 -13
  58. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +116 -5
  59. data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +48 -0
  60. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +1 -1
  61. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +92 -23
  62. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +47 -10
  63. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +58 -13
  64. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +171 -46
  65. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +26 -5
  66. data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +24 -3
  67. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +36 -7
  68. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +38 -9
  69. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +1 -1
  70. data/lib/google/cloud/compute/v1/region_operations/rest/nonstandard_lro.rb +68 -0
  71. data/lib/google/cloud/compute/v1/region_operations.rb +1 -0
  72. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +38 -9
  73. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +47 -10
  74. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +62 -17
  75. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +58 -13
  76. data/lib/google/cloud/compute/v1/regions/rest/client.rb +3 -3
  77. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +138 -11
  78. data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +48 -0
  79. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +37 -8
  80. data/lib/google/cloud/compute/v1/routers/rest/client.rb +60 -15
  81. data/lib/google/cloud/compute/v1/routes/rest/client.rb +34 -7
  82. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +75 -20
  83. data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +51 -14
  84. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +116 -7
  85. data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +46 -0
  86. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +37 -10
  87. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +45 -11
  88. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +71 -18
  89. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +47 -13
  90. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +56 -15
  91. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +86 -24
  92. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +37 -8
  93. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +92 -23
  94. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +74 -19
  95. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +54 -13
  96. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +37 -8
  97. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +65 -17
  98. data/lib/google/cloud/compute/v1/version.rb +1 -1
  99. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +48 -11
  100. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +37 -8
  101. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +1 -1
  102. data/lib/google/cloud/compute/v1/zone_operations/rest/nonstandard_lro.rb +68 -0
  103. data/lib/google/cloud/compute/v1/zone_operations.rb +1 -0
  104. data/lib/google/cloud/compute/v1/zones/rest/client.rb +1 -1
  105. data/lib/google/cloud/compute/v1.rb +3 -0
  106. data/proto_docs/README.md +1 -1
  107. data/proto_docs/google/api/resource.rb +10 -71
  108. data/proto_docs/google/cloud/compute/v1/compute.rb +1647 -330
  109. metadata +14 -7
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/compute/v1/compute_pb"
21
21
  require "google/cloud/compute/v1/region_commitments/rest/service_stub"
22
+ require "google/cloud/compute/v1/region_operations/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -81,6 +82,8 @@ module Google
81
82
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
82
83
  }
83
84
 
85
+ default_config.rpcs.update.timeout = 600.0
86
+
84
87
  default_config
85
88
  end
86
89
  yield @configure if block_given?
@@ -137,9 +140,21 @@ module Google
137
140
  credentials = Credentials.new credentials, scope: @config.scope
138
141
  end
139
142
 
143
+ @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config|
144
+ config.credentials = credentials
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
140
148
  @region_commitments_stub = ::Google::Cloud::Compute::V1::RegionCommitments::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
141
149
  end
142
150
 
151
+ ##
152
+ # Get the associated client for long-running operations via RegionOperations.
153
+ #
154
+ # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client]
155
+ #
156
+ attr_reader :region_operations
157
+
143
158
  # Service calls
144
159
 
145
160
  ##
@@ -163,7 +178,7 @@ module Google
163
178
  # the default parameter values, pass an empty Hash as a request object (see above).
164
179
  #
165
180
  # @param filter [::String]
166
- # A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
181
+ # A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
167
182
  # @param include_all_scopes [::Boolean]
168
183
  # Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included.
169
184
  # @param max_results [::Integer]
@@ -310,10 +325,10 @@ module Google
310
325
  # @param request_id [::String]
311
326
  # 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).
312
327
  # @yield [result, response] Access the result along with the Faraday response object
313
- # @yieldparam result [::Gapic::Rest::BaseOperation]
328
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
314
329
  # @yieldparam response [::Faraday::Response]
315
330
  #
316
- # @return [::Gapic::Rest::BaseOperation]
331
+ # @return [::Gapic::GenericLRO::Operation]
317
332
  #
318
333
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
319
334
  def insert request, options = nil
@@ -340,7 +355,15 @@ module Google
340
355
  metadata: @config.metadata
341
356
 
342
357
  @region_commitments_stub.insert request, options do |result, response|
343
- result = ::Gapic::Rest::BaseOperation.new result
358
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
359
+ operation: result,
360
+ client: region_operations,
361
+ request_values: {
362
+ "project" => request.project,
363
+ "region" => request.region
364
+ },
365
+ options: options
366
+ )
344
367
  yield result, response if block_given?
345
368
  return result
346
369
  end
@@ -370,7 +393,7 @@ module Google
370
393
  # the default parameter values, pass an empty Hash as a request object (see above).
371
394
  #
372
395
  # @param filter [::String]
373
- # A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
396
+ # A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
374
397
  # @param max_results [::Integer]
375
398
  # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
376
399
  # @param order_by [::String]
@@ -423,6 +446,87 @@ module Google
423
446
  raise ::Google::Cloud::Error.from_error(gapic_error)
424
447
  end
425
448
 
449
+ ##
450
+ # Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.
451
+ #
452
+ # @overload update(request, options = nil)
453
+ # Pass arguments to `update` via a request object, either of type
454
+ # {::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest} or an equivalent Hash.
455
+ #
456
+ # @param request [::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest, ::Hash]
457
+ # A request object representing the call parameters. Required. To specify no
458
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
459
+ # @param options [::Gapic::CallOptions, ::Hash]
460
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
461
+ # Note: currently retry functionality is not implemented. While it is possible
462
+ # to set it using ::Gapic::CallOptions, it will not be applied
463
+ #
464
+ # @overload update(commitment: nil, commitment_resource: nil, paths: nil, project: nil, region: nil, request_id: nil, update_mask: nil)
465
+ # Pass arguments to `update` via keyword arguments. Note that at
466
+ # least one keyword argument is required. To specify no parameters, or to keep all
467
+ # the default parameter values, pass an empty Hash as a request object (see above).
468
+ #
469
+ # @param commitment [::String]
470
+ # Name of the commitment for which auto renew is being updated.
471
+ # @param commitment_resource [::Google::Cloud::Compute::V1::Commitment, ::Hash]
472
+ # The body resource for this request
473
+ # @param paths [::String]
474
+ # @param project [::String]
475
+ # Project ID for this request.
476
+ # @param region [::String]
477
+ # Name of the region for this request.
478
+ # @param request_id [::String]
479
+ # 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).
480
+ # @param update_mask [::String]
481
+ # update_mask indicates fields to be updated as part of this request.
482
+ # @yield [result, response] Access the result along with the Faraday response object
483
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
484
+ # @yieldparam response [::Faraday::Response]
485
+ #
486
+ # @return [::Gapic::GenericLRO::Operation]
487
+ #
488
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
489
+ def update request, options = nil
490
+ raise ::ArgumentError, "request must be provided" if request.nil?
491
+
492
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest
493
+
494
+ # Converts hash and nil to an options object
495
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
496
+
497
+ # Customize the options with defaults
498
+ call_metadata = @config.rpcs.update.metadata.to_h
499
+
500
+ # Set x-goog-api-client header
501
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
502
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
503
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
504
+ transports_version_send: [:rest]
505
+
506
+ options.apply_defaults timeout: @config.rpcs.update.timeout,
507
+ metadata: call_metadata
508
+
509
+ options.apply_defaults timeout: @config.timeout,
510
+ metadata: @config.metadata
511
+
512
+ @region_commitments_stub.update request, options do |result, response|
513
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
514
+ operation: result,
515
+ client: region_operations,
516
+ request_values: {
517
+ "project" => request.project,
518
+ "region" => request.region
519
+ },
520
+ options: options
521
+ )
522
+ yield result, response if block_given?
523
+ return result
524
+ end
525
+ rescue ::Faraday::Error => e
526
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
527
+ raise ::Google::Cloud::Error.from_error(gapic_error)
528
+ end
529
+
426
530
  ##
427
531
  # Configuration class for the RegionCommitments REST API.
428
532
  #
@@ -542,6 +646,11 @@ module Google
542
646
  # @return [::Gapic::Config::Method]
543
647
  #
544
648
  attr_reader :list
649
+ ##
650
+ # RPC-specific configuration for `update`
651
+ # @return [::Gapic::Config::Method]
652
+ #
653
+ attr_reader :update
545
654
 
546
655
  # @private
547
656
  def initialize parent_rpcs = nil
@@ -553,6 +662,8 @@ module Google
553
662
  @insert = ::Gapic::Config::Method.new insert_config
554
663
  list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
555
664
  @list = ::Gapic::Config::Method.new list_config
665
+ update_config = parent_rpcs.update if parent_rpcs.respond_to? :update
666
+ @update = ::Gapic::Config::Method.new update_config
556
667
 
557
668
  yield self if block_given?
558
669
  end
@@ -225,6 +225,54 @@ module Google
225
225
 
226
226
  [uri, body, query_string_params]
227
227
  end
228
+
229
+ ##
230
+ # Baseline implementation for the update REST call
231
+ #
232
+ # @param request_pb [::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest]
233
+ # A request object representing the call parameters. Required.
234
+ # @param options [::Gapic::CallOptions]
235
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
236
+ #
237
+ # @yield [result, response] Access the result along with the Faraday response object
238
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
239
+ # @yieldparam response [::Faraday::Response]
240
+ #
241
+ # @return [::Google::Cloud::Compute::V1::Operation]
242
+ # A result object deserialized from the server's reply
243
+ def update request_pb, options = nil
244
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
245
+
246
+ uri, body, query_string_params = transcode_update_request request_pb
247
+ response = @client_stub.make_patch_request(
248
+ uri: uri,
249
+ body: body,
250
+ params: query_string_params,
251
+ options: options
252
+ )
253
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
254
+
255
+ yield result, response if block_given?
256
+ result
257
+ end
258
+
259
+ ##
260
+ # GRPC transcoding helper method for the update REST call
261
+ #
262
+ # @param request_pb [::Google::Cloud::Compute::V1::UpdateRegionCommitmentRequest]
263
+ # A request object representing the call parameters. Required.
264
+ # @return [Array(String, [String, nil], Hash{String => String})]
265
+ # Uri, Body, Query string parameters
266
+ def transcode_update_request request_pb
267
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/commitments/#{request_pb.commitment}"
268
+ body = request_pb.commitment_resource.to_json
269
+ query_string_params = {}
270
+ query_string_params["paths"] = request_pb.paths.to_s if request_pb.has_paths?
271
+ query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?
272
+ query_string_params["updateMask"] = request_pb.update_mask.to_s if request_pb.has_update_mask?
273
+
274
+ [uri, body, query_string_params]
275
+ end
228
276
  end
229
277
  end
230
278
  end
@@ -221,7 +221,7 @@ module Google
221
221
  # the default parameter values, pass an empty Hash as a request object (see above).
222
222
  #
223
223
  # @param filter [::String]
224
- # A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
224
+ # A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
225
225
  # @param max_results [::Integer]
226
226
  # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
227
227
  # @param order_by [::String]
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/compute/v1/compute_pb"
21
21
  require "google/cloud/compute/v1/region_disks/rest/service_stub"
22
+ require "google/cloud/compute/v1/region_operations/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -153,9 +154,21 @@ module Google
153
154
  credentials = Credentials.new credentials, scope: @config.scope
154
155
  end
155
156
 
157
+ @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config|
158
+ config.credentials = credentials
159
+ config.endpoint = @config.endpoint
160
+ end
161
+
156
162
  @region_disks_stub = ::Google::Cloud::Compute::V1::RegionDisks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
157
163
  end
158
164
 
165
+ ##
166
+ # Get the associated client for long-running operations via RegionOperations.
167
+ #
168
+ # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client]
169
+ #
170
+ attr_reader :region_operations
171
+
159
172
  # Service calls
160
173
 
161
174
  ##
@@ -189,10 +202,10 @@ module Google
189
202
  # @param request_id [::String]
190
203
  # 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).
191
204
  # @yield [result, response] Access the result along with the Faraday response object
192
- # @yieldparam result [::Gapic::Rest::BaseOperation]
205
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
193
206
  # @yieldparam response [::Faraday::Response]
194
207
  #
195
- # @return [::Gapic::Rest::BaseOperation]
208
+ # @return [::Gapic::GenericLRO::Operation]
196
209
  #
197
210
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
198
211
  def add_resource_policies request, options = nil
@@ -219,7 +232,15 @@ module Google
219
232
  metadata: @config.metadata
220
233
 
221
234
  @region_disks_stub.add_resource_policies request, options do |result, response|
222
- result = ::Gapic::Rest::BaseOperation.new result
235
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
236
+ operation: result,
237
+ client: region_operations,
238
+ request_values: {
239
+ "project" => request.project,
240
+ "region" => request.region
241
+ },
242
+ options: options
243
+ )
223
244
  yield result, response if block_given?
224
245
  return result
225
246
  end
@@ -229,7 +250,7 @@ module Google
229
250
  end
230
251
 
231
252
  ##
232
- # Creates a snapshot of this regional disk.
253
+ # Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.
233
254
  #
234
255
  # @overload create_snapshot(request, options = nil)
235
256
  # Pass arguments to `create_snapshot` via a request object, either of type
@@ -259,10 +280,10 @@ module Google
259
280
  # @param snapshot_resource [::Google::Cloud::Compute::V1::Snapshot, ::Hash]
260
281
  # The body resource for this request
261
282
  # @yield [result, response] Access the result along with the Faraday response object
262
- # @yieldparam result [::Gapic::Rest::BaseOperation]
283
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
263
284
  # @yieldparam response [::Faraday::Response]
264
285
  #
265
- # @return [::Gapic::Rest::BaseOperation]
286
+ # @return [::Gapic::GenericLRO::Operation]
266
287
  #
267
288
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
268
289
  def create_snapshot request, options = nil
@@ -289,7 +310,15 @@ module Google
289
310
  metadata: @config.metadata
290
311
 
291
312
  @region_disks_stub.create_snapshot request, options do |result, response|
292
- result = ::Gapic::Rest::BaseOperation.new result
313
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
314
+ operation: result,
315
+ client: region_operations,
316
+ request_values: {
317
+ "project" => request.project,
318
+ "region" => request.region
319
+ },
320
+ options: options
321
+ )
293
322
  yield result, response if block_given?
294
323
  return result
295
324
  end
@@ -327,10 +356,10 @@ module Google
327
356
  # @param request_id [::String]
328
357
  # 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).
329
358
  # @yield [result, response] Access the result along with the Faraday response object
330
- # @yieldparam result [::Gapic::Rest::BaseOperation]
359
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
331
360
  # @yieldparam response [::Faraday::Response]
332
361
  #
333
- # @return [::Gapic::Rest::BaseOperation]
362
+ # @return [::Gapic::GenericLRO::Operation]
334
363
  #
335
364
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
336
365
  def delete request, options = nil
@@ -357,7 +386,15 @@ module Google
357
386
  metadata: @config.metadata
358
387
 
359
388
  @region_disks_stub.delete request, options do |result, response|
360
- result = ::Gapic::Rest::BaseOperation.new result
389
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
390
+ operation: result,
391
+ client: region_operations,
392
+ request_values: {
393
+ "project" => request.project,
394
+ "region" => request.region
395
+ },
396
+ options: options
397
+ )
361
398
  yield result, response if block_given?
362
399
  return result
363
400
  end
@@ -529,10 +566,10 @@ module Google
529
566
  # @param source_image [::String]
530
567
  # Source image to restore onto a disk. This field is optional.
531
568
  # @yield [result, response] Access the result along with the Faraday response object
532
- # @yieldparam result [::Gapic::Rest::BaseOperation]
569
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
533
570
  # @yieldparam response [::Faraday::Response]
534
571
  #
535
- # @return [::Gapic::Rest::BaseOperation]
572
+ # @return [::Gapic::GenericLRO::Operation]
536
573
  #
537
574
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
538
575
  def insert request, options = nil
@@ -559,7 +596,15 @@ module Google
559
596
  metadata: @config.metadata
560
597
 
561
598
  @region_disks_stub.insert request, options do |result, response|
562
- result = ::Gapic::Rest::BaseOperation.new result
599
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
600
+ operation: result,
601
+ client: region_operations,
602
+ request_values: {
603
+ "project" => request.project,
604
+ "region" => request.region
605
+ },
606
+ options: options
607
+ )
563
608
  yield result, response if block_given?
564
609
  return result
565
610
  end
@@ -589,7 +634,7 @@ module Google
589
634
  # the default parameter values, pass an empty Hash as a request object (see above).
590
635
  #
591
636
  # @param filter [::String]
592
- # A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
637
+ # A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
593
638
  # @param max_results [::Integer]
594
639
  # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
595
640
  # @param order_by [::String]
@@ -673,10 +718,10 @@ module Google
673
718
  # @param request_id [::String]
674
719
  # 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).
675
720
  # @yield [result, response] Access the result along with the Faraday response object
676
- # @yieldparam result [::Gapic::Rest::BaseOperation]
721
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
677
722
  # @yieldparam response [::Faraday::Response]
678
723
  #
679
- # @return [::Gapic::Rest::BaseOperation]
724
+ # @return [::Gapic::GenericLRO::Operation]
680
725
  #
681
726
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
682
727
  def remove_resource_policies request, options = nil
@@ -703,7 +748,15 @@ module Google
703
748
  metadata: @config.metadata
704
749
 
705
750
  @region_disks_stub.remove_resource_policies request, options do |result, response|
706
- result = ::Gapic::Rest::BaseOperation.new result
751
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
752
+ operation: result,
753
+ client: region_operations,
754
+ request_values: {
755
+ "project" => request.project,
756
+ "region" => request.region
757
+ },
758
+ options: options
759
+ )
707
760
  yield result, response if block_given?
708
761
  return result
709
762
  end
@@ -743,10 +796,10 @@ module Google
743
796
  # @param request_id [::String]
744
797
  # 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).
745
798
  # @yield [result, response] Access the result along with the Faraday response object
746
- # @yieldparam result [::Gapic::Rest::BaseOperation]
799
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
747
800
  # @yieldparam response [::Faraday::Response]
748
801
  #
749
- # @return [::Gapic::Rest::BaseOperation]
802
+ # @return [::Gapic::GenericLRO::Operation]
750
803
  #
751
804
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
752
805
  def resize request, options = nil
@@ -773,7 +826,15 @@ module Google
773
826
  metadata: @config.metadata
774
827
 
775
828
  @region_disks_stub.resize request, options do |result, response|
776
- result = ::Gapic::Rest::BaseOperation.new result
829
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
830
+ operation: result,
831
+ client: region_operations,
832
+ request_values: {
833
+ "project" => request.project,
834
+ "region" => request.region
835
+ },
836
+ options: options
837
+ )
777
838
  yield result, response if block_given?
778
839
  return result
779
840
  end
@@ -880,10 +941,10 @@ module Google
880
941
  # @param resource [::String]
881
942
  # Name or id of the resource for this request.
882
943
  # @yield [result, response] Access the result along with the Faraday response object
883
- # @yieldparam result [::Gapic::Rest::BaseOperation]
944
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
884
945
  # @yieldparam response [::Faraday::Response]
885
946
  #
886
- # @return [::Gapic::Rest::BaseOperation]
947
+ # @return [::Gapic::GenericLRO::Operation]
887
948
  #
888
949
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
889
950
  def set_labels request, options = nil
@@ -910,7 +971,15 @@ module Google
910
971
  metadata: @config.metadata
911
972
 
912
973
  @region_disks_stub.set_labels request, options do |result, response|
913
- result = ::Gapic::Rest::BaseOperation.new result
974
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
975
+ operation: result,
976
+ client: region_operations,
977
+ request_values: {
978
+ "project" => request.project,
979
+ "region" => request.region
980
+ },
981
+ options: options
982
+ )
914
983
  yield result, response if block_given?
915
984
  return result
916
985
  end