package pubsublite
import "cloud.google.com/go/pubsublite/apiv1"
Package pubsublite is an auto-generated package for the Pub/Sub Lite API.
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 := pubsublite.NewAdminClient(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 := pubsublite.NewAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &pubsublitepb.CreateReservationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#CreateReservationRequest. } resp, err := c.CreateReservation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewAdminClient 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 AdminCallOptions
- type AdminClient
- func NewAdminClient(ctx context.Context, opts ...option.ClientOption) (*AdminClient, error)
- func (c *AdminClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *AdminClient) Close() error
- func (c *AdminClient) Connection() *grpc.ClientConn
- func (c *AdminClient) CreateReservation(ctx context.Context, req *pubsublitepb.CreateReservationRequest, opts ...gax.CallOption) (*pubsublitepb.Reservation, error)
- func (c *AdminClient) CreateSubscription(ctx context.Context, req *pubsublitepb.CreateSubscriptionRequest, opts ...gax.CallOption) (*pubsublitepb.Subscription, error)
- func (c *AdminClient) CreateTopic(ctx context.Context, req *pubsublitepb.CreateTopicRequest, opts ...gax.CallOption) (*pubsublitepb.Topic, error)
- func (c *AdminClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *AdminClient) DeleteReservation(ctx context.Context, req *pubsublitepb.DeleteReservationRequest, opts ...gax.CallOption) error
- func (c *AdminClient) DeleteSubscription(ctx context.Context, req *pubsublitepb.DeleteSubscriptionRequest, opts ...gax.CallOption) error
- func (c *AdminClient) DeleteTopic(ctx context.Context, req *pubsublitepb.DeleteTopicRequest, opts ...gax.CallOption) error
- func (c *AdminClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *AdminClient) GetReservation(ctx context.Context, req *pubsublitepb.GetReservationRequest, opts ...gax.CallOption) (*pubsublitepb.Reservation, error)
- func (c *AdminClient) GetSubscription(ctx context.Context, req *pubsublitepb.GetSubscriptionRequest, opts ...gax.CallOption) (*pubsublitepb.Subscription, error)
- func (c *AdminClient) GetTopic(ctx context.Context, req *pubsublitepb.GetTopicRequest, opts ...gax.CallOption) (*pubsublitepb.Topic, error)
- func (c *AdminClient) GetTopicPartitions(ctx context.Context, req *pubsublitepb.GetTopicPartitionsRequest, opts ...gax.CallOption) (*pubsublitepb.TopicPartitions, error)
- func (c *AdminClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- func (c *AdminClient) ListReservationTopics(ctx context.Context, req *pubsublitepb.ListReservationTopicsRequest, opts ...gax.CallOption) *StringIterator
- func (c *AdminClient) ListReservations(ctx context.Context, req *pubsublitepb.ListReservationsRequest, opts ...gax.CallOption) *ReservationIterator
- func (c *AdminClient) ListSubscriptions(ctx context.Context, req *pubsublitepb.ListSubscriptionsRequest, opts ...gax.CallOption) *SubscriptionIterator
- func (c *AdminClient) ListTopicSubscriptions(ctx context.Context, req *pubsublitepb.ListTopicSubscriptionsRequest, opts ...gax.CallOption) *StringIterator
- func (c *AdminClient) ListTopics(ctx context.Context, req *pubsublitepb.ListTopicsRequest, opts ...gax.CallOption) *TopicIterator
- func (c *AdminClient) SeekSubscription(ctx context.Context, req *pubsublitepb.SeekSubscriptionRequest, opts ...gax.CallOption) (*SeekSubscriptionOperation, error)
- func (c *AdminClient) SeekSubscriptionOperation(name string) *SeekSubscriptionOperation
- func (c *AdminClient) UpdateReservation(ctx context.Context, req *pubsublitepb.UpdateReservationRequest, opts ...gax.CallOption) (*pubsublitepb.Reservation, error)
- func (c *AdminClient) UpdateSubscription(ctx context.Context, req *pubsublitepb.UpdateSubscriptionRequest, opts ...gax.CallOption) (*pubsublitepb.Subscription, error)
- func (c *AdminClient) UpdateTopic(ctx context.Context, req *pubsublitepb.UpdateTopicRequest, opts ...gax.CallOption) (*pubsublitepb.Topic, error)
- type CursorCallOptions
- type CursorClient
- func NewCursorClient(ctx context.Context, opts ...option.ClientOption) (*CursorClient, error)
- func (c *CursorClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *CursorClient) Close() error
- func (c *CursorClient) CommitCursor(ctx context.Context, req *pubsublitepb.CommitCursorRequest, opts ...gax.CallOption) (*pubsublitepb.CommitCursorResponse, error)
- func (c *CursorClient) Connection() *grpc.ClientConn
- func (c *CursorClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *CursorClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *CursorClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- func (c *CursorClient) ListPartitionCursors(ctx context.Context, req *pubsublitepb.ListPartitionCursorsRequest, opts ...gax.CallOption) *PartitionCursorIterator
- func (c *CursorClient) StreamingCommitCursor(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.CursorService_StreamingCommitCursorClient, error)
- type OperationIterator
- func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
- func (it *OperationIterator) PageInfo() *iterator.PageInfo
- type PartitionAssignmentCallOptions
- type PartitionAssignmentClient
- func NewPartitionAssignmentClient(ctx context.Context, opts ...option.ClientOption) (*PartitionAssignmentClient, error)
- func (c *PartitionAssignmentClient) AssignPartitions(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.PartitionAssignmentService_AssignPartitionsClient, error)
- func (c *PartitionAssignmentClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *PartitionAssignmentClient) Close() error
- func (c *PartitionAssignmentClient) Connection() *grpc.ClientConn
- func (c *PartitionAssignmentClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *PartitionAssignmentClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *PartitionAssignmentClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- type PartitionCursorIterator
- func (it *PartitionCursorIterator) Next() (*pubsublitepb.PartitionCursor, error)
- func (it *PartitionCursorIterator) PageInfo() *iterator.PageInfo
- type PublisherCallOptions
- type PublisherClient
- func NewPublisherClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error)
- func (c *PublisherClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *PublisherClient) Close() error
- func (c *PublisherClient) Connection() *grpc.ClientConn
- func (c *PublisherClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *PublisherClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *PublisherClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- func (c *PublisherClient) Publish(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.PublisherService_PublishClient, error)
- type ReservationIterator
- func (it *ReservationIterator) Next() (*pubsublitepb.Reservation, error)
- func (it *ReservationIterator) PageInfo() *iterator.PageInfo
- type SeekSubscriptionOperation
- func (op *SeekSubscriptionOperation) Done() bool
- func (op *SeekSubscriptionOperation) Metadata() (*pubsublitepb.OperationMetadata, error)
- func (op *SeekSubscriptionOperation) Name() string
- func (op *SeekSubscriptionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*pubsublitepb.SeekSubscriptionResponse, error)
- func (op *SeekSubscriptionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*pubsublitepb.SeekSubscriptionResponse, error)
- type StringIterator
- func (it *StringIterator) Next() (string, error)
- func (it *StringIterator) PageInfo() *iterator.PageInfo
- type SubscriberCallOptions
- type SubscriberClient
- func NewSubscriberClient(ctx context.Context, opts ...option.ClientOption) (*SubscriberClient, error)
- func (c *SubscriberClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *SubscriberClient) Close() error
- func (c *SubscriberClient) Connection() *grpc.ClientConn
- func (c *SubscriberClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *SubscriberClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *SubscriberClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- func (c *SubscriberClient) Subscribe(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.SubscriberService_SubscribeClient, error)
- type SubscriptionIterator
- func (it *SubscriptionIterator) Next() (*pubsublitepb.Subscription, error)
- func (it *SubscriptionIterator) PageInfo() *iterator.PageInfo
- type TopicIterator
- func (it *TopicIterator) Next() (*pubsublitepb.Topic, error)
- func (it *TopicIterator) PageInfo() *iterator.PageInfo
- type TopicStatsCallOptions
- type TopicStatsClient
- func NewTopicStatsClient(ctx context.Context, opts ...option.ClientOption) (*TopicStatsClient, error)
- func (c *TopicStatsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *TopicStatsClient) Close() error
- func (c *TopicStatsClient) ComputeHeadCursor(ctx context.Context, req *pubsublitepb.ComputeHeadCursorRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeHeadCursorResponse, error)
- func (c *TopicStatsClient) ComputeMessageStats(ctx context.Context, req *pubsublitepb.ComputeMessageStatsRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeMessageStatsResponse, error)
- func (c *TopicStatsClient) ComputeTimeCursor(ctx context.Context, req *pubsublitepb.ComputeTimeCursorRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeTimeCursorResponse, error)
- func (c *TopicStatsClient) Connection() *grpc.ClientConn
- func (c *TopicStatsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *TopicStatsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *TopicStatsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
Examples ¶
- AdminClient.CancelOperation
- AdminClient.CreateReservation
- AdminClient.CreateSubscription
- AdminClient.CreateTopic
- AdminClient.DeleteOperation
- AdminClient.DeleteReservation
- AdminClient.DeleteSubscription
- AdminClient.DeleteTopic
- AdminClient.GetOperation
- AdminClient.GetReservation
- AdminClient.GetSubscription
- AdminClient.GetTopic
- AdminClient.GetTopicPartitions
- AdminClient.ListOperations
- AdminClient.ListReservationTopics
- AdminClient.ListReservations
- AdminClient.ListSubscriptions
- AdminClient.ListTopicSubscriptions
- AdminClient.ListTopics
- AdminClient.SeekSubscription
- AdminClient.UpdateReservation
- AdminClient.UpdateSubscription
- AdminClient.UpdateTopic
- CursorClient.CancelOperation
- CursorClient.CommitCursor
- CursorClient.DeleteOperation
- CursorClient.GetOperation
- CursorClient.ListOperations
- CursorClient.ListPartitionCursors
- CursorClient.StreamingCommitCursor
- NewAdminClient
- NewCursorClient
- NewPartitionAssignmentClient
- NewPublisherClient
- NewSubscriberClient
- NewTopicStatsClient
- PartitionAssignmentClient.AssignPartitions
- PartitionAssignmentClient.CancelOperation
- PartitionAssignmentClient.DeleteOperation
- PartitionAssignmentClient.GetOperation
- PartitionAssignmentClient.ListOperations
- PublisherClient.CancelOperation
- PublisherClient.DeleteOperation
- PublisherClient.GetOperation
- PublisherClient.ListOperations
- PublisherClient.Publish
- SubscriberClient.CancelOperation
- SubscriberClient.DeleteOperation
- SubscriberClient.GetOperation
- SubscriberClient.ListOperations
- SubscriberClient.Subscribe
- TopicStatsClient.CancelOperation
- TopicStatsClient.ComputeHeadCursor
- TopicStatsClient.ComputeMessageStats
- TopicStatsClient.ComputeTimeCursor
- TopicStatsClient.DeleteOperation
- TopicStatsClient.GetOperation
- TopicStatsClient.ListOperations
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type AdminCallOptions ¶
type AdminCallOptions struct { CreateTopic []gax.CallOption GetTopic []gax.CallOption GetTopicPartitions []gax.CallOption ListTopics []gax.CallOption UpdateTopic []gax.CallOption DeleteTopic []gax.CallOption ListTopicSubscriptions []gax.CallOption CreateSubscription []gax.CallOption GetSubscription []gax.CallOption ListSubscriptions []gax.CallOption UpdateSubscription []gax.CallOption DeleteSubscription []gax.CallOption SeekSubscription []gax.CallOption CreateReservation []gax.CallOption GetReservation []gax.CallOption ListReservations []gax.CallOption UpdateReservation []gax.CallOption DeleteReservation []gax.CallOption ListReservationTopics []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
AdminCallOptions contains the retry settings for each method of AdminClient.
type AdminClient ¶
type AdminClient struct { // The call options for this service. CallOptions *AdminCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }
AdminClient is a client for interacting with Pub/Sub Lite API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The service that a client application uses to manage topics and subscriptions, such creating, listing, and deleting topics and subscriptions.
func NewAdminClient ¶
func NewAdminClient(ctx context.Context, opts ...option.ClientOption) (*AdminClient, error)
NewAdminClient creates a new admin service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The service that a client application uses to manage topics and
subscriptions, such creating, listing, and deleting topics and subscriptions.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*AdminClient) CancelOperation ¶
func (c *AdminClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AdminClient) Close ¶
func (c *AdminClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AdminClient) Connection ¶
func (c *AdminClient) 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 (*AdminClient) CreateReservation ¶
func (c *AdminClient) CreateReservation(ctx context.Context, req *pubsublitepb.CreateReservationRequest, opts ...gax.CallOption) (*pubsublitepb.Reservation, error)
CreateReservation creates a new reservation.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CreateReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#CreateReservationRequest.
}
resp, err := c.CreateReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) CreateSubscription ¶
func (c *AdminClient) CreateSubscription(ctx context.Context, req *pubsublitepb.CreateSubscriptionRequest, opts ...gax.CallOption) (*pubsublitepb.Subscription, error)
CreateSubscription creates a new subscription.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CreateSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#CreateSubscriptionRequest.
}
resp, err := c.CreateSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) CreateTopic ¶
func (c *AdminClient) CreateTopic(ctx context.Context, req *pubsublitepb.CreateTopicRequest, opts ...gax.CallOption) (*pubsublitepb.Topic, error)
CreateTopic creates a new topic.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CreateTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#CreateTopicRequest.
}
resp, err := c.CreateTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) DeleteOperation ¶
func (c *AdminClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AdminClient) DeleteReservation ¶
func (c *AdminClient) DeleteReservation(ctx context.Context, req *pubsublitepb.DeleteReservationRequest, opts ...gax.CallOption) error
DeleteReservation deletes the specified reservation.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.DeleteReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#DeleteReservationRequest.
}
err = c.DeleteReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AdminClient) DeleteSubscription ¶
func (c *AdminClient) DeleteSubscription(ctx context.Context, req *pubsublitepb.DeleteSubscriptionRequest, opts ...gax.CallOption) error
DeleteSubscription deletes the specified subscription.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.DeleteSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#DeleteSubscriptionRequest.
}
err = c.DeleteSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AdminClient) DeleteTopic ¶
func (c *AdminClient) DeleteTopic(ctx context.Context, req *pubsublitepb.DeleteTopicRequest, opts ...gax.CallOption) error
DeleteTopic deletes the specified topic.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.DeleteTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#DeleteTopicRequest.
}
err = c.DeleteTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AdminClient) GetOperation ¶
func (c *AdminClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) GetReservation ¶
func (c *AdminClient) GetReservation(ctx context.Context, req *pubsublitepb.GetReservationRequest, opts ...gax.CallOption) (*pubsublitepb.Reservation, error)
GetReservation returns the reservation configuration.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#GetReservationRequest.
}
resp, err := c.GetReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) GetSubscription ¶
func (c *AdminClient) GetSubscription(ctx context.Context, req *pubsublitepb.GetSubscriptionRequest, opts ...gax.CallOption) (*pubsublitepb.Subscription, error)
GetSubscription returns the subscription configuration.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#GetSubscriptionRequest.
}
resp, err := c.GetSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) GetTopic ¶
func (c *AdminClient) GetTopic(ctx context.Context, req *pubsublitepb.GetTopicRequest, opts ...gax.CallOption) (*pubsublitepb.Topic, error)
GetTopic returns the topic configuration.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#GetTopicRequest.
}
resp, err := c.GetTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) GetTopicPartitions ¶
func (c *AdminClient) GetTopicPartitions(ctx context.Context, req *pubsublitepb.GetTopicPartitionsRequest, opts ...gax.CallOption) (*pubsublitepb.TopicPartitions, error)
GetTopicPartitions returns the partition information for the requested topic.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetTopicPartitionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#GetTopicPartitionsRequest.
}
resp, err := c.GetTopicPartitions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) ListOperations ¶
func (c *AdminClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
func (*AdminClient) ListReservationTopics ¶
func (c *AdminClient) ListReservationTopics(ctx context.Context, req *pubsublitepb.ListReservationTopicsRequest, opts ...gax.CallOption) *StringIterator
ListReservationTopics lists the topics attached to the specified reservation.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListReservationTopicsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ListReservationTopicsRequest.
}
it := c.ListReservationTopics(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*pubsublitepb.ListReservationTopicsResponse)
}
}
func (*AdminClient) ListReservations ¶
func (c *AdminClient) ListReservations(ctx context.Context, req *pubsublitepb.ListReservationsRequest, opts ...gax.CallOption) *ReservationIterator
ListReservations returns the list of reservations for the given project.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListReservationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ListReservationsRequest.
}
it := c.ListReservations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*pubsublitepb.ListReservationsResponse)
}
}
func (*AdminClient) ListSubscriptions ¶
func (c *AdminClient) ListSubscriptions(ctx context.Context, req *pubsublitepb.ListSubscriptionsRequest, opts ...gax.CallOption) *SubscriptionIterator
ListSubscriptions returns the list of subscriptions for the given project.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListSubscriptionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ListSubscriptionsRequest.
}
it := c.ListSubscriptions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*pubsublitepb.ListSubscriptionsResponse)
}
}
func (*AdminClient) ListTopicSubscriptions ¶
func (c *AdminClient) ListTopicSubscriptions(ctx context.Context, req *pubsublitepb.ListTopicSubscriptionsRequest, opts ...gax.CallOption) *StringIterator
ListTopicSubscriptions lists the subscriptions attached to the specified topic.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListTopicSubscriptionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ListTopicSubscriptionsRequest.
}
it := c.ListTopicSubscriptions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*pubsublitepb.ListTopicSubscriptionsResponse)
}
}
func (*AdminClient) ListTopics ¶
func (c *AdminClient) ListTopics(ctx context.Context, req *pubsublitepb.ListTopicsRequest, opts ...gax.CallOption) *TopicIterator
ListTopics returns the list of topics for the given project.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListTopicsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ListTopicsRequest.
}
it := c.ListTopics(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*pubsublitepb.ListTopicsResponse)
}
}
func (*AdminClient) SeekSubscription ¶
func (c *AdminClient) SeekSubscription(ctx context.Context, req *pubsublitepb.SeekSubscriptionRequest, opts ...gax.CallOption) (*SeekSubscriptionOperation, error)
SeekSubscription performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors.
If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients.
If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online.
If the previous seek operation has not yet completed, it will be aborted
and the new invocation of seek will supersede it.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.SeekSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#SeekSubscriptionRequest.
}
op, err := c.SeekSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) SeekSubscriptionOperation ¶
func (c *AdminClient) SeekSubscriptionOperation(name string) *SeekSubscriptionOperation
SeekSubscriptionOperation returns a new SeekSubscriptionOperation from a given name. The name must be that of a previously created SeekSubscriptionOperation, possibly from a different process.
func (*AdminClient) UpdateReservation ¶
func (c *AdminClient) UpdateReservation(ctx context.Context, req *pubsublitepb.UpdateReservationRequest, opts ...gax.CallOption) (*pubsublitepb.Reservation, error)
UpdateReservation updates properties of the specified reservation.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.UpdateReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#UpdateReservationRequest.
}
resp, err := c.UpdateReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) UpdateSubscription ¶
func (c *AdminClient) UpdateSubscription(ctx context.Context, req *pubsublitepb.UpdateSubscriptionRequest, opts ...gax.CallOption) (*pubsublitepb.Subscription, error)
UpdateSubscription updates properties of the specified subscription.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.UpdateSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#UpdateSubscriptionRequest.
}
resp, err := c.UpdateSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AdminClient) UpdateTopic ¶
func (c *AdminClient) UpdateTopic(ctx context.Context, req *pubsublitepb.UpdateTopicRequest, opts ...gax.CallOption) (*pubsublitepb.Topic, error)
UpdateTopic updates properties of the specified topic.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.UpdateTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#UpdateTopicRequest.
}
resp, err := c.UpdateTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type CursorCallOptions ¶
type CursorCallOptions struct { StreamingCommitCursor []gax.CallOption CommitCursor []gax.CallOption ListPartitionCursors []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
CursorCallOptions contains the retry settings for each method of CursorClient.
type CursorClient ¶
type CursorClient struct { // The call options for this service. CallOptions *CursorCallOptions // contains filtered or unexported fields }
CursorClient is a client for interacting with Pub/Sub Lite API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The service that a subscriber client application uses to manage committed cursors while receiving messsages. A cursor represents a subscriber’s progress within a topic partition for a given subscription.
func NewCursorClient ¶
func NewCursorClient(ctx context.Context, opts ...option.ClientOption) (*CursorClient, error)
NewCursorClient creates a new cursor service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The service that a subscriber client application uses to manage committed
cursors while receiving messsages. A cursor represents a subscriber’s
progress within a topic partition for a given subscription.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*CursorClient) CancelOperation ¶
func (c *CursorClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*CursorClient) Close ¶
func (c *CursorClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CursorClient) CommitCursor ¶
func (c *CursorClient) CommitCursor(ctx context.Context, req *pubsublitepb.CommitCursorRequest, opts ...gax.CallOption) (*pubsublitepb.CommitCursorResponse, error)
CommitCursor updates the committed cursor.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CommitCursorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#CommitCursorRequest.
}
resp, err := c.CommitCursor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CursorClient) Connection ¶
func (c *CursorClient) 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 (*CursorClient) DeleteOperation ¶
func (c *CursorClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*CursorClient) GetOperation ¶
func (c *CursorClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CursorClient) ListOperations ¶
func (c *CursorClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
func (*CursorClient) ListPartitionCursors ¶
func (c *CursorClient) ListPartitionCursors(ctx context.Context, req *pubsublitepb.ListPartitionCursorsRequest, opts ...gax.CallOption) *PartitionCursorIterator
ListPartitionCursors returns all committed cursor information for a subscription.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListPartitionCursorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ListPartitionCursorsRequest.
}
it := c.ListPartitionCursors(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*pubsublitepb.ListPartitionCursorsResponse)
}
}
func (*CursorClient) StreamingCommitCursor ¶
func (c *CursorClient) StreamingCommitCursor(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.CursorService_StreamingCommitCursorClient, error)
StreamingCommitCursor establishes a stream with the server for managing committed cursors.
Code:play
Example¶
package main
import (
"context"
"io"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewCursorClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.StreamingCommitCursor(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*pubsublitepb.StreamingCommitCursorRequest{
// TODO: Create requests.
}
for _, req := range reqs {
if err := stream.Send(req); err != nil {
// TODO: Handle error.
}
}
stream.CloseSend()
}()
for {
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// TODO: handle error.
}
// TODO: Use resp.
_ = resp
}
}
type OperationIterator ¶
type OperationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) Next ¶
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo ¶
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type PartitionAssignmentCallOptions ¶
type PartitionAssignmentCallOptions struct { AssignPartitions []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
PartitionAssignmentCallOptions contains the retry settings for each method of PartitionAssignmentClient.
type PartitionAssignmentClient ¶
type PartitionAssignmentClient struct { // The call options for this service. CallOptions *PartitionAssignmentCallOptions // contains filtered or unexported fields }
PartitionAssignmentClient is a client for interacting with Pub/Sub Lite API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The service that a subscriber client application uses to determine which partitions it should connect to.
func NewPartitionAssignmentClient ¶
func NewPartitionAssignmentClient(ctx context.Context, opts ...option.ClientOption) (*PartitionAssignmentClient, error)
NewPartitionAssignmentClient creates a new partition assignment service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The service that a subscriber client application uses to determine which
partitions it should connect to.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPartitionAssignmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*PartitionAssignmentClient) AssignPartitions ¶
func (c *PartitionAssignmentClient) AssignPartitions(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.PartitionAssignmentService_AssignPartitionsClient, error)
AssignPartitions assign partitions for this client to handle for the specified subscription.
The client must send an InitialPartitionAssignmentRequest first.
The server will then send at most one unacknowledged PartitionAssignment
outstanding on the stream at a time.
The client should send a PartitionAssignmentAck after updating the
partitions it is connected to to reflect the new assignment.
Code:play
Example¶
package main
import (
"context"
"io"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewPartitionAssignmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.AssignPartitions(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*pubsublitepb.PartitionAssignmentRequest{
// TODO: Create requests.
}
for _, req := range reqs {
if err := stream.Send(req); err != nil {
// TODO: Handle error.
}
}
stream.CloseSend()
}()
for {
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// TODO: handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*PartitionAssignmentClient) CancelOperation ¶
func (c *PartitionAssignmentClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPartitionAssignmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*PartitionAssignmentClient) Close ¶
func (c *PartitionAssignmentClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*PartitionAssignmentClient) Connection ¶
func (c *PartitionAssignmentClient) 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 (*PartitionAssignmentClient) DeleteOperation ¶
func (c *PartitionAssignmentClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPartitionAssignmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*PartitionAssignmentClient) GetOperation ¶
func (c *PartitionAssignmentClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPartitionAssignmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PartitionAssignmentClient) ListOperations ¶
func (c *PartitionAssignmentClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewPartitionAssignmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
type PartitionCursorIterator ¶
type PartitionCursorIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsublitepb.PartitionCursor, nextPageToken string, err error) // contains filtered or unexported fields }
PartitionCursorIterator manages a stream of *pubsublitepb.PartitionCursor.
func (*PartitionCursorIterator) Next ¶
func (it *PartitionCursorIterator) Next() (*pubsublitepb.PartitionCursor, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*PartitionCursorIterator) PageInfo ¶
func (it *PartitionCursorIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type PublisherCallOptions ¶
type PublisherCallOptions struct { Publish []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []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 Pub/Sub Lite API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The service that a publisher client application uses to publish messages to topics. Published messages are retained by the service for the duration of the retention period configured for the respective topic, and are delivered to subscriber clients upon request (via the SubscriberService).
func NewPublisherClient ¶
func NewPublisherClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error)
NewPublisherClient creates a new publisher service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The service that a publisher client application uses to publish messages to
topics. Published messages are retained by the service for the duration of
the retention period configured for the respective topic, and are delivered
to subscriber clients upon request (via the SubscriberService).
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPublisherClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*PublisherClient) CancelOperation ¶
func (c *PublisherClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPublisherClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 ¶
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) DeleteOperation ¶
func (c *PublisherClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPublisherClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*PublisherClient) GetOperation ¶
func (c *PublisherClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewPublisherClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PublisherClient) ListOperations ¶
func (c *PublisherClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewPublisherClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
func (*PublisherClient) Publish ¶
func (c *PublisherClient) Publish(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.PublisherService_PublishClient, error)
Publish establishes a stream with the server for publishing messages. Once the
stream is initialized, the client publishes messages by sending publish
requests on the stream. The server responds with a PublishResponse for each
PublishRequest sent by the client, in the same order that the requests
were sent. Note that multiple PublishRequests can be in flight
simultaneously, but they will be processed by the server in the order that
they are sent by the client on a given stream.
Code:play
Example¶
package main
import (
"context"
"io"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewPublisherClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.Publish(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*pubsublitepb.PublishRequest{
// TODO: Create requests.
}
for _, req := range reqs {
if err := stream.Send(req); err != nil {
// TODO: Handle error.
}
}
stream.CloseSend()
}()
for {
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// TODO: handle error.
}
// TODO: Use resp.
_ = resp
}
}
type ReservationIterator ¶
type ReservationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsublitepb.Reservation, nextPageToken string, err error) // contains filtered or unexported fields }
ReservationIterator manages a stream of *pubsublitepb.Reservation.
func (*ReservationIterator) Next ¶
func (it *ReservationIterator) Next() (*pubsublitepb.Reservation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ReservationIterator) PageInfo ¶
func (it *ReservationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SeekSubscriptionOperation ¶
type SeekSubscriptionOperation struct {
// contains filtered or unexported fields
}
SeekSubscriptionOperation manages a long-running operation from SeekSubscription.
func (*SeekSubscriptionOperation) Done ¶
func (op *SeekSubscriptionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*SeekSubscriptionOperation) Metadata ¶
func (op *SeekSubscriptionOperation) Metadata() (*pubsublitepb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*SeekSubscriptionOperation) Name ¶
func (op *SeekSubscriptionOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*SeekSubscriptionOperation) Poll ¶
func (op *SeekSubscriptionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*pubsublitepb.SeekSubscriptionResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*SeekSubscriptionOperation) Wait ¶
func (op *SeekSubscriptionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*pubsublitepb.SeekSubscriptionResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type StringIterator ¶
type StringIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) // contains filtered or unexported fields }
StringIterator manages a stream of string.
func (*StringIterator) Next ¶
func (it *StringIterator) Next() (string, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*StringIterator) PageInfo ¶
func (it *StringIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SubscriberCallOptions ¶
type SubscriberCallOptions struct { Subscribe []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
SubscriberCallOptions contains the retry settings for each method of SubscriberClient.
type SubscriberClient ¶
type SubscriberClient struct { // The call options for this service. CallOptions *SubscriberCallOptions // contains filtered or unexported fields }
SubscriberClient is a client for interacting with Pub/Sub Lite API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The service that a subscriber client application uses to receive messages from subscriptions.
func NewSubscriberClient ¶
func NewSubscriberClient(ctx context.Context, opts ...option.ClientOption) (*SubscriberClient, error)
NewSubscriberClient creates a new subscriber service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The service that a subscriber client application uses to receive messages
from subscriptions.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewSubscriberClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*SubscriberClient) CancelOperation ¶
func (c *SubscriberClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewSubscriberClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*SubscriberClient) Close ¶
func (c *SubscriberClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SubscriberClient) Connection ¶
func (c *SubscriberClient) 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 (*SubscriberClient) DeleteOperation ¶
func (c *SubscriberClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewSubscriberClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*SubscriberClient) GetOperation ¶
func (c *SubscriberClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewSubscriberClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SubscriberClient) ListOperations ¶
func (c *SubscriberClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewSubscriberClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
func (*SubscriberClient) Subscribe ¶
func (c *SubscriberClient) Subscribe(ctx context.Context, opts ...gax.CallOption) (pubsublitepb.SubscriberService_SubscribeClient, error)
Subscribe establishes a stream with the server for receiving messages.
Code:play
Example¶
package main
import (
"context"
"io"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewSubscriberClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.Subscribe(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*pubsublitepb.SubscribeRequest{
// TODO: Create requests.
}
for _, req := range reqs {
if err := stream.Send(req); err != nil {
// TODO: Handle error.
}
}
stream.CloseSend()
}()
for {
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// TODO: handle error.
}
// TODO: Use resp.
_ = resp
}
}
type SubscriptionIterator ¶
type SubscriptionIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsublitepb.Subscription, nextPageToken string, err error) // contains filtered or unexported fields }
SubscriptionIterator manages a stream of *pubsublitepb.Subscription.
func (*SubscriptionIterator) Next ¶
func (it *SubscriptionIterator) Next() (*pubsublitepb.Subscription, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*SubscriptionIterator) PageInfo ¶
func (it *SubscriptionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TopicIterator ¶
type TopicIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*pubsublitepb.Topic, nextPageToken string, err error) // contains filtered or unexported fields }
TopicIterator manages a stream of *pubsublitepb.Topic.
func (*TopicIterator) Next ¶
func (it *TopicIterator) Next() (*pubsublitepb.Topic, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*TopicIterator) PageInfo ¶
func (it *TopicIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TopicStatsCallOptions ¶
type TopicStatsCallOptions struct { ComputeMessageStats []gax.CallOption ComputeHeadCursor []gax.CallOption ComputeTimeCursor []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
TopicStatsCallOptions contains the retry settings for each method of TopicStatsClient.
type TopicStatsClient ¶
type TopicStatsClient struct { // The call options for this service. CallOptions *TopicStatsCallOptions // contains filtered or unexported fields }
TopicStatsClient is a client for interacting with Pub/Sub Lite API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This service allows users to get stats about messages in their topic.
func NewTopicStatsClient ¶
func NewTopicStatsClient(ctx context.Context, opts ...option.ClientOption) (*TopicStatsClient, error)
NewTopicStatsClient creates a new topic stats service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
This service allows users to get stats about messages in their topic.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*TopicStatsClient) CancelOperation ¶
func (c *TopicStatsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TopicStatsClient) Close ¶
func (c *TopicStatsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*TopicStatsClient) ComputeHeadCursor ¶
func (c *TopicStatsClient) ComputeHeadCursor(ctx context.Context, req *pubsublitepb.ComputeHeadCursorRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeHeadCursorResponse, error)
ComputeHeadCursor compute the head cursor for the partition.
The head cursor’s offset is guaranteed to be less than or equal to all
messages which have not yet been acknowledged as published, and
greater than the offset of any message whose publish has already
been acknowledged. It is zero if there have never been messages in the
partition.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ComputeHeadCursorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ComputeHeadCursorRequest.
}
resp, err := c.ComputeHeadCursor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TopicStatsClient) ComputeMessageStats ¶
func (c *TopicStatsClient) ComputeMessageStats(ctx context.Context, req *pubsublitepb.ComputeMessageStatsRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeMessageStatsResponse, error)
ComputeMessageStats compute statistics about a range of messages in a given topic and
partition.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ComputeMessageStatsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ComputeMessageStatsRequest.
}
resp, err := c.ComputeMessageStats(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TopicStatsClient) ComputeTimeCursor ¶
func (c *TopicStatsClient) ComputeTimeCursor(ctx context.Context, req *pubsublitepb.ComputeTimeCursorRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeTimeCursorResponse, error)
ComputeTimeCursor compute the corresponding cursor for a publish or event time in a topic
partition.
Code:play
Example¶
package main
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
pubsublitepb "cloud.google.com/go/pubsublite/apiv1/pubsublitepb"
)
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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ComputeTimeCursorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1/pubsublitepb#ComputeTimeCursorRequest.
}
resp, err := c.ComputeTimeCursor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TopicStatsClient) Connection ¶
func (c *TopicStatsClient) 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 (*TopicStatsClient) DeleteOperation ¶
func (c *TopicStatsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TopicStatsClient) GetOperation ¶
func (c *TopicStatsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TopicStatsClient) ListOperations ¶
func (c *TopicStatsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
)
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 := pubsublite.NewTopicStatsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
Source Files ¶
admin_client.go auxiliary.go cursor_client.go doc.go partition_assignment_client.go publisher_client.go subscriber_client.go topic_stats_client.go version.go
Directories ¶
Path | Synopsis |
---|---|
apiv1/pubsublitepb |
- Version
- v1.8.2 (latest)
- Published
- Jun 5, 2024
- Platform
- linux/amd64
- Imports
- 18 packages
- Last checked
- 5 days ago –
Tools for package owners.