Skip to content

Commit

Permalink
Make Read return name/value/info, but no all details.
Browse files Browse the repository at this point in the history
Add Secret ID to Read struct
  • Loading branch information
anvial committed Apr 11, 2024
1 parent 25ad42f commit a1faee1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/juju/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ type ReadSecretInput struct {
}

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

type UpdateSecretInput struct {
Expand Down Expand Up @@ -133,7 +136,10 @@ func (c *secretsClient) ReadSecret(input *ReadSecretInput) (ReadSecretOutput, er
}

return ReadSecretOutput{
SecretDetails: results[0],
SecretId: results[0].Metadata.URI.String(),
Name: results[0].Metadata.Label,
Value: results[0].Value.EncodedValues(),
Info: results[0].Metadata.Description,
}, nil
}

Expand Down Expand Up @@ -185,6 +191,8 @@ func (c *secretsClient) UpdateSecret(input *UpdateSecretInput) error {
return typedError(err)
}
}
} else {
return errors.New("updating secrets by name is not supported")
}

return nil
Expand Down

0 comments on commit a1faee1

Please sign in to comment.