Add CLI for workers (#2164)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2022-06-10 09:05:43 -04:00
1 parent 5b978d7fa7
commit b84001c07d
23 files changed
+1019 -33

No files matched your search

+31 -13
View File
@@ -30,10 +30,6 @@ type cmdInfo struct {
// output env var and print
HasExampleCliOutput bool
// IsAbstractType triggers some behavior specialized for abstract types,
// e.g. those that have subcommands for create/update
IsAbstractType bool
// HasId controls whether to add ID emptiness checking. Note that some
// commands that allow name/scope id or name/scope name handling may skip
// this in favor of custom logic.
@@ -79,6 +75,10 @@ type cmdInfo struct {
// IsPluginType controls whether standard plugin flags are generated
IsPluginType bool
// SkipClientCallActions allows skipping creation of an actual client
// call for an action in favor of custom logic in extra actions
SkipClientCallActions []string
}
var inputStructs = map[string][]*cmdInfo{
@@ -89,7 +89,6 @@ var inputStructs = map[string][]*cmdInfo{
StdActions: []string{"read", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
IsAbstractType: true,
Container: "AuthMethod",
HasId: true,
HasName: true,
@@ -130,7 +129,6 @@ var inputStructs = map[string][]*cmdInfo{
ResourceType: resource.AuthMethod.String(),
Pkg: "authmethods",
StdActions: []string{"read", "delete", "list"},
IsAbstractType: true,
HasExtraHelpFunc: true,
Container: "Scope",
HasId: true,
@@ -179,7 +177,6 @@ var inputStructs = map[string][]*cmdInfo{
ResourceType: resource.CredentialStore.String(),
Pkg: "credentialstores",
StdActions: []string{"read", "delete", "list"},
IsAbstractType: true,
HasExtraHelpFunc: true,
Container: "Scope",
HasId: true,
@@ -206,7 +203,6 @@ var inputStructs = map[string][]*cmdInfo{
ResourceType: resource.CredentialLibrary.String(),
Pkg: "credentiallibraries",
StdActions: []string{"read", "delete", "list"},
IsAbstractType: true,
HasExtraHelpFunc: true,
Container: "CredentialStore",
HasId: true,
@@ -246,7 +242,6 @@ var inputStructs = map[string][]*cmdInfo{
ResourceType: resource.HostCatalog.String(),
Pkg: "hostcatalogs",
StdActions: []string{"read", "delete", "list"},
IsAbstractType: true,
HasExtraHelpFunc: true,
Container: "Scope",
HasId: true,
@@ -290,7 +285,6 @@ var inputStructs = map[string][]*cmdInfo{
StdActions: []string{"read", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
IsAbstractType: true,
Container: "HostCatalog",
HasId: true,
HasName: true,
@@ -332,7 +326,6 @@ var inputStructs = map[string][]*cmdInfo{
Pkg: "hosts",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
IsAbstractType: true,
Container: "HostCatalog",
HasId: true,
HasName: true,
@@ -358,7 +351,6 @@ var inputStructs = map[string][]*cmdInfo{
ResourceType: resource.ManagedGroup.String(),
Pkg: "managedgroups",
StdActions: []string{"read", "delete", "list"},
IsAbstractType: true,
Container: "AuthMethod",
HasId: true,
HasName: true,
@@ -425,7 +417,6 @@ var inputStructs = map[string][]*cmdInfo{
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
HasExampleCliOutput: true,
IsAbstractType: true,
HasName: true,
HasDescription: true,
Container: "Scope",
@@ -461,4 +452,31 @@ var inputStructs = map[string][]*cmdInfo{
VersionedActions: []string{"update", "add-accounts", "remove-accounts", "set-accounts"},
},
},
"workers": {
{
ResourceType: resource.Worker.String(),
Pkg: "workers",
StdActions: []string{"read", "update", "delete", "list"},
HasId: true,
Container: "Scope",
HasName: true,
HasDescription: true,
VersionedActions: []string{"update"},
},
{
ResourceType: resource.Worker.String(),
Pkg: "workers",
StdActions: []string{"create"},
SubActionPrefix: "worker-led",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "Scope",
HasDescription: true,
NeedsSubtypeInCreate: true,
SkipClientCallActions: []string{"create"},
},
},
}