Documentation ¶
Overview ¶
Package client contains the Waypoint client implementation.
The Waypoint client exposes a slightly higher level of abstraction than direct a API client for performing operations on an application. The primary consumer of this package is the CLI.
Index ¶
- func TestApp(t testing.T, c *Project) string
- type App
- func (c *App) Auth(ctx context.Context, op *pb.Job_AuthOp) (*pb.Job_AuthResult, error)
- func (c *App) Build(ctx context.Context, op *pb.Job_BuildOp) (*pb.Job_BuildResult, error)
- func (c *App) ConfigSync(ctx context.Context, op *pb.Job_ConfigSyncOp) (*pb.Job_Result, error)
- func (c *App) Deploy(ctx context.Context, op *pb.Job_DeployOp) (*pb.Job_DeployResult, error)
- func (c *App) Destroy(ctx context.Context, op *pb.Job_DestroyOp) error
- func (c *App) Docs(ctx context.Context, op *pb.Job_DocsOp) (*pb.Job_DocsResult, error)
- func (c *App) Exec(ctx context.Context, ec *execclient.Client) (exitCode int, err error)
- func (a *App) Logs(ctx context.Context, deploySeq string) (pb.Waypoint_GetLogStreamClient, error)
- func (c *App) Noop(ctx context.Context) error
- func (c *App) PushBuild(ctx context.Context, op *pb.Job_PushOp) error
- func (c *App) Ref() *pb.Ref_Application
- func (c *App) Release(ctx context.Context, op *pb.Job_ReleaseOp) (*pb.Job_ReleaseResult, error)
- func (c *App) StatusReport(ctx context.Context, op *pb.Job_StatusReportOp) (*pb.Job_StatusReportResult, error)
- func (c *App) Up(ctx context.Context, op *pb.Job_UpOp) (*pb.Job_Result, error)
- type Option
- func WithClient(client pb.WaypointClient) Option
- func WithClientConnect(opts ...serverclient.ConnectOption) Option
- func WithConfig(waypointHCL *configpkg.Config) Option
- func WithLabels(m map[string]string) Option
- func WithLogger(log hclog.Logger) Option
- func WithNoLocalServer() Option
- func WithProjectRef(ref *pb.Ref_Project) Option
- func WithSourceOverrides(m map[string]string) Option
- func WithUI(ui terminal.UI) Option
- func WithUseLocalRunner(useLocalRunner bool) Option
- func WithVariables(m []*pb.Variable) Option
- func WithWorkspaceRef(ref *pb.Ref_Workspace) Option
- type Project
- func (c *Project) App(n string) *App
- func (c *Project) Client() pb.WaypointClient
- func (c *Project) Close() error
- func (c *Project) DestroyProject(ctx context.Context, op *pb.Job_DestroyProjectOp) (*pb.Job_ProjectDestroyResult, error)
- func (c *Project) DoJobDangerously(ctx context.Context, job *pb.Job) (*pb.Job_Result, error)
- func (c *Project) Local() bool
- func (c *Project) LocalRunnerId() (string, bool)
- func (c *Project) Ref() *pb.Ref_Project
- func (c *Project) ServerVersion() *pb.VersionInfo
- func (c *Project) Validate(ctx context.Context, op *pb.Job_ValidateOp) (*pb.Job_ValidateResult, error)
- func (c *Project) WorkspaceRef() *pb.Ref_Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
App is used for application-specific operations.
func (*App) Auth ¶
func (c *App) Auth(ctx context.Context, op *pb.Job_AuthOp) (*pb.Job_AuthResult, error)
func (*App) Build ¶
func (c *App) Build(ctx context.Context, op *pb.Job_BuildOp) (*pb.Job_BuildResult, error)
func (*App) ConfigSync ¶ added in v0.2.0
func (c *App) ConfigSync(ctx context.Context, op *pb.Job_ConfigSyncOp) (*pb.Job_Result, error)
func (*App) Deploy ¶
func (c *App) Deploy(ctx context.Context, op *pb.Job_DeployOp) (*pb.Job_DeployResult, error)
func (*App) Docs ¶
func (c *App) Docs(ctx context.Context, op *pb.Job_DocsOp) (*pb.Job_DocsResult, error)
func (*App) Noop ¶
Noop executes a noop operation. This is primarily for testing but is exported since it has its uses in verifying a runner is functioning properly.
A noop operation will exercise the full logic of queueing a job, assigning it to a runner, dequeueing as a runner, executing, etc. It will use real remote runners if the client is configured to do so.
func (*App) Ref ¶
func (c *App) Ref() *pb.Ref_Application
Ref returns the application reference that this client is using.
func (*App) Release ¶
func (c *App) Release(ctx context.Context, op *pb.Job_ReleaseOp) (*pb.Job_ReleaseResult, error)
func (*App) StatusReport ¶ added in v0.4.0
func (c *App) StatusReport(ctx context.Context, op *pb.Job_StatusReportOp) (*pb.Job_StatusReportResult, error)
type Option ¶
func WithClient ¶
func WithClient(client pb.WaypointClient) Option
WithClient sets the client directly. In this case, the runner won't attempt any connection at all regardless of other configuration (env vars or waypoint config file). This will be used.
If this is specified, the client MUST use a tokenutil.ContextToken type for the PerRPCCredentials setting. This package and others will use context overrides for the token. If you do not use this, things will break.
func WithClientConnect ¶
func WithClientConnect(opts ...serverclient.ConnectOption) Option
WithClientConnect specifies the options for connecting to a client. If WithClient is specified, that client is always used.
If WithLocal is set and no client is specified and no server creds can be found, then an in-process server will be created.
func WithConfig ¶ added in v0.7.2
WithConfig sets the config file (waypoint.hcl) and path.
func WithLabels ¶
WithLabels sets the labels or any operations.
func WithLogger ¶
func WithLogger(log hclog.Logger) Option
WithLogger sets the logger for the client.
func WithNoLocalServer ¶ added in v0.7.0
func WithNoLocalServer() Option
WithNoLocalServer prevents the project client from automatically creating a local server.
func WithProjectRef ¶
func WithProjectRef(ref *pb.Ref_Project) Option
WithProjectRef sets the project reference for all operations performed.
func WithSourceOverrides ¶
WithSourceOverrides sets the data source overrides for queued jobs.
func WithUseLocalRunner ¶ added in v0.7.0
WithUseLocalRunner instructs this client to execute all jobs either on a local runner, or on a remote runner. If unset, it will automatically determine where jobs will execute, preferring remote when possible
func WithVariables ¶ added in v0.5.0
WithVariables sets variable values from flags and local env on any operations.
func WithWorkspaceRef ¶
func WithWorkspaceRef(ref *pb.Ref_Workspace) Option
WithWorkspaceRef sets the workspace reference for all operations performed. If this isn't set, the default workspace will be used.
type Project ¶
Project is the primary structure for interacting with a Waypoint server as a client. The client exposes a slightly higher level of abstraction over the server API for performing operations locally and remotely.
func TestProject ¶
TestProject returns an initialized client pointing to an in-memory test server. This will close automatically on test completion.
This will also change the working directory to a temporary directory so that any side effect file creation doesn't impact the real working directory. If you need to use your working directory, query it before calling this.
func (*Project) Client ¶
func (c *Project) Client() pb.WaypointClient
Client returns the raw Waypoint server API client.
func (*Project) DestroyProject ¶ added in v0.10.0
func (c *Project) DestroyProject(ctx context.Context, op *pb.Job_DestroyProjectOp) (*pb.Job_ProjectDestroyResult, error)
func (*Project) DoJobDangerously ¶ added in v0.10.0
DoJobDangerously executes the given job and returns the result. The "Dangerously" suffix is because this function isn't meant to be generally used; it is dangerous because it doesn't perform many validation steps. In almost all cases, callers should use a more focused function such as Build or Deploy, or write a new one.
func (*Project) LocalRunnerId ¶ added in v0.3.0
LocalRunnerId returns the id of the runner that this project started This is used to target jobs specifically at this runner.
func (*Project) Ref ¶
func (c *Project) Ref() *pb.Ref_Project
Ref returns the raw Waypoint server API client.
func (*Project) ServerVersion ¶ added in v0.3.1
func (c *Project) ServerVersion() *pb.VersionInfo
ServerVersion returns the server version that this client is connected to.
func (*Project) Validate ¶
func (c *Project) Validate(ctx context.Context, op *pb.Job_ValidateOp) (*pb.Job_ValidateResult, error)
func (*Project) WorkspaceRef ¶
func (c *Project) WorkspaceRef() *pb.Ref_Workspace
WorkspaceRef returns the application reference that this client is using.