mirror of https://github.com/docker/cli.git
volume: annotate cluster-volumes flags for API version and swarm
This hides the flags when connecting to an older engine, or if swarm is not enabled, and is also used to add badges in the documentation. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
3455580ebc
commit
0fab8ecf36
|
@ -69,15 +69,35 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
|
||||
// flags for cluster volumes only
|
||||
flags.StringVar(&options.group, "group", "", "Cluster Volume group (cluster volumes)")
|
||||
flags.SetAnnotation("group", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("group", "swarm", []string{"manager"})
|
||||
flags.StringVar(&options.scope, "scope", "single", `Cluster Volume access scope ("single"|"multi")`)
|
||||
flags.SetAnnotation("scope", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("scope", "swarm", []string{"manager"})
|
||||
flags.StringVar(&options.sharing, "sharing", "none", `Cluster Volume access sharing ("none"|"readonly"|"onewriter"|"all")`)
|
||||
flags.SetAnnotation("sharing", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("sharing", "swarm", []string{"manager"})
|
||||
flags.StringVar(&options.availability, "availability", "active", `Cluster Volume availability ("active"|"pause"|"drain")`)
|
||||
flags.SetAnnotation("availability", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("availability", "swarm", []string{"manager"})
|
||||
flags.StringVar(&options.accessType, "type", "block", `Cluster Volume access type ("mount"|"block")`)
|
||||
flags.SetAnnotation("type", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("type", "swarm", []string{"manager"})
|
||||
flags.Var(&options.secrets, "secret", "Cluster Volume secrets")
|
||||
flags.SetAnnotation("secret", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("secret", "swarm", []string{"manager"})
|
||||
flags.Var(&options.limitBytes, "limit-bytes", "Minimum size of the Cluster Volume in bytes")
|
||||
flags.SetAnnotation("limit-bytes", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("limit-bytes", "swarm", []string{"manager"})
|
||||
flags.Var(&options.requiredBytes, "required-bytes", "Maximum size of the Cluster Volume in bytes")
|
||||
flags.SetAnnotation("required-bytes", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("required-bytes", "swarm", []string{"manager"})
|
||||
flags.Var(&options.requisiteTopology, "topology-required", "A topology that the Cluster Volume must be accessible from")
|
||||
flags.SetAnnotation("topology-required", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("topology-required", "swarm", []string{"manager"})
|
||||
flags.Var(&options.preferredTopology, "topology-preferred", "A topology that the Cluster Volume would be preferred in")
|
||||
flags.SetAnnotation("topology-preferred", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("topology-preferred", "swarm", []string{"manager"})
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
flags.StringVar(&options.format, "format", "", flagsHelper.FormatHelp)
|
||||
flags.VarP(&options.filter, "filter", "f", "Provide filter values (e.g. 'dangling=true')")
|
||||
flags.BoolVar(&options.cluster, "cluster", false, "Display only cluster volumes, and use cluster volume list formatting")
|
||||
flags.SetAnnotation("cluster", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("cluster", "swarm", []string{"manager"})
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -22,11 +22,17 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runUpdate(dockerCli, args[0], availability, cmd.Flags())
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"version": "1.42",
|
||||
"swarm": "manager",
|
||||
},
|
||||
ValidArgsFunction: completion.VolumeNames(dockerCli),
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
flags.StringVar(&availability, "availability", "active", `Cluster Volume availability ("active"|"pause"|"drain")`)
|
||||
flags.SetAnnotation("availability", "version", []string{"1.42"})
|
||||
flags.SetAnnotation("availability", "swarm", []string{"manager"})
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue