Rename daemon CLI command to cache (#4808)
* internal/cmd/wrapper: add deprecation wrapper The deprecation wrapper can be used to display a warning to callers when a command is deprecated. * all: rename daemon to cache Rename the boundary daemon command to boundary cache. This avoids confusion with future client/daemons. * changes daemon to cache in nav --------- Co-authored-by: Robin Beck <stellarsquall@protonmail.ch>
This commit is contained in:
1 parent
be7d72d690
commit
e64443c66f
34 files changed
+554
-299
No files matched your search
@@ -4,6 +4,13 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
|
||||
|
||||
## Next
|
||||
|
||||
### Deprecations/Changes
|
||||
|
||||
* The `boundary daemon` command has been deprecated in favor of the new
|
||||
`boundary cache` command. The behavior remains the same. The `boundary search`
|
||||
command is unchanged.
|
||||
([PR](https://github.com/hashicorp/boundary/pull/4808))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fix a dead lock issue where the controller could get stuck with all of its
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -28,16 +28,16 @@ type AddTokenCommand struct {
|
||||
}
|
||||
|
||||
func (c *AddTokenCommand) Synopsis() string {
|
||||
return "Add an auth token to a running boundary daemon"
|
||||
return "Add an auth token to a running boundary cache"
|
||||
}
|
||||
|
||||
func (c *AddTokenCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: boundary daemon add-token [options]
|
||||
Usage: boundary cache add-token [options]
|
||||
|
||||
Add an auth token to the daemon:
|
||||
Add an auth token to the cache:
|
||||
|
||||
$ boundary daemon add-token
|
||||
$ boundary cache add-token
|
||||
|
||||
For a full list of examples, please see the documentation.
|
||||
|
||||
@@ -121,7 +121,7 @@ func (c *AddTokenCommand) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
if apiErr != nil {
|
||||
c.PrintApiError(apiErr, "Error from daemon when adding a token")
|
||||
c.PrintApiError(apiErr, "Error from cache when adding a token")
|
||||
return base.CommandApiError
|
||||
}
|
||||
switch base.Format(c.UI) {
|
||||
@@ -130,13 +130,13 @@ func (c *AddTokenCommand) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
case "table":
|
||||
c.UI.Output("The daemon add-token operation completed successfully.")
|
||||
c.UI.Output("The cache add-token operation completed successfully.")
|
||||
}
|
||||
return base.CommandSuccess
|
||||
}
|
||||
|
||||
// Add builds the UpsertTokenRequest using the client's address and token,
|
||||
// and trying to leverage the keyring. It then sends the request to the daemon.
|
||||
// and trying to leverage the keyring. It then sends the request to the cache.
|
||||
// The passed in cli.Ui is used to print out any errors when looking up the
|
||||
// auth token from the keyring. This allows background operations calling this
|
||||
// method to pass in a silent UI to suppress any output.
|
||||
@@ -206,7 +206,7 @@ func addToken(ctx context.Context, daemonPath string, p *daemon.UpsertTokenReque
|
||||
}
|
||||
resp, err := c.Post(ctx, "/v1/tokens", p, opt...)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("Error when sending request to the daemon: %w.", err)
|
||||
return nil, nil, fmt.Errorf("Error when sending request to the cache: %w.", err)
|
||||
}
|
||||
apiErr, err := resp.Decode(nil)
|
||||
return resp, apiErr, err
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package cache
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
var (
|
||||
_ cli.Command = (*StartCommand)(nil)
|
||||
_ cli.CommandAutocomplete = (*StartCommand)(nil)
|
||||
)
|
||||
|
||||
type CacheCommand struct {
|
||||
*base.Command
|
||||
}
|
||||
|
||||
func (c *CacheCommand) Synopsis() string {
|
||||
return "Manages the client side Boundary cache"
|
||||
}
|
||||
|
||||
func (c *CacheCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: boundary cache [sub command] [options]
|
||||
|
||||
This command allows interacting with the Boundary cache.
|
||||
|
||||
Start a cache:
|
||||
|
||||
$ boundary cache start
|
||||
|
||||
For a full list of examples, please see the documentation.
|
||||
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
func (c *CacheCommand) Flags() *base.FlagSets {
|
||||
return c.FlagSet(base.FlagSetNone)
|
||||
}
|
||||
|
||||
func (c *CacheCommand) AutocompleteArgs() complete.Predictor {
|
||||
return complete.PredictNothing
|
||||
}
|
||||
|
||||
func (c *CacheCommand) AutocompleteFlags() complete.Flags {
|
||||
return c.Flags().Completions()
|
||||
}
|
||||
|
||||
func (c *CacheCommand) Run(args []string) int {
|
||||
if len(args) >= 2 && args[1] == "daemon" {
|
||||
c.UI.Warn("The `boundary daemon` command is deprecated, use `boundary cache` instead")
|
||||
}
|
||||
return cli.RunResultHelp
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func writePidFile(ctx context.Context, pidFile string) (pidCleanup, error) {
|
||||
const op = "daemon.writePidFile"
|
||||
const op = "cache.writePidFile"
|
||||
|
||||
// Determine if we should clean up the file after we are done or if
|
||||
// it should stick around in the case of lock aquision error since this
|
||||
@@ -57,7 +57,7 @@ func writePidFile(ctx context.Context, pidFile string) (pidCleanup, error) {
|
||||
}
|
||||
|
||||
func pidFileInUse(ctx context.Context, pidFile string) (*os.Process, error) {
|
||||
const op = "daemon.pidFileInUse"
|
||||
const op = "cache.pidFileInUse"
|
||||
if pidFile == "" {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "pid filename is empty")
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func writePidFile(ctx context.Context, pidFile string) (pidCleanup, error) {
|
||||
const op = "daemon.writePidFile"
|
||||
const op = "cache.writePidFile"
|
||||
// Create the file for writing, and set shared read so following processes
|
||||
// cannot open this file for writing.
|
||||
fd, err := windows.CreateFile(&(windows.StringToUTF16(pidFile)[0]), windows.GENERIC_WRITE,
|
||||
@@ -59,7 +59,7 @@ func writePidFile(ctx context.Context, pidFile string) (pidCleanup, error) {
|
||||
}
|
||||
|
||||
func pidFileInUse(ctx context.Context, pidFile string) (*os.Process, error) {
|
||||
const op = "daemon.pidFileInUse"
|
||||
const op = "cache.pidFileInUse"
|
||||
if pidFile == "" {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "pid filename is empty")
|
||||
}
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -30,7 +30,7 @@ const (
|
||||
logFileName = "cache.log"
|
||||
|
||||
// Mark of process as having been started in the background
|
||||
backgroundEnvName = "_BOUNDARY_DAEMON_BACKGROUND"
|
||||
backgroundEnvName = "_BOUNDARY_CACHE_BACKGROUND"
|
||||
backgroundEnvVal = "1"
|
||||
)
|
||||
|
||||
@@ -54,16 +54,16 @@ type StartCommand struct {
|
||||
}
|
||||
|
||||
func (c *StartCommand) Synopsis() string {
|
||||
return "Start a Boundary daemon"
|
||||
return "Start a Boundary cache"
|
||||
}
|
||||
|
||||
func (c *StartCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: boundary daemon start [options]
|
||||
Usage: boundary cache start [options]
|
||||
|
||||
Start a daemon:
|
||||
Start a cache:
|
||||
|
||||
$ boundary daemon start
|
||||
$ boundary cache start
|
||||
|
||||
For a full list of examples, please see the documentation.
|
||||
|
||||
@@ -132,7 +132,7 @@ func (c *StartCommand) Flags() *base.FlagSets {
|
||||
Name: "background",
|
||||
Target: &c.flagBackground,
|
||||
Default: false,
|
||||
Usage: `Run the client cache daemon in the background`,
|
||||
Usage: `Run the cache daemon in the background`,
|
||||
})
|
||||
|
||||
return set
|
||||
@@ -242,7 +242,7 @@ func (c *StartCommand) Run(args []string) int {
|
||||
|
||||
// DefaultDotDirectory returns the default path to the boundary dot directory.
|
||||
func DefaultDotDirectory(ctx context.Context) (string, error) {
|
||||
const op = "daemon.DefaultDotDirectory"
|
||||
const op = "cache.DefaultDotDirectory"
|
||||
homeDir, err := homedir.Dir()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(ctx, err, op)
|
||||
@@ -256,7 +256,7 @@ func DefaultDotDirectory(ctx context.Context) (string, error) {
|
||||
// are saved as backup. When a new log file is rotated and there is already 3
|
||||
// backups created, the oldest one is deleted.
|
||||
func logFile(ctx context.Context, dotDir string, maxSizeMb int) (io.WriteCloser, string, error) {
|
||||
const op = "daemon.logFile"
|
||||
const op = "cache.logFile"
|
||||
logFilePath := filepath.Join(dotDir, logFileName)
|
||||
{
|
||||
// Ensure the file is created with the desired permissions.
|
||||
@@ -277,14 +277,14 @@ func logFile(ctx context.Context, dotDir string, maxSizeMb int) (io.WriteCloser,
|
||||
}
|
||||
|
||||
func (c *StartCommand) makeBackground(ctx context.Context, dotDir string) (bool, []io.Writer, pidCleanup, error) {
|
||||
const op = "daemon.makeBackground"
|
||||
const op = "cache.makeBackground"
|
||||
|
||||
writers := []io.Writer{}
|
||||
pidPath := filepath.Join(dotDir, pidFileName)
|
||||
if running, err := pidFileInUse(ctx, pidPath); running != nil {
|
||||
return false, writers, noopPidCleanup, stderrors.New("The daemon is already running.")
|
||||
return false, writers, noopPidCleanup, stderrors.New("The cache is already running.")
|
||||
} else if err != nil && !errors.Match(errors.T(errors.NotFound), err) {
|
||||
return false, writers, noopPidCleanup, fmt.Errorf("Error when checking if the daemon pid is in use: %w.", err)
|
||||
return false, writers, noopPidCleanup, fmt.Errorf("Error when checking if the cache pid is in use: %w.", err)
|
||||
}
|
||||
|
||||
if !c.flagBackground && os.Getenv(backgroundEnvName) != backgroundEnvVal {
|
||||
@@ -308,7 +308,7 @@ func (c *StartCommand) makeBackground(ctx context.Context, dotDir string) (bool,
|
||||
|
||||
env := os.Environ()
|
||||
env = append(env, fmt.Sprintf("%s=%s", backgroundEnvName, backgroundEnvVal))
|
||||
args := []string{"daemon", "start"}
|
||||
args := []string{"cache", "start"}
|
||||
args = append(args, "-refresh-interval", c.flagRefreshInterval.String())
|
||||
args = append(args, "-max-search-staleness", c.flagMaxSearchStaleness.String())
|
||||
args = append(args, "-max-search-refresh-timeout", c.flagMaxSearchRefreshTimeout.String())
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
var errDaemonNotRunning = stderr.New("The daemon process is not running.")
|
||||
var errCacheNotRunning = stderr.New("The cache process is not running.")
|
||||
|
||||
var (
|
||||
_ cli.Command = (*AddTokenCommand)(nil)
|
||||
@@ -34,16 +34,16 @@ type StatusCommand struct {
|
||||
}
|
||||
|
||||
func (c *StatusCommand) Synopsis() string {
|
||||
return "Get the status information of the running boundary daemon"
|
||||
return "Get the status information of the running boundary cache"
|
||||
}
|
||||
|
||||
func (c *StatusCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: boundary daemon status [options]
|
||||
Usage: boundary cache status [options]
|
||||
|
||||
Get the status of the boundary daemon:
|
||||
Get the status of the boundary cache:
|
||||
|
||||
$ boundary daemon status
|
||||
$ boundary cache status
|
||||
|
||||
For a full list of examples, please see the documentation.
|
||||
|
||||
@@ -86,7 +86,7 @@ func (c *StatusCommand) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
if apiErr != nil {
|
||||
c.PrintApiError(apiErr, "Error from daemon when getting the status")
|
||||
c.PrintApiError(apiErr, "Error from cache when getting the status")
|
||||
return base.CommandApiError
|
||||
}
|
||||
|
||||
@@ -115,11 +115,11 @@ func (c *StatusCommand) Status(ctx context.Context) (*api.Response, *daemon.Stat
|
||||
}
|
||||
|
||||
func status(ctx context.Context, daemonPath string, opt ...client.Option) (*api.Response, *daemon.StatusResult, *api.Error, error) {
|
||||
const op = "daemon.status"
|
||||
const op = "cache.status"
|
||||
addr := daemon.SocketAddress(daemonPath)
|
||||
_, err := os.Stat(addr.Path)
|
||||
if addr.Scheme == "unix" && err != nil {
|
||||
return nil, nil, nil, errDaemonNotRunning
|
||||
return nil, nil, nil, errCacheNotRunning
|
||||
}
|
||||
c, err := client.New(ctx, addr)
|
||||
if err != nil {
|
||||
@@ -134,7 +134,7 @@ func status(ctx context.Context, daemonPath string, opt ...client.Option) (*api.
|
||||
res := &daemon.StatusResult{}
|
||||
apiErr, err := resp.Decode(&res)
|
||||
if err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("Error when sending request to the daemon: %w.", err)
|
||||
return nil, nil, nil, fmt.Errorf("Error when sending request to the cache: %w.", err)
|
||||
}
|
||||
if apiErr != nil {
|
||||
return resp, nil, apiErr, nil
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -17,16 +17,16 @@ type StopCommand struct {
|
||||
}
|
||||
|
||||
func (c *StopCommand) Synopsis() string {
|
||||
return "Stop a Boundary daemon"
|
||||
return "Stop the Boundary cache"
|
||||
}
|
||||
|
||||
func (c *StopCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: boundary daemon stop
|
||||
Usage: boundary cache stop
|
||||
|
||||
Stop a daemon:
|
||||
Stop a cache:
|
||||
|
||||
$ boundary daemon stop
|
||||
$ boundary cache stop
|
||||
|
||||
For a full list of examples, please see the documentation.
|
||||
|
||||
@@ -59,7 +59,7 @@ func (c *StopCommand) Run(args []string) int {
|
||||
}
|
||||
if err := c.stop(c.Context); err != nil {
|
||||
if errors.Match(errors.T(errors.NotFound), err) {
|
||||
c.PrintCliError(errDaemonNotRunning)
|
||||
c.PrintCliError(errCacheNotRunning)
|
||||
} else {
|
||||
c.PrintCliError(err)
|
||||
}
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/util"
|
||||
)
|
||||
|
||||
// stop will send a term signal to the daemon to shut down.
|
||||
// stop will send a term signal to the cache to shut down.
|
||||
func (c *StopCommand) stop(ctx context.Context) error {
|
||||
switch {
|
||||
case util.IsNil(ctx):
|
||||
@@ -30,13 +30,13 @@ func (c *StopCommand) stop(ctx context.Context) error {
|
||||
pidPath := filepath.Join(dotPath, pidFileName)
|
||||
p, err := pidFileInUse(ctx, pidPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error when checking if the daemon's pid file is in use: %w", err)
|
||||
return fmt.Errorf("Error when checking if the cache's pid file is in use: %w", err)
|
||||
}
|
||||
if p == nil {
|
||||
return errors.New("The daemon is not running.")
|
||||
return errors.New("The cache is not running.")
|
||||
}
|
||||
if err := p.Signal(syscall.SIGTERM); err != nil {
|
||||
return fmt.Errorf("Error when sending sigterm to daemon process: %w", err)
|
||||
return fmt.Errorf("Error when sending sigterm to cache process: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Vendored
+7
-7
@@ -4,7 +4,7 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/util"
|
||||
)
|
||||
|
||||
// stop will send a term signal to the daemon to shut down.
|
||||
// stop will send a term signal to the cache to shut down.
|
||||
func (c *StopCommand) stop(ctx context.Context) error {
|
||||
switch {
|
||||
case util.IsNil(ctx):
|
||||
@@ -40,7 +40,7 @@ func (c *StopCommand) stop(ctx context.Context) error {
|
||||
} else if apiErr != nil {
|
||||
errMsg = apiErr.Message
|
||||
}
|
||||
c.UI.Warn(fmt.Sprintf("Failed stopping the daemon through the handler: %q, now killing the process", errMsg))
|
||||
c.UI.Warn(fmt.Sprintf("Failed stopping the cache through the handler: %q, now killing the process", errMsg))
|
||||
default:
|
||||
// there wasn't an error stopping it through the handler. No need to
|
||||
// force kill the process
|
||||
@@ -51,12 +51,12 @@ func (c *StopCommand) stop(ctx context.Context) error {
|
||||
p, err := pidFileInUse(ctx, pidPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return errors.New("Unable to stop the daemon: pid file not found.")
|
||||
return errors.New("Unable to stop the cache: pid file not found.")
|
||||
}
|
||||
return fmt.Errorf("Error when trying to stop the daemon: %w", err)
|
||||
return fmt.Errorf("Error when trying to stop the cache: %w", err)
|
||||
}
|
||||
if p == nil {
|
||||
return errors.New("Daemon process was not found.")
|
||||
return errors.New("Cache process was not found.")
|
||||
}
|
||||
|
||||
if err := p.Kill(); err != nil {
|
||||
@@ -73,7 +73,7 @@ func stopThroughHandler(ctx context.Context, dotPath string) (*api.Error, error)
|
||||
}
|
||||
resp, err := c.Post(ctx, "/v1/stop", nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error when sending request to the daemon: %w.", err)
|
||||
return nil, fmt.Errorf("Error when sending request to the cache: %w.", err)
|
||||
}
|
||||
apiErr, err := resp.Decode(nil)
|
||||
return apiErr, err
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
package cache
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -53,12 +53,12 @@ func startDaemon(ctx context.Context, baseCmd *base.Command) bool {
|
||||
|
||||
cmdName, err := os.Executable()
|
||||
if err != nil {
|
||||
baseCmd.UI.Error(fmt.Sprintf("unable to find boundary binary for daemon startup: %s", err.Error()))
|
||||
baseCmd.UI.Error(fmt.Sprintf("unable to find boundary binary for cache startup: %s", err.Error()))
|
||||
return false
|
||||
}
|
||||
|
||||
var stdErr bytes.Buffer
|
||||
cmd := exec.Command(cmdName, "daemon", "start", "-background")
|
||||
cmd := exec.Command(cmdName, "cache", "start", "-background")
|
||||
cmd.Stderr = &stdErr
|
||||
|
||||
// We use Run here instead of Start because the command spawns off a subprocess and returns.
|
||||
@@ -1,57 +0,0 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
var (
|
||||
_ cli.Command = (*StartCommand)(nil)
|
||||
_ cli.CommandAutocomplete = (*StartCommand)(nil)
|
||||
)
|
||||
|
||||
type DaemonCommand struct {
|
||||
*base.Command
|
||||
}
|
||||
|
||||
func (c *DaemonCommand) Synopsis() string {
|
||||
return "Manages the client side Boundary cache daemon"
|
||||
}
|
||||
|
||||
func (c *DaemonCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: boundary daemon [sub command] [options]
|
||||
|
||||
This command allows interacting with the Boundary daemon.
|
||||
|
||||
Start a daemon:
|
||||
|
||||
$ boundary daemon start
|
||||
|
||||
For a full list of examples, please see the documentation.
|
||||
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
func (c *DaemonCommand) Flags() *base.FlagSets {
|
||||
return c.FlagSet(base.FlagSetNone)
|
||||
}
|
||||
|
||||
func (c *DaemonCommand) AutocompleteArgs() complete.Predictor {
|
||||
return complete.PredictNothing
|
||||
}
|
||||
|
||||
func (c *DaemonCommand) AutocompleteFlags() complete.Flags {
|
||||
return c.Flags().Completions()
|
||||
}
|
||||
|
||||
func (c *DaemonCommand) Run(args []string) int {
|
||||
return cli.RunResultHelp
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/hashicorp/boundary/api/aliases"
|
||||
"github.com/hashicorp/boundary/api/sessions"
|
||||
"github.com/hashicorp/boundary/api/targets"
|
||||
daemoncmd "github.com/hashicorp/boundary/internal/clientcache/cmd/daemon"
|
||||
cachecmd "github.com/hashicorp/boundary/internal/clientcache/cmd/cache"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/internal/client"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/internal/daemon"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
@@ -35,7 +35,7 @@ var (
|
||||
"sessions",
|
||||
}
|
||||
|
||||
errDaemonNotRunning = stderrors.New("The deamon process is not running.")
|
||||
errCacheNotRunning = stderrors.New("The cache process is not running.")
|
||||
)
|
||||
|
||||
type SearchCommand struct {
|
||||
@@ -46,7 +46,7 @@ type SearchCommand struct {
|
||||
}
|
||||
|
||||
func (c *SearchCommand) Synopsis() string {
|
||||
return "Search Boundary resources using client side cache"
|
||||
return "Search Boundary resources using client cache"
|
||||
}
|
||||
|
||||
func (c *SearchCommand) Help() string {
|
||||
@@ -154,7 +154,7 @@ func (c *SearchCommand) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
if apiErr != nil {
|
||||
c.PrintApiError(apiErr, "Error from daemon when performing search")
|
||||
c.PrintApiError(apiErr, "Error from cache when performing search")
|
||||
return base.CommandApiError
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ func (c *SearchCommand) Search(ctx context.Context) (*api.Response, *daemon.Sear
|
||||
opts = append(opts, client.WithOutputCurlString())
|
||||
}
|
||||
|
||||
dotPath, err := daemoncmd.DefaultDotDirectory(ctx)
|
||||
dotPath, err := cachecmd.DefaultDotDirectory(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@@ -215,7 +215,7 @@ func search(ctx context.Context, daemonPath string, fb filterBy, opt ...client.O
|
||||
addr := daemon.SocketAddress(daemonPath)
|
||||
_, err := os.Stat(addr.Path)
|
||||
if addr.Scheme == "unix" && err != nil {
|
||||
return nil, nil, nil, errDaemonNotRunning
|
||||
return nil, nil, nil, errCacheNotRunning
|
||||
}
|
||||
c, err := client.New(ctx, addr)
|
||||
if err != nil {
|
||||
@@ -232,12 +232,12 @@ func search(ctx context.Context, daemonPath string, fb filterBy, opt ...client.O
|
||||
}
|
||||
resp, err := c.Get(ctx, "/v1/search", q, opt...)
|
||||
if err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("Error when sending request to the daemon: %w.", err)
|
||||
return nil, nil, nil, fmt.Errorf("Error when sending request to the cache: %w.", err)
|
||||
}
|
||||
res := &daemon.SearchResult{}
|
||||
apiErr, err := resp.Decode(&res)
|
||||
if err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("Error when decoding request from the daemon: %w.", err)
|
||||
return nil, nil, nil, fmt.Errorf("Error when decoding request from the cache: %w.", err)
|
||||
}
|
||||
if apiErr != nil {
|
||||
return resp, nil, apiErr, nil
|
||||
|
||||
@@ -28,7 +28,7 @@ type RefreshTokenValue string
|
||||
const sentinelNoRefreshToken RefreshTokenValue = "__no_refresh_token_supported__"
|
||||
|
||||
// CacheSupport is an enum that identifies if a boundary instance can be supported
|
||||
// by the client daemon cache.
|
||||
// by the client cache.
|
||||
type CacheSupport string
|
||||
|
||||
const (
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ type resourceSearcher interface {
|
||||
// is returned and the returned SearchResults will be empty.
|
||||
// search implements searcher.
|
||||
func (l *resourceSearchFns[T]) search(ctx context.Context, p SearchParams) (*SearchResult, error) {
|
||||
const op = "daemon.(resourceSearchFns).search"
|
||||
const op = "cache.(resourceSearchFns).search"
|
||||
|
||||
var found []T
|
||||
var err error
|
||||
|
||||
@@ -106,7 +106,7 @@ func (c *Client) Post(ctx context.Context, path string, body any, opt ...Option)
|
||||
}
|
||||
|
||||
// request returns a retryablehttp.Request with the url set to the domain socket
|
||||
// associated with this client and proper headers set for client daemon requests.
|
||||
// associated with this client and proper headers set for client cache requests.
|
||||
func request(ctx context.Context, method, path string) *retryablehttp.Request {
|
||||
req := &http.Request{
|
||||
Method: method,
|
||||
|
||||
@@ -27,7 +27,7 @@ values
|
||||
('target'),
|
||||
('session');
|
||||
|
||||
-- Contains refresh tokens for list requests sent by the client daemon to the
|
||||
-- Contains refresh tokens for list requests sent by the client cache to the
|
||||
-- boundary instance.
|
||||
create table if not exists refresh_token(
|
||||
user_id text not null
|
||||
|
||||
@@ -4,39 +4,90 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/daemon"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/cache"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/search"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/cmd/wrapper"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
extraCommandsFuncs = append(extraCommandsFuncs, func(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
|
||||
Commands["daemon"] = func() (cli.Command, error) {
|
||||
return &daemon.DaemonCommand{
|
||||
Commands["cache"] = func() (cli.Command, error) {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon start"] = func() (cli.Command, error) {
|
||||
return &daemon.StartCommand{
|
||||
Commands["cache start"] = func() (cli.Command, error) {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon stop"] = func() (cli.Command, error) {
|
||||
return &daemon.StopCommand{
|
||||
Commands["cache stop"] = func() (cli.Command, error) {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon add-token"] = func() (cli.Command, error) {
|
||||
return &daemon.AddTokenCommand{
|
||||
Commands["cache add-token"] = func() (cli.Command, error) {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon status"] = func() (cli.Command, error) {
|
||||
return &daemon.StatusCommand{
|
||||
Commands["cache status"] = func() (cli.Command, error) {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon start"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon stop"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon add-token"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon status"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
Commands["search"] = func() (cli.Command, error) {
|
||||
return &search.SearchCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
|
||||
@@ -6,39 +6,90 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/daemon"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/cache"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/search"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/cmd/wrapper"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
extraCommandsFuncs = append(extraCommandsFuncs, func(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
|
||||
Commands["daemon"] = func() (cli.Command, error) {
|
||||
return &daemon.DaemonCommand{
|
||||
Commands["cache"] = func() (cli.Command, error) {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon start"] = func() (cli.Command, error) {
|
||||
return &daemon.StartCommand{
|
||||
Commands["cache start"] = func() (cli.Command, error) {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon stop"] = func() (cli.Command, error) {
|
||||
return &daemon.StopCommand{
|
||||
Commands["cache stop"] = func() (cli.Command, error) {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon add-token"] = func() (cli.Command, error) {
|
||||
return &daemon.AddTokenCommand{
|
||||
Commands["cache add-token"] = func() (cli.Command, error) {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon status"] = func() (cli.Command, error) {
|
||||
return &daemon.StatusCommand{
|
||||
Commands["cache status"] = func() (cli.Command, error) {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon start"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon stop"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon add-token"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon status"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
Commands["search"] = func() (cli.Command, error) {
|
||||
return &search.SearchCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
|
||||
@@ -4,39 +4,90 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/daemon"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/cache"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/search"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/cmd/wrapper"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
extraCommandsFuncs = append(extraCommandsFuncs, func(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
|
||||
Commands["daemon"] = func() (cli.Command, error) {
|
||||
return &daemon.DaemonCommand{
|
||||
Commands["cache"] = func() (cli.Command, error) {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon start"] = func() (cli.Command, error) {
|
||||
return &daemon.StartCommand{
|
||||
Commands["cache start"] = func() (cli.Command, error) {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon stop"] = func() (cli.Command, error) {
|
||||
return &daemon.StopCommand{
|
||||
Commands["cache stop"] = func() (cli.Command, error) {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon add-token"] = func() (cli.Command, error) {
|
||||
return &daemon.AddTokenCommand{
|
||||
Commands["cache add-token"] = func() (cli.Command, error) {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon status"] = func() (cli.Command, error) {
|
||||
return &daemon.StatusCommand{
|
||||
Commands["cache status"] = func() (cli.Command, error) {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon start"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon stop"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon add-token"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon status"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
Commands["search"] = func() (cli.Command, error) {
|
||||
return &search.SearchCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
|
||||
@@ -6,39 +6,90 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/daemon"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/cache"
|
||||
"github.com/hashicorp/boundary/internal/clientcache/cmd/search"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/cmd/wrapper"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
extraCommandsFuncs = append(extraCommandsFuncs, func(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
|
||||
Commands["daemon"] = func() (cli.Command, error) {
|
||||
return &daemon.DaemonCommand{
|
||||
Commands["cache"] = func() (cli.Command, error) {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon start"] = func() (cli.Command, error) {
|
||||
return &daemon.StartCommand{
|
||||
Commands["cache start"] = func() (cli.Command, error) {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon stop"] = func() (cli.Command, error) {
|
||||
return &daemon.StopCommand{
|
||||
Commands["cache stop"] = func() (cli.Command, error) {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon add-token"] = func() (cli.Command, error) {
|
||||
return &daemon.AddTokenCommand{
|
||||
Commands["cache add-token"] = func() (cli.Command, error) {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
Commands["daemon status"] = func() (cli.Command, error) {
|
||||
return &daemon.StatusCommand{
|
||||
Commands["cache status"] = func() (cli.Command, error) {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}, nil
|
||||
}
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.CacheCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon start"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StartCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon stop"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StopCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon add-token"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.AddTokenCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
// TODO(johanbrandhorst): remove after deprecation period
|
||||
Commands["daemon status"] = wrapper.WrapForDeprecation(
|
||||
func() wrapper.WrappableCommand {
|
||||
return &cache.StatusCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
}
|
||||
},
|
||||
"daemon",
|
||||
"cache",
|
||||
)
|
||||
Commands["search"] = func() (cli.Command, error) {
|
||||
return &search.SearchCommand{
|
||||
Command: base.NewCommand(ui),
|
||||
|
||||
@@ -35,7 +35,7 @@ type WrappableCommand interface {
|
||||
BaseCommand() *base.Command
|
||||
}
|
||||
|
||||
// CommandWrapper starts the boundary daemon after the command was Run and attempts
|
||||
// CommandWrapper starts the boundary cache after the command was Run and attempts
|
||||
// to send the current persona to any running daemon.
|
||||
type CommandWrapper struct {
|
||||
WrappableCommand
|
||||
@@ -50,8 +50,8 @@ func Wrap(c func() WrappableCommand) cli.CommandFactory {
|
||||
}
|
||||
}
|
||||
|
||||
// Run runs the wrapped command and then attempts to start the boundary daemon and send
|
||||
// the current persona
|
||||
// Run runs the wrapped command and then attempts to start the boundary cache and send
|
||||
// the current token to it.
|
||||
func (w *CommandWrapper) Run(args []string) int {
|
||||
// potentially intercept the token in case it isn't stored in the keyring
|
||||
var token string
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package wrapper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
// DeprecationWrapper can be used to mark a command as deprecated.
|
||||
type DeprecationWrapper struct {
|
||||
WrappableCommand
|
||||
old string
|
||||
new string
|
||||
}
|
||||
|
||||
// WrapForDeprecation returns a cli.CommandFactory that will print a deprecation warning when invoked.
|
||||
func WrapForDeprecation(c func() WrappableCommand, old, new string) cli.CommandFactory {
|
||||
return func() (cli.Command, error) {
|
||||
return &DeprecationWrapper{
|
||||
WrappableCommand: c(),
|
||||
old: old,
|
||||
new: new,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Run prints a deprecation warning and then runs the wrapped command.
|
||||
func (w *DeprecationWrapper) Run(args []string) int {
|
||||
w.WrappableCommand.BaseCommand().UI.Warn(
|
||||
fmt.Sprintf(
|
||||
"The '%s' command is deprecated and will be removed in a future release. Please use the '%s' command instead.",
|
||||
w.old,
|
||||
w.new,
|
||||
),
|
||||
)
|
||||
|
||||
return w.WrappableCommand.Run(args)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ description: |-
|
||||
|
||||
# Client cache
|
||||
|
||||
The Boundary client daemon runs on end users' computers and locally caches session and target resource information from Boundary instances.
|
||||
The Boundary client cache runs on end users' computers and locally caches session and target resource information from Boundary instances.
|
||||
The cache helps expedite searches.
|
||||
|
||||
## Boundary `list` vs. `search`
|
||||
@@ -16,7 +16,7 @@ You can use the Boundary API or CLI to `list` resources like targets, sessions,
|
||||
When you use the `list` command, Boundary searches the control plane to provide a current total of resources when it produces the list of results.
|
||||
Some Boundary resources can provide a significant number of items in the response.
|
||||
|
||||
Because large lists of results may overwhelm your system resources, the client daemon caches the results of the `list` operation.
|
||||
Because large lists of results may overwhelm your system resources, the client cache caches the results of the `list` operation.
|
||||
You can search the local cache instead of the control plane to help protect your system resources.
|
||||
The Boundary `search` command also produces a list of Boundary resources.
|
||||
When you use the `search` command, however, Boundary searches the local cache to create the list.
|
||||
@@ -34,16 +34,16 @@ For more information, refer to [Identity and access management (IAM)](/boundary/
|
||||
|
||||
## Client cache management
|
||||
|
||||
The Boundary client daemon starts automatically in the background when a user runs a CLI command that interacts with a Boundary instance.
|
||||
If you do not want the daemon to automatically start, you can include the `-skip-cache-daemon` flag or set the **BOUNDARY_SKIP_CACHE_DAEMON** environment variable when you use the Boundary CLI to interact with a Boundary instance.
|
||||
The Boundary client cache starts automatically in the background when a user runs a CLI command that interacts with a Boundary instance.
|
||||
If you do not want the cache to automatically start, you can include the `-skip-cache-daemon` flag or set the **BOUNDARY_SKIP_CACHE_DAEMON** environment variable when you use the Boundary CLI to interact with a Boundary instance.
|
||||
|
||||
### Startup and customization
|
||||
|
||||
You can start the daemon manually using the `boundary daemon start` command.
|
||||
By default, the daemon starts in the foreground.
|
||||
You can start the cache manually using the `boundary cache start` command.
|
||||
By default, the cache starts in the foreground.
|
||||
You can start it in the background by adding the `-background` flag.
|
||||
|
||||
If you start the daemon manually, you can customize the caching behavior.
|
||||
If you start the cache manually, you can customize the caching behavior.
|
||||
Include any of the following options to customize the behavior:
|
||||
|
||||
- `max-search-staleness` - The amount of time that can pass since the last refresh before calling `boundary search` results in a blocking refresh from the Boundary instance of the resources being searched.
|
||||
@@ -52,7 +52,7 @@ In the event of a timeout, Boundary uses the stale data that is currently in the
|
||||
- `refresh-interval` - A duration that specifies how frequently the client cache should query Boundary for changes to sessions and targets.
|
||||
Note that Boundary only searches sessions and targets that the user who ran the command has access to.
|
||||
|
||||
For more information, refer to the [`daemon start`](/boundary/docs/commands/daemon/start) command documentation.
|
||||
For more information, refer to the [`cache start`](/boundary/docs/commands/cache/start) command documentation.
|
||||
|
||||
### Logging
|
||||
|
||||
@@ -62,10 +62,10 @@ It compresses and keeps the last 3 rotated logs before deleting a log.
|
||||
|
||||
### Status
|
||||
|
||||
You can check the status of the cache using the `boundary daemon status` command.
|
||||
You can check the status of the cache using the `boundary cache status` command.
|
||||
The command returns information about the cache including the uptime, user count, user information, and which Boundary resources the cache is tracking.
|
||||
|
||||
For more information, refer to the [`daemon status`](/boundary/docs/commands/daemon/status) command documentation.
|
||||
For more information, refer to the [`cache status`](/boundary/docs/commands/cache/status) command documentation.
|
||||
|
||||
|
||||
### Auth tokens
|
||||
@@ -74,6 +74,6 @@ By default, the Boundary CLI tries to use a keyring to store and receive auth to
|
||||
Whenever you use an auth token to interact with Boundary, the client cache stores the auth token and syncs the data associated with it.
|
||||
If you authenticate to multiple Boundary instances, the client cache stores multiple auth tokens and syncs the data associated with each token.
|
||||
|
||||
To search the client cache for a specific Boundary instance, you can specify the appropriate auth token using the `boundary daemon add-token` command.
|
||||
To search the client cache for a specific Boundary instance, you can specify the appropriate auth token using the `boundary cache add-token` command.
|
||||
|
||||
For more information, refer to the [`daemon add-token`](/boundary/docs/commands/daemon/add-token) command documentation.
|
||||
For more information, refer to the [`cache add-token`](/boundary/docs/commands/cache/add-token) command documentation.
|
||||
+9
-9
@@ -1,15 +1,15 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: daemon add-token - Command
|
||||
page_title: cache add-token - Command
|
||||
description: |-
|
||||
The "daemon add-token" command lets you add an auth token to a Boundary daemon that is running.
|
||||
The "cache add-token" command lets you add an auth token to a Boundary cache that is running.
|
||||
---
|
||||
|
||||
# daemon add-token
|
||||
# cache add-token
|
||||
|
||||
Command: `boundary daemon add-token`
|
||||
Command: `boundary cache add-token`
|
||||
|
||||
The `boundary daemon add-token` command lets you add an auth token from your keyring to a Boundary daemon that is running.
|
||||
The `boundary cache add-token` command lets you add an auth token from your keyring to a Boundary cache that is running.
|
||||
|
||||
By default, the Boundary CLI tries to use a keyring to store and receive auth tokens.
|
||||
Whenever you use an auth token to interact with Boundary, the client cache stores the auth token and syncs the data associated with it.
|
||||
@@ -32,13 +32,13 @@ For more information, refer to [Identity and access management (IAM)](/boundary/
|
||||
The following command adds an auth token to the client cache from your keyring:
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon add-token
|
||||
$ boundary cache add-token
|
||||
```
|
||||
|
||||
The following command specifies the name of the keyring `development` from which you want to add the token:
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon add-token -token-name development
|
||||
$ boundary cache add-token -token-name development
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -46,7 +46,7 @@ $ boundary daemon add-token -token-name development
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon add-token [options]
|
||||
$ boundary cache add-token [options]
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
@@ -71,4 +71,4 @@ If you set this parameter, it overrides the `token-name` parameter.
|
||||
You can use this value to switch user identities for different commands.
|
||||
You can also specify a token name using the **BOUNDARY_TOKEN_NAME** environment variable.
|
||||
|
||||
@include 'cmd-option-note.mdx'
|
||||
@include 'cmd-option-note.mdx'
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: cache - Command
|
||||
description: |-
|
||||
Boundary's "cache" command lets you manage a local cache of information to facilitate searches and protect your system resources from being overwhelmed.
|
||||
---
|
||||
|
||||
# cache
|
||||
|
||||
Command: `boundary cache`
|
||||
|
||||
The `cache` command lets you manage the Boundary cache and perform operations on the local cache of information.
|
||||
|
||||
## Example
|
||||
|
||||
The following command starts the Boundary cache in the background:
|
||||
|
||||
```shell-session
|
||||
$ boundary cache start -background
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
Usage: boundary cache <subcommand> [options] [args]
|
||||
# ...
|
||||
Subcommands:
|
||||
add-token Add an auth token to a Boundary cache that is currently running.
|
||||
start Starts the Boundary cache.
|
||||
status Gets the status information of a Boundary cache that is currently running.
|
||||
stop Stops the Boundary cache.
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
For more information, examples, and usage, click on the name of the subcommand in the sidebar or one of the links below:
|
||||
|
||||
- [add-token](/boundary/docs/commands/cache/add-token)
|
||||
- [start](/boundary/docs/commands/cache/start)
|
||||
- [status](/boundary/docs/commands/cache/status)
|
||||
- [stop](/boundary/docs/commands/cache/stop)
|
||||
Vendored
+11
-11
@@ -1,22 +1,22 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: daemon start - Command
|
||||
page_title: cache start - Command
|
||||
description: |-
|
||||
The "daemon start" command lets you manually start the Boundary daemon and customize the behavior of the local cache.
|
||||
The "cache start" command lets you manually start the Boundary cache and customize the behavior of the local cache.
|
||||
---
|
||||
|
||||
# daemon start
|
||||
# cache start
|
||||
|
||||
Command: `boundary daemon start`
|
||||
Command: `boundary cache start`
|
||||
|
||||
The `boundary daemon start` command lets you manually start the Boundary daemon and customize the behavior of the local cache.
|
||||
The `boundary cache start` command lets you manually start the Boundary cache and customize the behavior of the local cache.
|
||||
|
||||
## Example
|
||||
|
||||
The following command starts the Boundary daemon in the background:
|
||||
The following command starts the Boundary cache in the background:
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon start -background
|
||||
$ boundary cache start -background
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -24,16 +24,16 @@ $ boundary daemon start -background
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon start [options] [args]
|
||||
$ boundary cache start [options] [args]
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
### Command options
|
||||
|
||||
- `background` - Starts the Boundary daemon in the background.
|
||||
- `background` - Starts the Boundary cache in the background.
|
||||
The default value is `false`.
|
||||
By default, the daemon starts in the foreground.
|
||||
By default, the cache starts in the foreground.
|
||||
- `log-format=<string>` - Specifies the log format, mostly as a fallback for events.
|
||||
Supported values are `standard` and `json`.
|
||||
- `max-search-refresh-timeout=<duration>` - If a search request triggers a best effort refresh, this value specifies how long the refresh should run before time out.
|
||||
@@ -46,4 +46,4 @@ The default value is 30 seconds.
|
||||
- `refresh-interval` - A duration that specifies how frequently the client cache should query Boundary for changes to sessions and targets.
|
||||
Note that Boundary only searches sessions and targets that the user who ran the command has access to.
|
||||
|
||||
@include 'cmd-option-note.mdx'
|
||||
@include 'cmd-option-note.mdx'
|
||||
Vendored
+9
-9
@@ -1,23 +1,23 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: daemon status - Command
|
||||
page_title: cache status - Command
|
||||
description: |-
|
||||
The "daemon status" command lets you manually check the status of the Boundary daemon.
|
||||
The "cache status" command lets you manually check the status of the Boundary cache.
|
||||
---
|
||||
|
||||
# daemon status
|
||||
# cache status
|
||||
|
||||
Command: `boundary daemon status`
|
||||
Command: `boundary cache status`
|
||||
|
||||
The `boundary daemon status` command lets you manually check the status of the Boundary daemon.
|
||||
The `boundary cache status` command lets you manually check the status of the Boundary cache.
|
||||
Boundary prints out a status report that includes configuration, user, and resource information.
|
||||
|
||||
## Example
|
||||
|
||||
The following command checks the status of the Boundary daemon:
|
||||
The following command checks the status of the Boundary cache:
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon status
|
||||
$ boundary cache status
|
||||
```
|
||||
|
||||
**Example output:**
|
||||
@@ -39,7 +39,7 @@ Status:
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon status [options] [args]
|
||||
$ boundary cache status [options] [args]
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
@@ -49,4 +49,4 @@ $ boundary daemon status [options] [args]
|
||||
- `output-curl-string` - Specifies that Boundary should print an equivalent cURL command string and exit, instead of executing the request.
|
||||
The default value is `false`.
|
||||
|
||||
@include 'cmd-option-note.mdx'
|
||||
@include 'cmd-option-note.mdx'
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: cache stop - Command
|
||||
description: |-
|
||||
The "cache stop" command lets you manually stop the Boundary cache.
|
||||
---
|
||||
|
||||
# cache stop
|
||||
|
||||
Command: `boundary cache stop`
|
||||
|
||||
The `boundary cache stop` command lets you manually stop the Boundary cache.
|
||||
|
||||
## Example
|
||||
|
||||
The following command stops the Boundary cache:
|
||||
|
||||
```shell-session
|
||||
$ boundary cache stop
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
$ boundary cache stop [options] [args]
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
@include 'cmd-option-note.mdx'
|
||||
@@ -1,43 +0,0 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: daemon - Command
|
||||
description: |-
|
||||
Boundary's "daemon" command lets you manage a local cache of information to facilitate searches and protect your system resources from being overwhelmed.
|
||||
---
|
||||
|
||||
# daemon
|
||||
|
||||
Command: `boundary daemon`
|
||||
|
||||
The `daemon` command lets you manage the Boundary daemon and perform operations on the local cache of information.
|
||||
|
||||
## Example
|
||||
|
||||
The following command starts the Boundary daemon in the background:
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon start -background
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
Usage: boundary daemon <subcommand> [options] [args]
|
||||
# ...
|
||||
Subcommands:
|
||||
add-token Add an auth token to a Boundary daemon that is currently running.
|
||||
start Starts the Boundary daemon.
|
||||
status Gets the status information of a Boundary daemon that is currently running.
|
||||
stop Stops the Boundary daemon.
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
For more information, examples, and usage, click on the name of the subcommand in the sidebar or one of the links below:
|
||||
|
||||
- [add-token](/boundary/docs/commands/daemon/add-token)
|
||||
- [start](/boundary/docs/commands/daemon/start)
|
||||
- [status](/boundary/docs/commands/daemon/status)
|
||||
- [stop](/boundary/docs/commands/daemon/stop)
|
||||
@@ -1,32 +0,0 @@
|
||||
---
|
||||
layout: docs
|
||||
page_title: daemon stop - Command
|
||||
description: |-
|
||||
The "daemon stop" command lets you manually stop the Boundary daemon.
|
||||
---
|
||||
|
||||
# daemon stop
|
||||
|
||||
Command: `boundary daemon stop`
|
||||
|
||||
The `boundary daemon stop` command lets you manually stop the Boundary daemon.
|
||||
|
||||
## Example
|
||||
|
||||
The following command stops the Boundary daemon:
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon stop
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
$ boundary daemon stop [options] [args]
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
@include 'cmd-option-note.mdx'
|
||||
@@ -982,27 +982,27 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "daemon",
|
||||
"title": "cache",
|
||||
"routes": [
|
||||
{
|
||||
"title": "Overview",
|
||||
"path": "commands/daemon"
|
||||
"path": "commands/cache"
|
||||
},
|
||||
{
|
||||
"title": "add-token",
|
||||
"path": "commands/daemon/add-token"
|
||||
"path": "commands/cache/add-token"
|
||||
},
|
||||
{
|
||||
"title": "start",
|
||||
"path": "commands/daemon/start"
|
||||
"path": "commands/cache/start"
|
||||
},
|
||||
{
|
||||
"title": "status",
|
||||
"path": "commands/daemon/status"
|
||||
"path": "commands/cache/status"
|
||||
},
|
||||
{
|
||||
"title": "stop",
|
||||
"path": "commands/daemon/stop"
|
||||
"path": "commands/cache/stop"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user