MCPcopy Index your code
hub / github.com/docker/cli / newCACommand

Function newCACommand

cli/command/swarm/ca.go:29–56  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

27}
28
29func newCACommand(dockerCLI command.Cli) *cobra.Command {
30 opts := caOptions{}
31
32 cmd := &cobra.Command{
33 Use: "ca [OPTIONS]",
34 Short: "Display and rotate the root CA",
35 Args: cli.NoArgs,
36 RunE: func(cmd *cobra.Command, args []string) error {
37 return runCA(cmd.Context(), dockerCLI, cmd.Flags(), opts)
38 },
39 Annotations: map[string]string{
40 "version": "1.30",
41 "swarm": "manager",
42 },
43 ValidArgsFunction: cobra.NoFileCompletions,
44 DisableFlagsInUseLine: true,
45 }
46
47 flags := cmd.Flags()
48 addSwarmCAFlags(flags, &opts.swarmCAOptions)
49 flags.BoolVar(&opts.rotate, flagRotate, false, "Rotate the swarm CA - if no certificate or key are provided, new ones will be generated")
50 flags.Var(&opts.rootCACert, flagCACert, "Path to the PEM-formatted root CA certificate to use for the new cluster")
51 flags.Var(&opts.rootCAKey, flagCAKey, "Path to the PEM-formatted root CA key to use for the new cluster")
52
53 flags.BoolVarP(&opts.detach, "detach", "d", false, "Exit immediately instead of waiting for the root rotation to converge")
54 flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress progress output")
55 return cmd
56}
57
58func runCA(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, opts caOptions) error {
59 apiClient := dockerCLI.Client()

Calls 2

runCAFunction · 0.85
addSwarmCAFlagsFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…