Documentation ¶
Index ¶
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func Id() (string, error)
- func MustAsset(name string) []byte
- func NewStatus(init pb.Status_State) *pb.Status
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func Run(opts ...Option) error
- func StatusSetError(s *pb.Status, err error)
- func StatusSetSuccess(s *pb.Status)
- func TestServer(t testing.T, impl pb.WaypointServer, opts ...TestOption) pb.WaypointClient
- type AuthChecker
- type Option
- type TestOption
Constants ¶
This section is empty.
Variables ¶
var DefaultEffects = []string{"mutable"}
var Effects = map[string][]string{
"ListBuilds": readonly,
}
Information about the effects of endpoints that are authenticated. If a endpoint is not listed, the DefaultEffect value is used.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func Id ¶
Id returns a unique Id that can be used for new values. This generates a ulid value but the ID itself should be an internal detail. An error will be returned if the ID could be generated.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewStatus ¶
func NewStatus(init pb.Status_State) *pb.Status
NewStatus returns a new Status message with the given initial state.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func Run ¶
Run initializes and starts the server. This will block until the server exits (by cancelling the associated context set with WithContext or due to an unrecoverable error).
func StatusSetError ¶
StatusSetError sets the error state on the status and marks the completion time.
func StatusSetSuccess ¶
StatusSetSuccess sets state of the status to success and marks the completion time.
func TestServer ¶
func TestServer(t testing.T, impl pb.WaypointServer, opts ...TestOption) pb.WaypointClient
TestServer starts a server and returns a gRPC client to that server. We use t.Cleanup to ensure resources are automatically cleaned up.
Types ¶
type AuthChecker ¶
type AuthChecker interface { // Called before each RPC to authenticate it. Authenticate(ctx context.Context, token, endpoint string, effects []string) error }
An interface implemented by something that wishes to authenticate the server actions.
type Option ¶
type Option func(*options)
Option configures Run
func WithAuthentication ¶
func WithAuthentication(ac AuthChecker) Option
WithAuthentication configures the server to require authentication.
func WithBrowserUI ¶
WithBrowserUI configures the server to enable the browser UI.
func WithContext ¶
WithContext sets the context for the server. When this context is cancelled, the server will be shut down.
func WithGRPC ¶
WithGRPC sets the GRPC listener. This listener must be closed manually by the caller. Prior to closing the listener, it is recommended that you cancel the context set with WithContext and wait for Run to return.
func WithHTTP ¶
WithHTTP sets the HTTP listener. This listener must be closed manually by the caller. Prior to closing the listener, it is recommended that you cancel the context set with WithContext and wait for Run to return.
func WithImpl ¶
func WithImpl(impl pb.WaypointServer) Option
WithImpl sets the service implementation to serve.
type TestOption ¶
type TestOption func(*testConfig)
TestOption is used with TestServer to configure test behavior.
func TestWithContext ¶
func TestWithContext(ctx context.Context) TestOption
TestWithContext specifies a context to use with the test server. When this is done then the server will exit.
func TestWithRestart ¶
func TestWithRestart(ch <-chan struct{}) TestOption
TestWithRestart specifies a channel that will be sent to to trigger a restart. The restart happens asynchronously. If you want to ensure the server is shutdown first, use TestWithContext, shut it down, wait for errors on the API, then restart.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package component has component implementations for the various resulting types.
|
Package component has component implementations for the various resulting types. |
Package logbuffer provides a structure and API for efficiently reading and writing logs that may be streamed to a server.
|
Package logbuffer provides a structure and API for efficiently reading and writing logs that may be streamed to a server. |
state
Package state manages the state that the singleprocess server has, providing operations to mutate that state safely as needed.
|
Package state manages the state that the singleprocess server has, providing operations to mutate that state safely as needed. |