Skip to content

Commit

Permalink
Update src/cmd/tag.go
Browse files Browse the repository at this point in the history
Co-authored-by: David Bloss <[email protected]>
  • Loading branch information
taimoor ahmad and davidbloss authored Sep 14, 2023
1 parent 2f79d68 commit db07ba5
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/cmd/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,20 @@ opslevel create tag --type=Team ID|ALIAS KEY VALUE
value := args[2]

if cmd.Flag("assign").Changed {
var input opslevel.TagAssignInput
tagInput := opslevel.TagInput{
Key: key,
Value: value,
}
input := opslevel.TagAssignInput{Tags: []opslevel.TagInput{tagInput}}

if opslevel.IsID(resource) {
input = opslevel.TagAssignInput{
Id: opslevel.ID(resource),
Tags: []opslevel.TagInput{tagInput},
}
input.Id = opslevel.ID(resource)
} else {
input = opslevel.TagAssignInput{
Alias: resource,
Type: opslevel.TaggableResource(resourceType),
Tags: []opslevel.TagInput{tagInput},
}
input.Alias = resource
input.Type = opslevel.TaggableResource(resourceType)
}


result, err := getClientGQL().AssignTag(input)
cobra.CheckErr(err)
fmt.Printf("updated new tag on %s: %s\n", resource, result[0].Id)
Expand Down

0 comments on commit db07ba5

Please sign in to comment.