google-cloud-tasks-v2beta2 0.9.1 → 0.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e80ae51d66a7f756830eb5e4917850ea222313585240499e23000317677da056
4
- data.tar.gz: 96fd19b5ac780c7cddc12d4acb21cd61e7ee2abcb11492438606d685afe7b8c5
3
+ metadata.gz: 8345417897fed9c7b4548ed24dc365e4244b647a0029b8d73cb394774b3fd141
4
+ data.tar.gz: 2de002018d143b900187360372c944e34d01f4cddef53287d4d23ee4c8029aff
5
5
  SHA512:
6
- metadata.gz: c4ba80a9b5c375c9961a3255b6637b73b4eb0c1ece7404981430ba34c4f7a6478c9662db0664c6eb0bba2f95a02a881918f5e6463bc1ad1785d9899f316b4abf
7
- data.tar.gz: 1fc31a92570e5074a1daa14f1c728a854f6d013330ea258a11da0307d4b7a7a707bd26ac0a8c4f42d21df82a3253c0bb22dfa16ac46fe89b08eed5c193303d4a
6
+ metadata.gz: fa4cf268916f442236956272a73ee5d3a5ea668466d2bbdb55f3221a9c286840ba65ef4012b5d59a7e41699229a2f66a160602c49d6bb06c7efb459ed879102b
7
+ data.tar.gz: 98f270bd62d980f46c7a93c1bdc505e589551e4d579182fa54338ce38bd14d1257488a15a9de67a6ce738e9a7d136d6e5e310ecc5c7fd817a5c8773152da8a4f
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/config"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Tasks
24
+ ##
25
+ # @example Loading just the REST part of this package, including all its services, and instantiating a REST client
26
+ #
27
+ # require "google/cloud/tasks/v2beta2/rest"
28
+ # client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Rest::Client.new
29
+ #
30
+ module V2beta2
31
+ ##
32
+ # @private
33
+ # Initialize the mixin bindings configuration
34
+ #
35
+ def self.configure
36
+ @configure ||= begin
37
+ namespace = ["Google", "Cloud", "Tasks"]
38
+ parent_config = while namespace.any?
39
+ parent_name = namespace.join "::"
40
+ parent_const = const_get parent_name
41
+ break parent_const.configure if parent_const.respond_to? :configure
42
+ namespace.pop
43
+ end
44
+
45
+ default_config = Configuration.new parent_config
46
+ default_config.bindings_override["google.cloud.location.Locations.GetLocation"] = [
47
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
48
+ uri_method: :get,
49
+ uri_template: "/v2beta2/{name}",
50
+ matches: [
51
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
52
+ ],
53
+ body: nil
54
+ )
55
+ ]
56
+ default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [
57
+
58
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
59
+ uri_method: :get,
60
+ uri_template: "/v2beta2/{name}/locations",
61
+ matches: [
62
+ ["name", %r{^projects/[^/]+/?$}, false]
63
+ ],
64
+ body: nil
65
+ )
66
+ ]
67
+ default_config
68
+ end
69
+ yield @configure if block_given?
70
+ @configure
71
+ end
72
+
73
+ ##
74
+ # @private
75
+ # Configuration class for the google.cloud.tasks.v2beta2 package.
76
+ #
77
+ # This class contains common configuration for all services
78
+ # of the google.cloud.tasks.v2beta2 package.
79
+ #
80
+ # This configuration is for internal use of the client library classes,
81
+ # and it is not intended that the end-users will read or change it.
82
+ #
83
+ class Configuration
84
+ extend ::Gapic::Config
85
+
86
+ # @private
87
+ # Overrides for http bindings for the RPC of the mixins for this package.
88
+ # Services in this package should use these when creating clients for the mixin services.
89
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
90
+ config_attr :bindings_override, {}, ::Hash, nil
91
+
92
+ # @private
93
+ def initialize parent_config = nil
94
+ @parent_config = parent_config unless parent_config.nil?
95
+
96
+ yield self if block_given?
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/tasks/v2beta2/cloudtasks_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -90,6 +91,8 @@ module Google
90
91
 
91
92
  default_config.rpcs.resume_queue.timeout = 20.0
92
93
 
94
+ default_config.rpcs.upload_queue_yaml.timeout = 20.0
95
+
93
96
  default_config.rpcs.get_iam_policy.timeout = 20.0
94
97
  default_config.rpcs.get_iam_policy.retry_policy = {
95
98
  initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
@@ -129,6 +132,8 @@ module Google
129
132
 
130
133
  default_config.rpcs.run_task.timeout = 20.0
131
134
 
135
+ default_config.rpcs.buffer_task.timeout = 20.0
136
+
132
137
  default_config
133
138
  end
134
139
  yield @configure if block_given?
@@ -198,15 +203,29 @@ module Google
198
203
  @quota_project_id = @config.quota_project
199
204
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
200
205
 
206
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
207
+ config.credentials = credentials
208
+ config.quota_project = @quota_project_id
209
+ config.endpoint = @config.endpoint
210
+ end
211
+
201
212
  @cloud_tasks_stub = ::Gapic::ServiceStub.new(
202
213
  ::Google::Cloud::Tasks::V2beta2::CloudTasks::Stub,
203
214
  credentials: credentials,
204
215
  endpoint: @config.endpoint,
205
216
  channel_args: @config.channel_args,
206
- interceptors: @config.interceptors
217
+ interceptors: @config.interceptors,
218
+ channel_pool_config: @config.channel_pool
207
219
  )
208
220
  end
209
221
 
222
+ ##
223
+ # Get the associated client for mix-in of the Locations.
224
+ #
225
+ # @return [Google::Cloud::Location::Locations::Client]
226
+ #
227
+ attr_reader :location_client
228
+
210
229
  # Service calls
211
230
 
212
231
  ##
@@ -463,7 +482,7 @@ module Google
463
482
  #
464
483
  # The list of allowed locations can be obtained by calling Cloud
465
484
  # Tasks' implementation of
466
- # [ListLocations][google.cloud.location.Locations.ListLocations].
485
+ # `::Google::Cloud::Location::Locations::Client#list_locations`.
467
486
  # @param queue [::Google::Cloud::Tasks::V2beta2::Queue, ::Hash]
468
487
  # Required. The queue to create.
469
488
  #
@@ -1027,6 +1046,91 @@ module Google
1027
1046
  raise ::Google::Cloud::Error.from_error(e)
1028
1047
  end
1029
1048
 
1049
+ ##
1050
+ # Update queue list by uploading a queue.yaml file.
1051
+ #
1052
+ # The queue.yaml file is supplied in the request body as a YAML encoded
1053
+ # string. This method was added to support gcloud clients versions before
1054
+ # 322.0.0. New clients should use CreateQueue instead of this method.
1055
+ #
1056
+ # @overload upload_queue_yaml(request, options = nil)
1057
+ # Pass arguments to `upload_queue_yaml` via a request object, either of type
1058
+ # {::Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest} or an equivalent Hash.
1059
+ #
1060
+ # @param request [::Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest, ::Hash]
1061
+ # A request object representing the call parameters. Required. To specify no
1062
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1063
+ # @param options [::Gapic::CallOptions, ::Hash]
1064
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1065
+ #
1066
+ # @overload upload_queue_yaml(app_id: nil, http_body: nil)
1067
+ # Pass arguments to `upload_queue_yaml` via keyword arguments. Note that at
1068
+ # least one keyword argument is required. To specify no parameters, or to keep all
1069
+ # the default parameter values, pass an empty Hash as a request object (see above).
1070
+ #
1071
+ # @param app_id [::String]
1072
+ # Required. The App ID is supplied as an HTTP parameter. Unlike internal
1073
+ # usage of App ID, it does not include a region prefix. Rather, the App ID
1074
+ # represents the Project ID against which to make the request.
1075
+ # @param http_body [::Google::Api::HttpBody, ::Hash]
1076
+ # The http body contains the queue.yaml file which used to update queue lists
1077
+ #
1078
+ # @yield [response, operation] Access the result along with the RPC operation
1079
+ # @yieldparam response [::Google::Protobuf::Empty]
1080
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1081
+ #
1082
+ # @return [::Google::Protobuf::Empty]
1083
+ #
1084
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1085
+ #
1086
+ # @example Basic example
1087
+ # require "google/cloud/tasks/v2beta2"
1088
+ #
1089
+ # # Create a client object. The client can be reused for multiple calls.
1090
+ # client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new
1091
+ #
1092
+ # # Create a request. To set request fields, pass in keyword arguments.
1093
+ # request = Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest.new
1094
+ #
1095
+ # # Call the upload_queue_yaml method.
1096
+ # result = client.upload_queue_yaml request
1097
+ #
1098
+ # # The returned object is of type Google::Protobuf::Empty.
1099
+ # p result
1100
+ #
1101
+ def upload_queue_yaml request, options = nil
1102
+ raise ::ArgumentError, "request must be provided" if request.nil?
1103
+
1104
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest
1105
+
1106
+ # Converts hash and nil to an options object
1107
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1108
+
1109
+ # Customize the options with defaults
1110
+ metadata = @config.rpcs.upload_queue_yaml.metadata.to_h
1111
+
1112
+ # Set x-goog-api-client and x-goog-user-project headers
1113
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1114
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1115
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1116
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1117
+
1118
+ options.apply_defaults timeout: @config.rpcs.upload_queue_yaml.timeout,
1119
+ metadata: metadata,
1120
+ retry_policy: @config.rpcs.upload_queue_yaml.retry_policy
1121
+
1122
+ options.apply_defaults timeout: @config.timeout,
1123
+ metadata: @config.metadata,
1124
+ retry_policy: @config.retry_policy
1125
+
1126
+ @cloud_tasks_stub.call_rpc :upload_queue_yaml, request, options: options do |response, operation|
1127
+ yield response, operation if block_given?
1128
+ return response
1129
+ end
1130
+ rescue ::GRPC::BadStatus => e
1131
+ raise ::Google::Cloud::Error.from_error(e)
1132
+ end
1133
+
1030
1134
  ##
1031
1135
  # Gets the access control policy for a
1032
1136
  # {::Google::Cloud::Tasks::V2beta2::Queue Queue}. Returns an empty policy if the
@@ -1612,10 +1716,10 @@ module Google
1612
1716
  # that was deleted or completed recently then the call will fail
1613
1717
  # with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
1614
1718
  # If the task's queue was created using Cloud Tasks, then another task with
1615
- # the same name can't be created for ~1hour after the original task was
1719
+ # the same name can't be created for ~1 hour after the original task was
1616
1720
  # deleted or completed. If the task's queue was created using queue.yaml or
1617
1721
  # queue.xml, then another task with the same name can't be created
1618
- # for ~9days after the original task was deleted or completed.
1722
+ # for ~9 days after the original task was deleted or completed.
1619
1723
  #
1620
1724
  # Because there is an extra lookup cost to identify duplicate task
1621
1725
  # names, these {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_task CreateTask}
@@ -2446,6 +2550,115 @@ module Google
2446
2550
  raise ::Google::Cloud::Error.from_error(e)
2447
2551
  end
2448
2552
 
2553
+ ##
2554
+ # Creates and buffers a new task without the need to explicitly define a Task
2555
+ # message. The queue must have [HTTP
2556
+ # target][google.cloud.tasks.v2beta2.HttpTarget]. To create the task with a
2557
+ # custom ID, use the following format and set TASK_ID to your desired ID:
2558
+ # projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
2559
+ # To create the task with an automatically generated ID, use the following
2560
+ # format:
2561
+ # projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
2562
+ # Note: This feature is in its experimental stage. You must request access to
2563
+ # the API through the [Cloud Tasks BufferTask Experiment Signup
2564
+ # form](https://forms.gle/X8Zr5hiXH5tTGFqh8).
2565
+ #
2566
+ # @overload buffer_task(request, options = nil)
2567
+ # Pass arguments to `buffer_task` via a request object, either of type
2568
+ # {::Google::Cloud::Tasks::V2beta2::BufferTaskRequest} or an equivalent Hash.
2569
+ #
2570
+ # @param request [::Google::Cloud::Tasks::V2beta2::BufferTaskRequest, ::Hash]
2571
+ # A request object representing the call parameters. Required. To specify no
2572
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2573
+ # @param options [::Gapic::CallOptions, ::Hash]
2574
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2575
+ #
2576
+ # @overload buffer_task(queue: nil, task_id: nil, body: nil)
2577
+ # Pass arguments to `buffer_task` via keyword arguments. Note that at
2578
+ # least one keyword argument is required. To specify no parameters, or to keep all
2579
+ # the default parameter values, pass an empty Hash as a request object (see above).
2580
+ #
2581
+ # @param queue [::String]
2582
+ # Required. The parent queue name. For example:
2583
+ # projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
2584
+ #
2585
+ # The queue must already exist.
2586
+ # @param task_id [::String]
2587
+ # Optional. Task ID for the task being created. If not provided, a random
2588
+ # task ID is assigned to the task.
2589
+ # @param body [::Google::Api::HttpBody, ::Hash]
2590
+ # Optional. Body of the HTTP request.
2591
+ #
2592
+ # The body can take any generic value. The value is written to the
2593
+ # [HttpRequest][payload] of the [Task].
2594
+ #
2595
+ # @yield [response, operation] Access the result along with the RPC operation
2596
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::BufferTaskResponse]
2597
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2598
+ #
2599
+ # @return [::Google::Cloud::Tasks::V2beta2::BufferTaskResponse]
2600
+ #
2601
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2602
+ #
2603
+ # @example Basic example
2604
+ # require "google/cloud/tasks/v2beta2"
2605
+ #
2606
+ # # Create a client object. The client can be reused for multiple calls.
2607
+ # client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new
2608
+ #
2609
+ # # Create a request. To set request fields, pass in keyword arguments.
2610
+ # request = Google::Cloud::Tasks::V2beta2::BufferTaskRequest.new
2611
+ #
2612
+ # # Call the buffer_task method.
2613
+ # result = client.buffer_task request
2614
+ #
2615
+ # # The returned object is of type Google::Cloud::Tasks::V2beta2::BufferTaskResponse.
2616
+ # p result
2617
+ #
2618
+ def buffer_task request, options = nil
2619
+ raise ::ArgumentError, "request must be provided" if request.nil?
2620
+
2621
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::BufferTaskRequest
2622
+
2623
+ # Converts hash and nil to an options object
2624
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2625
+
2626
+ # Customize the options with defaults
2627
+ metadata = @config.rpcs.buffer_task.metadata.to_h
2628
+
2629
+ # Set x-goog-api-client and x-goog-user-project headers
2630
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2631
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2632
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
2633
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2634
+
2635
+ header_params = {}
2636
+ if request.queue
2637
+ header_params["queue"] = request.queue
2638
+ end
2639
+ if request.task_id
2640
+ header_params["task_id"] = request.task_id
2641
+ end
2642
+
2643
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2644
+ metadata[:"x-goog-request-params"] ||= request_params_header
2645
+
2646
+ options.apply_defaults timeout: @config.rpcs.buffer_task.timeout,
2647
+ metadata: metadata,
2648
+ retry_policy: @config.rpcs.buffer_task.retry_policy
2649
+
2650
+ options.apply_defaults timeout: @config.timeout,
2651
+ metadata: @config.metadata,
2652
+ retry_policy: @config.retry_policy
2653
+
2654
+ @cloud_tasks_stub.call_rpc :buffer_task, request, options: options do |response, operation|
2655
+ yield response, operation if block_given?
2656
+ return response
2657
+ end
2658
+ rescue ::GRPC::BadStatus => e
2659
+ raise ::Google::Cloud::Error.from_error(e)
2660
+ end
2661
+
2449
2662
  ##
2450
2663
  # Configuration class for the CloudTasks API.
2451
2664
  #
@@ -2565,6 +2778,14 @@ module Google
2565
2778
  end
2566
2779
  end
2567
2780
 
2781
+ ##
2782
+ # Configuration for the channel pool
2783
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
2784
+ #
2785
+ def channel_pool
2786
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
2787
+ end
2788
+
2568
2789
  ##
2569
2790
  # Configuration RPC class for the CloudTasks API.
2570
2791
  #
@@ -2624,6 +2845,11 @@ module Google
2624
2845
  #
2625
2846
  attr_reader :resume_queue
2626
2847
  ##
2848
+ # RPC-specific configuration for `upload_queue_yaml`
2849
+ # @return [::Gapic::Config::Method]
2850
+ #
2851
+ attr_reader :upload_queue_yaml
2852
+ ##
2627
2853
  # RPC-specific configuration for `get_iam_policy`
2628
2854
  # @return [::Gapic::Config::Method]
2629
2855
  #
@@ -2683,6 +2909,11 @@ module Google
2683
2909
  # @return [::Gapic::Config::Method]
2684
2910
  #
2685
2911
  attr_reader :run_task
2912
+ ##
2913
+ # RPC-specific configuration for `buffer_task`
2914
+ # @return [::Gapic::Config::Method]
2915
+ #
2916
+ attr_reader :buffer_task
2686
2917
 
2687
2918
  # @private
2688
2919
  def initialize parent_rpcs = nil
@@ -2702,6 +2933,8 @@ module Google
2702
2933
  @pause_queue = ::Gapic::Config::Method.new pause_queue_config
2703
2934
  resume_queue_config = parent_rpcs.resume_queue if parent_rpcs.respond_to? :resume_queue
2704
2935
  @resume_queue = ::Gapic::Config::Method.new resume_queue_config
2936
+ upload_queue_yaml_config = parent_rpcs.upload_queue_yaml if parent_rpcs.respond_to? :upload_queue_yaml
2937
+ @upload_queue_yaml = ::Gapic::Config::Method.new upload_queue_yaml_config
2705
2938
  get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
2706
2939
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
2707
2940
  set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
@@ -2726,6 +2959,8 @@ module Google
2726
2959
  @cancel_lease = ::Gapic::Config::Method.new cancel_lease_config
2727
2960
  run_task_config = parent_rpcs.run_task if parent_rpcs.respond_to? :run_task
2728
2961
  @run_task = ::Gapic::Config::Method.new run_task_config
2962
+ buffer_task_config = parent_rpcs.buffer_task if parent_rpcs.respond_to? :buffer_task
2963
+ @buffer_task = ::Gapic::Config::Method.new buffer_task_config
2729
2964
 
2730
2965
  yield self if block_given?
2731
2966
  end