Skip to content

Commit

Permalink
update client to latest swagger spec (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenglund authored Aug 14, 2023
1 parent 69fa027 commit 7008c8e
Show file tree
Hide file tree
Showing 86 changed files with 1,923 additions and 262 deletions.
2 changes: 1 addition & 1 deletion api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (rc *RockClient) GetAPIKey(ctx context.Context, name string,
user = *opts.User
}

getReq := rc.APIKeysApi.GetApiKey(ctx, user, name).Reveal(opts.Reveal)
getReq := rc.APIKeysApi.GetApiKey(ctx, user, name)

err = rc.Retry(ctx, func() error {
resp, httpResp, err = getReq.Execute()
Expand Down
17 changes: 5 additions & 12 deletions api_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,20 @@ func (s *SuiteAPIKey) TearDownSuite() {
s.Require().NoError(err)
}

const mask = "************************************************************"

func (s *SuiteAPIKey) TestGetAPIKey() {
ctx := testCtx()
key, err := s.rc.GetAPIKey(ctx, s.keyName)
s.Require().NoError(err)
s.Assert().Equalf(mask, key.Key[4:], "key should be masked")
s.Equal(6, len(key.GetKey()), "key hash should be 6 characters")
key.GetCreatedByApikeyName()
key.GetLastAccessTime()
}

func (s *SuiteAPIKey) TestUpdateAPIKey() {
ctx := testCtx()
key, err := s.rc.UpdateAPIKey(ctx, s.keyName, option.State(option.KeySuspended))
s.Require().NoError(err)
s.Assert().NotEqual(option.KeyActive, key.GetState())
}

func (s *SuiteAPIKey) TestGetAPIKeyWithReveal() {
ctx := testCtx()
key, err := s.rc.GetAPIKey(ctx, s.keyName, option.RevealKey())
s.Require().NoError(err)
s.Assert().NotEqualf(mask, key.Key[4:], "key should not be masked")
s.NotEqual(option.KeyActive, key.GetState())
}

func (s *SuiteAPIKey) TestListAPIKeys() {
Expand All @@ -78,5 +71,5 @@ func (s *SuiteAPIKey) TestListAPIKeys() {
}
}

s.Assert().True(found)
s.True(found)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/imdario/mergo v0.3.12 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
Expand Down
8 changes: 8 additions & 0 deletions openapi/.openapi-generator/FILES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion openapi/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7008c8e

Please sign in to comment.