Skip to content

Commit

Permalink
"opslevel import group" command has been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbloss committed Nov 1, 2023
1 parent 7f12369 commit 737f82e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Removed-20231101-104007.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Removed
body: '"opslevel import group" command has been removed'
time: 2023-11-01T10:40:07.550406-05:00
42 changes: 0 additions & 42 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 @@ -270,46 +269,6 @@ 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
`,
Run: func(cmd *cobra.Command, args []string) {
reader, err := readImportFilepathAsCSV()
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)
}
},
}

func init() {
createCmd.AddCommand(createGroupCmd)
getCmd.AddCommand(getGroupCommand)
Expand All @@ -321,5 +280,4 @@ func init() {
listCmd.AddCommand(listGroupCmd)
updateCmd.AddCommand(updateGroupCmd)
deleteCmd.AddCommand(deleteGroupCmd)
importCmd.AddCommand(importGroupsCmd)
}

0 comments on commit 737f82e

Please sign in to comment.