Skip to content

Commit

Permalink
deprecate "opslevel import group" command
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbloss committed Nov 1, 2023
1 parent 8d8e2d9 commit eb9f976
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Deprecated-20231101-105247.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Deprecated
body: '"opslevel import group" command is deprecated'
time: 2023-11-01T10:52:47.479832-05:00
37 changes: 4 additions & 33 deletions src/cmd/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"

"github.com/opslevel/opslevel-go/v2023"
"github.com/rs/zerolog/log"

"github.com/opslevel/cli/common"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -273,40 +272,12 @@ var deleteGroupCmd = &cobra.Command{
var importGroupsCmd = &cobra.Command{
Use: "group",
Aliases: []string{"groups"},
Short: "Imports groups from a CSV",
Deprecated: `Please convert all Groups into Teams. See https://docs.opslevel.com/docs/groups`,
Long: `Imports a list of groups from a CSV file with the column headers:
Name,Description,Parent
Example:
cat << EOF | opslevel import group -f -
Name,Description,Parent
Engineering,All of Engineering,
Product,All of Product,engineering
Sales,Sales BU,product
EOF
`,
Short: "(Formerly) Imports groups from a CSV",
Long: "(Formerly) Imports groups from a CSV",
Deprecated: `Groups are deprecated! Please use Teams instead. See https://docs.opslevel.com/docs/groups`,
Run: func(cmd *cobra.Command, args []string) {
reader, err := readImportFilepathAsCSV()
err := errors.New("Groups are deprecated! Please use Teams instead.\nopslevel import team <args>")
cobra.CheckErr(err)
for reader.Rows() {
name := reader.Text("Name")
input := opslevel.GroupInput{
Name: name,
Description: reader.Text("Description"),
}
parent := reader.Text("Parent")
if parent != "" {
input.Parent = opslevel.NewIdentifier(parent)
}
group, err := getClientGQL().CreateGroup(input)
if err != nil {
log.Error().Err(err).Msgf("error creating group '%s'", name)
continue
}
log.Info().Msgf("created group '%s' with id '%s'", group.Name, group.Id)
}
},
}

Expand Down

0 comments on commit eb9f976

Please sign in to comment.