MCPcopy Create free account
hub / github.com/docker/cli / runSecretInspect

Function runSecretInspect

cli/command/secret/inspect.go:44–71  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, opts inspectOptions)

Source from the content-addressed store, hash-verified

42}
43
44func runSecretInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
45 apiClient := dockerCLI.Client()
46
47 if opts.pretty {
48 opts.format = "pretty"
49 }
50
51 getRef := func(id string) (any, []byte, error) {
52 res, err := apiClient.SecretInspect(ctx, id, client.SecretInspectOptions{})
53 return res.Secret, res.Raw, err
54 }
55
56 // check if the user is trying to apply a template to the pretty format, which
57 // is not supported
58 if strings.HasPrefix(opts.format, "pretty") && opts.format != "pretty" {
59 return errors.New("cannot supply extra formatting options to the pretty template")
60 }
61
62 secretCtx := formatter.Context{
63 Output: dockerCLI.Out(),
64 Format: newFormat(opts.format, false),
65 }
66
67 if err := inspectFormatWrite(secretCtx, opts.names, getRef); err != nil {
68 return cli.StatusError{StatusCode: 1, Status: err.Error()}
69 }
70 return nil
71}

Callers 1

newSecretInspectCommandFunction · 0.85

Calls 6

newFormatFunction · 0.70
inspectFormatWriteFunction · 0.70
ClientMethod · 0.65
OutMethod · 0.65
SecretInspectMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…