Skip to content

Commit

Permalink
Return all secret details in read output, not only value.
Browse files Browse the repository at this point in the history
  • Loading branch information
anvial committed Apr 10, 2024
1 parent 757e856 commit 25ad42f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 2 additions & 6 deletions internal/juju/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type ReadSecretInput struct {
}

type ReadSecretOutput struct {
Value map[string]string
SecretDetails apisecrets.SecretDetails
}

type UpdateSecretInput struct {
Expand Down Expand Up @@ -132,12 +132,8 @@ func (c *secretsClient) ReadSecret(input *ReadSecretInput) (ReadSecretOutput, er
return ReadSecretOutput{}, errors.New(results[0].Error)
}

value, err := results[0].Value.Values()
if err != nil {
return ReadSecretOutput{}, err
}
return ReadSecretOutput{
Value: value,
SecretDetails: results[0],
}, nil
}

Expand Down
2 changes: 0 additions & 2 deletions internal/juju/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func (s *SecretSuite) TestReadSecret() {
s.Require().NoError(err)

s.Assert().NotNil(output)
s.Assert().Equal(map[string]string{"key": "value"}, output.Value)
}

func (s *SecretSuite) TestReadSecretError() {
Expand Down Expand Up @@ -217,7 +216,6 @@ func (s *SecretSuite) TestUpdateSecretWithRenaming() {
s.Require().NoError(err)

s.Assert().NotNil(output)
s.Assert().Equal(map[string]string{"key": "value2"}, output.Value)
}

func (s *SecretSuite) TestUpdateSecret() {
Expand Down

0 comments on commit 25ad42f

Please sign in to comment.