# frozen_string_literal: true

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!

require "google/cloud/errors"
require "google/cloud/eventarc/v1/eventarc_pb"
require "google/cloud/eventarc/v1/eventarc/rest/service_stub"
require "google/cloud/location/rest"
require "google/iam/v1/rest"

module Google
  module Cloud
    module Eventarc
      module V1
        module Eventarc
          module Rest
            ##
            # REST client for the Eventarc service.
            #
            # Eventarc allows users to subscribe to various events that are provided by
            # Google Cloud services and forward them to supported destinations.
            #
            class Client
              include Paths

              # @private
              attr_reader :eventarc_stub

              ##
              # Configure the Eventarc Client class.
              #
              # See {::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client::Configuration}
              # for a description of the configuration fields.
              #
              # @example
              #
              #   # Modify the configuration for all Eventarc clients
              #   ::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client.configure do |config|
              #     config.timeout = 10.0
              #   end
              #
              # @yield [config] Configure the Client client.
              # @yieldparam config [Client::Configuration]
              #
              # @return [Client::Configuration]
              #
              def self.configure
                @configure ||= begin
                  namespace = ["Google", "Cloud", "Eventarc", "V1"]
                  parent_config = while namespace.any?
                                    parent_name = namespace.join "::"
                                    parent_const = const_get parent_name
                                    break parent_const.configure if parent_const.respond_to? :configure
                                    namespace.pop
                                  end
                  default_config = Client::Configuration.new parent_config

                  default_config
                end
                yield @configure if block_given?
                @configure
              end

              ##
              # Configure the Eventarc Client instance.
              #
              # The configuration is set to the derived mode, meaning that values can be changed,
              # but structural changes (adding new fields, etc.) are not allowed. Structural changes
              # should be made on {Client.configure}.
              #
              # See {::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client::Configuration}
              # for a description of the configuration fields.
              #
              # @yield [config] Configure the Client client.
              # @yieldparam config [Client::Configuration]
              #
              # @return [Client::Configuration]
              #
              def configure
                yield @config if block_given?
                @config
              end

              ##
              # Create a new Eventarc REST client object.
              #
              # @example
              #
              #   # Create a client using the default configuration
              #   client = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client.new
              #
              #   # Create a client using a custom configuration
              #   client = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client.new do |config|
              #     config.timeout = 10.0
              #   end
              #
              # @yield [config] Configure the Eventarc client.
              # @yieldparam config [Client::Configuration]
              #
              def initialize
                # Create the configuration object
                @config = Configuration.new Client.configure

                # Yield the configuration if needed
                yield @config if block_given?

                # Create credentials
                credentials = @config.credentials
                # Use self-signed JWT if the endpoint is unchanged from default,
                # but only if the default endpoint does not have a region prefix.
                enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                                         !@config.endpoint.split(".").first.include?("-")
                credentials ||= Credentials.default scope: @config.scope,
                                                    enable_self_signed_jwt: enable_self_signed_jwt
                if credentials.is_a?(::String) || credentials.is_a?(::Hash)
                  credentials = Credentials.new credentials, scope: @config.scope
                end

                @quota_project_id = @config.quota_project
                @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

                @operations_client = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::Operations.new do |config|
                  config.credentials = credentials
                  config.quota_project = @quota_project_id
                  config.endpoint = @config.endpoint
                end

                @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
                  config.credentials = credentials
                  config.quota_project = @quota_project_id
                  config.endpoint = @config.endpoint
                  config.bindings_override = @config.bindings_override
                end

                @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
                  config.credentials = credentials
                  config.quota_project = @quota_project_id
                  config.endpoint = @config.endpoint
                  config.bindings_override = @config.bindings_override
                end

                @eventarc_stub = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
              end

              ##
              # Get the associated client for long-running operations.
              #
              # @return [::Google::Cloud::Eventarc::V1::Eventarc::Rest::Operations]
              #
              attr_reader :operations_client

              ##
              # Get the associated client for mix-in of the Locations.
              #
              # @return [Google::Cloud::Location::Locations::Rest::Client]
              #
              attr_reader :location_client

              ##
              # Get the associated client for mix-in of the IAMPolicy.
              #
              # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
              #
              attr_reader :iam_policy_client

              # Service calls

              ##
              # Get a single trigger.
              #
              # @overload get_trigger(request, options = nil)
              #   Pass arguments to `get_trigger` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::GetTriggerRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::GetTriggerRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload get_trigger(name: nil)
              #   Pass arguments to `get_trigger` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the trigger to get.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::Trigger]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::Trigger]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def get_trigger request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::GetTriggerRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.get_trigger.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.get_trigger.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.get_trigger.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.get_trigger request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # List triggers.
              #
              # @overload list_triggers(request, options = nil)
              #   Pass arguments to `list_triggers` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::ListTriggersRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::ListTriggersRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload list_triggers(parent: nil, page_size: nil, page_token: nil, order_by: nil, filter: nil)
              #   Pass arguments to `list_triggers` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent collection to list triggers on.
              #   @param page_size [::Integer]
              #     The maximum number of triggers to return on each page.
              #
              #     Note: The service may send fewer.
              #   @param page_token [::String]
              #     The page token; provide the value from the `next_page_token` field in a
              #     previous `ListTriggers` call to retrieve the subsequent page.
              #
              #     When paginating, all other parameters provided to `ListTriggers` must match
              #     the call that provided the page token.
              #   @param order_by [::String]
              #     The sorting order of the resources returned. Value should be a
              #     comma-separated list of fields. The default sorting order is ascending. To
              #     specify descending order for a field, append a `desc` suffix; for example:
              #     `name desc, trigger_id`.
              #   @param filter [::String]
              #     Filter field. Used to filter the Triggers to be listed. Possible filters
              #     are described in https://google.aip.dev/160. For example, using
              #     "?filter=destination:gke" would list only Triggers with a gke destination.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::ListTriggersResponse]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::ListTriggersResponse]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def list_triggers request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::ListTriggersRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.list_triggers.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.list_triggers.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.list_triggers.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.list_triggers request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Create a new trigger in a particular project and location.
              #
              # @overload create_trigger(request, options = nil)
              #   Pass arguments to `create_trigger` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::CreateTriggerRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::CreateTriggerRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload create_trigger(parent: nil, trigger: nil, trigger_id: nil, validate_only: nil)
              #   Pass arguments to `create_trigger` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent collection in which to add this trigger.
              #   @param trigger [::Google::Cloud::Eventarc::V1::Trigger, ::Hash]
              #     Required. The trigger to create.
              #   @param trigger_id [::String]
              #     Required. The user-provided ID to be assigned to the trigger.
              #   @param validate_only [::Boolean]
              #     Required. If set, validate the request and preview the review, but do not
              #     post it.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def create_trigger request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::CreateTriggerRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.create_trigger.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.create_trigger.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.create_trigger.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.create_trigger request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Update a single trigger.
              #
              # @overload update_trigger(request, options = nil)
              #   Pass arguments to `update_trigger` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::UpdateTriggerRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::UpdateTriggerRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload update_trigger(trigger: nil, update_mask: nil, allow_missing: nil, validate_only: nil)
              #   Pass arguments to `update_trigger` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param trigger [::Google::Cloud::Eventarc::V1::Trigger, ::Hash]
              #     The trigger to be updated.
              #   @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
              #     The fields to be updated; only fields explicitly provided are updated.
              #     If no field mask is provided, all provided fields in the request are
              #     updated. To update all fields, provide a field mask of "*".
              #   @param allow_missing [::Boolean]
              #     If set to true, and the trigger is not found, a new trigger will be
              #     created. In this situation, `update_mask` is ignored.
              #   @param validate_only [::Boolean]
              #     Required. If set, validate the request and preview the review, but do not
              #     post it.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def update_trigger request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::UpdateTriggerRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.update_trigger.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.update_trigger.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.update_trigger.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.update_trigger request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Delete a single trigger.
              #
              # @overload delete_trigger(request, options = nil)
              #   Pass arguments to `delete_trigger` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::DeleteTriggerRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::DeleteTriggerRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload delete_trigger(name: nil, etag: nil, allow_missing: nil, validate_only: nil)
              #   Pass arguments to `delete_trigger` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the trigger to be deleted.
              #   @param etag [::String]
              #     If provided, the trigger will only be deleted if the etag matches the
              #     current etag on the resource.
              #   @param allow_missing [::Boolean]
              #     If set to true, and the trigger is not found, the request will succeed
              #     but no action will be taken on the server.
              #   @param validate_only [::Boolean]
              #     Required. If set, validate the request and preview the review, but do not
              #     post it.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def delete_trigger request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::DeleteTriggerRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.delete_trigger.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.delete_trigger.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.delete_trigger.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.delete_trigger request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Get a single Channel.
              #
              # @overload get_channel(request, options = nil)
              #   Pass arguments to `get_channel` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::GetChannelRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::GetChannelRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload get_channel(name: nil)
              #   Pass arguments to `get_channel` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the channel to get.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::Channel]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::Channel]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def get_channel request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::GetChannelRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.get_channel.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.get_channel.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.get_channel.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.get_channel request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # List channels.
              #
              # @overload list_channels(request, options = nil)
              #   Pass arguments to `list_channels` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::ListChannelsRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::ListChannelsRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload list_channels(parent: nil, page_size: nil, page_token: nil, order_by: nil)
              #   Pass arguments to `list_channels` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent collection to list channels on.
              #   @param page_size [::Integer]
              #     The maximum number of channels to return on each page.
              #
              #     Note: The service may send fewer.
              #   @param page_token [::String]
              #     The page token; provide the value from the `next_page_token` field in a
              #     previous `ListChannels` call to retrieve the subsequent page.
              #
              #     When paginating, all other parameters provided to `ListChannels` must
              #     match the call that provided the page token.
              #   @param order_by [::String]
              #     The sorting order of the resources returned. Value should be a
              #     comma-separated list of fields. The default sorting order is ascending. To
              #     specify descending order for a field, append a `desc` suffix; for example:
              #     `name desc, channel_id`.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::ListChannelsResponse]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::ListChannelsResponse]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def list_channels request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::ListChannelsRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.list_channels.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.list_channels.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.list_channels.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.list_channels request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Create a new channel in a particular project and location.
              #
              # @overload create_channel(request, options = nil)
              #   Pass arguments to `create_channel` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::CreateChannelRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::CreateChannelRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload create_channel(parent: nil, channel: nil, channel_id: nil, validate_only: nil)
              #   Pass arguments to `create_channel` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent collection in which to add this channel.
              #   @param channel [::Google::Cloud::Eventarc::V1::Channel, ::Hash]
              #     Required. The channel to create.
              #   @param channel_id [::String]
              #     Required. The user-provided ID to be assigned to the channel.
              #   @param validate_only [::Boolean]
              #     Required. If set, validate the request and preview the review, but do not
              #     post it.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def create_channel request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::CreateChannelRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.create_channel.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.create_channel.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.create_channel.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.create_channel request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Update a single channel.
              #
              # @overload update_channel(request, options = nil)
              #   Pass arguments to `update_channel` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::UpdateChannelRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::UpdateChannelRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload update_channel(channel: nil, update_mask: nil, validate_only: nil)
              #   Pass arguments to `update_channel` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param channel [::Google::Cloud::Eventarc::V1::Channel, ::Hash]
              #     The channel to be updated.
              #   @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
              #     The fields to be updated; only fields explicitly provided are updated.
              #     If no field mask is provided, all provided fields in the request are
              #     updated. To update all fields, provide a field mask of "*".
              #   @param validate_only [::Boolean]
              #     Required. If set, validate the request and preview the review, but do not
              #     post it.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def update_channel request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::UpdateChannelRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.update_channel.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.update_channel.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.update_channel.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.update_channel request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Delete a single channel.
              #
              # @overload delete_channel(request, options = nil)
              #   Pass arguments to `delete_channel` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::DeleteChannelRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::DeleteChannelRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload delete_channel(name: nil, validate_only: nil)
              #   Pass arguments to `delete_channel` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the channel to be deleted.
              #   @param validate_only [::Boolean]
              #     Required. If set, validate the request and preview the review, but do not
              #     post it.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def delete_channel request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::DeleteChannelRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.delete_channel.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.delete_channel.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.delete_channel.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.delete_channel request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Get a single Provider.
              #
              # @overload get_provider(request, options = nil)
              #   Pass arguments to `get_provider` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::GetProviderRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::GetProviderRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload get_provider(name: nil)
              #   Pass arguments to `get_provider` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the provider to get.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::Provider]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::Provider]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def get_provider request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::GetProviderRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.get_provider.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.get_provider.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.get_provider.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.get_provider request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # List providers.
              #
              # @overload list_providers(request, options = nil)
              #   Pass arguments to `list_providers` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::ListProvidersRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::ListProvidersRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload list_providers(parent: nil, page_size: nil, page_token: nil, order_by: nil, filter: nil)
              #   Pass arguments to `list_providers` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent of the provider to get.
              #   @param page_size [::Integer]
              #     The maximum number of providers to return on each page.
              #   @param page_token [::String]
              #     The page token; provide the value from the `next_page_token` field in a
              #     previous `ListProviders` call to retrieve the subsequent page.
              #
              #     When paginating, all other parameters provided to `ListProviders` must
              #     match the call that provided the page token.
              #   @param order_by [::String]
              #     The sorting order of the resources returned. Value should be a
              #     comma-separated list of fields. The default sorting oder is ascending. To
              #     specify descending order for a field, append a `desc` suffix; for example:
              #     `name desc, _id`.
              #   @param filter [::String]
              #     The filter field that the list request will filter on.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::ListProvidersResponse]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::ListProvidersResponse]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def list_providers request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::ListProvidersRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.list_providers.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.list_providers.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.list_providers.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.list_providers request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Get a single ChannelConnection.
              #
              # @overload get_channel_connection(request, options = nil)
              #   Pass arguments to `get_channel_connection` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::GetChannelConnectionRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::GetChannelConnectionRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload get_channel_connection(name: nil)
              #   Pass arguments to `get_channel_connection` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the channel connection to get.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::ChannelConnection]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::ChannelConnection]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def get_channel_connection request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::GetChannelConnectionRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.get_channel_connection.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.get_channel_connection.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.get_channel_connection.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.get_channel_connection request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # List channel connections.
              #
              # @overload list_channel_connections(request, options = nil)
              #   Pass arguments to `list_channel_connections` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::ListChannelConnectionsRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::ListChannelConnectionsRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload list_channel_connections(parent: nil, page_size: nil, page_token: nil)
              #   Pass arguments to `list_channel_connections` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent collection from which to list channel connections.
              #   @param page_size [::Integer]
              #     The maximum number of channel connections to return on each page.
              #
              #     Note: The service may send fewer responses.
              #   @param page_token [::String]
              #     The page token; provide the value from the `next_page_token` field in a
              #     previous `ListChannelConnections` call to retrieve the subsequent page.
              #
              #     When paginating, all other parameters provided to `ListChannelConnetions`
              #     match the call that provided the page token.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::ListChannelConnectionsResponse]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::ListChannelConnectionsResponse]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def list_channel_connections request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::ListChannelConnectionsRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.list_channel_connections.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.list_channel_connections.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.list_channel_connections.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.list_channel_connections request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Create a new ChannelConnection in a particular project and location.
              #
              # @overload create_channel_connection(request, options = nil)
              #   Pass arguments to `create_channel_connection` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::CreateChannelConnectionRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::CreateChannelConnectionRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload create_channel_connection(parent: nil, channel_connection: nil, channel_connection_id: nil)
              #   Pass arguments to `create_channel_connection` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param parent [::String]
              #     Required. The parent collection in which to add this channel connection.
              #   @param channel_connection [::Google::Cloud::Eventarc::V1::ChannelConnection, ::Hash]
              #     Required. Channel connection to create.
              #   @param channel_connection_id [::String]
              #     Required. The user-provided ID to be assigned to the channel connection.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def create_channel_connection request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::CreateChannelConnectionRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.create_channel_connection.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.create_channel_connection.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.create_channel_connection.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.create_channel_connection request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Delete a single ChannelConnection.
              #
              # @overload delete_channel_connection(request, options = nil)
              #   Pass arguments to `delete_channel_connection` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::DeleteChannelConnectionRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::DeleteChannelConnectionRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload delete_channel_connection(name: nil)
              #   Pass arguments to `delete_channel_connection` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the channel connection to delete.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Gapic::Operation]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Gapic::Operation]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def delete_channel_connection request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::DeleteChannelConnectionRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.delete_channel_connection.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.delete_channel_connection.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.delete_channel_connection.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.delete_channel_connection request, options do |result, operation|
                  result = ::Gapic::Operation.new result, @operations_client, options: options
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Get a GoogleChannelConfig
              #
              # @overload get_google_channel_config(request, options = nil)
              #   Pass arguments to `get_google_channel_config` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::GetGoogleChannelConfigRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::GetGoogleChannelConfigRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload get_google_channel_config(name: nil)
              #   Pass arguments to `get_google_channel_config` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param name [::String]
              #     Required. The name of the config to get.
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::GoogleChannelConfig]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::GoogleChannelConfig]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def get_google_channel_config request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::GetGoogleChannelConfigRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.get_google_channel_config.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.get_google_channel_config.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.get_google_channel_config.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.get_google_channel_config request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Update a single GoogleChannelConfig
              #
              # @overload update_google_channel_config(request, options = nil)
              #   Pass arguments to `update_google_channel_config` via a request object, either of type
              #   {::Google::Cloud::Eventarc::V1::UpdateGoogleChannelConfigRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Cloud::Eventarc::V1::UpdateGoogleChannelConfigRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
              #
              # @overload update_google_channel_config(google_channel_config: nil, update_mask: nil)
              #   Pass arguments to `update_google_channel_config` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param google_channel_config [::Google::Cloud::Eventarc::V1::GoogleChannelConfig, ::Hash]
              #     Required. The config to be updated.
              #   @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
              #     The fields to be updated; only fields explicitly provided are updated.
              #     If no field mask is provided, all provided fields in the request are
              #     updated. To update all fields, provide a field mask of "*".
              # @yield [result, operation] Access the result along with the TransportOperation object
              # @yieldparam result [::Google::Cloud::Eventarc::V1::GoogleChannelConfig]
              # @yieldparam operation [::Gapic::Rest::TransportOperation]
              #
              # @return [::Google::Cloud::Eventarc::V1::GoogleChannelConfig]
              #
              # @raise [::Google::Cloud::Error] if the REST call is aborted.
              def update_google_channel_config request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::UpdateGoogleChannelConfigRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                call_metadata = @config.rpcs.update_google_channel_config.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Cloud::Eventarc::V1::VERSION,
                  transports_version_send: [:rest]

                call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                options.apply_defaults timeout:      @config.rpcs.update_google_channel_config.timeout,
                                       metadata:     call_metadata,
                                       retry_policy: @config.rpcs.update_google_channel_config.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @eventarc_stub.update_google_channel_config request, options do |result, operation|
                  yield result, operation if block_given?
                  return result
                end
              rescue ::Gapic::Rest::Error => e
                raise ::Google::Cloud::Error.from_error(e)
              end

              ##
              # Configuration class for the Eventarc REST API.
              #
              # This class represents the configuration for Eventarc REST,
              # providing control over timeouts, retry behavior, logging, transport
              # parameters, and other low-level controls. Certain parameters can also be
              # applied individually to specific RPCs. See
              # {::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client::Configuration::Rpcs}
              # for a list of RPCs that can be configured independently.
              #
              # Configuration can be applied globally to all clients, or to a single client
              # on construction.
              #
              # @example
              #
              #   # Modify the global config, setting the timeout for
              #   # get_trigger to 20 seconds,
              #   # and all remaining timeouts to 10 seconds.
              #   ::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client.configure do |config|
              #     config.timeout = 10.0
              #     config.rpcs.get_trigger.timeout = 20.0
              #   end
              #
              #   # Apply the above configuration only to a new client.
              #   client = ::Google::Cloud::Eventarc::V1::Eventarc::Rest::Client.new do |config|
              #     config.timeout = 10.0
              #     config.rpcs.get_trigger.timeout = 20.0
              #   end
              #
              # @!attribute [rw] endpoint
              #   The hostname or hostname:port of the service endpoint.
              #   Defaults to `"eventarc.googleapis.com"`.
              #   @return [::String]
              # @!attribute [rw] credentials
              #   Credentials to send with calls. You may provide any of the following types:
              #    *  (`String`) The path to a service account key file in JSON format
              #    *  (`Hash`) A service account key as a Hash
              #    *  (`Google::Auth::Credentials`) A googleauth credentials object
              #       (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
              #    *  (`Signet::OAuth2::Client`) A signet oauth2 client object
              #       (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
              #    *  (`nil`) indicating no credentials
              #   @return [::Object]
              # @!attribute [rw] scope
              #   The OAuth scopes
              #   @return [::Array<::String>]
              # @!attribute [rw] lib_name
              #   The library name as recorded in instrumentation and logging
              #   @return [::String]
              # @!attribute [rw] lib_version
              #   The library version as recorded in instrumentation and logging
              #   @return [::String]
              # @!attribute [rw] timeout
              #   The call timeout in seconds.
              #   @return [::Numeric]
              # @!attribute [rw] metadata
              #   Additional headers to be sent with the call.
              #   @return [::Hash{::Symbol=>::String}]
              # @!attribute [rw] retry_policy
              #   The retry policy. The value is a hash with the following keys:
              #    *  `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
              #    *  `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
              #    *  `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
              #    *  `:retry_codes` (*type:* `Array<String>`) - The error codes that should
              #       trigger a retry.
              #   @return [::Hash]
              # @!attribute [rw] quota_project
              #   A separate project against which to charge quota.
              #   @return [::String]
              #
              class Configuration
                extend ::Gapic::Config

                DEFAULT_ENDPOINT = "eventarc.googleapis.com"

                config_attr :endpoint,      DEFAULT_ENDPOINT, ::String
                config_attr :credentials,   nil do |value|
                  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
                  allowed.any? { |klass| klass === value }
                end
                config_attr :scope,         nil, ::String, ::Array, nil
                config_attr :lib_name,      nil, ::String, nil
                config_attr :lib_version,   nil, ::String, nil
                config_attr :timeout,       nil, ::Numeric, nil
                config_attr :metadata,      nil, ::Hash, nil
                config_attr :retry_policy,  nil, ::Hash, ::Proc, nil
                config_attr :quota_project, nil, ::String, nil

                # @private
                # Overrides for http bindings for the RPCs of this service
                # are only used when this service is used as mixin, and only
                # by the host service.
                # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
                config_attr :bindings_override, {}, ::Hash, nil

                # @private
                def initialize parent_config = nil
                  @parent_config = parent_config unless parent_config.nil?

                  yield self if block_given?
                end

                ##
                # Configurations for individual RPCs
                # @return [Rpcs]
                #
                def rpcs
                  @rpcs ||= begin
                    parent_rpcs = nil
                    parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
                    Rpcs.new parent_rpcs
                  end
                end

                ##
                # Configuration RPC class for the Eventarc API.
                #
                # Includes fields providing the configuration for each RPC in this service.
                # Each configuration object is of type `Gapic::Config::Method` and includes
                # the following configuration fields:
                #
                #  *  `timeout` (*type:* `Numeric`) - The call timeout in seconds
                #  *  `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
                #  *  `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
                #     include the following keys:
                #      *  `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
                #      *  `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
                #      *  `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
                #      *  `:retry_codes` (*type:* `Array<String>`) - The error codes that should
                #         trigger a retry.
                #
                class Rpcs
                  ##
                  # RPC-specific configuration for `get_trigger`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :get_trigger
                  ##
                  # RPC-specific configuration for `list_triggers`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :list_triggers
                  ##
                  # RPC-specific configuration for `create_trigger`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :create_trigger
                  ##
                  # RPC-specific configuration for `update_trigger`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :update_trigger
                  ##
                  # RPC-specific configuration for `delete_trigger`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :delete_trigger
                  ##
                  # RPC-specific configuration for `get_channel`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :get_channel
                  ##
                  # RPC-specific configuration for `list_channels`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :list_channels
                  ##
                  # RPC-specific configuration for `create_channel`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :create_channel
                  ##
                  # RPC-specific configuration for `update_channel`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :update_channel
                  ##
                  # RPC-specific configuration for `delete_channel`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :delete_channel
                  ##
                  # RPC-specific configuration for `get_provider`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :get_provider
                  ##
                  # RPC-specific configuration for `list_providers`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :list_providers
                  ##
                  # RPC-specific configuration for `get_channel_connection`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :get_channel_connection
                  ##
                  # RPC-specific configuration for `list_channel_connections`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :list_channel_connections
                  ##
                  # RPC-specific configuration for `create_channel_connection`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :create_channel_connection
                  ##
                  # RPC-specific configuration for `delete_channel_connection`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :delete_channel_connection
                  ##
                  # RPC-specific configuration for `get_google_channel_config`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :get_google_channel_config
                  ##
                  # RPC-specific configuration for `update_google_channel_config`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :update_google_channel_config

                  # @private
                  def initialize parent_rpcs = nil
                    get_trigger_config = parent_rpcs.get_trigger if parent_rpcs.respond_to? :get_trigger
                    @get_trigger = ::Gapic::Config::Method.new get_trigger_config
                    list_triggers_config = parent_rpcs.list_triggers if parent_rpcs.respond_to? :list_triggers
                    @list_triggers = ::Gapic::Config::Method.new list_triggers_config
                    create_trigger_config = parent_rpcs.create_trigger if parent_rpcs.respond_to? :create_trigger
                    @create_trigger = ::Gapic::Config::Method.new create_trigger_config
                    update_trigger_config = parent_rpcs.update_trigger if parent_rpcs.respond_to? :update_trigger
                    @update_trigger = ::Gapic::Config::Method.new update_trigger_config
                    delete_trigger_config = parent_rpcs.delete_trigger if parent_rpcs.respond_to? :delete_trigger
                    @delete_trigger = ::Gapic::Config::Method.new delete_trigger_config
                    get_channel_config = parent_rpcs.get_channel if parent_rpcs.respond_to? :get_channel
                    @get_channel = ::Gapic::Config::Method.new get_channel_config
                    list_channels_config = parent_rpcs.list_channels if parent_rpcs.respond_to? :list_channels
                    @list_channels = ::Gapic::Config::Method.new list_channels_config
                    create_channel_config = parent_rpcs.create_channel if parent_rpcs.respond_to? :create_channel
                    @create_channel = ::Gapic::Config::Method.new create_channel_config
                    update_channel_config = parent_rpcs.update_channel if parent_rpcs.respond_to? :update_channel
                    @update_channel = ::Gapic::Config::Method.new update_channel_config
                    delete_channel_config = parent_rpcs.delete_channel if parent_rpcs.respond_to? :delete_channel
                    @delete_channel = ::Gapic::Config::Method.new delete_channel_config
                    get_provider_config = parent_rpcs.get_provider if parent_rpcs.respond_to? :get_provider
                    @get_provider = ::Gapic::Config::Method.new get_provider_config
                    list_providers_config = parent_rpcs.list_providers if parent_rpcs.respond_to? :list_providers
                    @list_providers = ::Gapic::Config::Method.new list_providers_config
                    get_channel_connection_config = parent_rpcs.get_channel_connection if parent_rpcs.respond_to? :get_channel_connection
                    @get_channel_connection = ::Gapic::Config::Method.new get_channel_connection_config
                    list_channel_connections_config = parent_rpcs.list_channel_connections if parent_rpcs.respond_to? :list_channel_connections
                    @list_channel_connections = ::Gapic::Config::Method.new list_channel_connections_config
                    create_channel_connection_config = parent_rpcs.create_channel_connection if parent_rpcs.respond_to? :create_channel_connection
                    @create_channel_connection = ::Gapic::Config::Method.new create_channel_connection_config
                    delete_channel_connection_config = parent_rpcs.delete_channel_connection if parent_rpcs.respond_to? :delete_channel_connection
                    @delete_channel_connection = ::Gapic::Config::Method.new delete_channel_connection_config
                    get_google_channel_config_config = parent_rpcs.get_google_channel_config if parent_rpcs.respond_to? :get_google_channel_config
                    @get_google_channel_config = ::Gapic::Config::Method.new get_google_channel_config_config
                    update_google_channel_config_config = parent_rpcs.update_google_channel_config if parent_rpcs.respond_to? :update_google_channel_config
                    @update_google_channel_config = ::Gapic::Config::Method.new update_google_channel_config_config

                    yield self if block_given?
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end