Eventarc Publishing V1 API - Class Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client (v1.2.0)

Reference documentation and code samples for the Eventarc Publishing V1 API class Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.

REST client for the Publisher service.

Eventarc processes events generated by an event provider and delivers them to a subscriber.

An event provider is a software-as-a-service (SaaS) system or product that can generate and deliver events through Eventarc.

A third-party event provider is an event provider from outside of Google.

A partner is a third-party event provider that is integrated with Eventarc.

A subscriber is a GCP customer interested in receiving events.

Channel is a first-class Eventarc resource that is created and managed by the subscriber in their GCP project. A Channel represents a subscriber's intent to receive events from an event provider. A Channel is associated with exactly one event provider.

ChannelConnection is a first-class Eventarc resource that is created and managed by the partner in their GCP project. A ChannelConnection represents a connection between a partner and a subscriber's Channel. A ChannelConnection has a one-to-one mapping with a Channel.

Publisher allows an event provider to publish events to Eventarc.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Publisher Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Publisher clients
::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Publisher 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 Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#initialize

def initialize() { |config| ... } -> Client

Create a new Publisher REST client object.

Yields
  • (config) — Configure the Publisher client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new do |config|
  config.timeout = 10.0
end

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#publish

def publish(request, options = nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishResponse
def publish(message_bus: nil, proto_message: nil, json_message: nil, avro_message: nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishResponse

Publish events to a message bus.

Overloads
def publish(request, options = nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishResponse
Pass arguments to publish via a request object, either of type Google::Cloud::Eventarc::Publishing::V1::PublishRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::Publishing::V1::PublishRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def publish(message_bus: nil, proto_message: nil, json_message: nil, avro_message: nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishResponse
Pass arguments to publish 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).
Parameters
  • message_bus (::String) — Required. The full name of the message bus to publish events to. Format: projects/{project}/locations/{location}/messageBuses/{messageBus}.
  • proto_message (::Google::Cloud::Eventarc::Publishing::V1::CloudEvent, ::Hash) — The Protobuf format of the CloudEvent being published. Specification can be found here: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md
  • json_message (::String) — The JSON format of the CloudEvent being published. Specification can be found here: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
  • avro_message (::String) — The Avro format of the CloudEvent being published. Specification can be found here: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/eventarc/publishing/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Eventarc::Publishing::V1::PublishRequest.new

# Call the publish method.
result = client.publish request

# The returned object is of type Google::Cloud::Eventarc::Publishing::V1::PublishResponse.
p result

#publish_channel_connection_events

def publish_channel_connection_events(request, options = nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse
def publish_channel_connection_events(channel_connection: nil, events: nil, text_events: nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse

Publish events to a ChannelConnection in a partner's project.

Overloads
def publish_channel_connection_events(request, options = nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse
Pass arguments to publish_channel_connection_events via a request object, either of type Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsRequest or an equivalent Hash.
Parameters
def publish_channel_connection_events(channel_connection: nil, events: nil, text_events: nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse
Pass arguments to publish_channel_connection_events 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).
Parameters
  • channel_connection (::String) — The channel_connection that the events are published from. For example: projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}.
  • events (::Array<::Google::Protobuf::Any, ::Hash>) — The CloudEvents v1.0 events to publish. No other types are allowed. If this field is set, then the text_events fields must not be set.
  • text_events (::Array<::String>) — The text representation of events to publish. CloudEvent v1.0 in JSON format is the only allowed type. Refer to https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md for specification. If this field is set, then the events fields must not be set.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/eventarc/publishing/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsRequest.new

# Call the publish_channel_connection_events method.
result = client.publish_channel_connection_events request

# The returned object is of type Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse.
p result

#publish_events

def publish_events(request, options = nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse
def publish_events(channel: nil, events: nil, text_events: nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse

Publish events to a subscriber's channel.

Overloads
def publish_events(request, options = nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse
Pass arguments to publish_events via a request object, either of type Google::Cloud::Eventarc::Publishing::V1::PublishEventsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::Publishing::V1::PublishEventsRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def publish_events(channel: nil, events: nil, text_events: nil) -> ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse
Pass arguments to publish_events 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).
Parameters
  • channel (::String) — The full name of the channel to publish to. For example: projects/{project}/locations/{location}/channels/{channel-id}.
  • events (::Array<::Google::Protobuf::Any, ::Hash>) — The CloudEvents v1.0 events to publish. No other types are allowed. If this field is set, then the text_events fields must not be set.
  • text_events (::Array<::String>) — The text representation of events to publish. CloudEvent v1.0 in JSON format is the only allowed type. Refer to https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md for specification. If this field is set, then the events fields must not be set.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/eventarc/publishing/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Eventarc::Publishing::V1::PublishEventsRequest.new

# Call the publish_events method.
result = client.publish_events request

# The returned object is of type Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse.
p result

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)