v1

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

README

CloudEvent gRPC Protobuf Definitions

Overview

This repository includes the protobuf message and RPC method definitions for CloudEvent gRPC service, along with the corresponding Go code generated from these definitions.

Getting Started

Prerequisites

Make sure you have the following tools installed:

$ go install google.golang.org/protobuf/cmd/protoc-gen-go
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
Updating CloudEvent gRPC Service
  1. Modify the *.proto files to reflect your desired changes.

  2. Run the following command to update the generated code:

    go generate
    

    This step is crucial to ensure that your changes are applied to both the gRPC server and client stub.

Documentation

Index

Constants

View Source
const (
	CloudEventService_Publish_FullMethodName   = "/io.cloudevents.v1.CloudEventService/Publish"
	CloudEventService_Subscribe_FullMethodName = "/io.cloudevents.v1.CloudEventService/Subscribe"
)

Variables

View Source
var CloudEventService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "io.cloudevents.v1.CloudEventService",
	HandlerType: (*CloudEventServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Publish",
			Handler:    _CloudEventService_Publish_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Subscribe",
			Handler:       _CloudEventService_Subscribe_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "cloudevent.proto",
}

CloudEventService_ServiceDesc is the grpc.ServiceDesc for CloudEventService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_cloudevent_proto protoreflect.FileDescriptor

Functions

func RegisterCloudEventServiceServer

func RegisterCloudEventServiceServer(s grpc.ServiceRegistrar, srv CloudEventServiceServer)

Types

type CloudEvent

type CloudEvent struct {

	// Unique event identifier.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// URI of the event source.
	Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	// Version of the spec in use.
	SpecVersion string `protobuf:"bytes,3,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"`
	// Event type identifier.
	Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
	// Optional & Extension Attributes
	Attributes map[string]*CloudEventAttributeValue `` /* 161-byte string literal not displayed */
	// CloudEvent Data (Bytes, Text, or Proto)
	//
	// Types that are assignable to Data:
	//
	//	*CloudEvent_BinaryData
	//	*CloudEvent_TextData
	//	*CloudEvent_ProtoData
	Data isCloudEvent_Data `protobuf_oneof:"data"`
	// contains filtered or unexported fields
}

CloudEvent is copied from https://github.com/cloudevents/spec/blob/main/cloudevents/formats/protobuf-format.md.

func (*CloudEvent) Descriptor deprecated

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

Deprecated: Use CloudEvent.ProtoReflect.Descriptor instead.

func (*CloudEvent) GetAttributes

func (x *CloudEvent) GetAttributes() map[string]*CloudEventAttributeValue

func (*CloudEvent) GetBinaryData

func (x *CloudEvent) GetBinaryData() []byte

func (*CloudEvent) GetData

func (m *CloudEvent) GetData() isCloudEvent_Data

func (*CloudEvent) GetId

func (x *CloudEvent) GetId() string

func (*CloudEvent) GetProtoData

func (x *CloudEvent) GetProtoData() *any1.Any

func (*CloudEvent) GetSource

func (x *CloudEvent) GetSource() string

func (*CloudEvent) GetSpecVersion

func (x *CloudEvent) GetSpecVersion() string

func (*CloudEvent) GetTextData

func (x *CloudEvent) GetTextData() string

func (*CloudEvent) GetType

func (x *CloudEvent) GetType() string

func (*CloudEvent) ProtoMessage

func (*CloudEvent) ProtoMessage()

func (*CloudEvent) ProtoReflect

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

func (*CloudEvent) Reset

func (x *CloudEvent) Reset()

func (*CloudEvent) String

func (x *CloudEvent) String() string

type CloudEventAttributeValue

type CloudEventAttributeValue struct {

	// The value can be any one of these types.
	//
	// Types that are assignable to Attr:
	//
	//	*CloudEventAttributeValue_CeBoolean
	//	*CloudEventAttributeValue_CeInteger
	//	*CloudEventAttributeValue_CeString
	//	*CloudEventAttributeValue_CeBytes
	//	*CloudEventAttributeValue_CeUri
	//	*CloudEventAttributeValue_CeUriRef
	//	*CloudEventAttributeValue_CeTimestamp
	Attr isCloudEventAttributeValue_Attr `protobuf_oneof:"attr"`
	// contains filtered or unexported fields
}

CloudEventAttribute enables extensions to use any of the seven allowed data types as the value of an envelope key.

func (*CloudEventAttributeValue) Descriptor deprecated

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

Deprecated: Use CloudEventAttributeValue.ProtoReflect.Descriptor instead.

func (*CloudEventAttributeValue) GetAttr

func (m *CloudEventAttributeValue) GetAttr() isCloudEventAttributeValue_Attr

func (*CloudEventAttributeValue) GetCeBoolean

func (x *CloudEventAttributeValue) GetCeBoolean() bool

func (*CloudEventAttributeValue) GetCeBytes

func (x *CloudEventAttributeValue) GetCeBytes() []byte

func (*CloudEventAttributeValue) GetCeInteger

func (x *CloudEventAttributeValue) GetCeInteger() int32

func (*CloudEventAttributeValue) GetCeString

func (x *CloudEventAttributeValue) GetCeString() string

func (*CloudEventAttributeValue) GetCeTimestamp

func (x *CloudEventAttributeValue) GetCeTimestamp() *timestamp.Timestamp

func (*CloudEventAttributeValue) GetCeUri

func (x *CloudEventAttributeValue) GetCeUri() string

func (*CloudEventAttributeValue) GetCeUriRef

func (x *CloudEventAttributeValue) GetCeUriRef() string

func (*CloudEventAttributeValue) ProtoMessage

func (*CloudEventAttributeValue) ProtoMessage()

func (*CloudEventAttributeValue) ProtoReflect

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

func (*CloudEventAttributeValue) Reset

func (x *CloudEventAttributeValue) Reset()

func (*CloudEventAttributeValue) String

func (x *CloudEventAttributeValue) String() string

type CloudEventAttributeValue_CeBoolean

type CloudEventAttributeValue_CeBoolean struct {
	// Boolean value.
	CeBoolean bool `protobuf:"varint,1,opt,name=ce_boolean,json=ceBoolean,proto3,oneof"`
}

type CloudEventAttributeValue_CeBytes

type CloudEventAttributeValue_CeBytes struct {
	// Byte string value.
	CeBytes []byte `protobuf:"bytes,4,opt,name=ce_bytes,json=ceBytes,proto3,oneof"`
}

type CloudEventAttributeValue_CeInteger

type CloudEventAttributeValue_CeInteger struct {
	// Integer value.
	CeInteger int32 `protobuf:"varint,2,opt,name=ce_integer,json=ceInteger,proto3,oneof"`
}

type CloudEventAttributeValue_CeString

type CloudEventAttributeValue_CeString struct {
	// String value.
	CeString string `protobuf:"bytes,3,opt,name=ce_string,json=ceString,proto3,oneof"`
}

type CloudEventAttributeValue_CeTimestamp

type CloudEventAttributeValue_CeTimestamp struct {
	// Timestamp value.
	CeTimestamp *timestamp.Timestamp `protobuf:"bytes,7,opt,name=ce_timestamp,json=ceTimestamp,proto3,oneof"`
}

type CloudEventAttributeValue_CeUri

type CloudEventAttributeValue_CeUri struct {
	// URI value.
	CeUri string `protobuf:"bytes,5,opt,name=ce_uri,json=ceUri,proto3,oneof"`
}

type CloudEventAttributeValue_CeUriRef

type CloudEventAttributeValue_CeUriRef struct {
	// URI reference value.
	CeUriRef string `protobuf:"bytes,6,opt,name=ce_uri_ref,json=ceUriRef,proto3,oneof"`
}

type CloudEventServiceClient

type CloudEventServiceClient interface {
	Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	Subscribe(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (CloudEventService_SubscribeClient, error)
}

CloudEventServiceClient is the client API for CloudEventService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type CloudEventServiceServer

type CloudEventServiceServer interface {
	Publish(context.Context, *PublishRequest) (*empty.Empty, error)
	Subscribe(*SubscriptionRequest, CloudEventService_SubscribeServer) error
	// contains filtered or unexported methods
}

CloudEventServiceServer is the server API for CloudEventService service. All implementations must embed UnimplementedCloudEventServiceServer for forward compatibility

type CloudEventService_SubscribeClient

type CloudEventService_SubscribeClient interface {
	Recv() (*CloudEvent, error)
	grpc.ClientStream
}

type CloudEventService_SubscribeServer

type CloudEventService_SubscribeServer interface {
	Send(*CloudEvent) error
	grpc.ServerStream
}

type CloudEvent_BinaryData

type CloudEvent_BinaryData struct {
	// If the event is binary data then the datacontenttype attribute
	// should be set to an appropriate media-type.
	BinaryData []byte `protobuf:"bytes,6,opt,name=binary_data,json=binaryData,proto3,oneof"`
}

type CloudEvent_ProtoData

type CloudEvent_ProtoData struct {
	// If the event is a protobuf then it must be encoded using this Any
	// type. The datacontenttype attribute should be set to
	// application/protobuf and the dataschema attribute set to the message
	// type.
	ProtoData *any1.Any `protobuf:"bytes,8,opt,name=proto_data,json=protoData,proto3,oneof"`
}

type CloudEvent_TextData

type CloudEvent_TextData struct {
	// If the event is string data then the datacontenttype attribute
	// should be set to an appropriate media-type such as application/json.
	TextData string `protobuf:"bytes,7,opt,name=text_data,json=textData,proto3,oneof"`
}

type PublishRequest

type PublishRequest struct {

	// Required. The topic to which event should be published.
	// Format is `myhome/groundfloor/livingroom/temperature`.
	Topic string      `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Event *CloudEvent `protobuf:"bytes,2,opt,name=event,proto3" json:"event,omitempty"`
	// contains filtered or unexported fields
}

func (*PublishRequest) Descriptor deprecated

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

Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead.

func (*PublishRequest) GetEvent

func (x *PublishRequest) GetEvent() *CloudEvent

func (*PublishRequest) GetTopic

func (x *PublishRequest) GetTopic() string

func (*PublishRequest) ProtoMessage

func (*PublishRequest) ProtoMessage()

func (*PublishRequest) ProtoReflect

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

func (*PublishRequest) Reset

func (x *PublishRequest) Reset()

func (*PublishRequest) String

func (x *PublishRequest) String() string

type SubscriptionRequest

type SubscriptionRequest struct {

	// Required. The topic from which event should be pulled.
	// Format is `myhome/groundfloor/livingroom/temperature`.
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// contains filtered or unexported fields
}

func (*SubscriptionRequest) Descriptor deprecated

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

Deprecated: Use SubscriptionRequest.ProtoReflect.Descriptor instead.

func (*SubscriptionRequest) GetTopic

func (x *SubscriptionRequest) GetTopic() string

func (*SubscriptionRequest) ProtoMessage

func (*SubscriptionRequest) ProtoMessage()

func (*SubscriptionRequest) ProtoReflect

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

func (*SubscriptionRequest) Reset

func (x *SubscriptionRequest) Reset()

func (*SubscriptionRequest) String

func (x *SubscriptionRequest) String() string

type UnimplementedCloudEventServiceServer

type UnimplementedCloudEventServiceServer struct {
}

UnimplementedCloudEventServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedCloudEventServiceServer) Publish

func (UnimplementedCloudEventServiceServer) Subscribe

type UnsafeCloudEventServiceServer

type UnsafeCloudEventServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeCloudEventServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CloudEventServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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