Documentation ¶
Index ¶
- Variables
- func Id() (string, error)
- func NewStatus(init pb.Status_State) *pb.Status
- 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 an endpoint is not listed, the DefaultEffect value is used.
Functions ¶
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 NewStatus ¶
func NewStatus(init pb.Status_State) *pb.Status
NewStatus returns a new Status message with the given initial state.
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. The implementation may // return a new context if they want to insert authentication information // into it (such as the current user). The implementation may return a nil // context and the existing context will be used. Authenticate( ctx context.Context, token, endpoint string, effects []string, ) (context.Context, 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 grpcmetadata contains functions for reading and writing waypoint specific metadata to contexts, which is transmitted by RPC calls.
|
Package grpcmetadata contains functions for reading and writing waypoint specific metadata to contexts, which is transmitted by RPC calls. |
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. |