Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 5c57830

Browse files
authored
Update processcreds.CredentialProcessResponse visibility to public (#4621)
In order to have a canonical type for encoding/decoding JSON for a credential process, the visibility of this type needed to be public. This type has been detailed in official AWS CLI documentation and is effectively part of the tooling ecosystem's external interface.
1 parent 8e62f0a commit 5c57830

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

aws/credentials/processcreds/provider.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,24 @@ func NewCredentialsCommand(command *exec.Cmd, options ...func(*ProcessProvider))
226226
return credentials.NewCredentials(p)
227227
}
228228

229-
type credentialProcessResponse struct {
230-
Version int
231-
AccessKeyID string `json:"AccessKeyId"`
229+
// A CredentialProcessResponse is the AWS credentials format that must be
230+
// returned when executing an external credential_process.
231+
type CredentialProcessResponse struct {
232+
// As of this writing, the Version key must be set to 1. This might
233+
// increment over time as the structure evolves.
234+
Version int
235+
236+
// The access key ID that identifies the temporary security credentials.
237+
AccessKeyID string `json:"AccessKeyId"`
238+
239+
// The secret access key that can be used to sign requests.
232240
SecretAccessKey string
233-
SessionToken string
234-
Expiration *time.Time
241+
242+
// The token that users must pass to the service API to use the temporary credentials.
243+
SessionToken string
244+
245+
// The date on which the current credentials expire.
246+
Expiration *time.Time
235247
}
236248

237249
// Retrieve executes the 'credential_process' and returns the credentials.
@@ -242,7 +254,7 @@ func (p *ProcessProvider) Retrieve() (credentials.Value, error) {
242254
}
243255

244256
// Serialize and validate response
245-
resp := &credentialProcessResponse{}
257+
resp := &CredentialProcessResponse{}
246258
if err = json.Unmarshal(out, resp); err != nil {
247259
return credentials.Value{ProviderName: ProviderName}, awserr.New(
248260
ErrCodeProcessProviderParse,

0 commit comments

Comments
 (0)