protocol

package
Version: v0.0.0-...-71bd322 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package protocol hosts protobuf messages for the CIPD plugin system.

Index

Constants

This section is empty.

Variables

View Source
var Admissions_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cipd.plugin.Admissions",
	HandlerType: (*AdmissionsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ResolveAdmission",
			Handler:    _Admissions_ResolveAdmission_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListAdmissions",
			Handler:       _Admissions_ListAdmissions_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "go.chromium.org/luci/cipd/client/cipd/plugin/protocol/admission.proto",
}

Admissions_ServiceDesc is the grpc.ServiceDesc for Admissions 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_go_chromium_org_luci_cipd_client_cipd_plugin_protocol_admission_proto protoreflect.FileDescriptor
View Source
var File_go_chromium_org_luci_cipd_client_cipd_plugin_protocol_plugin_proto protoreflect.FileDescriptor
View Source
var Host_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cipd.plugin.Host",
	HandlerType: (*HostServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Log",
			Handler:    _Host_Log_Handler,
		},
		{
			MethodName: "ListMetadata",
			Handler:    _Host_ListMetadata_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "go.chromium.org/luci/cipd/client/cipd/plugin/protocol/plugin.proto",
}

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

Functions

func RegisterAdmissionsServer

func RegisterAdmissionsServer(s grpc.ServiceRegistrar, srv AdmissionsServer)

func RegisterHostServer

func RegisterHostServer(s grpc.ServiceRegistrar, srv HostServer)

Types

type Admission

type Admission struct {
	AdmissionId string        `protobuf:"bytes,1,opt,name=admission_id,json=admissionId,proto3" json:"admission_id,omitempty"` // an opaque ID identifies this request
	ServiceUrl  string        `protobuf:"bytes,2,opt,name=service_url,json=serviceUrl,proto3" json:"service_url,omitempty"`    // https:// address of the CIPD backend
	Package     string        `protobuf:"bytes,3,opt,name=package,proto3" json:"package,omitempty"`                            // a package being installed
	Instance    *v1.ObjectRef `protobuf:"bytes,4,opt,name=instance,proto3" json:"instance,omitempty"`                          // a concrete package instance being installed
	// contains filtered or unexported fields
}

Admission is sent by CIPD client when it attempts to install a package.

The plugin may allow or forbid this via ResolveAdmission RPC.

func (*Admission) Descriptor deprecated

This method has been deprecated.
func (*Admission) Descriptor() ([]byte, []int)

Deprecated: Use Admission.ProtoReflect.Descriptor instead.

func (*Admission) GetAdmissionId

func (x *Admission) GetAdmissionId() string

func (*Admission) GetInstance

func (x *Admission) GetInstance() *v1.ObjectRef

func (*Admission) GetPackage

func (x *Admission) GetPackage() string

func (*Admission) GetServiceUrl

func (x *Admission) GetServiceUrl() string

func (*Admission) ProtoMessage

func (*Admission) ProtoMessage()

func (*Admission) ProtoReflect

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

func (*Admission) Reset

func (x *Admission) Reset()

func (*Admission) String

func (x *Admission) String() string

type AdmissionsClient

type AdmissionsClient interface {
	// ListAdmissions returns a stream of admission requests to process.
	ListAdmissions(ctx context.Context, in *ListAdmissionsRequest, opts ...grpc.CallOption) (Admissions_ListAdmissionsClient, error)
	// ResolveAdmission submits a decision on an admission request.
	ResolveAdmission(ctx context.Context, in *ResolveAdmissionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

AdmissionsClient is the client API for Admissions 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.

func NewAdmissionsClient

func NewAdmissionsClient(cc grpc.ClientConnInterface) AdmissionsClient

type AdmissionsServer

type AdmissionsServer interface {
	// ListAdmissions returns a stream of admission requests to process.
	ListAdmissions(*ListAdmissionsRequest, Admissions_ListAdmissionsServer) error
	// ResolveAdmission submits a decision on an admission request.
	ResolveAdmission(context.Context, *ResolveAdmissionRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

AdmissionsServer is the server API for Admissions service. All implementations must embed UnimplementedAdmissionsServer for forward compatibility

type Admissions_ListAdmissionsClient

type Admissions_ListAdmissionsClient interface {
	Recv() (*Admission, error)
	grpc.ClientStream
}

type Admissions_ListAdmissionsServer

type Admissions_ListAdmissionsServer interface {
	Send(*Admission) error
	grpc.ServerStream
}

type Handshake

type Handshake struct {
	Port   int32  `protobuf:"varint,1,opt,name=port,proto3" json:"port,omitempty"`    // localhost TCP port to connect to
	Ticket string `protobuf:"bytes,2,opt,name=ticket,proto3" json:"ticket,omitempty"` // a secret string to send as x-plugin-ticket metadata
	// contains filtered or unexported fields
}

Handshake is sent in a compact (no new lines) JSONPB encoding over stdin from the plugin host (e.g. CIPD client) to the plugin process.

It instructs the plugin how to connect and authenticate to the host.

func (*Handshake) Descriptor deprecated

This method has been deprecated.
func (*Handshake) Descriptor() ([]byte, []int)

Deprecated: Use Handshake.ProtoReflect.Descriptor instead.

func (*Handshake) GetPort

func (x *Handshake) GetPort() int32

func (*Handshake) GetTicket

func (x *Handshake) GetTicket() string

func (*Handshake) ProtoMessage

func (*Handshake) ProtoMessage()

func (*Handshake) ProtoReflect

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

func (*Handshake) Reset

func (x *Handshake) Reset()

func (*Handshake) String

func (x *Handshake) String() string

type HostClient

type HostClient interface {
	// Log adds a logging message to the CIPD client logging output.
	Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Lists metadata entries attached to a package instance.
	//
	// Either returns all metadata or only entries with requested keys. The list
	// is sorted by the registration time of metadata entries (the most recent
	// first).
	//
	// Returns one page of the results. Use `next_page_token` to fetch the next
	// page. The last page has `next_page_token` empty.
	ListMetadata(ctx context.Context, in *ListMetadataRequest, opts ...grpc.CallOption) (*ListMetadataResponse, error)
}

HostClient is the client API for Host 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.

func NewHostClient

func NewHostClient(cc grpc.ClientConnInterface) HostClient

type HostServer

type HostServer interface {
	// Log adds a logging message to the CIPD client logging output.
	Log(context.Context, *LogRequest) (*emptypb.Empty, error)
	// Lists metadata entries attached to a package instance.
	//
	// Either returns all metadata or only entries with requested keys. The list
	// is sorted by the registration time of metadata entries (the most recent
	// first).
	//
	// Returns one page of the results. Use `next_page_token` to fetch the next
	// page. The last page has `next_page_token` empty.
	ListMetadata(context.Context, *ListMetadataRequest) (*ListMetadataResponse, error)
	// contains filtered or unexported methods
}

HostServer is the server API for Host service. All implementations must embed UnimplementedHostServer for forward compatibility

type ListAdmissionsRequest

type ListAdmissionsRequest struct {
	ProtocolVersion int32  `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` // currently should be 1
	PluginVersion   string `protobuf:"bytes,2,opt,name=plugin_version,json=pluginVersion,proto3" json:"plugin_version,omitempty"`        // arbitrary string for logs
	// contains filtered or unexported fields
}

ListAdmissionsRequest carries arguments for ListAdmissions RPC.

func (*ListAdmissionsRequest) Descriptor deprecated

This method has been deprecated.
func (*ListAdmissionsRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListAdmissionsRequest.ProtoReflect.Descriptor instead.

func (*ListAdmissionsRequest) GetPluginVersion

func (x *ListAdmissionsRequest) GetPluginVersion() string

func (*ListAdmissionsRequest) GetProtocolVersion

func (x *ListAdmissionsRequest) GetProtocolVersion() int32

func (*ListAdmissionsRequest) ProtoMessage

func (*ListAdmissionsRequest) ProtoMessage()

func (*ListAdmissionsRequest) ProtoReflect

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

func (*ListAdmissionsRequest) Reset

func (x *ListAdmissionsRequest) Reset()

func (*ListAdmissionsRequest) String

func (x *ListAdmissionsRequest) String() string

type ListMetadataRequest

type ListMetadataRequest struct {

	// URL ("https://...") of the CIPD backend that hosts the package.
	ServiceUrl string `protobuf:"bytes,1,opt,name=service_url,json=serviceUrl,proto3" json:"service_url,omitempty"`
	// The package that holds the instance we list metadata of.
	Package string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"`
	// The instance to list metadata of.
	Instance *v1.ObjectRef `protobuf:"bytes,3,opt,name=instance,proto3" json:"instance,omitempty"`
	// Metadata keys to limit the listing to or empty to list all metadata.
	Keys []string `protobuf:"bytes,4,rep,name=keys,proto3" json:"keys,omitempty"`
	// Maximum number of results to return on one page.
	PageSize int32 `protobuf:"varint,20,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// Value of 'next_page_token' from the previous response.
	PageToken string `protobuf:"bytes,21,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	// contains filtered or unexported fields
}

ListMetadataRequest contains arguments for ListMetadata RPC.

func (*ListMetadataRequest) Descriptor deprecated

This method has been deprecated.
func (*ListMetadataRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListMetadataRequest.ProtoReflect.Descriptor instead.

func (*ListMetadataRequest) GetInstance

func (x *ListMetadataRequest) GetInstance() *v1.ObjectRef

func (*ListMetadataRequest) GetKeys

func (x *ListMetadataRequest) GetKeys() []string

func (*ListMetadataRequest) GetPackage

func (x *ListMetadataRequest) GetPackage() string

func (*ListMetadataRequest) GetPageSize

func (x *ListMetadataRequest) GetPageSize() int32

func (*ListMetadataRequest) GetPageToken

func (x *ListMetadataRequest) GetPageToken() string

func (*ListMetadataRequest) GetServiceUrl

func (x *ListMetadataRequest) GetServiceUrl() string

func (*ListMetadataRequest) ProtoMessage

func (*ListMetadataRequest) ProtoMessage()

func (*ListMetadataRequest) ProtoReflect

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

func (*ListMetadataRequest) Reset

func (x *ListMetadataRequest) Reset()

func (*ListMetadataRequest) String

func (x *ListMetadataRequest) String() string

type ListMetadataResponse

type ListMetadataResponse struct {

	// Discovered metadata ordered by 'attached_ts' (the most recent first).
	Metadata []*v1.InstanceMetadata `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// Not empty if potentially have more metadata, can be passed to ListMetadata.
	NextPageToken string `protobuf:"bytes,20,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

ListMetadataResponse contains one page of results.

func (*ListMetadataResponse) Descriptor deprecated

This method has been deprecated.
func (*ListMetadataResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListMetadataResponse.ProtoReflect.Descriptor instead.

func (*ListMetadataResponse) GetMetadata

func (x *ListMetadataResponse) GetMetadata() []*v1.InstanceMetadata

func (*ListMetadataResponse) GetNextPageToken

func (x *ListMetadataResponse) GetNextPageToken() string

func (*ListMetadataResponse) ProtoMessage

func (*ListMetadataResponse) ProtoMessage()

func (*ListMetadataResponse) ProtoReflect

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

func (*ListMetadataResponse) Reset

func (x *ListMetadataResponse) Reset()

func (*ListMetadataResponse) String

func (x *ListMetadataResponse) String() string

type LogRequest

type LogRequest struct {
	Severity string `protobuf:"bytes,1,opt,name=severity,proto3" json:"severity,omitempty"` // "debug", info", "warning", "error"
	Message  string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

LogRequest results in a logging line in the CIPD client log.

func (*LogRequest) Descriptor deprecated

This method has been deprecated.
func (*LogRequest) Descriptor() ([]byte, []int)

Deprecated: Use LogRequest.ProtoReflect.Descriptor instead.

func (*LogRequest) GetMessage

func (x *LogRequest) GetMessage() string

func (*LogRequest) GetSeverity

func (x *LogRequest) GetSeverity() string

func (*LogRequest) ProtoMessage

func (*LogRequest) ProtoMessage()

func (*LogRequest) ProtoReflect

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

func (*LogRequest) Reset

func (x *LogRequest) Reset()

func (*LogRequest) String

func (x *LogRequest) String() string

type ResolveAdmissionRequest

type ResolveAdmissionRequest struct {
	AdmissionId string         `protobuf:"bytes,1,opt,name=admission_id,json=admissionId,proto3" json:"admission_id,omitempty"` // same as in the corresponding Admission
	Status      *status.Status `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`                              // not OK if the deployment is denied
	// contains filtered or unexported fields
}

ResolveAdmissionRequest carries a judgment on some Admission.

func (*ResolveAdmissionRequest) Descriptor deprecated

This method has been deprecated.
func (*ResolveAdmissionRequest) Descriptor() ([]byte, []int)

Deprecated: Use ResolveAdmissionRequest.ProtoReflect.Descriptor instead.

func (*ResolveAdmissionRequest) GetAdmissionId

func (x *ResolveAdmissionRequest) GetAdmissionId() string

func (*ResolveAdmissionRequest) GetStatus

func (x *ResolveAdmissionRequest) GetStatus() *status.Status

func (*ResolveAdmissionRequest) ProtoMessage

func (*ResolveAdmissionRequest) ProtoMessage()

func (*ResolveAdmissionRequest) ProtoReflect

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

func (*ResolveAdmissionRequest) Reset

func (x *ResolveAdmissionRequest) Reset()

func (*ResolveAdmissionRequest) String

func (x *ResolveAdmissionRequest) String() string

type UnimplementedAdmissionsServer

type UnimplementedAdmissionsServer struct {
}

UnimplementedAdmissionsServer must be embedded to have forward compatible implementations.

func (UnimplementedAdmissionsServer) ListAdmissions

func (UnimplementedAdmissionsServer) ResolveAdmission

type UnimplementedHostServer

type UnimplementedHostServer struct {
}

UnimplementedHostServer must be embedded to have forward compatible implementations.

func (UnimplementedHostServer) ListMetadata

func (UnimplementedHostServer) Log

type UnsafeAdmissionsServer

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

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

type UnsafeHostServer

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto