Skip to content

Commit 4dc244c

Browse files
committed
fix(cli/pam): Add back the pam types-list, pam types-create commands and indicate deprecation
Signed-off-by: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
1 parent 054b0f1 commit 4dc244c

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

cmd/pam.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,34 @@ party PAM providers to secure certificate stores. The PAM component of the Keyfa
4141
programmatically create, delete, edit, and list PAM Providers.`,
4242
}
4343

44+
var deprecatedPamTypesListCmd = &cobra.Command{
45+
Use: "types-list",
46+
Deprecated: "use `pam types list`.",
47+
Short: "Returns a list of all available PAM provider types.",
48+
Long: "Returns a list of all available PAM provider types.",
49+
RunE: func(cmd *cobra.Command, args []string) error {
50+
cmd.SilenceUsage = true
51+
deprecationErr := fmt.Errorf("this command is deprecated; use `pam types list`")
52+
return deprecationErr
53+
},
54+
}
55+
56+
var deprecatedPamTypesCreateCmd = &cobra.Command{
57+
Use: "types-create",
58+
Deprecated: "use `pam types create`.",
59+
Short: "Creates a new PAM provider type.",
60+
Long: `Creates a new PAM Provider type, currently only supported from JSON file and from GitHub. To install from
61+
Github. To install from GitHub, use the --repo flag to specify the GitHub repository and optionally the branch to use.
62+
NOTE: the file from Github must be named integration-manifest.json and must use the same schema as
63+
https://github.com/Keyfactor/hashicorp-vault-pam/blob/main/integration-manifest.json. To install from a local file, use
64+
--from-file to specify the path to the JSON file.`,
65+
RunE: func(cmd *cobra.Command, args []string) error {
66+
cmd.SilenceUsage = true
67+
deprecationErr := fmt.Errorf("this command is deprecated; use `pam types create`")
68+
return deprecationErr
69+
},
70+
}
71+
4472
var pamProvidersListCmd = &cobra.Command{
4573
Use: "list",
4674
Short: "Returns a list of all the configured PAM providers.",
@@ -411,10 +439,40 @@ func init() {
411439
filePath string
412440
name string
413441
id int32
442+
repo string
443+
branch string
414444
)
415445

416446
RootCmd.AddCommand(pamCmd)
417447

448+
// PAM Provider Types List
449+
pamCmd.AddCommand(deprecatedPamTypesListCmd)
450+
451+
// PAM Provider Types Create
452+
pamCmd.AddCommand(deprecatedPamTypesCreateCmd)
453+
deprecatedPamTypesCreateCmd.Flags().StringVarP(
454+
&filePath,
455+
FlagFromFile,
456+
"f",
457+
"",
458+
"Path to a JSON file containing the PAM Type Object Data.",
459+
)
460+
deprecatedPamTypesCreateCmd.Flags().StringVarP(&name, "name", "n", "", "Name of the PAM Provider Type.")
461+
deprecatedPamTypesCreateCmd.Flags().StringVarP(
462+
&repo,
463+
"repo",
464+
"r",
465+
"",
466+
"Keyfactor repository name of the PAM Provider Type.",
467+
)
468+
deprecatedPamTypesCreateCmd.Flags().StringVarP(
469+
&branch,
470+
"branch",
471+
"b",
472+
"",
473+
"Branch name for the repository. Defaults to 'main'.",
474+
)
475+
418476
// PAM Providers
419477

420478
// PAM Providers List

0 commit comments

Comments
 (0)