Documentation ¶
Overview ¶
Package publishing is an auto-generated package for the Eventarc Publishing API.
Processes events generated by an event provider and delivers them to a subscriber.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &publishingpb.PublishRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/eventarc/publishing/apiv1/publishingpb#PublishRequest. } resp, err := c.Publish(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewPublisherClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
- func DefaultAuthScopes() []string
- type PublisherCallOptions
- type PublisherClient
- func (c *PublisherClient) Close() error
- func (c *PublisherClient) Connection() *grpc.ClientConndeprecated
- func (c *PublisherClient) Publish(ctx context.Context, req *publishingpb.PublishRequest, opts ...gax.CallOption) (*publishingpb.PublishResponse, error)
- func (c *PublisherClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, ...) (*publishingpb.PublishChannelConnectionEventsResponse, error)
- func (c *PublisherClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, ...) (*publishingpb.PublishEventsResponse, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type PublisherCallOptions ¶
type PublisherCallOptions struct { PublishChannelConnectionEvents []gax.CallOption PublishEvents []gax.CallOption Publish []gax.CallOption }
PublisherCallOptions contains the retry settings for each method of PublisherClient.
type PublisherClient ¶
type PublisherClient struct { // The call options for this service. CallOptions *PublisherCallOptions // contains filtered or unexported fields }
PublisherClient is a client for interacting with Eventarc Publishing API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
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.
func NewPublisherClient ¶
func NewPublisherClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error)
NewPublisherClient creates a new publisher client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
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.
Example ¶
package main import ( "context" publishing "cloud.google.com/go/eventarc/publishing/apiv1" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewPublisherRESTClient ¶ added in v1.10.0
func NewPublisherRESTClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error)
NewPublisherRESTClient creates a new publisher rest client.
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.
Example ¶
package main import ( "context" publishing "cloud.google.com/go/eventarc/publishing/apiv1" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*PublisherClient) Close ¶
func (c *PublisherClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*PublisherClient) Connection
deprecated
func (c *PublisherClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*PublisherClient) Publish ¶ added in v1.15.0
func (c *PublisherClient) Publish(ctx context.Context, req *publishingpb.PublishRequest, opts ...gax.CallOption) (*publishingpb.PublishResponse, error)
Publish publish events to a message bus.
Example ¶
package main import ( "context" publishing "cloud.google.com/go/eventarc/publishing/apiv1" publishingpb "cloud.google.com/go/eventarc/publishing/apiv1/publishingpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &publishingpb.PublishRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/eventarc/publishing/apiv1/publishingpb#PublishRequest. } resp, err := c.Publish(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*PublisherClient) PublishChannelConnectionEvents ¶
func (c *PublisherClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error)
PublishChannelConnectionEvents publish events to a ChannelConnection in a partner’s project.
Example ¶
package main import ( "context" publishing "cloud.google.com/go/eventarc/publishing/apiv1" publishingpb "cloud.google.com/go/eventarc/publishing/apiv1/publishingpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &publishingpb.PublishChannelConnectionEventsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/eventarc/publishing/apiv1/publishingpb#PublishChannelConnectionEventsRequest. } resp, err := c.PublishChannelConnectionEvents(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*PublisherClient) PublishEvents ¶ added in v1.5.0
func (c *PublisherClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error)
PublishEvents publish events to a subscriber’s channel.
Example ¶
package main import ( "context" publishing "cloud.google.com/go/eventarc/publishing/apiv1" publishingpb "cloud.google.com/go/eventarc/publishing/apiv1/publishingpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &publishingpb.PublishEventsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/eventarc/publishing/apiv1/publishingpb#PublishEventsRequest. } resp, err := c.PublishEvents(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output: