Skip to content

Commit

Permalink
Merge pull request #196 from OpsLevel/db/setup-team-hierarchies
Browse files Browse the repository at this point in the history
add Parent Teams to add, create, import of teams
  • Loading branch information
davidbloss authored Oct 30, 2023
2 parents a3afe0a + d215da3 commit 12d672f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Feature-20231030-150050.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Feature
body: add "parentTeam" field to "import teams" command and team command examples
time: 2023-10-30T15:00:50.727989-05:00
3 changes: 3 additions & 0 deletions .changes/unreleased/Removed-20231030-150005.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Removed
body: remove "group" field from "import teams" command
time: 2023-10-30T15:00:05.134799-05:00
20 changes: 10 additions & 10 deletions src/cmd/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ var createTeamCmd = &cobra.Command{
Example: `opslevel create team my-team
cat << EOF | opslevel create team my-team" -f -
managerEmail: "[email protected]""
group:
alias: "my-group"
managerEmail: "[email protected]"
parentTeam:
alias: "parent-team"
responsibilities: "all the things"
EOF`,
Args: cobra.ExactArgs(1),
Expand Down Expand Up @@ -120,8 +120,8 @@ var updateTeamCmd = &cobra.Command{
Example: `
cat << EOF | opslevel update team my-team" -f -
managerEmail: "[email protected]""
group:
alias: "my-group"
parentTeam:
alias: "parent-team-2"
responsibilities: "all the things"
EOF
`,
Expand Down Expand Up @@ -271,10 +271,10 @@ var importTeamsCmd = &cobra.Command{
Aliases: []string{"teams"},
Short: "Imports teams from a CSV",
Long: `Imports a list of teams from a CSV file with the column headers:
Name,Manager,Responsibilities,Group`,
Name,Manager,Responsibilities,ParentTeam`,
Example: `
cat << EOF | opslevel import teams -f -
Name,Manager,Responsibilities,Group
Name,Manager,Responsibilities,ParentTeam
Platform,[email protected],Makes Tools,engineering
Sales,[email protected],Sells Tools,product
EOF
Expand All @@ -289,9 +289,9 @@ EOF
ManagerEmail: reader.Text("Manager"),
Responsibilities: reader.Text("Responsibilities"),
}
group := reader.Text("Group")
if group != "" {
input.Group = opslevel.NewIdentifier(group)
parentTeam := reader.Text("ParentTeam")
if parentTeam != "" {
input.ParentTeam = opslevel.NewIdentifier(parentTeam)
}
team, err := getClientGQL().CreateTeam(input)
if err != nil {
Expand Down

0 comments on commit 12d672f

Please sign in to comment.