Skip to content

Commit

Permalink
Update to use warrant-go v6 (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
akajla09 authored Dec 11, 2023
1 parent 8853ac9 commit dd11af3
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.1
github.com/warrant-dev/warrant-go/v5 v5.3.0
github.com/warrant-dev/warrant-go/v6 v6.0.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/warrant-dev/warrant-go/v5 v5.3.0 h1:7DipZOCw7EpLffBOzNg+VVoO9klUQTd+zEvpP056XII=
github.com/warrant-dev/warrant-go/v5 v5.3.0/go.mod h1:00jaOr9wwpFFqPf8Ol19d38eXNyuDJMMdvyO8lINdIY=
github.com/warrant-dev/warrant-go/v6 v6.0.0 h1:x0JuOrQCJRH8qMQc22u6pHHVgcZ+HAcR/TazmUkASuQ=
github.com/warrant-dev/warrant-go/v6 v6.0.0/go.mod h1:45aYwT5ozWGYI8gcg3+4rPsGpJD1wahPm+6SoxgNJIY=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/reader"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v6"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/printer"
"github.com/warrant-dev/warrant-cli/internal/reader"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v6"
)

var assertFlagVal string
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/printer"
"github.com/warrant-dev/warrant-cli/internal/reader"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v5/object"
"github.com/warrant-dev/warrant-go/v6"
"github.com/warrant-dev/warrant-go/v6/object"
)

func init() {
Expand Down Expand Up @@ -173,7 +173,7 @@ warrant object delete role:admin`,
return err
}

err = object.Delete(objectType, objectId)
_, err = object.Delete(objectType, objectId)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/objecttype.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/printer"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v5/objecttype"
"github.com/warrant-dev/warrant-go/v6"
"github.com/warrant-dev/warrant-go/v6/objecttype"
)

var listObjecttypeWarrantToken string
Expand Down
16 changes: 10 additions & 6 deletions internal/cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ package cmd
import (
"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/printer"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v6"
)

var queryWarrantToken string
var queryLimit int
var queryAfterId string
var queryNextCursor string
var queryPrevCursor string

func init() {
queryCmd.Flags().StringVarP(&queryWarrantToken, "warrant-token", "w", "", "optional warrant token header value to include in query request")
queryCmd.Flags().IntVarP(&queryLimit, "limit", "l", 0, "optional query result set limit")
queryCmd.Flags().StringVar(&queryAfterId, "afterId", "", "optional afterId to include for paginating result set")

queryCmd.Flags().StringVar(&queryNextCursor, "nextCursor", "", "optional nextCursor string for pagination")
queryCmd.Flags().StringVar(&queryPrevCursor, "prevCursor", "", "optional prevCursor string for pagination")
rootCmd.AddCommand(queryCmd)
}

Expand All @@ -51,8 +52,11 @@ warrant query 'select explicit *'`,
if queryLimit > 0 {
queryParams.Limit = queryLimit
}
if queryAfterId != "" {
queryParams.AfterId = queryAfterId
if queryNextCursor != "" {
queryParams.NextCursor = queryNextCursor
}
if queryPrevCursor != "" {
queryParams.PrevCursor = queryPrevCursor
}

result, err := warrant.Query(args[0], &warrant.QueryParams{})
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/reader"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v6"
)

func init() {
Expand All @@ -42,7 +42,7 @@ warrant remove user:56 member role:admin 'domain == warrant.dev'`,
return err
}

err = warrant.Delete(warrantSpec)
_, err = warrant.Delete(warrantSpec)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/spf13/cobra"
"github.com/warrant-dev/warrant-cli/internal/config"
"github.com/warrant-dev/warrant-cli/internal/printer"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v6"
)

var cmdConfig *config.Config
Expand Down
2 changes: 1 addition & 1 deletion internal/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/pkg/errors"
"github.com/warrant-dev/warrant-cli/internal/config"
"github.com/warrant-dev/warrant-go/v5"
"github.com/warrant-dev/warrant-go/v6"
)

// Read an objectType and objectId from string
Expand Down

0 comments on commit dd11af3

Please sign in to comment.