google-cloud-tasks 0.5.0 → 0.6.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 (26) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/tasks/v2/cloud_tasks_client.rb +1254 -0
  4. data/lib/google/cloud/tasks/v2/cloud_tasks_client_config.json +106 -0
  5. data/lib/google/cloud/tasks/v2/cloudtasks_pb.rb +99 -0
  6. data/lib/google/cloud/tasks/v2/cloudtasks_services_pb.rb +200 -0
  7. data/lib/google/cloud/tasks/v2/credentials.rb +41 -0
  8. data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/cloudtasks.rb +340 -0
  9. data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/queue.rb +333 -0
  10. data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/target.rb +270 -0
  11. data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/task.rb +170 -0
  12. data/lib/google/cloud/tasks/v2/doc/google/iam/v1/iam_policy.rb +63 -0
  13. data/lib/google/cloud/tasks/v2/doc/google/iam/v1/policy.rb +104 -0
  14. data/lib/google/cloud/tasks/v2/doc/google/protobuf/any.rb +130 -0
  15. data/lib/google/cloud/tasks/v2/doc/google/protobuf/duration.rb +91 -0
  16. data/lib/google/cloud/tasks/v2/doc/google/protobuf/empty.rb +29 -0
  17. data/lib/google/cloud/tasks/v2/doc/google/protobuf/field_mask.rb +230 -0
  18. data/lib/google/cloud/tasks/v2/doc/google/protobuf/timestamp.rb +109 -0
  19. data/lib/google/cloud/tasks/v2/doc/google/rpc/status.rb +87 -0
  20. data/lib/google/cloud/tasks/v2/helpers.rb +56 -0
  21. data/lib/google/cloud/tasks/v2/queue_pb.rb +51 -0
  22. data/lib/google/cloud/tasks/v2/target_pb.rb +44 -0
  23. data/lib/google/cloud/tasks/v2/task_pb.rb +50 -0
  24. data/lib/google/cloud/tasks/v2.rb +139 -0
  25. data/lib/google/cloud/tasks.rb +2 -2
  26. metadata +24 -2
@@ -0,0 +1,109 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Protobuf
18
+ # A Timestamp represents a point in time independent of any time zone
19
+ # or calendar, represented as seconds and fractions of seconds at
20
+ # nanosecond resolution in UTC Epoch time. It is encoded using the
21
+ # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
+ # backwards to year one. It is encoded assuming all minutes are 60
23
+ # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
+ # table is needed for interpretation. Range is from
25
+ # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
+ # By restricting to that range, we ensure that we can convert to
27
+ # and from RFC 3339 date strings.
28
+ # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
29
+ #
30
+ # = Examples
31
+ #
32
+ # Example 1: Compute Timestamp from POSIX `time()`.
33
+ #
34
+ # Timestamp timestamp;
35
+ # timestamp.set_seconds(time(NULL));
36
+ # timestamp.set_nanos(0);
37
+ #
38
+ # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
39
+ #
40
+ # struct timeval tv;
41
+ # gettimeofday(&tv, NULL);
42
+ #
43
+ # Timestamp timestamp;
44
+ # timestamp.set_seconds(tv.tv_sec);
45
+ # timestamp.set_nanos(tv.tv_usec * 1000);
46
+ #
47
+ # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
48
+ #
49
+ # FILETIME ft;
50
+ # GetSystemTimeAsFileTime(&ft);
51
+ # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
52
+ #
53
+ # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
54
+ # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
55
+ # Timestamp timestamp;
56
+ # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
57
+ # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
58
+ #
59
+ # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
60
+ #
61
+ # long millis = System.currentTimeMillis();
62
+ #
63
+ # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
64
+ # .setNanos((int) ((millis % 1000) * 1000000)).build();
65
+ #
66
+ #
67
+ # Example 5: Compute Timestamp from current time in Python.
68
+ #
69
+ # timestamp = Timestamp()
70
+ # timestamp.GetCurrentTime()
71
+ #
72
+ # = JSON Mapping
73
+ #
74
+ # In JSON format, the Timestamp type is encoded as a string in the
75
+ # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
76
+ # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
77
+ # where \\{year} is always expressed using four digits while \\{month}, \\{day},
78
+ # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
79
+ # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
80
+ # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
81
+ # is required. A proto3 JSON serializer should always use UTC (as indicated by
82
+ # "Z") when printing the Timestamp type and a proto3 JSON parser should be
83
+ # able to accept both UTC and other timezones (as indicated by an offset).
84
+ #
85
+ # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
86
+ # 01:30 UTC on January 15, 2017.
87
+ #
88
+ # In JavaScript, one can convert a Date object to this format using the
89
+ # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
90
+ # method. In Python, a standard `datetime.datetime` object can be converted
91
+ # to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
92
+ # with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
93
+ # can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
94
+ # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
95
+ # ) to obtain a formatter capable of generating timestamps in this format.
96
+ # @!attribute [rw] seconds
97
+ # @return [Integer]
98
+ # Represents seconds of UTC time since Unix epoch
99
+ # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
100
+ # 9999-12-31T23:59:59Z inclusive.
101
+ # @!attribute [rw] nanos
102
+ # @return [Integer]
103
+ # Non-negative fractions of a second at nanosecond resolution. Negative
104
+ # second values with fractions must still have non-negative nanos values
105
+ # that count forward in time. Must be from 0 to 999,999,999
106
+ # inclusive.
107
+ class Timestamp; end
108
+ end
109
+ end
@@ -0,0 +1,87 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Rpc
18
+ # The `Status` type defines a logical error model that is suitable for
19
+ # different programming environments, including REST APIs and RPC APIs. It is
20
+ # used by [gRPC](https://github.com/grpc). The error model is designed to be:
21
+ #
22
+ # * Simple to use and understand for most users
23
+ # * Flexible enough to meet unexpected needs
24
+ #
25
+ # = Overview
26
+ #
27
+ # The `Status` message contains three pieces of data: error code, error
28
+ # message, and error details. The error code should be an enum value of
29
+ # {Google::Rpc::Code}, but it may accept additional error codes
30
+ # if needed. The error message should be a developer-facing English message
31
+ # that helps developers *understand* and *resolve* the error. If a localized
32
+ # user-facing error message is needed, put the localized message in the error
33
+ # details or localize it in the client. The optional error details may contain
34
+ # arbitrary information about the error. There is a predefined set of error
35
+ # detail types in the package `google.rpc` that can be used for common error
36
+ # conditions.
37
+ #
38
+ # = Language mapping
39
+ #
40
+ # The `Status` message is the logical representation of the error model, but it
41
+ # is not necessarily the actual wire format. When the `Status` message is
42
+ # exposed in different client libraries and different wire protocols, it can be
43
+ # mapped differently. For example, it will likely be mapped to some exceptions
44
+ # in Java, but more likely mapped to some error codes in C.
45
+ #
46
+ # = Other uses
47
+ #
48
+ # The error model and the `Status` message can be used in a variety of
49
+ # environments, either with or without APIs, to provide a
50
+ # consistent developer experience across different environments.
51
+ #
52
+ # Example uses of this error model include:
53
+ #
54
+ # * Partial errors. If a service needs to return partial errors to the client,
55
+ # it may embed the `Status` in the normal response to indicate the partial
56
+ # errors.
57
+ #
58
+ # * Workflow errors. A typical workflow has multiple steps. Each step may
59
+ # have a `Status` message for error reporting.
60
+ #
61
+ # * Batch operations. If a client uses batch request and batch response, the
62
+ # `Status` message should be used directly inside batch response, one for
63
+ # each error sub-response.
64
+ #
65
+ # * Asynchronous operations. If an API call embeds asynchronous operation
66
+ # results in its response, the status of those operations should be
67
+ # represented directly using the `Status` message.
68
+ #
69
+ # * Logging. If some API errors are stored in logs, the message `Status` could
70
+ # be used directly after any stripping needed for security/privacy reasons.
71
+ # @!attribute [rw] code
72
+ # @return [Integer]
73
+ # The status code, which should be an enum value of
74
+ # {Google::Rpc::Code}.
75
+ # @!attribute [rw] message
76
+ # @return [String]
77
+ # A developer-facing error message, which should be in English. Any
78
+ # user-facing error message should be localized and sent in the
79
+ # {Google::Rpc::Status#details} field, or localized
80
+ # by the client.
81
+ # @!attribute [rw] details
82
+ # @return [Array<Google::Protobuf::Any>]
83
+ # A list of messages that carry the error details. There is a common set of
84
+ # message types for APIs to use.
85
+ class Status; end
86
+ end
87
+ end
@@ -0,0 +1,56 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # # limitations under the License.
14
+ module Google
15
+ module Cloud
16
+ module Tasks
17
+ module V2
18
+ class CloudTasksClient
19
+ # Alias for Google::Cloud::Tasks::V2::CloudTasksClient.location_path.
20
+ # @param project [String]
21
+ # @param location [String]
22
+ # @return [String]
23
+ def location_path project, location
24
+ self.class.location_path project, location
25
+ end
26
+
27
+ # Alias for Google::Cloud::Tasks::V2::CloudTasksClient.project_path.
28
+ # @param project [String]
29
+ # @return [String]
30
+ def project_path project
31
+ self.class.project_path project
32
+ end
33
+
34
+ # Alias for Google::Cloud::Tasks::V2::CloudTasksClient.queue_path.
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param queue [String]
38
+ # @return [String]
39
+ def queue_path project, location, queue
40
+ self.class.queue_path project, location, queue
41
+ end
42
+
43
+ # Alias for Google::Cloud::Tasks::V2::CloudTasksClient.task_path.
44
+ # @param project [String]
45
+ # @param location [String]
46
+ # @param queue [String]
47
+ # @param task [String]
48
+ # @return [String]
49
+ def task_path project, location, queue, task
50
+ self.class.task_path project, location, queue, task
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,51 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/tasks/v2/queue.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ require 'google/cloud/tasks/v2/target_pb'
9
+ require 'google/protobuf/duration_pb'
10
+ require 'google/protobuf/timestamp_pb'
11
+ Google::Protobuf::DescriptorPool.generated_pool.build do
12
+ add_message "google.cloud.tasks.v2.Queue" do
13
+ optional :name, :string, 1
14
+ optional :app_engine_routing_override, :message, 2, "google.cloud.tasks.v2.AppEngineRouting"
15
+ optional :rate_limits, :message, 3, "google.cloud.tasks.v2.RateLimits"
16
+ optional :retry_config, :message, 4, "google.cloud.tasks.v2.RetryConfig"
17
+ optional :state, :enum, 5, "google.cloud.tasks.v2.Queue.State"
18
+ optional :purge_time, :message, 6, "google.protobuf.Timestamp"
19
+ end
20
+ add_enum "google.cloud.tasks.v2.Queue.State" do
21
+ value :STATE_UNSPECIFIED, 0
22
+ value :RUNNING, 1
23
+ value :PAUSED, 2
24
+ value :DISABLED, 3
25
+ end
26
+ add_message "google.cloud.tasks.v2.RateLimits" do
27
+ optional :max_dispatches_per_second, :double, 1
28
+ optional :max_burst_size, :int32, 2
29
+ optional :max_concurrent_dispatches, :int32, 3
30
+ end
31
+ add_message "google.cloud.tasks.v2.RetryConfig" do
32
+ optional :max_attempts, :int32, 1
33
+ optional :max_retry_duration, :message, 2, "google.protobuf.Duration"
34
+ optional :min_backoff, :message, 3, "google.protobuf.Duration"
35
+ optional :max_backoff, :message, 4, "google.protobuf.Duration"
36
+ optional :max_doublings, :int32, 5
37
+ end
38
+ end
39
+
40
+ module Google
41
+ module Cloud
42
+ module Tasks
43
+ module V2
44
+ Queue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.Queue").msgclass
45
+ Queue::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.Queue.State").enummodule
46
+ RateLimits = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.RateLimits").msgclass
47
+ RetryConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.RetryConfig").msgclass
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,44 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/tasks/v2/target.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_message "google.cloud.tasks.v2.AppEngineHttpRequest" do
10
+ optional :http_method, :enum, 1, "google.cloud.tasks.v2.HttpMethod"
11
+ optional :app_engine_routing, :message, 2, "google.cloud.tasks.v2.AppEngineRouting"
12
+ optional :relative_uri, :string, 3
13
+ map :headers, :string, :string, 4
14
+ optional :body, :bytes, 5
15
+ end
16
+ add_message "google.cloud.tasks.v2.AppEngineRouting" do
17
+ optional :service, :string, 1
18
+ optional :version, :string, 2
19
+ optional :instance, :string, 3
20
+ optional :host, :string, 4
21
+ end
22
+ add_enum "google.cloud.tasks.v2.HttpMethod" do
23
+ value :HTTP_METHOD_UNSPECIFIED, 0
24
+ value :POST, 1
25
+ value :GET, 2
26
+ value :HEAD, 3
27
+ value :PUT, 4
28
+ value :DELETE, 5
29
+ value :PATCH, 6
30
+ value :OPTIONS, 7
31
+ end
32
+ end
33
+
34
+ module Google
35
+ module Cloud
36
+ module Tasks
37
+ module V2
38
+ AppEngineHttpRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.AppEngineHttpRequest").msgclass
39
+ AppEngineRouting = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.AppEngineRouting").msgclass
40
+ HttpMethod = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.HttpMethod").enummodule
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,50 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/tasks/v2/task.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ require 'google/cloud/tasks/v2/target_pb'
9
+ require 'google/protobuf/duration_pb'
10
+ require 'google/protobuf/timestamp_pb'
11
+ require 'google/rpc/status_pb'
12
+ Google::Protobuf::DescriptorPool.generated_pool.build do
13
+ add_message "google.cloud.tasks.v2.Task" do
14
+ optional :name, :string, 1
15
+ optional :schedule_time, :message, 4, "google.protobuf.Timestamp"
16
+ optional :create_time, :message, 5, "google.protobuf.Timestamp"
17
+ optional :dispatch_deadline, :message, 6, "google.protobuf.Duration"
18
+ optional :dispatch_count, :int32, 7
19
+ optional :response_count, :int32, 8
20
+ optional :first_attempt, :message, 9, "google.cloud.tasks.v2.Attempt"
21
+ optional :last_attempt, :message, 10, "google.cloud.tasks.v2.Attempt"
22
+ optional :view, :enum, 11, "google.cloud.tasks.v2.Task.View"
23
+ oneof :message_type do
24
+ optional :app_engine_http_request, :message, 2, "google.cloud.tasks.v2.AppEngineHttpRequest"
25
+ end
26
+ end
27
+ add_enum "google.cloud.tasks.v2.Task.View" do
28
+ value :VIEW_UNSPECIFIED, 0
29
+ value :BASIC, 1
30
+ value :FULL, 2
31
+ end
32
+ add_message "google.cloud.tasks.v2.Attempt" do
33
+ optional :schedule_time, :message, 1, "google.protobuf.Timestamp"
34
+ optional :dispatch_time, :message, 2, "google.protobuf.Timestamp"
35
+ optional :response_time, :message, 3, "google.protobuf.Timestamp"
36
+ optional :response_status, :message, 4, "google.rpc.Status"
37
+ end
38
+ end
39
+
40
+ module Google
41
+ module Cloud
42
+ module Tasks
43
+ module V2
44
+ Task = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.Task").msgclass
45
+ Task::View = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.Task.View").enummodule
46
+ Attempt = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.tasks.v2.Attempt").msgclass
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,139 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "google/cloud/tasks/v2/cloud_tasks_client"
17
+ require "google/cloud/tasks/v2/helpers"
18
+
19
+ module Google
20
+ module Cloud
21
+ module Tasks
22
+ # rubocop:disable LineLength
23
+
24
+ ##
25
+ # # Ruby Client for Cloud Tasks API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
26
+ #
27
+ # [Cloud Tasks API][Product Documentation]:
28
+ # Manages the execution of large numbers of distributed requests.
29
+ # - [Product Documentation][]
30
+ #
31
+ # ## Quick Start
32
+ # In order to use this library, you first need to go through the following
33
+ # steps:
34
+ #
35
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
+ # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
+ # 3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/library/tasks.googleapis.com)
38
+ # 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
39
+ #
40
+ # ### Installation
41
+ # ```
42
+ # $ gem install google-cloud-tasks
43
+ # ```
44
+ #
45
+ # ### Next Steps
46
+ # - Read the [Cloud Tasks API Product documentation][Product Documentation]
47
+ # to learn more about the product and see How-to Guides.
48
+ # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
49
+ # to see the full list of Cloud APIs that we cover.
50
+ #
51
+ # [Product Documentation]: https://cloud.google.com/tasks
52
+ #
53
+ # ## Enabling Logging
54
+ #
55
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
56
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
57
+ # or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
58
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
59
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
60
+ #
61
+ # Configuring a Ruby stdlib logger:
62
+ #
63
+ # ```ruby
64
+ # require "logger"
65
+ #
66
+ # module MyLogger
67
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
68
+ # def logger
69
+ # LOGGER
70
+ # end
71
+ # end
72
+ #
73
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
74
+ # module GRPC
75
+ # extend MyLogger
76
+ # end
77
+ # ```
78
+ #
79
+ module V2
80
+ # rubocop:enable LineLength
81
+
82
+ ##
83
+ # Cloud Tasks allows developers to manage the execution of background
84
+ # work in their applications.
85
+ #
86
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
87
+ # Provides the means for authenticating requests made by the client. This parameter can
88
+ # be many types.
89
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
90
+ # authenticating requests made by this client.
91
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
92
+ # credentials for this client.
93
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
94
+ # credentials for this client.
95
+ # A `GRPC::Core::Channel` will be used to make calls through.
96
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
97
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
98
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
99
+ # metadata for requests, generally, to give OAuth credentials.
100
+ # @param scopes [Array<String>]
101
+ # The OAuth scopes for this service. This parameter is ignored if
102
+ # an updater_proc is supplied.
103
+ # @param client_config [Hash]
104
+ # A Hash for call options for each method. See
105
+ # Google::Gax#construct_settings for the structure of
106
+ # this data. Falls back to the default config if not specified
107
+ # or the specified config is missing data points.
108
+ # @param timeout [Numeric]
109
+ # The default timeout, in seconds, for calls made through this client.
110
+ # @param metadata [Hash]
111
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
112
+ # @param exception_transformer [Proc]
113
+ # An optional proc that intercepts any exceptions raised during an API call to inject
114
+ # custom error handling.
115
+ def self.new \
116
+ credentials: nil,
117
+ scopes: nil,
118
+ client_config: nil,
119
+ timeout: nil,
120
+ metadata: nil,
121
+ exception_transformer: nil,
122
+ lib_name: nil,
123
+ lib_version: nil
124
+ kwargs = {
125
+ credentials: credentials,
126
+ scopes: scopes,
127
+ client_config: client_config,
128
+ timeout: timeout,
129
+ metadata: metadata,
130
+ exception_transformer: exception_transformer,
131
+ lib_name: lib_name,
132
+ lib_version: lib_version
133
+ }.select { |_, v| v != nil }
134
+ Google::Cloud::Tasks::V2::CloudTasksClient.new(**kwargs)
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end