rpc

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultArtifactEndpoint      string = "Artifact"
	DefaultBuildEndpoint                = "Build"
	DefaultBuilderEndpoint              = "Builder"
	DefaultCacheEndpoint                = "Cache"
	DefaultCommandEndpoint              = "Command"
	DefaultCommunicatorEndpoint         = "Communicator"
	DefaultHookEndpoint                 = "Hook"
	DefaultPostProcessorEndpoint        = "PostProcessor"
	DefaultProvisionerEndpoint          = "Provisioner"
	DefaultUiEndpoint                   = "Ui"
)

Variables

This section is empty.

Functions

func Communicator

func Communicator(client *rpc.Client) *communicator

func NewFileInfo added in v0.12.0

func NewFileInfo(fi os.FileInfo) *fileInfo

Types

type ArtifactServer

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

ArtifactServer wraps a packer.Artifact implementation and makes it exportable as part of a Golang RPC server.

func (*ArtifactServer) BuilderId

func (s *ArtifactServer) BuilderId(args *interface{}, reply *string) error

func (*ArtifactServer) Destroy

func (s *ArtifactServer) Destroy(args *interface{}, reply *error) error

func (*ArtifactServer) Files

func (s *ArtifactServer) Files(args *interface{}, reply *[]string) error

func (*ArtifactServer) Id

func (s *ArtifactServer) Id(args *interface{}, reply *string) error

func (*ArtifactServer) State added in v0.7.2

func (s *ArtifactServer) State(name string, reply *interface{}) error

func (*ArtifactServer) String

func (s *ArtifactServer) String(args *interface{}, reply *string) error

type BasicError

type BasicError struct {
	Message string
}

This is a type that wraps error types so that they can be messaged across RPC channels. Since "error" is an interface, we can't always gob-encode the underlying structure. This is a valid error interface implementer that we will push across.

func NewBasicError

func NewBasicError(err error) *BasicError

func (*BasicError) Error

func (e *BasicError) Error() string

type BuildPrepareResponse added in v0.3.11

type BuildPrepareResponse struct {
	Warnings []string
	Error    *BasicError
}

type BuildServer

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

BuildServer wraps a packer.Build implementation and makes it exportable as part of a Golang RPC server.

func (*BuildServer) Cancel

func (b *BuildServer) Cancel(args *interface{}, reply *interface{}) error

func (*BuildServer) Name

func (b *BuildServer) Name(args *interface{}, reply *string) error

func (*BuildServer) Prepare

func (b *BuildServer) Prepare(args *interface{}, resp *BuildPrepareResponse) error

func (*BuildServer) Run

func (b *BuildServer) Run(streamId uint32, reply *[]uint32) error

func (*BuildServer) SetDebug

func (b *BuildServer) SetDebug(val *bool, reply *interface{}) error

func (*BuildServer) SetForce added in v0.2.0

func (b *BuildServer) SetForce(val *bool, reply *interface{}) error

func (*BuildServer) SetOnError added in v0.11.0

func (b *BuildServer) SetOnError(val *string, reply *interface{}) error

type BuilderPrepareArgs

type BuilderPrepareArgs struct {
	Configs []interface{}
}

type BuilderPrepareResponse added in v0.3.11

type BuilderPrepareResponse struct {
	GeneratedVars []string
	Warnings      []string
	Error         *BasicError
}

type BuilderServer

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

BuilderServer wraps a packer.Builder implementation and makes it exportable as part of a Golang RPC server.

func (*BuilderServer) Cancel

func (b *BuilderServer) Cancel(args *interface{}, reply *interface{}) error

func (*BuilderServer) ConfigSpec added in v1.5.0

func (s *BuilderServer) ConfigSpec(_ interface{}, reply *ConfigSpecResponse) error

func (*BuilderServer) Prepare

func (*BuilderServer) Run

func (b *BuilderServer) Run(streamId uint32, reply *uint32) error

type Client added in v0.5.0

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

Client is the client end that communicates with a Packer RPC server. Establishing a connection is up to the user, the Client can just communicate over any ReadWriteCloser.

func NewClient added in v0.5.0

func NewClient(rwc io.ReadWriteCloser) (*Client, error)

func (*Client) Artifact added in v0.5.0

func (c *Client) Artifact() packer.Artifact

func (*Client) Build added in v0.5.0

func (c *Client) Build() packer.Build

func (*Client) Builder added in v0.5.0

func (c *Client) Builder() packer.Builder

func (*Client) Close added in v0.5.0

func (c *Client) Close() error

func (*Client) Communicator added in v0.5.0

func (c *Client) Communicator() packer.Communicator

func (*Client) Hook added in v0.5.0

func (c *Client) Hook() packer.Hook

func (*Client) PostProcessor added in v0.5.0

func (c *Client) PostProcessor() packer.PostProcessor

func (*Client) Provisioner added in v0.5.0

func (c *Client) Provisioner() packer.Provisioner

func (*Client) Ui added in v0.5.0

func (c *Client) Ui() packer.Ui

type CommandFinished

type CommandFinished struct {
	ExitStatus int
}

type CommunicatorDownloadArgs

type CommunicatorDownloadArgs struct {
	Path           string
	WriterStreamId uint32
}

type CommunicatorDownloadDirArgs added in v0.9.0

type CommunicatorDownloadDirArgs struct {
	Dst     string
	Src     string
	Exclude []string
}

type CommunicatorServer

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

CommunicatorServer wraps a packer.Communicator implementation and makes it exportable as part of a Golang RPC server.

func (*CommunicatorServer) ConfigSpec added in v1.5.0

func (s *CommunicatorServer) ConfigSpec(_ interface{}, reply *ConfigSpecResponse) error

func (*CommunicatorServer) Download

func (c *CommunicatorServer) Download(args *CommunicatorDownloadArgs, reply *interface{}) (err error)

func (*CommunicatorServer) DownloadDir added in v0.9.0

func (c *CommunicatorServer) DownloadDir(args *CommunicatorUploadDirArgs, reply *error) error

func (*CommunicatorServer) Start

func (c *CommunicatorServer) Start(args *CommunicatorStartArgs, reply *interface{}) error

func (*CommunicatorServer) Upload

func (c *CommunicatorServer) Upload(args *CommunicatorUploadArgs, reply *interface{}) (err error)

func (*CommunicatorServer) UploadDir added in v0.3.5

func (c *CommunicatorServer) UploadDir(args *CommunicatorUploadDirArgs, reply *error) error

type CommunicatorStartArgs

type CommunicatorStartArgs struct {
	Command          string
	StdinStreamId    uint32
	StdoutStreamId   uint32
	StderrStreamId   uint32
	ResponseStreamId uint32
}

type CommunicatorUploadArgs

type CommunicatorUploadArgs struct {
	Path           string
	ReaderStreamId uint32
	FileInfo       *fileInfo
}

type CommunicatorUploadDirArgs added in v0.3.5

type CommunicatorUploadDirArgs struct {
	Dst     string
	Src     string
	Exclude []string
}

type ConfigSpecResponse added in v1.5.0

type ConfigSpecResponse struct {
	ConfigSpec []byte
}

type HookRunArgs

type HookRunArgs struct {
	Name     string
	Data     interface{}
	StreamId uint32
}

type HookServer

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

HookServer wraps a packer.Hook implementation and makes it exportable as part of a Golang RPC server.

func (*HookServer) Cancel added in v0.3.6

func (h *HookServer) Cancel(args *interface{}, reply *interface{}) error

func (*HookServer) Run

func (h *HookServer) Run(args *HookRunArgs, reply *interface{}) error

type PostProcessorConfigureArgs added in v0.1.4

type PostProcessorConfigureArgs struct {
	Configs []interface{}
}

type PostProcessorProcessResponse

type PostProcessorProcessResponse struct {
	Err           *BasicError
	Keep          bool
	ForceOverride bool
	StreamId      uint32
}

type PostProcessorServer

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

PostProcessorServer wraps a packer.PostProcessor implementation and makes it exportable as part of a Golang RPC server.

func (*PostProcessorServer) Cancel added in v1.4.0

func (b *PostProcessorServer) Cancel(args *interface{}, reply *interface{}) error

func (*PostProcessorServer) ConfigSpec added in v1.5.0

func (s *PostProcessorServer) ConfigSpec(_ interface{}, reply *ConfigSpecResponse) error

func (*PostProcessorServer) Configure

func (p *PostProcessorServer) Configure(args *PostProcessorConfigureArgs, reply *interface{}) (err error)

func (*PostProcessorServer) PostProcess

func (p *PostProcessorServer) PostProcess(streamId uint32, reply *PostProcessorProcessResponse) error

type ProgressTrackingClient added in v1.4.0

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

func (*ProgressTrackingClient) Close added in v1.4.0

func (u *ProgressTrackingClient) Close() error

func (*ProgressTrackingClient) Read added in v1.4.0

func (u *ProgressTrackingClient) Read(b []byte) (read int, err error)

Read will send len(b) over the wire instead of it's content

type ProgressTrackingServer added in v1.4.0

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

func (*ProgressTrackingServer) Add added in v1.4.0

func (t *ProgressTrackingServer) Add(size int, _ *interface{}) error

func (*ProgressTrackingServer) Close added in v1.4.0

func (t *ProgressTrackingServer) Close(_, _ *interface{}) error

type ProvisionerPrepareArgs

type ProvisionerPrepareArgs struct {
	Configs []interface{}
}

type ProvisionerProvisionArgs

type ProvisionerProvisionArgs struct {
	GeneratedData map[string]interface{}
	StreamID      uint32
}

type ProvisionerServer

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

ProvisionerServer wraps a packer.Provisioner implementation and makes it exportable as part of a Golang RPC server.

func (*ProvisionerServer) Cancel added in v0.3.6

func (p *ProvisionerServer) Cancel(args *interface{}, reply *interface{}) error

func (*ProvisionerServer) ConfigSpec added in v1.5.0

func (s *ProvisionerServer) ConfigSpec(_ interface{}, reply *ConfigSpecResponse) error

func (*ProvisionerServer) Prepare

func (p *ProvisionerServer) Prepare(args *ProvisionerPrepareArgs, reply *interface{}) error

func (*ProvisionerServer) Provision

func (p *ProvisionerServer) Provision(args *ProvisionerProvisionArgs, reply *interface{}) error

type Server added in v0.5.0

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

Server represents an RPC server for Packer. This must be paired on the other side with a Client.

func NewServer added in v0.5.0

func NewServer(conn io.ReadWriteCloser) (*Server, error)

NewServer returns a new Packer RPC server.

func (*Server) Close added in v0.5.0

func (s *Server) Close() error

func (*Server) RegisterArtifact added in v0.5.0

func (s *Server) RegisterArtifact(a packer.Artifact) error

func (*Server) RegisterBuild added in v0.5.0

func (s *Server) RegisterBuild(b packer.Build) error

func (*Server) RegisterBuilder added in v0.5.0

func (s *Server) RegisterBuilder(b packer.Builder) error

func (*Server) RegisterCommunicator added in v0.5.0

func (s *Server) RegisterCommunicator(c packer.Communicator) error

func (*Server) RegisterHook added in v0.5.0

func (s *Server) RegisterHook(h packer.Hook) error

func (*Server) RegisterPostProcessor added in v0.5.0

func (s *Server) RegisterPostProcessor(p packer.PostProcessor) error

func (*Server) RegisterProvisioner added in v0.5.0

func (s *Server) RegisterProvisioner(p packer.Provisioner) error

func (*Server) RegisterUi added in v0.5.0

func (s *Server) RegisterUi(ui packer.Ui) error

func (*Server) Serve added in v0.5.0

func (s *Server) Serve()

ServeConn serves a single connection over the RPC server. It is up to the caller to obtain a proper io.ReadWriteCloser.

type TrackProgressParameters added in v1.4.0

type TrackProgressParameters struct {
	Src         string
	TotalSize   int64
	CurrentSize int64
}

type Ui

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

An implementation of packer.Ui where the Ui is actually executed over an RPC connection.

func (*Ui) Ask

func (u *Ui) Ask(query string) (result string, err error)

func (*Ui) ConfigSpec added in v1.5.0

func (p *Ui) ConfigSpec() hcldec.ObjectSpec

func (*Ui) Error

func (u *Ui) Error(message string)

func (*Ui) Machine added in v0.3.0

func (u *Ui) Machine(t string, args ...string)

func (*Ui) Message

func (u *Ui) Message(message string)

func (*Ui) Say

func (u *Ui) Say(message string)

func (*Ui) TrackProgress added in v1.4.0

func (u *Ui) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser

TrackProgress starts a pair of ProgressTrackingClient and ProgressProgressTrackingServer that will send the size of each read bytes of stream. In order to track an operation on the terminal side.

type UiMachineArgs added in v0.3.0

type UiMachineArgs struct {
	Category string
	Args     []string
}

The arguments sent to Ui.Machine

type UiServer

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

UiServer wraps a packer.Ui implementation and makes it exportable as part of a Golang RPC server.

func (*UiServer) Ask

func (u *UiServer) Ask(query string, reply *string) (err error)

func (*UiServer) Error

func (u *UiServer) Error(message *string, reply *interface{}) error

func (*UiServer) Machine added in v0.3.0

func (u *UiServer) Machine(args *UiMachineArgs, reply *interface{}) error

func (*UiServer) Message

func (u *UiServer) Message(message *string, reply *interface{}) error

func (*UiServer) NewTrackProgress added in v1.4.0

func (ui *UiServer) NewTrackProgress(pl *TrackProgressParameters, reply *string) error

func (*UiServer) Say

func (u *UiServer) Say(message *string, reply *interface{}) error

Jump to

Keyboard shortcuts

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