Files
threshold/internal/cmd/gencli/input.go
T
Jim 86192f75eb feature (auth/ldap): add LDAP auth method along with associated accounts and managed groups (#2912)
* feature (auth): required schema changes for auth ldap method (#2669)

chore (auth/ldap): move schema changes to next avail migration number

* feature (auth/ldap): define AuthMethod and all its value objects (#2703)

* feature (auth/ldap): storage protos
* feature (auth/ldap): define AuthMethod and all its value objects

* feature (auth/ldap): add repo and reading an auth method (#2718)

* feature (auth/ldap): add Repository.CreateAuthMethod(...) and Repository.DeleteAuthMethod(...) (#2724)

* feature (auth/ldap): add Repository.UpdateAuthMethod(...) (#2739)

* feature (auth/ldap): add Account

* feature (auth/ldap): add AuthMethod.EnableGroups

* fix (auth/ldap): refactor AuthMethod.oplog to enforce proper constraints

* feature (auth/ldap): add Account repo functions

* refactor (auth/ldap): remove entry attributes from account

Realized the entry attributes could have absolutely anything in them
(including binary data) and since we absolutely don't have to have them
there's just no reason to take on the risk.

* feature (auth/ldap): add AuthMethod.UseTokenGroups

* feature (auth/ldap): add Authenticate(...)

* refactor (auth/ldap): ensure options take a context as the 1st parameter

* feature (auth/ldap): add Account attribute maps

* chore (auth/ldap): make fmt deltas

* feature (auth/ldap): add managed groups (#2760)

* tests (auth/ldap): add missing unit test to Repository.DeleteAccount(...)

Add bits to test the delete operation when you're not able to generate
oplog metadata

* feature (auth/ldap): add managed groups

fixup! feature (auth/ldap): add managed groups (#2760)

* feature (auth/ldap): service proto definition (#2761)

* feature (handlers/authmethods): add handlers for ldap auth method operations (#2794)

* feature (auth/ldap): add Account attribute maps

* chore (auth/ldap): update cap/ldap to latest version

* feature (auth/ldap): add ldap api generation definitions

* feature (authmethods): add ldap repo NewService(...)

* feature (authmethods/ldap): add proper mask_mapping to protobufs

* feature (authmethods): add support to get an ldap auth method

* refactor (auth/ldap): export TestGenerateCA(...)

* feature (authmethods): add support to create an ldap auth method

* feature (authmethods): add support to delete an ldap auth method

* feature (authmethods): add support to list ldap auth methods

* refactor (auth/ldap): make urls optional for NewAuthMethod(...)

* refactor (auth/ldap): export ldap.TestInvalidPem

* chore: make fmt changes

* fix (auth/ldap): properly handle group search config

Add constraints and tests to ensure when an ldap AuthMethod.EnableGroups
is true, and UseTokenGroups is false; that there's a GroupDn configured
for finding a user's associated groups

* feature (authmethods): add support to update an ldap auth methods

* chore (db/ldap): tmp mv migrations so there's no conflict with ongoing work

* feature (verifier): add ldap auth method to verifier bits

* fix (controller): prevent panic when controller stops when there's no listener

* feature (authmethods): add support to authenticate via ldap auth methods

* chore (migrations): fix whitespace in stmt

* chore: fmt fixup

* tests (auth/ldap): invalid err msg

* feature (cli/authmethods): add support for ldap auth-methods CRUD and authenticate (#2810)

* feature (authmethods): add CLI support for ldap auth methods CRUD

* tests (api/auth): ldap auth method classification tests

* feature (authmethods): add CLI support for ldap auth authenticate

* feature (auth/ldap): set request timeouts for ldap server connections

* feature (handlers/authmethods): handle u_anon listing properly.

* feature (account/handers): ldap account and managed group CRUDL APIs (#2852)

* feature (auth/ldap) add repository Listing of ManagedGroupMemberAccount

* feature (controller/handlers): add ldapRepoFn to accounts service

* feature (auth/ldap) register ldap managed group subtype

* feature (account/handlers): ldap account CRUDL APIs

* feature (controller/handlers): add ldapRepo to managed groups service

* feature (account/handlers): ldap managed group CRUDL APIs

* docs (domain): add LDAP accounts, auth-methods and managed groups (#2857)

* feature (ldap/cli) add ldap accounts and managed groups CRUDL commands (#2856)

* fix (handlers/authmethods): fix ldap authorized actions (#2892)

* feature (cli/ldap/authenticate): use primary auth method if none is provided (#2890)

* fix (auth/ldap): support setting the state attribute

* feature (cli/ldap/authenticate): use primary auth method if none is provided

* feature (wh/ldap) add tests for new ldap auth method and accounts (#2919)

* refactor (migrations/ldap): mv to correct directory

* chore: add copyright headers

* fix (api/authmethods/ldap): renumber new LdapAuthMethodAttributes field

* fix (auth/ldap): allow the auth method state to be updated (#2951)

* chore: update sdk and api versions for llb - this is tmp until merging

* tests (managed groups): add required errContains for new test
2023-03-15 11:40:40 -04:00

670 lines
21 KiB
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package main
import (
"github.com/hashicorp/boundary/internal/types/resource"
)
type cmdInfo struct {
// The type of the resource, e.g. "target"
ResourceType string
// The API package under the api path
Pkg string
// Standard actions (with standard parameters) used by this resource
StdActions []string
// HasExtraCommandVars controls whether to generate an embedded struct with
// extra command variables
HasExtraCommandVars bool
// SkipNormalHelp indicates skipping the normal help case for when it needs
// to be only custom (mainly for subactions)
SkipNormalHelp bool
// HasExtraHelpFunc controls whether to include a default statement chaining
// to an extra help function
HasExtraHelpFunc bool
// HasExampleCliOutput controls whether to generate code to look for a CLI
// output env var and print
HasExampleCliOutput 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.
HasId bool
// Container controls what to generate for a required container (scope ID,
// auth method ID, etc.)
Container string
// HasName controls whether to add name options
HasName bool
// HasDescription controls whether to add description options
HasDescription bool
// HasScopeName controls whether to add scope name options
HasScopeName bool
// VersionedActions controls which actions to add a case for version checking
VersionedActions []string
// SubActionPrefix specifies the prefix to use when generating sub-action
// commands (e.g. "targets update tcp")
SubActionPrefix string
// NeedsSubtypeInCreate controls whether the sub-type must be passed in as
// an argument to a create call. Targets need this, accounts do not, etc.
NeedsSubtypeInCreate bool
// PrefixAttributeFieldErrorsWithSubactionPrefix will prepend the value in
// SubActionPrefix when reporting errors which are reported in flag format.
// This allows the flags to be defined differently from the the attribute
// names in the API.
PrefixAttributeFieldErrorsWithSubactionPrefix bool
// HasGenericAttributes controls whether to generate flags for -attributes,
// -attr, -string-attr, etc.
HasGenericAttributes bool
// HasGenericSecrets controls whether to generate flags for -secrets,
// -secret, -string-secret, etc.
HasGenericSecrets bool
// HasJsonObject controls whether to generate flags for -object,
// -kv, -string-kv, -bool-kv, -num-kv.
HasJsonObject bool
// 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{
"accounts": {
{
ResourceType: resource.Account.String(),
Pkg: "accounts",
StdActions: []string{"read", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
Container: "AuthMethod",
HasId: true,
HasName: true,
HasDescription: true,
VersionedActions: []string{"change-password", "set-password"},
},
{
ResourceType: resource.Account.String(),
Pkg: "accounts",
StdActions: []string{"create", "update"},
SubActionPrefix: "password",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "AuthMethod",
HasDescription: true,
VersionedActions: []string{"update"},
},
{
ResourceType: resource.Account.String(),
Pkg: "accounts",
StdActions: []string{"create", "update"},
SubActionPrefix: "oidc",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "AuthMethod",
HasDescription: true,
VersionedActions: []string{"update"},
},
{
ResourceType: resource.Account.String(),
Pkg: "accounts",
StdActions: []string{"create", "update"},
SubActionPrefix: "ldap",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "AuthMethod",
HasDescription: true,
VersionedActions: []string{"update"},
},
},
"authmethods": {
{
ResourceType: resource.AuthMethod.String(),
Pkg: "authmethods",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
Container: "Scope",
HasId: true,
},
{
ResourceType: resource.AuthMethod.String(),
Pkg: "authmethods",
StdActions: []string{"create", "update"},
SubActionPrefix: "password",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
},
{
ResourceType: resource.AuthMethod.String(),
Pkg: "authmethods",
StdActions: []string{"create", "update"},
SubActionPrefix: "oidc",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"update", "change-state"},
NeedsSubtypeInCreate: true,
},
{
ResourceType: resource.AuthMethod.String(),
Pkg: "authmethods",
StdActions: []string{"create", "update"},
SubActionPrefix: "ldap",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
},
},
"authtokens": {
{
ResourceType: resource.AuthToken.String(),
Pkg: "authtokens",
StdActions: []string{"read", "delete", "list"},
Container: "Scope",
},
},
"credentialstores": {
{
ResourceType: resource.CredentialStore.String(),
Pkg: "credentialstores",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
Container: "Scope",
HasId: true,
},
{
ResourceType: resource.CredentialStore.String(),
Pkg: "credentialstores",
StdActions: []string{"create", "update"},
SubActionPrefix: "vault",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
{
ResourceType: resource.CredentialStore.String(),
Pkg: "credentialstores",
StdActions: []string{"create", "update"},
SubActionPrefix: "static",
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
},
"credentiallibraries": {
{
ResourceType: resource.CredentialLibrary.String(),
Pkg: "credentiallibraries",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
Container: "CredentialStore",
HasId: true,
},
{
ResourceType: resource.CredentialLibrary.String(),
Pkg: "credentiallibraries",
StdActions: []string{"create", "update"},
SubActionPrefix: "vault",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
NeedsSubtypeInCreate: true,
Container: "CredentialStore",
VersionedActions: []string{"update"},
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
{
ResourceType: resource.CredentialLibrary.String(),
Pkg: "credentiallibraries",
StdActions: []string{"create", "update"},
SubActionPrefix: "vault-generic",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
NeedsSubtypeInCreate: true,
Container: "CredentialStore",
VersionedActions: []string{"update"},
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
{
ResourceType: resource.CredentialLibrary.String(),
Pkg: "credentiallibraries",
StdActions: []string{"create", "update"},
SubActionPrefix: "vault-ssh-certificate",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
NeedsSubtypeInCreate: true,
Container: "CredentialStore",
VersionedActions: []string{"update"},
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
},
"credentials": {
{
ResourceType: resource.Credential.String(),
Pkg: "credentials",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
Container: "CredentialStore",
HasId: true,
},
{
ResourceType: resource.Credential.String(),
Pkg: "credentials",
StdActions: []string{"create", "update"},
SubActionPrefix: "username_password",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "CredentialStore",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
{
ResourceType: resource.Credential.String(),
Pkg: "credentials",
StdActions: []string{"create", "update"},
SubActionPrefix: "ssh_private_key",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "CredentialStore",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
},
{
ResourceType: resource.Credential.String(),
Pkg: "credentials",
StdActions: []string{"create", "update"},
SubActionPrefix: "json",
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "CredentialStore",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
PrefixAttributeFieldErrorsWithSubactionPrefix: true,
HasJsonObject: true,
},
},
"groups": {
{
ResourceType: resource.Group.String(),
Pkg: "groups",
StdActions: []string{"create", "read", "update", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
HasId: true,
Container: "Scope",
HasName: true,
HasDescription: true,
VersionedActions: []string{"update", "add-members", "remove-members", "set-members"},
},
},
"hostcatalogs": {
{
ResourceType: resource.HostCatalog.String(),
Pkg: "hostcatalogs",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
Container: "Scope",
HasId: true,
},
{
ResourceType: resource.HostCatalog.String(),
Pkg: "hostcatalogs",
StdActions: []string{"create", "update"},
SubActionPrefix: "static",
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
},
{
ResourceType: resource.HostCatalog.String(),
Pkg: "hostcatalogs",
StdActions: []string{"create", "update"},
SubActionPrefix: "plugin",
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
HasDescription: true,
Container: "Scope",
IsPluginType: true,
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
HasGenericAttributes: true,
HasGenericSecrets: true,
},
},
"hostsets": {
{
ResourceType: resource.HostSet.String(),
Pkg: "hostsets",
StdActions: []string{"read", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
Container: "HostCatalog",
HasId: true,
HasName: true,
HasDescription: true,
VersionedActions: []string{"add-hosts", "set-hosts", "remove-hosts"},
},
{
ResourceType: resource.HostSet.String(),
Pkg: "hostsets",
StdActions: []string{"create", "update"},
SubActionPrefix: "static",
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "HostCatalog",
HasDescription: true,
VersionedActions: []string{"update"},
},
{
ResourceType: resource.HostSet.String(),
Pkg: "hostsets",
StdActions: []string{"create", "update"},
SubActionPrefix: "plugin",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "HostCatalog",
HasDescription: true,
HasGenericAttributes: true,
VersionedActions: []string{"update"},
},
},
"hosts": {
{
ResourceType: resource.Host.String(),
Pkg: "hosts",
StdActions: []string{"read", "delete", "list"},
HasExtraHelpFunc: true,
Container: "HostCatalog",
HasId: true,
HasName: true,
HasDescription: true,
},
{
ResourceType: resource.Host.String(),
Pkg: "hosts",
StdActions: []string{"create", "update"},
SubActionPrefix: "static",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "HostCatalog",
HasDescription: true,
VersionedActions: []string{"update"},
},
},
"managedgroups": {
{
ResourceType: resource.ManagedGroup.String(),
Pkg: "managedgroups",
StdActions: []string{"read", "delete", "list"},
Container: "AuthMethod",
HasId: true,
HasName: true,
HasDescription: true,
},
{
ResourceType: resource.ManagedGroup.String(),
Pkg: "managedgroups",
StdActions: []string{"create", "update"},
SubActionPrefix: "oidc",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "AuthMethod",
HasDescription: true,
VersionedActions: []string{"update"},
},
{
ResourceType: resource.ManagedGroup.String(),
Pkg: "managedgroups",
StdActions: []string{"create", "update"},
SubActionPrefix: "ldap",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "AuthMethod",
HasDescription: true,
VersionedActions: []string{"update"},
},
},
"roles": {
{
ResourceType: resource.Role.String(),
Pkg: "roles",
StdActions: []string{"create", "read", "update", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
HasId: true,
Container: "Scope",
HasName: true,
HasDescription: true,
VersionedActions: []string{"update", "add-grants", "remove-grants", "set-grants", "add-principals", "remove-principals", "set-principals"},
},
},
"scopes": {
{
ResourceType: resource.Scope.String(),
Pkg: "scopes",
StdActions: []string{"create", "read", "update", "delete", "list"},
HasExtraCommandVars: true,
HasId: true,
Container: "Scope",
HasName: true,
HasDescription: true,
VersionedActions: []string{"update"},
},
},
"sessions": {
{
ResourceType: resource.Session.String(),
Pkg: "sessions",
StdActions: []string{"read", "list"},
Container: "Scope",
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
HasId: true,
VersionedActions: []string{"cancel"},
},
},
"targets": {
{
ResourceType: resource.Target.String(),
Pkg: "targets",
StdActions: []string{"read", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
HasExampleCliOutput: true,
HasName: true,
HasDescription: true,
Container: "Scope",
VersionedActions: []string{"add-host-sources", "remove-host-sources", "set-host-sources", "add-credential-sources", "remove-credential-sources", "set-credential-sources"},
},
{
ResourceType: resource.Target.String(),
Pkg: "targets",
StdActions: []string{"create", "update"},
SubActionPrefix: "tcp",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "Scope",
HasDescription: true,
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
},
{
ResourceType: resource.Target.String(),
Pkg: "targets",
StdActions: []string{"create", "update"},
SubActionPrefix: "ssh",
HasExtraCommandVars: true,
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "Scope",
HasDescription: true,
VersionedActions: []string{"update"},
NeedsSubtypeInCreate: true,
},
},
"users": {
{
ResourceType: resource.User.String(),
Pkg: "users",
StdActions: []string{"create", "read", "update", "delete", "list"},
HasExtraCommandVars: true,
HasExtraHelpFunc: true,
HasId: true,
Container: "Scope",
HasName: true,
HasDescription: true,
VersionedActions: []string{"update", "add-accounts", "remove-accounts", "set-accounts"},
},
},
"workers": {
{
ResourceType: resource.Worker.String(),
Pkg: "workers",
StdActions: []string{"read", "update", "delete", "list"},
HasExtraHelpFunc: true,
HasId: true,
Container: "Scope",
HasName: true,
HasDescription: true,
VersionedActions: []string{"update", "add-worker-tags", "set-worker-tags", "remove-worker-tags"},
},
{
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"},
},
{
ResourceType: resource.Worker.String(),
Pkg: "workers",
StdActions: []string{"create"},
SubActionPrefix: "controller-led",
SkipNormalHelp: true,
HasExtraHelpFunc: true,
HasId: true,
HasName: true,
Container: "Scope",
HasDescription: true,
NeedsSubtypeInCreate: true,
SkipClientCallActions: []string{"create"},
},
},
}