|
| 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 | + |
| 15 | + |
| 16 | +require "google/cloud/tasks/v2beta3/cloud_tasks_client" |
| 17 | + |
| 18 | +module Google |
| 19 | + module Cloud |
| 20 | + module Tasks |
| 21 | + # rubocop:disable LineLength |
| 22 | + |
| 23 | + ## |
| 24 | + # # Ruby Client for Cloud Tasks API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning)) |
| 25 | + # |
| 26 | + # [Cloud Tasks API][Product Documentation]: |
| 27 | + # Manages the execution of large numbers of distributed requests. |
| 28 | + # - [Product Documentation][] |
| 29 | + # |
| 30 | + # ## Quick Start |
| 31 | + # In order to use this library, you first need to go through the following |
| 32 | + # steps: |
| 33 | + # |
| 34 | + # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) |
| 35 | + # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) |
| 36 | + # 3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/library/tasks.googleapis.com) |
| 37 | + # 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication) |
| 38 | + # |
| 39 | + # ### Installation |
| 40 | + # ``` |
| 41 | + # $ gem install google-cloud-tasks |
| 42 | + # ``` |
| 43 | + # |
| 44 | + # ### Next Steps |
| 45 | + # - Read the [Cloud Tasks API Product documentation][Product Documentation] |
| 46 | + # to learn more about the product and see How-to Guides. |
| 47 | + # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md) |
| 48 | + # to see the full list of Cloud APIs that we cover. |
| 49 | + # |
| 50 | + # [Product Documentation]: https://cloud.google.com/tasks |
| 51 | + # |
| 52 | + # ## Enabling Logging |
| 53 | + # |
| 54 | + # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. |
| 55 | + # 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, |
| 56 | + # or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger) |
| 57 | + # 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) |
| 58 | + # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information. |
| 59 | + # |
| 60 | + # Configuring a Ruby stdlib logger: |
| 61 | + # |
| 62 | + # ```ruby |
| 63 | + # require "logger" |
| 64 | + # |
| 65 | + # module MyLogger |
| 66 | + # LOGGER = Logger.new $stderr, level: Logger::WARN |
| 67 | + # def logger |
| 68 | + # LOGGER |
| 69 | + # end |
| 70 | + # end |
| 71 | + # |
| 72 | + # # Define a gRPC module-level logger method before grpc/logconfig.rb loads. |
| 73 | + # module GRPC |
| 74 | + # extend MyLogger |
| 75 | + # end |
| 76 | + # ``` |
| 77 | + # |
| 78 | + module V2beta3 |
| 79 | + # rubocop:enable LineLength |
| 80 | + |
| 81 | + ## |
| 82 | + # Cloud Tasks allows developers to manage the execution of background |
| 83 | + # work in their applications. |
| 84 | + # |
| 85 | + # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc] |
| 86 | + # Provides the means for authenticating requests made by the client. This parameter can |
| 87 | + # be many types. |
| 88 | + # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for |
| 89 | + # authenticating requests made by this client. |
| 90 | + # A `String` will be treated as the path to the keyfile to be used for the construction of |
| 91 | + # credentials for this client. |
| 92 | + # A `Hash` will be treated as the contents of a keyfile to be used for the construction of |
| 93 | + # credentials for this client. |
| 94 | + # A `GRPC::Core::Channel` will be used to make calls through. |
| 95 | + # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials |
| 96 | + # should already be composed with a `GRPC::Core::CallCredentials` object. |
| 97 | + # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the |
| 98 | + # metadata for requests, generally, to give OAuth credentials. |
| 99 | + # @param scopes [Array<String>] |
| 100 | + # The OAuth scopes for this service. This parameter is ignored if |
| 101 | + # an updater_proc is supplied. |
| 102 | + # @param client_config [Hash] |
| 103 | + # A Hash for call options for each method. See |
| 104 | + # Google::Gax#construct_settings for the structure of |
| 105 | + # this data. Falls back to the default config if not specified |
| 106 | + # or the specified config is missing data points. |
| 107 | + # @param timeout [Numeric] |
| 108 | + # The default timeout, in seconds, for calls made through this client. |
| 109 | + # @param metadata [Hash] |
| 110 | + # Default metadata to be sent with each request. This can be overridden on a per call basis. |
| 111 | + # @param exception_transformer [Proc] |
| 112 | + # An optional proc that intercepts any exceptions raised during an API call to inject |
| 113 | + # custom error handling. |
| 114 | + def self.new \ |
| 115 | + credentials: nil, |
| 116 | + scopes: nil, |
| 117 | + client_config: nil, |
| 118 | + timeout: nil, |
| 119 | + metadata: nil, |
| 120 | + exception_transformer: nil, |
| 121 | + lib_name: nil, |
| 122 | + lib_version: nil |
| 123 | + kwargs = { |
| 124 | + credentials: credentials, |
| 125 | + scopes: scopes, |
| 126 | + client_config: client_config, |
| 127 | + timeout: timeout, |
| 128 | + metadata: metadata, |
| 129 | + exception_transformer: exception_transformer, |
| 130 | + lib_name: lib_name, |
| 131 | + lib_version: lib_version |
| 132 | + }.select { |_, v| v != nil } |
| 133 | + Google::Cloud::Tasks::V2beta3::CloudTasksClient.new(**kwargs) |
| 134 | + end |
| 135 | + end |
| 136 | + end |
| 137 | + end |
| 138 | +end |
0 commit comments