import "github.com/ubclaunchpad/inertia/client"
Package client provides the interface through which Inertia communicates with a serverside daemon
client.go doc.go socket.go sshc.go users.go util.go
var ( // ErrNeedTotp is used to indicate that a 2FA-enabled user has not provided a TOTP ErrNeedTotp = errors.New("TOTP is needed for user") )
MinDaemonVersion is the minimum inertiad version supported by this library
AuthenticateRequest denotes options for authenticating with the Inertia daemon
Client manages a deployment
NewClient sets up a client to communicate to the daemon at the given remote
Down brings the project down on the remote VPS instance specified in the configuration object.
GetSSHClient instantiates an SSH client for Inertia-related commands
func (c *Client) GetUserClient() *UserClient
GetUserClient instantiates an API client for Inertia user management commands
ListEnv lists environment variables currently set on remote
Logs get logs of given container
LogsWithOutput opens a websocket connection to given container's logs and streams it to the given io.Writer
Prune clears Docker ReadFiles on this remote.
Reset shuts down deployment and deletes the contents of the deployment's project directory
Status lists the currently active containers on the remote VPS instance
Token generates token on this remote.
Up brings the project up on the remote VPS instance specified in the deployment object.
UpWithOutput blocks and streams 'up' output to the client's io.Writer
UpdateEnv updates environment variable
WithDebug sets the client's debug mode
WithWriter sets the given io.Writer as the client's default output
LogsRequest denotes parameters for log querying
Options denotes configuration options for a Client
type SSHClient struct {
// contains filtered or unexported fields
}
SSHClient implements Inertia's SSH commands
AssignAPIToken generates an API token and assigns it to client.Remote
DaemonDown brings the daemon down on the remote instance
DaemonUp brings the daemon up on the remote instance.
GenerateKeys creates a public-private key-pair on the remote vps and returns the public key.
func (s *SSHClient) GetRunner() runner.SSHSession
GetRunner returns the SSH client's underlying session
InstallDocker installs docker on a remote vps.
UninstallInertia removes the inertia/ directory on the remote instance
SocketReader is an interface to a websocket connection
UpRequest declares parameters for project deployment
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is used to access Inertia's /user APIs
func NewUserClient(c *Client) *UserClient
NewUserClient instantiates a new client for user management functions
AddUser adds an authorized user for access to Inertia Web
func (u *UserClient) Authenticate(ctx context.Context, req AuthenticateRequest) (token string, err error)
Authenticate gets an access token for the user with the given credentials. Use "" for totp if none is required.
func (u *UserClient) DisableTotp(ctx context.Context) error
DisableTotp disables Totp for a given user
func (u *UserClient) EnableTotp(ctx context.Context, username, password string) (*api.TotpResponse, error)
EnableTotp enables Totp for a given user
ListUsers lists all users on the remote.
RemoveUser prevents a user from accessing Inertia Web
func (u *UserClient) ResetUsers(ctx context.Context) error
ResetUsers resets all users on the remote.
Path | Synopsis |
---|---|
bootstrap | Package bootstrap provides Inertia's remote bootstrapping script, based off of inertia/client.Client |
internal | Package internal provides compiled scripts and other internal assets |
runner | Package runner provides the Inertia client's low-level SSH command runner |
runner/mocks | Package mocks provides mocked implmentations of interfaces in client/runner |
Package client imports 21 packages (graph) and is imported by 8 packages. Updated 2021-01-14. Refresh now. Tools for package owners.