Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use warrant-go v6 #47

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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