rpc

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package rpc is a generated protocol buffer package.

It is generated from these files:

rpc.proto

It has these top-level messages:

GetLogsRequest
GetLogsResponse
AppArchive
Version
UpOptions
UpRequest
UpSummary
UpMessage

Index

Constants

This section is empty.

Variables

View Source
var UpSummary_StatusCode_name = map[int32]string{
	0: "UNKNOWN",
	1: "LOGGING",
	2: "STARTED",
	3: "ONGOING",
	4: "SUCCESS",
	5: "FAILURE",
}
View Source
var UpSummary_StatusCode_value = map[string]int32{
	"UNKNOWN": 0,
	"LOGGING": 1,
	"STARTED": 2,
	"ONGOING": 3,
	"SUCCESS": 4,
	"FAILURE": 5,
}

Functions

func RegisterDraftServer

func RegisterDraftServer(s *grpc.Server, srv DraftServer)

Types

type AppArchive

type AppArchive struct {
	Name    string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
}

AppArchive represents the archived application included in a `draft up`.

func (*AppArchive) Descriptor

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

func (*AppArchive) GetContent

func (m *AppArchive) GetContent() []byte

func (*AppArchive) GetName

func (m *AppArchive) GetName() string

func (*AppArchive) ProtoMessage

func (*AppArchive) ProtoMessage()

func (*AppArchive) Reset

func (m *AppArchive) Reset()

func (*AppArchive) String

func (m *AppArchive) String() string

type Client

type Client interface {
	Version(context.Context) (*version.Version, error)
	UpBuild(context.Context, *UpRequest, chan<- *UpSummary) error
	UpStream(context.Context, <-chan *UpRequest, chan<- *UpSummary) error
	GetLogs(context.Context, *GetLogsRequest) (*GetLogsResponse, error)
}

Client handles rpc to the Server.

func NewClient

func NewClient(opts ...ClientOpt) Client

NewClient returns a Client configured with the provided ClientOpts.

type ClientOpt

type ClientOpt func(*clientOpts)

ClientOpt is an optional configuration for a client.

func DefaultClientOpts added in v0.10.0

func DefaultClientOpts() []ClientOpt

DefaultClientOpts returns the set of default rpc ClientOpts the draft client requires.

func WithGrpcDialOpt added in v0.10.0

func WithGrpcDialOpt(dialOpts ...grpc.DialOption) ClientOpt

WithGrpcDialOpt adds the provided grpc.DialOptions for the rpc.Client to use when initializing the underlying grpc.Client.

func WithServerAddr

func WithServerAddr(addr string) ClientOpt

WithServerAddr sets the draft server address the client should dial when invoking an rpc.

func WithServerHost

func WithServerHost(host string) ClientOpt

WithServerHost sets the draft server host the client should use when invoking an rpc.

type DraftClient

type DraftClient interface {
	// GetVersion returns the current version of the server.
	GetVersion(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*Version, error)
	// GetLogs returns the logs for a particular draft build.
	GetLogs(ctx context.Context, in *GetLogsRequest, opts ...grpc.CallOption) (*GetLogsResponse, error)
	// UpBuild returns a stream of the UpSummary within
	// for a given draft upload.
	//
	// Results are streamed rather than returned at once so
	// each stage of a draft up may be distinguished by the
	// client as a distinct message.
	UpBuild(ctx context.Context, in *UpMessage, opts ...grpc.CallOption) (Draft_UpBuildClient, error)
	// A Bidirectional streaming RPC.
	//
	// Accepts a stream of UpMessages each representing a separate
	// draft up. This is the api invoked by the draft client when
	// doing a draft up with watch enabled.
	UpStream(ctx context.Context, opts ...grpc.CallOption) (Draft_UpStreamClient, error)
}

func NewDraftClient

func NewDraftClient(cc *grpc.ClientConn) DraftClient

type DraftServer

type DraftServer interface {
	// GetVersion returns the current version of the server.
	GetVersion(context.Context, *google_protobuf.Empty) (*Version, error)
	// GetLogs returns the logs for a particular draft build.
	GetLogs(context.Context, *GetLogsRequest) (*GetLogsResponse, error)
	// UpBuild returns a stream of the UpSummary within
	// for a given draft upload.
	//
	// Results are streamed rather than returned at once so
	// each stage of a draft up may be distinguished by the
	// client as a distinct message.
	UpBuild(*UpMessage, Draft_UpBuildServer) error
	// A Bidirectional streaming RPC.
	//
	// Accepts a stream of UpMessages each representing a separate
	// draft up. This is the api invoked by the draft client when
	// doing a draft up with watch enabled.
	UpStream(Draft_UpStreamServer) error
}

type Draft_UpBuildClient

type Draft_UpBuildClient interface {
	Recv() (*UpMessage, error)
	grpc.ClientStream
}

type Draft_UpBuildServer

type Draft_UpBuildServer interface {
	Send(*UpMessage) error
	grpc.ServerStream
}

type Draft_UpStreamClient

type Draft_UpStreamClient interface {
	Send(*UpMessage) error
	Recv() (*UpMessage, error)
	grpc.ClientStream
}

type Draft_UpStreamServer

type Draft_UpStreamServer interface {
	Send(*UpMessage) error
	Recv() (*UpMessage, error)
	grpc.ServerStream
}

type GetLogsRequest added in v0.11.0

type GetLogsRequest struct {
	AppName string `protobuf:"bytes,1,opt,name=app_name,json=appName" json:"app_name,omitempty"`
	BuildID string `protobuf:"bytes,2,opt,name=buildID" json:"buildID,omitempty"`
	Limit   int64  `protobuf:"varint,3,opt,name=limit" json:"limit,omitempty"`
}

GetLogsRequest is the message sent to draftd to retrieve logs for a draft build.

func (*GetLogsRequest) Descriptor added in v0.11.0

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

func (*GetLogsRequest) GetAppName added in v0.11.0

func (m *GetLogsRequest) GetAppName() string

func (*GetLogsRequest) GetBuildID added in v0.11.0

func (m *GetLogsRequest) GetBuildID() string

func (*GetLogsRequest) GetLimit added in v0.11.0

func (m *GetLogsRequest) GetLimit() int64

func (*GetLogsRequest) ProtoMessage added in v0.11.0

func (*GetLogsRequest) ProtoMessage()

func (*GetLogsRequest) Reset added in v0.11.0

func (m *GetLogsRequest) Reset()

func (*GetLogsRequest) String added in v0.11.0

func (m *GetLogsRequest) String() string

type GetLogsResponse added in v0.11.0

type GetLogsResponse struct {
	Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
}

GetLogsResponse is the message returned by draftd containing the logs (up to limit) for a draft build.

func (*GetLogsResponse) Descriptor added in v0.11.0

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

func (*GetLogsResponse) GetContent added in v0.11.0

func (m *GetLogsResponse) GetContent() []byte

func (*GetLogsResponse) ProtoMessage added in v0.11.0

func (*GetLogsResponse) ProtoMessage()

func (*GetLogsResponse) Reset added in v0.11.0

func (m *GetLogsResponse) Reset()

func (*GetLogsResponse) String added in v0.11.0

func (m *GetLogsResponse) String() string

type Handler

type Handler interface {
	LogsHandler
	UpHandler
}

Handler is the api surface to the rpc package. When calling Server.Server, requests are dispatched specific embedded interfaces within Handler.

type LogsHandler added in v0.11.0

type LogsHandler interface {
	// Logs is the handler to fetch logs for a draft build.
	Logs(context.Context, *GetLogsRequest) (*GetLogsResponse, error)
}

LogsHandler is the mechanism by which draft build logs requests initiated by the draft client are dispatched by the rpc.Server.

type RecvStream

type RecvStream interface {
	Done() <-chan struct{}
	Recv() *UpSummary
	Err() error
	Stop()
}

RecvStream is returned by a Client for streaming summaries in response to a draft up. Stop should be called on return to notify the stream to close.

type Server

type Server interface {
	Serve(net.Listener, Handler) error
	Stop() bool
}

Server handles rpc made by the client.

func NewServer

func NewServer(opts ...ServerOpt) Server

NewServer returns a Server configured with the provided ServerOpts.

type ServerOpt

type ServerOpt func(*serverOpts)

ServerOpt is an optional configuration for a server.

func DefaultServerOpts added in v0.10.0

func DefaultServerOpts() []ServerOpt

DefaultServerOpts returns the set of default rpc ServerOpts that draftd requires.

func WithGrpcServerOpt added in v0.10.0

func WithGrpcServerOpt(grpcOpts ...grpc.ServerOption) ServerOpt

WithGrpcServerOpt adds the provided grpc.ServerOption for the rpc.Server to use when initializing the underlying grpc.Server.

type UpHandler

type UpHandler interface {
	Up(context.Context, *UpRequest) <-chan *UpSummary
}

UpHandler is the mechanism by which to accept draft up requests initiated by the draft client dispatched by the rpc.Server.

type UpMessage

type UpMessage struct {
	// Types that are valid to be assigned to Message:
	//	*UpMessage_UpRequest
	//	*UpMessage_UpSummary
	Message isUpMessage_Message `protobuf_oneof:"Message"`
}

UpMessage is the discriminated union of draft up messages exchanged between the client and server.

func (*UpMessage) Descriptor

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

func (*UpMessage) GetMessage

func (m *UpMessage) GetMessage() isUpMessage_Message

func (*UpMessage) GetUpRequest

func (m *UpMessage) GetUpRequest() *UpRequest

func (*UpMessage) GetUpSummary

func (m *UpMessage) GetUpSummary() *UpSummary

func (*UpMessage) ProtoMessage

func (*UpMessage) ProtoMessage()

func (*UpMessage) Reset

func (m *UpMessage) Reset()

func (*UpMessage) String

func (m *UpMessage) String() string

func (*UpMessage) XXX_OneofFuncs

func (*UpMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type UpMessage_UpRequest

type UpMessage_UpRequest struct {
	UpRequest *UpRequest `protobuf:"bytes,1,opt,name=up_request,json=upRequest,oneof"`
}

type UpMessage_UpSummary

type UpMessage_UpSummary struct {
	UpSummary *UpSummary `protobuf:"bytes,2,opt,name=up_summary,json=upSummary,oneof"`
}

type UpOptions

type UpOptions struct {
	ReleaseWait bool `protobuf:"varint,1,opt,name=release_wait,json=releaseWait" json:"release_wait,omitempty"`
}

UpOptions are configurable settings to use when issuing a `draft up`.

func (*UpOptions) Descriptor

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

func (*UpOptions) GetReleaseWait

func (m *UpOptions) GetReleaseWait() bool

func (*UpOptions) ProtoMessage

func (*UpOptions) ProtoMessage()

func (*UpOptions) Reset

func (m *UpOptions) Reset()

func (*UpOptions) String

func (m *UpOptions) String() string

type UpRequest

type UpRequest struct {
	AppName    string             `protobuf:"bytes,1,opt,name=app_name,json=appName" json:"app_name,omitempty"`
	Namespace  string             `protobuf:"bytes,2,opt,name=namespace" json:"namespace,omitempty"`
	Options    *UpOptions         `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
	Chart      *hapi_chart3.Chart `protobuf:"bytes,4,opt,name=chart" json:"chart,omitempty"`
	Values     *hapi_chart.Config `protobuf:"bytes,5,opt,name=values" json:"values,omitempty"`
	AppArchive *AppArchive        `protobuf:"bytes,6,opt,name=app_archive,json=appArchive" json:"app_archive,omitempty"`
}

UpRequest indicates the message sent by a draft client and received by a draft server to carry out a draft up command.

func (*UpRequest) Descriptor

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

func (*UpRequest) GetAppArchive

func (m *UpRequest) GetAppArchive() *AppArchive

func (*UpRequest) GetAppName

func (m *UpRequest) GetAppName() string

func (*UpRequest) GetChart

func (m *UpRequest) GetChart() *hapi_chart3.Chart

func (*UpRequest) GetNamespace

func (m *UpRequest) GetNamespace() string

func (*UpRequest) GetOptions

func (m *UpRequest) GetOptions() *UpOptions

func (*UpRequest) GetValues

func (m *UpRequest) GetValues() *hapi_chart.Config

func (*UpRequest) ProtoMessage

func (*UpRequest) ProtoMessage()

func (*UpRequest) Reset

func (m *UpRequest) Reset()

func (*UpRequest) String

func (m *UpRequest) String() string

type UpSummary

type UpSummary struct {
	// stage_desc describes the particular stage this summary
	// represents, e.g. "Build Docker Image." This is meant
	// to be a canonical summary of the stage's intent.
	StageDesc string `protobuf:"bytes,1,opt,name=stage_desc,json=stageDesc" json:"stage_desc,omitempty"`
	// status_text indicates a string description of the progress
	// or completion of draft up.
	StatusText string `protobuf:"bytes,2,opt,name=status_text,json=statusText" json:"status_text,omitempty"`
	// status_code indicates the status of the progress or
	// completion of a draft up.
	StatusCode UpSummary_StatusCode `protobuf:"varint,3,opt,name=status_code,json=statusCode,enum=rpc.UpSummary_StatusCode" json:"status_code,omitempty"`
	// build_id is the build identifier associated with this draft up build.
	BuildId string `protobuf:"bytes,4,opt,name=build_id,json=buildId" json:"build_id,omitempty"`
}

UpSummary is the message returned when executing a draft up.

func (*UpSummary) Descriptor

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

func (*UpSummary) GetBuildId added in v0.7.0

func (m *UpSummary) GetBuildId() string

func (*UpSummary) GetStageDesc

func (m *UpSummary) GetStageDesc() string

func (*UpSummary) GetStatusCode

func (m *UpSummary) GetStatusCode() UpSummary_StatusCode

func (*UpSummary) GetStatusText

func (m *UpSummary) GetStatusText() string

func (*UpSummary) ProtoMessage

func (*UpSummary) ProtoMessage()

func (*UpSummary) Reset

func (m *UpSummary) Reset()

func (*UpSummary) String

func (m *UpSummary) String() string

type UpSummary_StatusCode

type UpSummary_StatusCode int32

StatusCode is the enumeration of the possible status codes returned for a draft up. TODO: Flush this out.

const (
	UpSummary_UNKNOWN UpSummary_StatusCode = 0
	UpSummary_LOGGING UpSummary_StatusCode = 1
	UpSummary_STARTED UpSummary_StatusCode = 2
	UpSummary_ONGOING UpSummary_StatusCode = 3
	UpSummary_SUCCESS UpSummary_StatusCode = 4
	UpSummary_FAILURE UpSummary_StatusCode = 5
)

func (UpSummary_StatusCode) EnumDescriptor

func (UpSummary_StatusCode) EnumDescriptor() ([]byte, []int)

func (UpSummary_StatusCode) String

func (x UpSummary_StatusCode) String() string

type Version

type Version struct {
	SemVer       string `protobuf:"bytes,1,opt,name=sem_ver,json=semVer" json:"sem_ver,omitempty"`
	GitCommit    string `protobuf:"bytes,2,opt,name=git_commit,json=gitCommit" json:"git_commit,omitempty"`
	GitTreeState string `protobuf:"bytes,3,opt,name=git_tree_state,json=gitTreeState" json:"git_tree_state,omitempty"`
}

Version represents the wire description of a server's version.

func (*Version) Descriptor

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

func (*Version) GetGitCommit

func (m *Version) GetGitCommit() string

func (*Version) GetGitTreeState

func (m *Version) GetGitTreeState() string

func (*Version) GetSemVer

func (m *Version) GetSemVer() string

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) Reset

func (m *Version) Reset()

func (*Version) String

func (m *Version) String() string

Jump to

Keyboard shortcuts

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