mirror of
https://github.com/fluxcd/flux2.git
synced 2026-05-01 15:48:51 +00:00
Standardise the names of types
Most commands use either a kind, or a more readable spelling of a kind, in their output. To make this easier, this centralises the definition of those names in one place, and lets the command implementations choose whichever they need. Signed-off-by: Michael Bridgen <michael@weave.works>
This commit is contained in:
parent
d55d185044
commit
22a5ac7f0f
19 changed files with 75 additions and 50 deletions
|
|
@ -45,8 +45,8 @@ func init() {
|
|||
}
|
||||
|
||||
type deleteCommand struct {
|
||||
humanKind string // the kind being deleted, lowercase and spaced e.g., "image policy"
|
||||
adapter adapter // for getting the value, and later deleting it
|
||||
names
|
||||
object adapter // for getting the value, and later deleting it
|
||||
}
|
||||
|
||||
func (del deleteCommand) run(cmd *cobra.Command, args []string) error {
|
||||
|
|
@ -68,7 +68,7 @@ func (del deleteCommand) run(cmd *cobra.Command, args []string) error {
|
|||
Name: name,
|
||||
}
|
||||
|
||||
err = kubeClient.Get(ctx, namespacedName, del.adapter.asRuntimeObject())
|
||||
err = kubeClient.Get(ctx, namespacedName, del.object.asRuntimeObject())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ func (del deleteCommand) run(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
logger.Actionf("deleting %s %s in %s namespace", del.humanKind, name, namespace)
|
||||
err = kubeClient.Delete(ctx, del.adapter.asRuntimeObject())
|
||||
err = kubeClient.Delete(ctx, del.object.asRuntimeObject())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue