From 6cb6d903c0d022ddaa9777628093ab1f352b2013 Mon Sep 17 00:00:00 2001 From: Devon Bautista Date: Wed, 13 Nov 2024 15:27:47 -0700 Subject: [PATCH] feat: group SMD and BSS commands Group "low-level" commands, commands that send a single request to SMD/BSS and return the result directly, under the respective service metacommand. Commands that send a request to BSS are prefixed with 'bss' while commands that send a request to SMD are prefixed with 'smd'. This will save room for the more "high level" commands, commands that a sysadmin is more likely to use that abstract away the calls like 'discover'. --- ...boot-params-add.go => bss-boot-params-add.go} | 12 ++++++------ ...arams-delete.go => bss-boot-params-delete.go} | 10 +++++----- ...boot-params-get.go => bss-boot-params-get.go} | 10 +++++----- ...boot-params-set.go => bss-boot-params-set.go} | 14 +++++++------- ...arams-update.go => bss-boot-params-update.go} | 14 +++++++------- cmd/{boot-params.go => bss-boot-params.go} | 2 +- ...boot-script-get.go => bss-boot-script-get.go} | 2 +- cmd/{boot-script.go => bss-boot-script.go} | 2 +- cmd/{boot.go => bss-boot.go} | 4 ++-- cmd/{compep-delete.go => smd-compep-delete.go} | 10 +++++----- cmd/{compep-get.go => smd-compep-get.go} | 2 +- cmd/{compep.go => smd-compep.go} | 4 ++-- cmd/{component-add.go => smd-component-add.go} | 10 +++++----- ...mponent-delete.go => smd-component-delete.go} | 12 ++++++------ cmd/{component-get.go => smd-component-get.go} | 2 +- cmd/{component.go => smd-component.go} | 4 ++-- cmd/{group-add.go => smd-group-add.go} | 14 +++++++------- cmd/{group-delete.go => smd-group-delete.go} | 2 +- cmd/{group-get.go => smd-group-get.go} | 16 ++++++++-------- ...oup-member-add.go => smd-group-member-add.go} | 2 +- ...mber-delete.go => smd-group-member-delete.go} | 2 +- ...oup-member-get.go => smd-group-member-get.go} | 2 +- cmd/{group-member.go => smd-group-member.go} | 2 +- cmd/{group-update.go => smd-group-update.go} | 14 +++++++------- cmd/{group.go => smd-group.go} | 4 ++-- cmd/{iface-add.go => smd-iface-add.go} | 12 ++++++------ cmd/{iface-delete.go => smd-iface-delete.go} | 12 ++++++------ cmd/{iface-get.go => smd-iface-get.go} | 3 +-- cmd/{iface.go => smd-iface.go} | 4 ++-- cmd/{rfe-add.go => smd-rfe-add.go} | 8 ++++---- cmd/{rfe-delete.go => smd-rfe-delete.go} | 12 ++++++------ cmd/{rfe-get.go => smd-rfe-get.go} | 3 +-- cmd/{rfe.go => smd-rfe.go} | 4 ++-- 33 files changed, 114 insertions(+), 116 deletions(-) rename cmd/{boot-params-add.go => bss-boot-params-add.go} (92%) rename cmd/{boot-params-delete.go => bss-boot-params-delete.go} (94%) rename cmd/{boot-params-get.go => bss-boot-params-get.go} (91%) rename cmd/{boot-params-set.go => bss-boot-params-set.go} (90%) rename cmd/{boot-params-update.go => bss-boot-params-update.go} (89%) rename cmd/{boot-params.go => bss-boot-params.go} (93%) rename cmd/{boot-script-get.go => bss-boot-script-get.go} (98%) rename cmd/{boot-script.go => bss-boot-script.go} (92%) rename cmd/{boot.go => bss-boot.go} (91%) rename cmd/{compep-delete.go => smd-compep-delete.go} (94%) rename cmd/{compep-get.go => smd-compep-get.go} (98%) rename cmd/{compep.go => smd-compep.go} (90%) rename cmd/{component-add.go => smd-component-add.go} (92%) rename cmd/{component-delete.go => smd-component-delete.go} (93%) rename cmd/{component-get.go => smd-component-get.go} (97%) rename cmd/{component.go => smd-component.go} (88%) rename cmd/{group-add.go => smd-group-add.go} (92%) rename cmd/{group-delete.go => smd-group-delete.go} (98%) rename cmd/{group-get.go => smd-group-get.go} (85%) rename cmd/{group-member-add.go => smd-group-member-add.go} (96%) rename cmd/{group-member-delete.go => smd-group-member-delete.go} (97%) rename cmd/{group-member-get.go => smd-group-member-get.go} (95%) rename cmd/{group-member.go => smd-group-member.go} (92%) rename cmd/{group-update.go => smd-group-update.go} (89%) rename cmd/{group.go => smd-group.go} (90%) rename cmd/{iface-add.go => smd-iface-add.go} (90%) rename cmd/{iface-delete.go => smd-iface-delete.go} (94%) rename cmd/{iface-get.go => smd-iface-get.go} (98%) rename cmd/{iface.go => smd-iface.go} (90%) rename cmd/{rfe-add.go => smd-rfe-add.go} (95%) rename cmd/{rfe-delete.go => smd-rfe-delete.go} (94%) rename cmd/{rfe-get.go => smd-rfe-get.go} (98%) rename cmd/{rfe.go => smd-rfe.go} (91%) diff --git a/cmd/boot-params-add.go b/cmd/bss-boot-params-add.go similarity index 92% rename from cmd/boot-params-add.go rename to cmd/bss-boot-params-add.go index acc0c61..cbdefbe 100644 --- a/cmd/boot-params-add.go +++ b/cmd/bss-boot-params-add.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootParamsAddCmd represents the add command +// bootParamsAddCmd represents the bss-boot-params-add command var bootParamsAddCmd = &cobra.Command{ Use: "add", Args: cobra.NoArgs, @@ -23,15 +23,15 @@ Alternatively, pass -f to pass a file (optionally specifying --payload-format, J but the rules above still apply for the payload. This command sends a POST to BSS. An access token is required.`, - Example: ` ochami boot params add \ + Example: ` ochami bss boot params add \ --mac 00:de:ad:be:ef:00 \ --kernel https://example.com/kernel \ --initrd https://example.com/initrd \ --params 'quiet nosplash' - ochami boot params add --mac 00:de:ad:be:ef:00,00:c0:ff:ee:00:00 --params 'quiet nosplash' - ochami boot params add --mac 00:de:ad:be:ef:00 --mac 00:c0:ff:ee:00:00 --kernel https://example.com/kernel - ochami boot params add -f payload.json - ochami boot params add -f payload.yaml --payload-format yaml`, + ochami bss boot params add --mac 00:de:ad:be:ef:00,00:c0:ff:ee:00:00 --params 'quiet nosplash' + ochami bss boot params add --mac 00:de:ad:be:ef:00 --mac 00:c0:ff:ee:00:00 --kernel https://example.com/kernel + ochami bss boot params add -f payload.json + ochami bss boot params add -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // cmd.LocalFlags().NFlag() doesn't seem to work, so we check every flag if len(args) == 0 && diff --git a/cmd/boot-params-delete.go b/cmd/bss-boot-params-delete.go similarity index 94% rename from cmd/boot-params-delete.go rename to cmd/bss-boot-params-delete.go index b44703e..273f93e 100644 --- a/cmd/boot-params-delete.go +++ b/cmd/bss-boot-params-delete.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootParamsDeleteCmd represents the bss-bootparams-delete command +// bootParamsDeleteCmd represents the bss-boot-params-delete command var bootParamsDeleteCmd = &cobra.Command{ Use: "delete", Args: cobra.NoArgs, @@ -25,10 +25,10 @@ boot parameters by config (kernel URI, initrd URI, or kernel command line) or by JSON by default), but the rules above still apply for the payload. This command sends a DELETE to BSS. An access token is required.`, - Example: ` ochami boot params delete --kernel https://example.com/kernel - ochami boot params delete --kernel https://example.com/kernel --initrd https://example.com/initrd - ochami boot params delete -f payload.json - ochami boot params delete -f payload.yaml --payload-format yaml`, + Example: ` ochami bss boot params delete --kernel https://example.com/kernel + ochami bss boot params delete --kernel https://example.com/kernel --initrd https://example.com/initrd + ochami bss boot params delete -f payload.json + ochami bss boot params delete -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // cmd.LocalFlags().NFlag() doesn't seem to work, so we check every flag if len(args) == 0 && diff --git a/cmd/boot-params-get.go b/cmd/bss-boot-params-get.go similarity index 91% rename from cmd/boot-params-get.go rename to cmd/bss-boot-params-get.go index 86c290e..1497255 100644 --- a/cmd/boot-params-get.go +++ b/cmd/bss-boot-params-get.go @@ -13,7 +13,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootParamsGetCmd represents the boot-params-get command +// bootParamsGetCmd represents the bss-boot-params-get command var bootParamsGetCmd = &cobra.Command{ Use: "get", Args: cobra.NoArgs, @@ -23,10 +23,10 @@ parameters are returned. Optionally, --mac, --xname, and/or --nid can be passed to get boot parameters for specific components. This command sends a GET to BSS. An access token is required.`, - Example: ` ochami bss bootparams get - ochami bss bootparams get --mac 00:de:ad:be:ef:00 - ochami bss bootparams get --mac 00:de:ad:be:ef:00,00:c0:ff:ee:00:00 - ochami bss bootparams get --mac 00:de:ad:be:ef:00 --mac 00:c0:ff:ee:00:00`, + Example: ` ochami bss boot params get + ochami bss boot params get --mac 00:de:ad:be:ef:00 + ochami bss boot params get --mac 00:de:ad:be:ef:00,00:c0:ff:ee:00:00 + ochami bss boot params get --mac 00:de:ad:be:ef:00 --mac 00:c0:ff:ee:00:00`, Run: func(cmd *cobra.Command, args []string) { // Without a base URI, we cannot do anything bssBaseURI, err := getBaseURI(cmd) diff --git a/cmd/boot-params-set.go b/cmd/bss-boot-params-set.go similarity index 90% rename from cmd/boot-params-set.go rename to cmd/bss-boot-params-set.go index 39e1f0e..1bde7e0 100644 --- a/cmd/boot-params-set.go +++ b/cmd/bss-boot-params-set.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootParamsSetCmd represents the boot-params-set command +// bootParamsSetCmd represents the bss-boot-params-set command var bootParamsSetCmd = &cobra.Command{ Use: "set", Args: cobra.NoArgs, @@ -25,12 +25,12 @@ to pass a file (optionally specifying --payload-format, JSON by default), but th still apply for the payload. This command sends a PUT to BSS. An access token is required.`, - Example: ` ochami boot params set --xname x1000c1s7b0 --kernel https://example.com/kernel - ochami boot params set --xname x1000c1s7b0,x1000c1s7b1 --kernel https://example.com/kernel - ochami boot params set --xname x1000c1s7b0 --xname x1000c1s7b1 --kernel https://example.com/kernel - ochami boot params set --xname x1000c1s7b0 --nid 1 --mac 00:c0:ff:ee:00:00 --params 'quiet nosplash' - ochami boot params set -f payload.json - ochami boot params set -f payload.yaml --payload-format yaml`, + Example: ` ochami bss boot params set --xname x1000c1s7b0 --kernel https://example.com/kernel + ochami bss boot params set --xname x1000c1s7b0,x1000c1s7b1 --kernel https://example.com/kernel + ochami bss boot params set --xname x1000c1s7b0 --xname x1000c1s7b1 --kernel https://example.com/kernel + ochami bss boot params set --xname x1000c1s7b0 --nid 1 --mac 00:c0:ff:ee:00:00 --params 'quiet nosplash' + ochami bss boot params set -f payload.json + ochami bss boot params set -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // cmd.LocalFlags().NFlag() doesn't seem to work, so we check every flag if len(args) == 0 && diff --git a/cmd/boot-params-update.go b/cmd/bss-boot-params-update.go similarity index 89% rename from cmd/boot-params-update.go rename to cmd/bss-boot-params-update.go index 25f049f..3332d72 100644 --- a/cmd/boot-params-update.go +++ b/cmd/bss-boot-params-update.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootParamsUpdateCmd represents the bss-bootparams-update command +// bootParamsUpdateCmd represents the bss-boot-params-update command var bootParamsUpdateCmd = &cobra.Command{ Use: "update", Args: cobra.NoArgs, @@ -23,12 +23,12 @@ var bootParamsUpdateCmd = &cobra.Command{ default), but the rules above still apply for the payload. This command sends a PATCH to BSS. An access token is required.`, - Example: ` ochami boot params update --xname x1000c1s7b0 --kernel https://example.com/kernel - ochami boot params update --xname x1000c1s7b0,x1000c1s7b1 --kernel https://example.com/kernel - ochami boot params update --xname x1000c1s7b0 --xname x1000c1s7b1 --kernel https://example.com/kernel - ochami boot params update --xname x1000c1s7b0 --nid 1 --mac 00:c0:ff:ee:00:00 --params 'quiet nosplash' - ochami boot params update -f payload.json - ochami boot params update -f payload.yaml --payload-format yaml`, + Example: ` ochami bss boot params update --xname x1000c1s7b0 --kernel https://example.com/kernel + ochami bss boot params update --xname x1000c1s7b0,x1000c1s7b1 --kernel https://example.com/kernel + ochami bss boot params update --xname x1000c1s7b0 --xname x1000c1s7b1 --kernel https://example.com/kernel + ochami bss boot params update --xname x1000c1s7b0 --nid 1 --mac 00:c0:ff:ee:00:00 --params 'quiet nosplash' + ochami bss boot params update -f payload.json + ochami bss boot params update -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // cmd.LocalFlags().NFlag() doesn't seem to work, so we check every flag if len(args) == 0 && diff --git a/cmd/boot-params.go b/cmd/bss-boot-params.go similarity index 93% rename from cmd/boot-params.go rename to cmd/bss-boot-params.go index 5e7197a..7dfe73d 100644 --- a/cmd/boot-params.go +++ b/cmd/bss-boot-params.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootParamsCmd represents the boot-params command +// bootParamsCmd represents the bss-boot-params command var bootParamsCmd = &cobra.Command{ Use: "params", Args: cobra.NoArgs, diff --git a/cmd/boot-script-get.go b/cmd/bss-boot-script-get.go similarity index 98% rename from cmd/boot-script-get.go rename to cmd/bss-boot-script-get.go index 2860b69..cde5f2d 100644 --- a/cmd/boot-script-get.go +++ b/cmd/bss-boot-script-get.go @@ -13,7 +13,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootScriptGetCmd represents the bss-bootscript-get command +// bootScriptGetCmd represents the bss-boot-script-get command var bootScriptGetCmd = &cobra.Command{ Use: "get", Args: cobra.NoArgs, diff --git a/cmd/boot-script.go b/cmd/bss-boot-script.go similarity index 92% rename from cmd/boot-script.go rename to cmd/bss-boot-script.go index cc53254..5e94534 100644 --- a/cmd/boot-script.go +++ b/cmd/bss-boot-script.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootScriptCmd represents the boot-script command +// bootScriptCmd represents the bss-boot-script command var bootScriptCmd = &cobra.Command{ Use: "script", Args: cobra.NoArgs, diff --git a/cmd/boot.go b/cmd/bss-boot.go similarity index 91% rename from cmd/boot.go rename to cmd/bss-boot.go index e4de84a..4d4b5ee 100644 --- a/cmd/boot.go +++ b/cmd/bss-boot.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// bootCmd represents the boot command +// bootCmd represents the bss-boot command var bootCmd = &cobra.Command{ Use: "boot", Args: cobra.NoArgs, @@ -29,5 +29,5 @@ under this one interact with the Boot Script Service (BSS).`, } func init() { - rootCmd.AddCommand(bootCmd) + bssCmd.AddCommand(bootCmd) } diff --git a/cmd/compep-delete.go b/cmd/smd-compep-delete.go similarity index 94% rename from cmd/compep-delete.go rename to cmd/smd-compep-delete.go index 1e8142c..4aa0e3a 100644 --- a/cmd/compep-delete.go +++ b/cmd/smd-compep-delete.go @@ -12,17 +12,17 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// compepDeleteCmd represents the compep-delete command +// compepDeleteCmd represents the smd-compep-delete command var compepDeleteCmd = &cobra.Command{ Use: "delete -f | --all | ...", Short: "Delete one or more component endpoints", Long: `Delete one or more component endpoints. These can be specified by one or more xnames. This command sends a DELETE to SMD. An access token is required.`, - Example: ` ochami compep delete x3000c1s7b56n0 x3000c1s7b56n1 - ochami compep delete --all - ochami compep delete -f payload.json - ochami compep delete -f payload.yaml --payload-format yaml`, + Example: ` ochami smd compep delete x3000c1s7b56n0 x3000c1s7b56n1 + ochami smd compep delete --all + ochami smd compep delete -f payload.json + ochami smd compep delete -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // With options, only one of: // - A payload file with -f diff --git a/cmd/compep-get.go b/cmd/smd-compep-get.go similarity index 98% rename from cmd/compep-get.go rename to cmd/smd-compep-get.go index f53fa7e..331f5a4 100644 --- a/cmd/compep-get.go +++ b/cmd/smd-compep-get.go @@ -13,7 +13,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// compepGetCmd represents the compep-get command +// compepGetCmd represents the smd-compep-get command var compepGetCmd = &cobra.Command{ Use: "get [...]", Short: "Get all component endpoints or one identified by an xname", diff --git a/cmd/compep.go b/cmd/smd-compep.go similarity index 90% rename from cmd/compep.go rename to cmd/smd-compep.go index fa7b757..e0f83b9 100644 --- a/cmd/compep.go +++ b/cmd/smd-compep.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// compepCmd represents the compep command +// compepCmd represents the smd-compep command var compepCmd = &cobra.Command{ Use: "compep", Args: cobra.NoArgs, @@ -29,5 +29,5 @@ interact with the State Management Database (SMD).`, } func init() { - rootCmd.AddCommand(compepCmd) + smdCmd.AddCommand(compepCmd) } diff --git a/cmd/component-add.go b/cmd/smd-component-add.go similarity index 92% rename from cmd/component-add.go rename to cmd/smd-component-add.go index 18f7ad2..153d644 100644 --- a/cmd/component-add.go +++ b/cmd/smd-component-add.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// componentAddCmd represents the component-add command +// componentAddCmd represents the smd-component-add command var componentAddCmd = &cobra.Command{ Use: "add -f | ( )", Short: "Add new component(s)", @@ -20,10 +20,10 @@ var componentAddCmd = &cobra.Command{ other flags of this command. This command sends a POST to SMD. An access token is required.`, - Example: ` ochami component add x3000c1s7b56n0 56 - ochami component add --state Ready --enabled --role Compute --arch X86 x3000c1s7b56n0 56 - ochami component add -f payload.json - ochami component add -f payload.yaml --payload-format yaml`, + Example: ` ochami smd component add x3000c1s7b56n0 56 + ochami smd component add --state Ready --enabled --role Compute --arch X86 x3000c1s7b56n0 56 + ochami smd component add -f payload.json + ochami smd component add -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // Check that all required args are passed if len(args) == 0 && !cmd.Flag("payload").Changed { diff --git a/cmd/component-delete.go b/cmd/smd-component-delete.go similarity index 93% rename from cmd/component-delete.go rename to cmd/smd-component-delete.go index caa7423..7d02a38 100644 --- a/cmd/component-delete.go +++ b/cmd/smd-component-delete.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// componentDeleteCmd represents the component-delete command +// componentDeleteCmd represents the smd-component-delete command var componentDeleteCmd = &cobra.Command{ Use: "delete -f | --all | ...", Short: "Delete one or more components", @@ -19,11 +19,11 @@ var componentDeleteCmd = &cobra.Command{ or more NIDs, or a combination of both. This command sends a DELETE to SMD. An access token is required.`, - Example: ` ochami component delete x3000c1s7b56n0 - ochami component delete x3000c1s7b56n0 x3000c1s7b56n1 - ochami component delete --all - ochami component delete -f payload.json - ochami component delete -f payload.yaml --payload-format yaml`, + Example: ` ochami smd component delete x3000c1s7b56n0 + ochami smd component delete x3000c1s7b56n0 x3000c1s7b56n1 + ochami smd component delete --all + ochami smd component delete -f payload.json + ochami smd component delete -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // With options, only one of: // - A payload file with -f diff --git a/cmd/component-get.go b/cmd/smd-component-get.go similarity index 97% rename from cmd/component-get.go rename to cmd/smd-component-get.go index 0d46495..888c47b 100644 --- a/cmd/component-get.go +++ b/cmd/smd-component-get.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// componentGetCmd represents the component-get command +// componentGetCmd represents the smd-component-get command var componentGetCmd = &cobra.Command{ Use: "get", Args: cobra.NoArgs, diff --git a/cmd/component.go b/cmd/smd-component.go similarity index 88% rename from cmd/component.go rename to cmd/smd-component.go index c42061a..4eeffc1 100644 --- a/cmd/component.go +++ b/cmd/smd-component.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// componentCmd represents the component command +// componentCmd represents the smd-component command var componentCmd = &cobra.Command{ Use: "component", Args: cobra.NoArgs, @@ -29,5 +29,5 @@ interact with the State Management Database (SMD).`, } func init() { - rootCmd.AddCommand(componentCmd) + smdCmd.AddCommand(componentCmd) } diff --git a/cmd/group-add.go b/cmd/smd-group-add.go similarity index 92% rename from cmd/group-add.go rename to cmd/smd-group-add.go index f576c3a..89bce0a 100644 --- a/cmd/group-add.go +++ b/cmd/smd-group-add.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupAddCmd represents the group-add command +// groupAddCmd represents the smd-group-add command var groupAddCmd = &cobra.Command{ Use: "add -f | ", Short: "Add new group", @@ -20,17 +20,17 @@ Specifying -f also is mutually exclusive with the other flags of this commands and its arguments. This command sends a POST to SMD. An access token is required.`, - Example: ` ochami group add computes - ochami group add -d "Compute group" computes - ochami group add -d "Compute group" --tag tag1,tag2 --m x3000c1s7b0n1,x3000c1s7b1n1 computes - ochami group add \ + Example: ` ochami smd group add computes + ochami smd group add -d "Compute group" computes + ochami smd group add -d "Compute group" --tag tag1,tag2 --m x3000c1s7b0n1,x3000c1s7b1n1 computes + ochami smd group add \ --description "ARM64 group" \ --tag arm,64-bit \ --member x3000c1s7b0n1,x3000c1s7b1n1 \ --exclusive-group amd64 \ arm64 - ochami group add -f payload.json - ochami group add -f payload.yaml --payload-format yaml`, + ochami smd group add -f payload.json + ochami smd group add -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // Check that all required args are passed if len(args) == 0 && !cmd.Flag("payload").Changed { diff --git a/cmd/group-delete.go b/cmd/smd-group-delete.go similarity index 98% rename from cmd/group-delete.go rename to cmd/smd-group-delete.go index b7379e4..7ef903d 100644 --- a/cmd/group-delete.go +++ b/cmd/smd-group-delete.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupDeleteCmd represents the group-delete command +// groupDeleteCmd represents the smd-group-delete command var groupDeleteCmd = &cobra.Command{ Use: "delete -f | ...", Short: "Delete one or more groups", diff --git a/cmd/group-get.go b/cmd/smd-group-get.go similarity index 85% rename from cmd/group-get.go rename to cmd/smd-group-get.go index 89466e2..6da3324 100644 --- a/cmd/group-get.go +++ b/cmd/smd-group-get.go @@ -13,18 +13,18 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupGetCmd represents the get command +// groupGetCmd represents the smd-group-get command var groupGetCmd = &cobra.Command{ Use: "get", Args: cobra.NoArgs, Short: "Get all groups or group(s) identified by name and/or tag", - Example: ` ochami group get - ochami group get --name group1 - ochami group get --tag group1_tag - ochami group get --name group1,group2 - ochami group get --name group1 --name group2 - ochami group get --name group1,group2 --tag tag1,tag2 - ochami group get --name group1 --name group2 --tag tag1 --tag tag2`, + Example: ` ochami smd group get + ochami smd group get --name group1 + ochami smd group get --tag group1_tag + ochami smd group get --name group1,group2 + ochami smd group get --name group1 --name group2 + ochami smd group get --name group1,group2 --tag tag1,tag2 + ochami smd group get --name group1 --name group2 --tag tag1 --tag tag2`, Run: func(cmd *cobra.Command, args []string) { // Without a base URI, we cannot do anything smdBaseURI, err := getBaseURI(cmd) diff --git a/cmd/group-member-add.go b/cmd/smd-group-member-add.go similarity index 96% rename from cmd/group-member-add.go rename to cmd/smd-group-member-add.go index d5d90c5..3e7fc84 100644 --- a/cmd/group-member-add.go +++ b/cmd/smd-group-member-add.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupMemberAddCmd represents the group-member-add command +// groupMemberAddCmd represents the smd-group-member-add command var groupMemberAddCmd = &cobra.Command{ Use: "add ...", Args: cobra.MinimumNArgs(2), diff --git a/cmd/group-member-delete.go b/cmd/smd-group-member-delete.go similarity index 97% rename from cmd/group-member-delete.go rename to cmd/smd-group-member-delete.go index 9edc653..15408a2 100644 --- a/cmd/group-member-delete.go +++ b/cmd/smd-group-member-delete.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupMemberDeleteCmd represents the group-member-delete command +// groupMemberDeleteCmd represents the smd-group-member-delete command var groupMemberDeleteCmd = &cobra.Command{ Use: "delete ...", Args: cobra.MinimumNArgs(2), diff --git a/cmd/group-member-get.go b/cmd/smd-group-member-get.go similarity index 95% rename from cmd/group-member-get.go rename to cmd/smd-group-member-get.go index c079df4..f07bd02 100644 --- a/cmd/group-member-get.go +++ b/cmd/smd-group-member-get.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupMemberGetCmd represents the group-member-get command +// groupMemberGetCmd represents the smd-group-member-get command var groupMemberGetCmd = &cobra.Command{ Use: "get ", Args: cobra.ExactArgs(1), diff --git a/cmd/group-member.go b/cmd/smd-group-member.go similarity index 92% rename from cmd/group-member.go rename to cmd/smd-group-member.go index c10609a..a216922 100644 --- a/cmd/group-member.go +++ b/cmd/smd-group-member.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupMemberCmd represents the group-member command +// groupMemberCmd represents the smd-group-member command var groupMemberCmd = &cobra.Command{ Use: "member", Args: cobra.NoArgs, diff --git a/cmd/group-update.go b/cmd/smd-group-update.go similarity index 89% rename from cmd/group-update.go rename to cmd/smd-group-update.go index 6cb1dfa..f4c2261 100644 --- a/cmd/group-update.go +++ b/cmd/smd-group-update.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupUpdateCmd represents the update command +// groupUpdateCmd represents the smd-group-update command var groupUpdateCmd = &cobra.Command{ Use: "update [-f ] | ([--description ] [--tag ]... )", Short: "Update the description and/or tags of a group", @@ -21,12 +21,12 @@ or --tag must be specified. Alternatively, pass -f to pass a file rules above still apply for the payload. This command sends a PATCH to SMD. An access token is required.`, - Example: ` ochami group update --description "New description for compute" compute - ochami group update --tag existing_tag --tag new_tag compute - ochami group update --tag existing_tag,new_tag compute - ochami group update --tag existing_tag,new_tag -d "New description for compute" compute - ochami group update -f payload.json - ochami group update -f payload.yaml --payload-format yaml`, + Example: ` ochami smd group update --description "New description for compute" compute + ochami smd group update --tag existing_tag --tag new_tag compute + ochami smd group update --tag existing_tag,new_tag compute + ochami smd group update --tag existing_tag,new_tag -d "New description for compute" compute + ochami smd group update -f payload.json + ochami smd group update -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // cmd.LocalFlags().NFlag() doesn't seem to work, so we check every flag if len(args) == 0 && !cmd.Flag("description").Changed && !cmd.Flag("tag").Changed { diff --git a/cmd/group.go b/cmd/smd-group.go similarity index 90% rename from cmd/group.go rename to cmd/smd-group.go index 7148dfa..739438e 100644 --- a/cmd/group.go +++ b/cmd/smd-group.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// groupCmd represents the group command +// groupCmd represents the smd-group command var groupCmd = &cobra.Command{ Use: "group", Args: cobra.NoArgs, @@ -29,5 +29,5 @@ interact with the State Management Database (SMD).`, } func init() { - rootCmd.AddCommand(groupCmd) + smdCmd.AddCommand(groupCmd) } diff --git a/cmd/iface-add.go b/cmd/smd-iface-add.go similarity index 90% rename from cmd/iface-add.go rename to cmd/smd-iface-add.go index 6037b37..3689e67 100644 --- a/cmd/iface-add.go +++ b/cmd/smd-iface-add.go @@ -13,7 +13,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// ifaceAddCmd represents the iface-add command +// ifaceAddCmd represents the smd-iface-add command var ifaceAddCmd = &cobra.Command{ Use: "add -f | ( (,)...)", Short: "Add new ethernet interface(s)", @@ -23,11 +23,11 @@ passed to read from a payload file. Specifying -f also is mutually exclusive wit of this command and its arguments. This command sends a POST to SMD. An access token is required.`, - Example: ` ochami iface add x3000c1s7b55n0 de:ca:fc:0f:fe:ee NMN,172.16.0.55 - ochami iface add -d "Node Management for n55" x3000c1s7b55n0 de:ca:fc:0f:fe:ee NMN,172.16.0.55 - ochami iface add x3000c1s7b55n0 de:ca:fc:0f:fe:ee external,10.1.0.55 internal,172.16.0.55 - ochami iface add -f payload.json - ochami iface add -f payload.yaml --payload-format yaml`, + Example: ` ochami smd iface add x3000c1s7b55n0 de:ca:fc:0f:fe:ee NMN,172.16.0.55 + ochami smd iface add -d "Node Management for n55" x3000c1s7b55n0 de:ca:fc:0f:fe:ee NMN,172.16.0.55 + ochami smd iface add x3000c1s7b55n0 de:ca:fc:0f:fe:ee external,10.1.0.55 internal,172.16.0.55 + ochami smd iface add -f payload.json + ochami smd iface add -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // Check that all required args are passed if len(args) == 0 && !cmd.Flag("payload").Changed { diff --git a/cmd/iface-delete.go b/cmd/smd-iface-delete.go similarity index 94% rename from cmd/iface-delete.go rename to cmd/smd-iface-delete.go index 81d5a7b..61504a5 100644 --- a/cmd/iface-delete.go +++ b/cmd/smd-iface-delete.go @@ -11,7 +11,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// ifaceDeleteCmd represents the iface-delete command +// ifaceDeleteCmd represents the smd-iface-delete command var ifaceDeleteCmd = &cobra.Command{ Use: "delete -f | --all | ...", Short: "Delete one or more ethernet interfaces", @@ -19,11 +19,11 @@ var ifaceDeleteCmd = &cobra.Command{ interface IDs (note this is not the same as a component xname). This command sends a DELETE to SMD. An access token is required.`, - Example: ` ochami iface delete decafc0ffeee - ochami iface delete decafc0ffeee de:ad:be:ee:ee:ef - ochami iface delete --all - ochami iface delete -f payload.json - ochami iface delete -f payload.yaml --payload-format yaml`, + Example: ` ochami smd iface delete decafc0ffeee + ochami smd iface delete decafc0ffeee de:ad:be:ee:ee:ef + ochami smd iface delete --all + ochami smd iface delete -f payload.json + ochami smd iface delete -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // With options, only one of: // - A payload file with -f diff --git a/cmd/iface-get.go b/cmd/smd-iface-get.go similarity index 98% rename from cmd/iface-get.go rename to cmd/smd-iface-get.go index 9faacf6..cb47965 100644 --- a/cmd/iface-get.go +++ b/cmd/smd-iface-get.go @@ -13,7 +13,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// ifaceGetCmd represents the iface-get command +// ifaceGetCmd represents the smd-iface-get command var ifaceGetCmd = &cobra.Command{ Use: "get", Args: cobra.NoArgs, @@ -21,7 +21,6 @@ var ifaceGetCmd = &cobra.Command{ Long: `Get some or all ethernet interfaces optionally based on filter(s). If no options are passed, all ethernet interfaces are returned. Optionally, options can be passed to limit the ethernet interfaces returned.`, - Example: ` ochami iface get`, Run: func(cmd *cobra.Command, args []string) { // Without a base URI, we cannot do anything smdBaseURI, err := getBaseURI(cmd) diff --git a/cmd/iface.go b/cmd/smd-iface.go similarity index 90% rename from cmd/iface.go rename to cmd/smd-iface.go index 42330a8..895d642 100644 --- a/cmd/iface.go +++ b/cmd/smd-iface.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// ifaceCmd represents the iface command +// ifaceCmd represents the smd-iface command var ifaceCmd = &cobra.Command{ Use: "iface", Args: cobra.NoArgs, @@ -29,5 +29,5 @@ interact with the State Management Database (SMD).`, } func init() { - rootCmd.AddCommand(ifaceCmd) + smdCmd.AddCommand(ifaceCmd) } diff --git a/cmd/rfe-add.go b/cmd/smd-rfe-add.go similarity index 95% rename from cmd/rfe-add.go rename to cmd/smd-rfe-add.go index 0876304..ccc52df 100644 --- a/cmd/rfe-add.go +++ b/cmd/smd-rfe-add.go @@ -12,7 +12,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// rfeAddCmd represents the rfe-add command +// rfeAddCmd represents the smd-rfe-add command var rfeAddCmd = &cobra.Command{ Use: "add -f | ( )", Short: "Add new redfish endpoint(s)", @@ -21,9 +21,9 @@ unless -f is passed to read from a payload file. Specifying -f also is mutually flags of this command and its arguments. This command sends a POST to SMD. An access token is required.`, - Example: ` ochami rfe add x3000c1s7b56 bmc-node56 172.16.0.156 de:ca:fc:0f:fe:ee - ochami rfe add -f payload.json - ochami rfe add -f payload.yaml --payload-format yaml`, + Example: ` ochami smd rfe add x3000c1s7b56 bmc-node56 172.16.0.156 de:ca:fc:0f:fe:ee + ochami smd rfe add -f payload.json + ochami smd rfe add -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // Check that all required args are passed if len(args) == 0 && !cmd.Flag("payload").Changed { diff --git a/cmd/rfe-delete.go b/cmd/smd-rfe-delete.go similarity index 94% rename from cmd/rfe-delete.go rename to cmd/smd-rfe-delete.go index 1c89bb4..885bdfe 100644 --- a/cmd/rfe-delete.go +++ b/cmd/smd-rfe-delete.go @@ -11,18 +11,18 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// rfeDeleteCmd represents the delete command +// rfeDeleteCmd represents the smd-rfe-delete command var rfeDeleteCmd = &cobra.Command{ Use: "delete -f | --all | ...", Short: "Delete one or more redfish endpoints", Long: `Delete one or more redfish endpoints. These can be specified by one or more xnames. This command sends a DELETE to SMD. An access token is required.`, - Example: ` ochami rfe delete x3000c1s7b56 - ochami rfe delete x3000c1s7b56 x3000c1s7b56 - ochami rfe delete --all - ochami rfe delete -f payload.json - ochami rfe delete -f payload.yaml --payload-format yaml`, + Example: ` ochami smd rfe delete x3000c1s7b56 + ochami smd rfe delete x3000c1s7b56 x3000c1s7b56 + ochami smd rfe delete --all + ochami smd rfe delete -f payload.json + ochami smd rfe delete -f payload.yaml --payload-format yaml`, Run: func(cmd *cobra.Command, args []string) { // With options, only one of: // - A payload file with -f diff --git a/cmd/rfe-get.go b/cmd/smd-rfe-get.go similarity index 98% rename from cmd/rfe-get.go rename to cmd/smd-rfe-get.go index 4a1f9e0..6517f5a 100644 --- a/cmd/rfe-get.go +++ b/cmd/smd-rfe-get.go @@ -13,7 +13,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// rfeGetCmd represents the rfe-get command +// rfeGetCmd represents the smd-rfe-get command var rfeGetCmd = &cobra.Command{ Use: "get", Args: cobra.NoArgs, @@ -21,7 +21,6 @@ var rfeGetCmd = &cobra.Command{ Long: `Get all redfish endpoints or some based on filter(s). If no options are passed, all redfish endpoints are returned. Optionally, options can be passed to limit the redfish endpoints returned.`, - Example: ` ochami rfe get`, Run: func(cmd *cobra.Command, args []string) { // Without a base URI, we cannot do anything smdBaseURI, err := getBaseURI(cmd) diff --git a/cmd/rfe.go b/cmd/smd-rfe.go similarity index 91% rename from cmd/rfe.go rename to cmd/smd-rfe.go index 488a085..393a46f 100644 --- a/cmd/rfe.go +++ b/cmd/smd-rfe.go @@ -9,7 +9,7 @@ import ( "github.com/OpenCHAMI/ochami/internal/log" ) -// rfeCmd represents the rfe command +// rfeCmd represents the smd-rfe command var rfeCmd = &cobra.Command{ Use: "rfe", Args: cobra.NoArgs, @@ -29,5 +29,5 @@ interact with the State Management Database (SMD).`, } func init() { - rootCmd.AddCommand(rfeCmd) + smdCmd.AddCommand(rfeCmd) }