Skip to content

Commit

Permalink
chore(deps): bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamzeh committed Dec 11, 2023
1 parent 6b28a24 commit e821343
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 46 deletions.
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/openfga/cli

go 1.21.4
go 1.21.5

require (
github.com/golang/mock v1.6.0
Expand All @@ -9,13 +9,13 @@ require (
github.com/muesli/roff v0.1.0
github.com/nwidger/jsoncolor v0.3.2
github.com/oklog/ulid/v2 v2.1.0
github.com/openfga/api/proto v0.0.0-20231201195548-7ad5c05e75ca
github.com/openfga/go-sdk v0.3.0-beta.1.0.20231127120042-25b92122948b
github.com/openfga/language/pkg/go v0.0.0-20231205215259-92fa8fbddd50
github.com/openfga/openfga v1.4.0-rc1.0.20231128174922-9d26b1a5f809
github.com/openfga/api/proto v0.0.0-20231208224251-d2c535d32f73
github.com/openfga/go-sdk v0.3.0-beta.1.0.20231211020732-3416cf7e4ce8
github.com/openfga/language/pkg/go v0.0.0-20231211021145-b54d4bf9b384
github.com/openfga/openfga v1.3.11-0.20231208194451-c01b4615f19e
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0
github.com/spf13/viper v1.18.1
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -46,6 +46,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/mango v0.2.0 // indirect
github.com/muesli/mango-pflag v0.1.0 // indirect
github.com/natefinch/wrap v0.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
Expand All @@ -67,7 +68,7 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
Expand Down
26 changes: 14 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWe
github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0=
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
github.com/natefinch/wrap v0.2.0 h1:IXzc/pw5KqxJv55gV0lSOcKHYuEZPGbQrOOXr/bamRk=
github.com/natefinch/wrap v0.2.0/go.mod h1:6gMHlAl12DwYEfKP3TkuykYUfLSEAvHw67itm4/KAS8=
github.com/nwidger/jsoncolor v0.3.2 h1:rVJJlwAWDJShnbTYOQ5RM7yTA20INyKXlJ/fg4JMhHQ=
github.com/nwidger/jsoncolor v0.3.2/go.mod h1:Cs34umxLbJvgBMnVNVqhji9BhoT/N/KinHqZptQ7cf4=
github.com/oklog/ulid/v2 v2.1.0 h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU=
Expand All @@ -143,14 +145,14 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI=
github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
github.com/openfga/api/proto v0.0.0-20231201195548-7ad5c05e75ca h1:a6jTXuhaDujhui5CD3bzwJ8gwFAHrHi+gx1XRq0LZWg=
github.com/openfga/api/proto v0.0.0-20231201195548-7ad5c05e75ca/go.mod h1:YSbEQDNGnVlThfExHQ3zDNd+puWXf4zzfL0ms2VbIwI=
github.com/openfga/go-sdk v0.3.0-beta.1.0.20231127120042-25b92122948b h1:04yvgA4OMVjJgVc7bIh+5a/l6i6vlUIRBdM4CALrtyc=
github.com/openfga/go-sdk v0.3.0-beta.1.0.20231127120042-25b92122948b/go.mod h1:RODDM0KHDu3VjhaStH6VbM9mfZl+EGwHmfNQx7v13bY=
github.com/openfga/language/pkg/go v0.0.0-20231205215259-92fa8fbddd50 h1:u/SwhUkLawu+RNUEyn0ehFVkb4degLsy8QHtOpsc8E0=
github.com/openfga/language/pkg/go v0.0.0-20231205215259-92fa8fbddd50/go.mod h1:HbTu+eir08P+lNWemmc/aKai/IoOmanXKFole/HTmn8=
github.com/openfga/openfga v1.4.0-rc1.0.20231128174922-9d26b1a5f809 h1:WgV4qTkz0pqYdulATJ3s/F2risRKR4vnL6HNn11LMkI=
github.com/openfga/openfga v1.4.0-rc1.0.20231128174922-9d26b1a5f809/go.mod h1:36ryB6Y9qI2X/e0qzvBB9KvcfrIf5hd3Gpi2O+smtCI=
github.com/openfga/api/proto v0.0.0-20231208224251-d2c535d32f73 h1:lGEwAl2ixfmDU+BjoOTPcBTgWEcqvKQaz0/eb8dqyoE=
github.com/openfga/api/proto v0.0.0-20231208224251-d2c535d32f73/go.mod h1:YSbEQDNGnVlThfExHQ3zDNd+puWXf4zzfL0ms2VbIwI=
github.com/openfga/go-sdk v0.3.0-beta.1.0.20231211020732-3416cf7e4ce8 h1:RKshYwAn82duCwwv+wZvrOUC6ZOAnRZYDmw730JvE7c=
github.com/openfga/go-sdk v0.3.0-beta.1.0.20231211020732-3416cf7e4ce8/go.mod h1:Ky3uVuylBYH8tiBPvGDn1QUypCgw9zFUL0VzA5PBR80=
github.com/openfga/language/pkg/go v0.0.0-20231211021145-b54d4bf9b384 h1:nGdEPKkHVTl1v8bxUyrQZ4B8UlOscnJBgSe3cnfIbHc=
github.com/openfga/language/pkg/go v0.0.0-20231211021145-b54d4bf9b384/go.mod h1:WamR7K9KCvw+Elbep2QhVWo0xE/DRJSuQz3RQYwvfck=
github.com/openfga/openfga v1.3.11-0.20231208194451-c01b4615f19e h1:q9tZmhPwtLUF6GZ+lzSoPa/Ieu8IUm355/FZUlv2UpE=
github.com/openfga/openfga v1.3.11-0.20231208194451-c01b4615f19e/go.mod h1:D5ZLnOgkGmPMET+X3bkfm/bRGOxOi+TxLq0/r4s5ndM=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
Expand Down Expand Up @@ -192,8 +194,8 @@ github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI=
github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM=
github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -244,8 +246,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No=
golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb h1:c0vyKkb6yr3KR7jEfJaOSv4lG7xPkbN6r52aJz1d8a8=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
2 changes: 1 addition & 1 deletion internal/authorizationmodel/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (model *AuthzModel) GetCreatedAt() *time.Time {
}

func (model *AuthzModel) Set(authzModel openfga.AuthorizationModel) {
model.ID = authzModel.Id
model.ID = &authzModel.Id
model.SchemaVersion = &authzModel.SchemaVersion
model.TypeDefinitions = &authzModel.TypeDefinitions

Expand Down
2 changes: 1 addition & 1 deletion internal/cmdutils/get-client-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func GetClientConfig(cmd *cobra.Command) fga.ClientConfig {
clientCredentialsClientSecret, _ := cmd.Flags().GetString("client-secret")

return fga.ClientConfig{
ServerURL: apiURL,
ApiUrl: apiURL,
StoreID: storeID,
AuthorizationModelID: authorizationModelID,
APIToken: apiToken,
Expand Down
31 changes: 6 additions & 25 deletions internal/fga/fga.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ limitations under the License.
package fga

import (
"net/url"

"github.com/openfga/cli/internal/build"
openfga "github.com/openfga/go-sdk"
"github.com/openfga/go-sdk/client"
"github.com/openfga/go-sdk/credentials"
)

var userAgent = "openfga-cli/" + build.Version

type ClientConfig struct {
ServerURL string `json:"api_url,omitempty"` //nolint:tagliatelle
ApiUrl string `json:"api_url,omitempty"` //nolint:tagliatelle

Check warning on line 29 in internal/fga/fga.go

View workflow job for this annotation

GitHub Actions / Lints

var-naming: struct field ApiUrl should be APIURL (revive)
StoreID string `json:"store_id,omitempty"`
AuthorizationModelID string `json:"authorization_model_id,omitempty"`
APIToken string `json:"api_token,omitempty"`
Expand Down Expand Up @@ -66,34 +63,18 @@ func (c ClientConfig) getCredentials() *credentials.Credentials {
}
}

func (c ClientConfig) getClientConfig() (*client.ClientConfiguration, error) {
apiURIParts, err := url.Parse(c.ServerURL)
if err != nil {
return nil, err //nolint:wrapcheck
}

var authorizationModelID *string
if c.AuthorizationModelID != "" {
authorizationModelID = openfga.PtrString(c.AuthorizationModelID)
}

func (c ClientConfig) getClientConfig() *client.ClientConfiguration {
return &client.ClientConfiguration{
ApiScheme: apiURIParts.Scheme,
ApiHost: apiURIParts.Host,
ApiUrl: c.ApiUrl,
StoreId: c.StoreID,
AuthorizationModelId: authorizationModelID,
AuthorizationModelId: c.AuthorizationModelID,
Credentials: c.getCredentials(),
UserAgent: userAgent,
}, nil
}
}

func (c ClientConfig) GetFgaClient() (*client.OpenFgaClient, error) {
config, err := c.getClientConfig()
if err != nil {
return nil, err
}

fgaClient, err := client.NewSdkClient(config)
fgaClient, err := client.NewSdkClient(c.getClientConfig())
if err != nil {
return nil, err //nolint:wrapcheck
}
Expand Down

0 comments on commit e821343

Please sign in to comment.