pubsub

package
v0.0.0-...-e560ebb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType_name = map[int32]string{
		0: "UPDATE_TYPE_UNSPECIFIED",
		1: "CREATE",
		2: "UPDATE_FAST_FORWARD",
		3: "UPDATE_NON_FAST_FORWARD",
		4: "DELETE",
	}
	SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType_value = map[string]int32{
		"UPDATE_TYPE_UNSPECIFIED": 0,
		"CREATE":                  1,
		"UPDATE_FAST_FORWARD":     2,
		"UPDATE_NON_FAST_FORWARD": 3,
		"DELETE":                  4,
	}
)

Enum value maps for SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType.

View Source
var File_backend_pubsub_source_repo_event_proto protoreflect.FileDescriptor

Functions

func NewClient

func NewClient(ctx context.Context, gaeProject, subscriptionName string) (*pubsub.Subscription, error)

NewClient initializes pubsub subscription.

func Subscribe

func Subscribe(ctx context.Context, sub pubsubReceiver,
	messageProcessor ProcessPubsubMessage) error

Subscribe subscribes to pubsub and blocks until context is cancelled.

Types

type ProcessPubsubMessage

type ProcessPubsubMessage func(context.Context, *SourceRepoEvent) error

ProcessPubsubMessage handles SourceRepoEvent pubsub message. If error is nil, the original message is acked and removed. Otherwise, the message will be available for consumptions again.

func Processor

func Processor(host *config.Host) ProcessPubsubMessage

Processor returns function which is called each time there is a new SourceRepoEvent.

type SourceRepoEvent

type SourceRepoEvent struct {

	// The name of the repo that has changed. Values are of the form
	// `projects/<project>/repos/<repo>`.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// URL to clone the repository from Google Cloud Source Repositories.
	Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	// The timestamp that this event happened.
	EventTime string `protobuf:"bytes,3,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"`
	// The detail data of the event.
	//
	// Types that are assignable to Event:
	//	*SourceRepoEvent_RefUpdateEvent_
	//	*SourceRepoEvent_CreateRepoEvent_
	//	*SourceRepoEvent_DeleteRepoEvent_
	Event isSourceRepoEvent_Event `protobuf_oneof:"event"`
	// contains filtered or unexported fields
}

Cloud Pub/Sub message payload for all events in Source Repo API.

func (*SourceRepoEvent) Descriptor deprecated

func (*SourceRepoEvent) Descriptor() ([]byte, []int)

Deprecated: Use SourceRepoEvent.ProtoReflect.Descriptor instead.

func (*SourceRepoEvent) GetCreateRepoEvent

func (x *SourceRepoEvent) GetCreateRepoEvent() *SourceRepoEvent_CreateRepoEvent

func (*SourceRepoEvent) GetDeleteRepoEvent

func (x *SourceRepoEvent) GetDeleteRepoEvent() *SourceRepoEvent_DeleteRepoEvent

func (*SourceRepoEvent) GetEvent

func (m *SourceRepoEvent) GetEvent() isSourceRepoEvent_Event

func (*SourceRepoEvent) GetEventTime

func (x *SourceRepoEvent) GetEventTime() string

func (*SourceRepoEvent) GetName

func (x *SourceRepoEvent) GetName() string

func (*SourceRepoEvent) GetRefUpdateEvent

func (x *SourceRepoEvent) GetRefUpdateEvent() *SourceRepoEvent_RefUpdateEvent

func (*SourceRepoEvent) GetUrl

func (x *SourceRepoEvent) GetUrl() string

func (*SourceRepoEvent) ProtoMessage

func (*SourceRepoEvent) ProtoMessage()

func (*SourceRepoEvent) ProtoReflect

func (x *SourceRepoEvent) ProtoReflect() protoreflect.Message

func (*SourceRepoEvent) Reset

func (x *SourceRepoEvent) Reset()

func (*SourceRepoEvent) String

func (x *SourceRepoEvent) String() string

type SourceRepoEvent_CreateRepoEvent

type SourceRepoEvent_CreateRepoEvent struct {
	// contains filtered or unexported fields
}

An event that created a repository.

func (*SourceRepoEvent_CreateRepoEvent) Descriptor deprecated

func (*SourceRepoEvent_CreateRepoEvent) Descriptor() ([]byte, []int)

Deprecated: Use SourceRepoEvent_CreateRepoEvent.ProtoReflect.Descriptor instead.

func (*SourceRepoEvent_CreateRepoEvent) ProtoMessage

func (*SourceRepoEvent_CreateRepoEvent) ProtoMessage()

func (*SourceRepoEvent_CreateRepoEvent) ProtoReflect

func (*SourceRepoEvent_CreateRepoEvent) Reset

func (*SourceRepoEvent_CreateRepoEvent) String

type SourceRepoEvent_CreateRepoEvent_

type SourceRepoEvent_CreateRepoEvent_ struct {
	CreateRepoEvent *SourceRepoEvent_CreateRepoEvent `protobuf:"bytes,5,opt,name=create_repo_event,json=createRepoEvent,proto3,oneof"`
}

type SourceRepoEvent_DeleteRepoEvent

type SourceRepoEvent_DeleteRepoEvent struct {
	// contains filtered or unexported fields
}

An event that deleted a repository.

func (*SourceRepoEvent_DeleteRepoEvent) Descriptor deprecated

func (*SourceRepoEvent_DeleteRepoEvent) Descriptor() ([]byte, []int)

Deprecated: Use SourceRepoEvent_DeleteRepoEvent.ProtoReflect.Descriptor instead.

func (*SourceRepoEvent_DeleteRepoEvent) ProtoMessage

func (*SourceRepoEvent_DeleteRepoEvent) ProtoMessage()

func (*SourceRepoEvent_DeleteRepoEvent) ProtoReflect

func (*SourceRepoEvent_DeleteRepoEvent) Reset

func (*SourceRepoEvent_DeleteRepoEvent) String

type SourceRepoEvent_DeleteRepoEvent_

type SourceRepoEvent_DeleteRepoEvent_ struct {
	DeleteRepoEvent *SourceRepoEvent_DeleteRepoEvent `protobuf:"bytes,6,opt,name=delete_repo_event,json=deleteRepoEvent,proto3,oneof"`
}

type SourceRepoEvent_RefUpdateEvent

type SourceRepoEvent_RefUpdateEvent struct {

	// The user who performed the ref updates.
	Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	// Updates on references, keyed by the names of the references.
	RefUpdates map[string]*SourceRepoEvent_RefUpdateEvent_RefUpdate `` /* 179-byte string literal not displayed */
	// contains filtered or unexported fields
}

An event that changed references.

func (*SourceRepoEvent_RefUpdateEvent) Descriptor deprecated

func (*SourceRepoEvent_RefUpdateEvent) Descriptor() ([]byte, []int)

Deprecated: Use SourceRepoEvent_RefUpdateEvent.ProtoReflect.Descriptor instead.

func (*SourceRepoEvent_RefUpdateEvent) GetEmail

func (x *SourceRepoEvent_RefUpdateEvent) GetEmail() string

func (*SourceRepoEvent_RefUpdateEvent) GetRefUpdates

func (*SourceRepoEvent_RefUpdateEvent) ProtoMessage

func (*SourceRepoEvent_RefUpdateEvent) ProtoMessage()

func (*SourceRepoEvent_RefUpdateEvent) ProtoReflect

func (*SourceRepoEvent_RefUpdateEvent) Reset

func (x *SourceRepoEvent_RefUpdateEvent) Reset()

func (*SourceRepoEvent_RefUpdateEvent) String

type SourceRepoEvent_RefUpdateEvent_

type SourceRepoEvent_RefUpdateEvent_ struct {
	RefUpdateEvent *SourceRepoEvent_RefUpdateEvent `protobuf:"bytes,4,opt,name=ref_update_event,json=refUpdateEvent,proto3,oneof"`
}

type SourceRepoEvent_RefUpdateEvent_RefUpdate

type SourceRepoEvent_RefUpdateEvent_RefUpdate struct {

	// The name of the reference. Values are of the form `refs/...` (e.g.
	// `refs/heads/master`).
	RefName string `protobuf:"bytes,1,opt,name=ref_name,json=refName,proto3" json:"ref_name,omitempty"`
	// The type of the update.
	UpdateType SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType `` /* 156-byte string literal not displayed */
	// The previous object ID that the ref pointed to.
	OldId string `protobuf:"bytes,3,opt,name=old_id,json=oldId,proto3" json:"old_id,omitempty"`
	// The new object ID that the ref points to.
	NewId string `protobuf:"bytes,4,opt,name=new_id,json=newId,proto3" json:"new_id,omitempty"`
	// contains filtered or unexported fields
}

An update on a reference.

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) Descriptor deprecated

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) Descriptor() ([]byte, []int)

Deprecated: Use SourceRepoEvent_RefUpdateEvent_RefUpdate.ProtoReflect.Descriptor instead.

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) GetNewId

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) GetOldId

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) GetRefName

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) GetUpdateType

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) ProtoMessage

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) ProtoReflect

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) Reset

func (*SourceRepoEvent_RefUpdateEvent_RefUpdate) String

type SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType

type SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType int32

The type of the update.

const (
	SourceRepoEvent_RefUpdateEvent_RefUpdate_UPDATE_TYPE_UNSPECIFIED SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType = 0
	// Create a new ref.
	SourceRepoEvent_RefUpdateEvent_RefUpdate_CREATE SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType = 1
	// Update the object that the ref points to.
	SourceRepoEvent_RefUpdateEvent_RefUpdate_UPDATE_FAST_FORWARD SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType = 2
	// Update the object that the ref points to forcibly.
	SourceRepoEvent_RefUpdateEvent_RefUpdate_UPDATE_NON_FAST_FORWARD SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType = 3
	// Delete the ref.
	SourceRepoEvent_RefUpdateEvent_RefUpdate_DELETE SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType = 4
)

func (SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType) Descriptor

func (SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType) Enum

func (SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType) EnumDescriptor deprecated

Deprecated: Use SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType.Descriptor instead.

func (SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType) Number

func (SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType) String

func (SourceRepoEvent_RefUpdateEvent_RefUpdate_UpdateType) Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL