google-cloud-tasks-v2 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/lib/google/cloud/tasks/v2/bindings_override.rb +1 -1
  4. data/lib/google/cloud/tasks/v2/cloud_tasks/client.rb +466 -12
  5. data/lib/google/cloud/tasks/v2/cloud_tasks/credentials.rb +1 -1
  6. data/lib/google/cloud/tasks/v2/cloud_tasks/operations.rb +843 -0
  7. data/lib/google/cloud/tasks/v2/cloud_tasks/paths.rb +39 -1
  8. data/lib/google/cloud/tasks/v2/cloud_tasks/rest/client.rb +438 -12
  9. data/lib/google/cloud/tasks/v2/cloud_tasks/rest/operations.rb +927 -0
  10. data/lib/google/cloud/tasks/v2/cloud_tasks/rest/service_stub.rb +248 -1
  11. data/lib/google/cloud/tasks/v2/cloud_tasks/rest.rb +2 -1
  12. data/lib/google/cloud/tasks/v2/cloud_tasks.rb +2 -1
  13. data/lib/google/cloud/tasks/v2/cloudtasks_pb.rb +15 -1
  14. data/lib/google/cloud/tasks/v2/cloudtasks_services_pb.rb +37 -7
  15. data/lib/google/cloud/tasks/v2/cmek_config_pb.rb +24 -0
  16. data/lib/google/cloud/tasks/v2/queue_pb.rb +2 -1
  17. data/lib/google/cloud/tasks/v2/rest.rb +1 -1
  18. data/lib/google/cloud/tasks/v2/target_pb.rb +9 -1
  19. data/lib/google/cloud/tasks/v2/task_pb.rb +3 -1
  20. data/lib/google/cloud/tasks/v2/version.rb +1 -1
  21. data/lib/google/cloud/tasks/v2.rb +1 -1
  22. data/lib/google-cloud-tasks-v2.rb +1 -1
  23. data/proto_docs/google/api/client.rb +1 -1
  24. data/proto_docs/google/api/field_behavior.rb +1 -1
  25. data/proto_docs/google/api/field_info.rb +88 -0
  26. data/proto_docs/google/api/launch_stage.rb +1 -1
  27. data/proto_docs/google/api/resource.rb +1 -1
  28. data/proto_docs/google/cloud/tasks/v2/cloudtasks.rb +203 -6
  29. data/proto_docs/google/cloud/tasks/v2/cmek_config.rb +44 -0
  30. data/proto_docs/google/cloud/tasks/v2/queue.rb +54 -30
  31. data/proto_docs/google/cloud/tasks/v2/target.rb +217 -3
  32. data/proto_docs/google/cloud/tasks/v2/task.rb +13 -1
  33. data/proto_docs/google/iam/v1/iam_policy.rb +1 -1
  34. data/proto_docs/google/iam/v1/options.rb +1 -1
  35. data/proto_docs/google/iam/v1/policy.rb +1 -1
  36. data/proto_docs/google/longrunning/operations.rb +191 -0
  37. data/proto_docs/google/protobuf/any.rb +1 -1
  38. data/proto_docs/google/protobuf/duration.rb +1 -1
  39. data/proto_docs/google/protobuf/empty.rb +1 -1
  40. data/proto_docs/google/protobuf/field_mask.rb +1 -1
  41. data/proto_docs/google/protobuf/timestamp.rb +8 -7
  42. data/proto_docs/google/rpc/status.rb +1 -1
  43. data/proto_docs/google/type/expr.rb +1 -1
  44. metadata +11 -7
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 Google LLC
3
+ # Copyright 2026 Google LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -24,6 +24,44 @@ module Google
24
24
  module CloudTasks
25
25
  # Path helper methods for the CloudTasks API.
26
26
  module Paths
27
+ ##
28
+ # Create a fully-qualified CmekConfig resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/cmekConfig`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ #
37
+ # @return [::String]
38
+ def cmek_config_path project:, location:
39
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
40
+
41
+ "projects/#{project}/locations/#{location}/cmekConfig"
42
+ end
43
+
44
+ ##
45
+ # Create a fully-qualified CryptoKey resource string.
46
+ #
47
+ # The resource will be in the following format:
48
+ #
49
+ # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`
50
+ #
51
+ # @param project [String]
52
+ # @param location [String]
53
+ # @param key_ring [String]
54
+ # @param crypto_key [String]
55
+ #
56
+ # @return [::String]
57
+ def crypto_key_path project:, location:, key_ring:, crypto_key:
58
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
59
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
60
+ raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
61
+
62
+ "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}"
63
+ end
64
+
27
65
  ##
28
66
  # Create a fully-qualified Location resource string.
29
67
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2023 Google LLC
3
+ # Copyright 2026 Google LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -130,6 +130,10 @@ module Google
130
130
 
131
131
  default_config.rpcs.run_task.timeout = 20.0
132
132
 
133
+ default_config.rpcs.update_cmek_config.timeout = 20.0
134
+
135
+ default_config.rpcs.get_cmek_config.timeout = 20.0
136
+
133
137
  default_config
134
138
  end
135
139
  yield @configure if block_given?
@@ -204,6 +208,13 @@ module Google
204
208
  @quota_project_id = @config.quota_project
205
209
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
206
210
 
211
+ @operations_client = ::Google::Cloud::Tasks::V2::CloudTasks::Rest::Operations.new do |config|
212
+ config.credentials = credentials
213
+ config.quota_project = @quota_project_id
214
+ config.endpoint = @config.endpoint
215
+ config.universe_domain = @config.universe_domain
216
+ end
217
+
207
218
  @cloud_tasks_stub = ::Google::Cloud::Tasks::V2::CloudTasks::Rest::ServiceStub.new(
208
219
  endpoint: @config.endpoint,
209
220
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
@@ -232,6 +243,13 @@ module Google
232
243
  end
233
244
  end
234
245
 
246
+ ##
247
+ # Get the associated client for long-running operations.
248
+ #
249
+ # @return [::Google::Cloud::Tasks::V2::CloudTasks::Rest::Operations]
250
+ #
251
+ attr_reader :operations_client
252
+
235
253
  ##
236
254
  # Get the associated client for mix-in of the Locations.
237
255
  #
@@ -652,8 +670,15 @@ module Google
652
670
  #
653
671
  # This command will delete the queue even if it has tasks in it.
654
672
  #
655
- # Note: If you delete a queue, a queue with the same name can't be created
656
- # for 7 days.
673
+ # Note: If you delete a queue, you may be prevented from creating a new queue
674
+ # with the same name as the deleted queue for a tombstone window of up to
675
+ # 3 days. During this window, the CreateQueue operation may appear to
676
+ # recreate the queue, but this can be misleading. If you attempt to create
677
+ # a queue with the same name as one that is in the tombstone window, run
678
+ # GetQueue to confirm that the queue creation was successful. If GetQueue
679
+ # returns 200 response code, your queue was successfully created with the
680
+ # name of the previously deleted queue. Otherwise, your queue did not
681
+ # successfully recreate.
657
682
  #
658
683
  # WARNING: Using this method may have unintended side effects if you are
659
684
  # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
@@ -1409,6 +1434,10 @@ module Google
1409
1434
  ##
1410
1435
  # Gets a task.
1411
1436
  #
1437
+ # After a task is successfully executed or has exhausted its retry attempts,
1438
+ # the task is deleted. A `GetTask` request for a deleted task returns a
1439
+ # `NOT_FOUND` error.
1440
+ #
1412
1441
  # @overload get_task(request, options = nil)
1413
1442
  # Pass arguments to `get_task` via a request object, either of type
1414
1443
  # {::Google::Cloud::Tasks::V2::GetTaskRequest} or an equivalent Hash.
@@ -1544,11 +1573,10 @@ module Google
1544
1573
  # a task's ID is identical to that of an existing task or a task
1545
1574
  # that was deleted or executed recently then the call will fail
1546
1575
  # with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
1547
- # If the task's queue was created using Cloud Tasks, then another task with
1548
- # the same name can't be created for ~1hour after the original task was
1549
- # deleted or executed. If the task's queue was created using queue.yaml or
1550
- # queue.xml, then another task with the same name can't be created
1551
- # for ~9days after the original task was deleted or executed.
1576
+ # The IDs of deleted tasks are not immediately available for reuse. It can
1577
+ # take up to 24 hours (or 9 days if the task's queue was created using a
1578
+ # queue.yaml or queue.xml) for the task ID to be released and made available
1579
+ # again.
1552
1580
  #
1553
1581
  # Because there is an extra lookup cost to identify duplicate task
1554
1582
  # names, these {::Google::Cloud::Tasks::V2::CloudTasks::Rest::Client#create_task CreateTask}
@@ -1630,6 +1658,111 @@ module Google
1630
1658
  raise ::Google::Cloud::Error.from_error(e)
1631
1659
  end
1632
1660
 
1661
+ ##
1662
+ # Creates a batch of tasks and adds them to a queue.
1663
+ #
1664
+ # All tasks must be for the same queue.
1665
+ # A maximum of 100 tasks can be created in a single batch.
1666
+ #
1667
+ # @overload batch_create_tasks(request, options = nil)
1668
+ # Pass arguments to `batch_create_tasks` via a request object, either of type
1669
+ # {::Google::Cloud::Tasks::V2::BatchCreateTasksRequest} or an equivalent Hash.
1670
+ #
1671
+ # @param request [::Google::Cloud::Tasks::V2::BatchCreateTasksRequest, ::Hash]
1672
+ # A request object representing the call parameters. Required. To specify no
1673
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1674
+ # @param options [::Gapic::CallOptions, ::Hash]
1675
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1676
+ #
1677
+ # @overload batch_create_tasks(parent: nil, requests: nil, request_id: nil)
1678
+ # Pass arguments to `batch_create_tasks` via keyword arguments. Note that at
1679
+ # least one keyword argument is required. To specify no parameters, or to keep all
1680
+ # the default parameter values, pass an empty Hash as a request object (see above).
1681
+ #
1682
+ # @param parent [::String]
1683
+ # Required. The queue name. For example:
1684
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1685
+ #
1686
+ # The queue must already exist.
1687
+ # @param requests [::Array<::Google::Cloud::Tasks::V2::CreateTaskRequest, ::Hash>]
1688
+ # Required. The list of requests to create tasks.
1689
+ # The queue specified in parent field of each CreateTaskRequest will be
1690
+ # the same. This validation happens on the client side as well as in the
1691
+ # handler.
1692
+ # BatchCreateTasksRequest.parent will also be the same value as the
1693
+ # individual CreateTaskRequest.parent.
1694
+ # The maximum number of requests is 100.
1695
+ # @param request_id [::String]
1696
+ # Optional. This field will be used to identify the long running operation,
1697
+ # avoiding duplication when user retries. If not provided, then a UUID will
1698
+ # be generated at server side.
1699
+ # @yield [result, operation] Access the result along with the TransportOperation object
1700
+ # @yieldparam result [::Gapic::Operation]
1701
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1702
+ #
1703
+ # @return [::Gapic::Operation]
1704
+ #
1705
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1706
+ #
1707
+ # @example Basic example
1708
+ # require "google/cloud/tasks/v2"
1709
+ #
1710
+ # # Create a client object. The client can be reused for multiple calls.
1711
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1712
+ #
1713
+ # # Create a request. To set request fields, pass in keyword arguments.
1714
+ # request = Google::Cloud::Tasks::V2::BatchCreateTasksRequest.new
1715
+ #
1716
+ # # Call the batch_create_tasks method.
1717
+ # result = client.batch_create_tasks request
1718
+ #
1719
+ # # The returned object is of type Gapic::Operation. You can use it to
1720
+ # # check the status of an operation, cancel it, or wait for results.
1721
+ # # Here is how to wait for a response.
1722
+ # result.wait_until_done! timeout: 60
1723
+ # if result.response?
1724
+ # p result.response
1725
+ # else
1726
+ # puts "No response received."
1727
+ # end
1728
+ #
1729
+ def batch_create_tasks request, options = nil
1730
+ raise ::ArgumentError, "request must be provided" if request.nil?
1731
+
1732
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::BatchCreateTasksRequest
1733
+
1734
+ # Converts hash and nil to an options object
1735
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1736
+
1737
+ # Customize the options with defaults
1738
+ call_metadata = @config.rpcs.batch_create_tasks.metadata.to_h
1739
+
1740
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1741
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1742
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1743
+ gapic_version: ::Google::Cloud::Tasks::V2::VERSION,
1744
+ transports_version_send: [:rest]
1745
+
1746
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1747
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1748
+
1749
+ options.apply_defaults timeout: @config.rpcs.batch_create_tasks.timeout,
1750
+ metadata: call_metadata,
1751
+ retry_policy: @config.rpcs.batch_create_tasks.retry_policy
1752
+
1753
+ options.apply_defaults timeout: @config.timeout,
1754
+ metadata: @config.metadata,
1755
+ retry_policy: @config.retry_policy
1756
+
1757
+ @cloud_tasks_stub.batch_create_tasks request, options do |result, operation|
1758
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1759
+ yield result, operation if block_given?
1760
+ throw :response, result
1761
+ end
1762
+ rescue ::Gapic::Rest::Error => e
1763
+ raise ::Google::Cloud::Error.from_error(e)
1764
+ end
1765
+
1633
1766
  ##
1634
1767
  # Deletes a task.
1635
1768
  #
@@ -1713,6 +1846,108 @@ module Google
1713
1846
  raise ::Google::Cloud::Error.from_error(e)
1714
1847
  end
1715
1848
 
1849
+ ##
1850
+ # Deletes a batch of tasks.
1851
+ # This is a non-atomic operation: if deletion fails for some tasks, it
1852
+ # can still succeed for others. The metadata field of
1853
+ # google.longrunning.Operation contains details of failed deletions.
1854
+ # A maximum of 1000 tasks can be deleted in a batch.
1855
+ #
1856
+ # @overload batch_delete_tasks(request, options = nil)
1857
+ # Pass arguments to `batch_delete_tasks` via a request object, either of type
1858
+ # {::Google::Cloud::Tasks::V2::BatchDeleteTasksRequest} or an equivalent Hash.
1859
+ #
1860
+ # @param request [::Google::Cloud::Tasks::V2::BatchDeleteTasksRequest, ::Hash]
1861
+ # A request object representing the call parameters. Required. To specify no
1862
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1863
+ # @param options [::Gapic::CallOptions, ::Hash]
1864
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1865
+ #
1866
+ # @overload batch_delete_tasks(parent: nil, names: nil, request_id: nil)
1867
+ # Pass arguments to `batch_delete_tasks` via keyword arguments. Note that at
1868
+ # least one keyword argument is required. To specify no parameters, or to keep all
1869
+ # the default parameter values, pass an empty Hash as a request object (see above).
1870
+ #
1871
+ # @param parent [::String]
1872
+ # Required. The queue name. For example:
1873
+ # Format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1874
+ # @param names [::Array<::String>]
1875
+ # Required. The names of the tasks to delete.
1876
+ # A maximum of 1000 tasks can be deleted in a batch.
1877
+ # For example:
1878
+ # Format:
1879
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1880
+ # @param request_id [::String]
1881
+ # Optional. This field will be used to identify the long running operation,
1882
+ # avoiding duplication when user retries. If not provided, then a UUID will
1883
+ # be generated at server side.
1884
+ # @yield [result, operation] Access the result along with the TransportOperation object
1885
+ # @yieldparam result [::Gapic::Operation]
1886
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1887
+ #
1888
+ # @return [::Gapic::Operation]
1889
+ #
1890
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1891
+ #
1892
+ # @example Basic example
1893
+ # require "google/cloud/tasks/v2"
1894
+ #
1895
+ # # Create a client object. The client can be reused for multiple calls.
1896
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
1897
+ #
1898
+ # # Create a request. To set request fields, pass in keyword arguments.
1899
+ # request = Google::Cloud::Tasks::V2::BatchDeleteTasksRequest.new
1900
+ #
1901
+ # # Call the batch_delete_tasks method.
1902
+ # result = client.batch_delete_tasks request
1903
+ #
1904
+ # # The returned object is of type Gapic::Operation. You can use it to
1905
+ # # check the status of an operation, cancel it, or wait for results.
1906
+ # # Here is how to wait for a response.
1907
+ # result.wait_until_done! timeout: 60
1908
+ # if result.response?
1909
+ # p result.response
1910
+ # else
1911
+ # puts "No response received."
1912
+ # end
1913
+ #
1914
+ def batch_delete_tasks request, options = nil
1915
+ raise ::ArgumentError, "request must be provided" if request.nil?
1916
+
1917
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::BatchDeleteTasksRequest
1918
+
1919
+ # Converts hash and nil to an options object
1920
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1921
+
1922
+ # Customize the options with defaults
1923
+ call_metadata = @config.rpcs.batch_delete_tasks.metadata.to_h
1924
+
1925
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1926
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1927
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1928
+ gapic_version: ::Google::Cloud::Tasks::V2::VERSION,
1929
+ transports_version_send: [:rest]
1930
+
1931
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1932
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1933
+
1934
+ options.apply_defaults timeout: @config.rpcs.batch_delete_tasks.timeout,
1935
+ metadata: call_metadata,
1936
+ retry_policy: @config.rpcs.batch_delete_tasks.retry_policy
1937
+
1938
+ options.apply_defaults timeout: @config.timeout,
1939
+ metadata: @config.metadata,
1940
+ retry_policy: @config.retry_policy
1941
+
1942
+ @cloud_tasks_stub.batch_delete_tasks request, options do |result, operation|
1943
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1944
+ yield result, operation if block_given?
1945
+ throw :response, result
1946
+ end
1947
+ rescue ::Gapic::Rest::Error => e
1948
+ raise ::Google::Cloud::Error.from_error(e)
1949
+ end
1950
+
1716
1951
  ##
1717
1952
  # Forces a task to run now.
1718
1953
  #
@@ -1726,10 +1961,6 @@ module Google
1726
1961
  # retry a failed task after a fix has been made or to manually force a task
1727
1962
  # to be dispatched now.
1728
1963
  #
1729
- # The dispatched task is returned. That is, the task that is returned
1730
- # contains the [status][Task.status] after the task is dispatched but
1731
- # before the task is received by its target.
1732
- #
1733
1964
  # If Cloud Tasks receives a successful response from the task's
1734
1965
  # target, then the task will be deleted; otherwise the task's
1735
1966
  # {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} will be reset to
@@ -1830,6 +2061,173 @@ module Google
1830
2061
  raise ::Google::Cloud::Error.from_error(e)
1831
2062
  end
1832
2063
 
2064
+ ##
2065
+ # Creates or Updates a CMEK config.
2066
+ #
2067
+ # Updates the Customer Managed Encryption Key associated with the Cloud Tasks
2068
+ # location (Creates if the key does not already exist). All new tasks created
2069
+ # in the location will be encrypted at-rest with the KMS-key provided in the
2070
+ # config.
2071
+ #
2072
+ # @overload update_cmek_config(request, options = nil)
2073
+ # Pass arguments to `update_cmek_config` via a request object, either of type
2074
+ # {::Google::Cloud::Tasks::V2::UpdateCmekConfigRequest} or an equivalent Hash.
2075
+ #
2076
+ # @param request [::Google::Cloud::Tasks::V2::UpdateCmekConfigRequest, ::Hash]
2077
+ # A request object representing the call parameters. Required. To specify no
2078
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2079
+ # @param options [::Gapic::CallOptions, ::Hash]
2080
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2081
+ #
2082
+ # @overload update_cmek_config(cmek_config: nil, update_mask: nil)
2083
+ # Pass arguments to `update_cmek_config` via keyword arguments. Note that at
2084
+ # least one keyword argument is required. To specify no parameters, or to keep all
2085
+ # the default parameter values, pass an empty Hash as a request object (see above).
2086
+ #
2087
+ # @param cmek_config [::Google::Cloud::Tasks::V2::CmekConfig, ::Hash]
2088
+ # Required. The config to update. Its name attribute distinguishes it.
2089
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2090
+ # List of fields to be updated in this request.
2091
+ # @yield [result, operation] Access the result along with the TransportOperation object
2092
+ # @yieldparam result [::Google::Cloud::Tasks::V2::CmekConfig]
2093
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2094
+ #
2095
+ # @return [::Google::Cloud::Tasks::V2::CmekConfig]
2096
+ #
2097
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2098
+ #
2099
+ # @example Basic example
2100
+ # require "google/cloud/tasks/v2"
2101
+ #
2102
+ # # Create a client object. The client can be reused for multiple calls.
2103
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
2104
+ #
2105
+ # # Create a request. To set request fields, pass in keyword arguments.
2106
+ # request = Google::Cloud::Tasks::V2::UpdateCmekConfigRequest.new
2107
+ #
2108
+ # # Call the update_cmek_config method.
2109
+ # result = client.update_cmek_config request
2110
+ #
2111
+ # # The returned object is of type Google::Cloud::Tasks::V2::CmekConfig.
2112
+ # p result
2113
+ #
2114
+ def update_cmek_config request, options = nil
2115
+ raise ::ArgumentError, "request must be provided" if request.nil?
2116
+
2117
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::UpdateCmekConfigRequest
2118
+
2119
+ # Converts hash and nil to an options object
2120
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2121
+
2122
+ # Customize the options with defaults
2123
+ call_metadata = @config.rpcs.update_cmek_config.metadata.to_h
2124
+
2125
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2126
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2127
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2128
+ gapic_version: ::Google::Cloud::Tasks::V2::VERSION,
2129
+ transports_version_send: [:rest]
2130
+
2131
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2132
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2133
+
2134
+ options.apply_defaults timeout: @config.rpcs.update_cmek_config.timeout,
2135
+ metadata: call_metadata,
2136
+ retry_policy: @config.rpcs.update_cmek_config.retry_policy
2137
+
2138
+ options.apply_defaults timeout: @config.timeout,
2139
+ metadata: @config.metadata,
2140
+ retry_policy: @config.retry_policy
2141
+
2142
+ @cloud_tasks_stub.update_cmek_config request, options do |result, operation|
2143
+ yield result, operation if block_given?
2144
+ end
2145
+ rescue ::Gapic::Rest::Error => e
2146
+ raise ::Google::Cloud::Error.from_error(e)
2147
+ end
2148
+
2149
+ ##
2150
+ # Gets the CMEK config.
2151
+ #
2152
+ # Gets the Customer Managed Encryption Key configured with the Cloud Tasks
2153
+ # location. By default there is no kms_key configured.
2154
+ #
2155
+ # @overload get_cmek_config(request, options = nil)
2156
+ # Pass arguments to `get_cmek_config` via a request object, either of type
2157
+ # {::Google::Cloud::Tasks::V2::GetCmekConfigRequest} or an equivalent Hash.
2158
+ #
2159
+ # @param request [::Google::Cloud::Tasks::V2::GetCmekConfigRequest, ::Hash]
2160
+ # A request object representing the call parameters. Required. To specify no
2161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2162
+ # @param options [::Gapic::CallOptions, ::Hash]
2163
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2164
+ #
2165
+ # @overload get_cmek_config(name: nil)
2166
+ # Pass arguments to `get_cmek_config` via keyword arguments. Note that at
2167
+ # least one keyword argument is required. To specify no parameters, or to keep all
2168
+ # the default parameter values, pass an empty Hash as a request object (see above).
2169
+ #
2170
+ # @param name [::String]
2171
+ # Required. The config. For example:
2172
+ # `projects/PROJECT_ID/locations/LOCATION_ID/CmekConfig`
2173
+ # @yield [result, operation] Access the result along with the TransportOperation object
2174
+ # @yieldparam result [::Google::Cloud::Tasks::V2::CmekConfig]
2175
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2176
+ #
2177
+ # @return [::Google::Cloud::Tasks::V2::CmekConfig]
2178
+ #
2179
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2180
+ #
2181
+ # @example Basic example
2182
+ # require "google/cloud/tasks/v2"
2183
+ #
2184
+ # # Create a client object. The client can be reused for multiple calls.
2185
+ # client = Google::Cloud::Tasks::V2::CloudTasks::Rest::Client.new
2186
+ #
2187
+ # # Create a request. To set request fields, pass in keyword arguments.
2188
+ # request = Google::Cloud::Tasks::V2::GetCmekConfigRequest.new
2189
+ #
2190
+ # # Call the get_cmek_config method.
2191
+ # result = client.get_cmek_config request
2192
+ #
2193
+ # # The returned object is of type Google::Cloud::Tasks::V2::CmekConfig.
2194
+ # p result
2195
+ #
2196
+ def get_cmek_config request, options = nil
2197
+ raise ::ArgumentError, "request must be provided" if request.nil?
2198
+
2199
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::GetCmekConfigRequest
2200
+
2201
+ # Converts hash and nil to an options object
2202
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2203
+
2204
+ # Customize the options with defaults
2205
+ call_metadata = @config.rpcs.get_cmek_config.metadata.to_h
2206
+
2207
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2208
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2209
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2210
+ gapic_version: ::Google::Cloud::Tasks::V2::VERSION,
2211
+ transports_version_send: [:rest]
2212
+
2213
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2214
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2215
+
2216
+ options.apply_defaults timeout: @config.rpcs.get_cmek_config.timeout,
2217
+ metadata: call_metadata,
2218
+ retry_policy: @config.rpcs.get_cmek_config.retry_policy
2219
+
2220
+ options.apply_defaults timeout: @config.timeout,
2221
+ metadata: @config.metadata,
2222
+ retry_policy: @config.retry_policy
2223
+
2224
+ @cloud_tasks_stub.get_cmek_config request, options do |result, operation|
2225
+ yield result, operation if block_given?
2226
+ end
2227
+ rescue ::Gapic::Rest::Error => e
2228
+ raise ::Google::Cloud::Error.from_error(e)
2229
+ end
2230
+
1833
2231
  ##
1834
2232
  # Configuration class for the CloudTasks REST API.
1835
2233
  #
@@ -2056,15 +2454,35 @@ module Google
2056
2454
  #
2057
2455
  attr_reader :create_task
2058
2456
  ##
2457
+ # RPC-specific configuration for `batch_create_tasks`
2458
+ # @return [::Gapic::Config::Method]
2459
+ #
2460
+ attr_reader :batch_create_tasks
2461
+ ##
2059
2462
  # RPC-specific configuration for `delete_task`
2060
2463
  # @return [::Gapic::Config::Method]
2061
2464
  #
2062
2465
  attr_reader :delete_task
2063
2466
  ##
2467
+ # RPC-specific configuration for `batch_delete_tasks`
2468
+ # @return [::Gapic::Config::Method]
2469
+ #
2470
+ attr_reader :batch_delete_tasks
2471
+ ##
2064
2472
  # RPC-specific configuration for `run_task`
2065
2473
  # @return [::Gapic::Config::Method]
2066
2474
  #
2067
2475
  attr_reader :run_task
2476
+ ##
2477
+ # RPC-specific configuration for `update_cmek_config`
2478
+ # @return [::Gapic::Config::Method]
2479
+ #
2480
+ attr_reader :update_cmek_config
2481
+ ##
2482
+ # RPC-specific configuration for `get_cmek_config`
2483
+ # @return [::Gapic::Config::Method]
2484
+ #
2485
+ attr_reader :get_cmek_config
2068
2486
 
2069
2487
  # @private
2070
2488
  def initialize parent_rpcs = nil
@@ -2096,10 +2514,18 @@ module Google
2096
2514
  @get_task = ::Gapic::Config::Method.new get_task_config
2097
2515
  create_task_config = parent_rpcs.create_task if parent_rpcs.respond_to? :create_task
2098
2516
  @create_task = ::Gapic::Config::Method.new create_task_config
2517
+ batch_create_tasks_config = parent_rpcs.batch_create_tasks if parent_rpcs.respond_to? :batch_create_tasks
2518
+ @batch_create_tasks = ::Gapic::Config::Method.new batch_create_tasks_config
2099
2519
  delete_task_config = parent_rpcs.delete_task if parent_rpcs.respond_to? :delete_task
2100
2520
  @delete_task = ::Gapic::Config::Method.new delete_task_config
2521
+ batch_delete_tasks_config = parent_rpcs.batch_delete_tasks if parent_rpcs.respond_to? :batch_delete_tasks
2522
+ @batch_delete_tasks = ::Gapic::Config::Method.new batch_delete_tasks_config
2101
2523
  run_task_config = parent_rpcs.run_task if parent_rpcs.respond_to? :run_task
2102
2524
  @run_task = ::Gapic::Config::Method.new run_task_config
2525
+ update_cmek_config_config = parent_rpcs.update_cmek_config if parent_rpcs.respond_to? :update_cmek_config
2526
+ @update_cmek_config = ::Gapic::Config::Method.new update_cmek_config_config
2527
+ get_cmek_config_config = parent_rpcs.get_cmek_config if parent_rpcs.respond_to? :get_cmek_config
2528
+ @get_cmek_config = ::Gapic::Config::Method.new get_cmek_config_config
2103
2529
 
2104
2530
  yield self if block_given?
2105
2531
  end