aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.97k stars 556 forks source link

feat(credential-providers): source accountId from credential providers #6019

Open siddsriv opened 2 months ago

siddsriv commented 2 months ago

Issue

Internal JS-4633 Part 1

Description

Sources accountId from credential providers.

Test Suites: 1 passed, 1 total Tests: 8 passed, 8 total Snapshots: 0 total Time: 2.76 s, estimated 4 s Ran all test suites. Done in 3.48s.

- [x] SSO
```console
 PASS  src/isSsoProfile.spec.ts (5.651 s)
 PASS  src/validateSsoProfile.spec.ts (5.806 s)
 PASS  src/fromSSO.spec.ts (5.911 s)
 PASS  src/resolveSSOCredentials.spec.ts (6.007 s)

Test Suites: 4 passed, 4 total
Tests:       33 passed, 33 total
Snapshots:   0 total
Time:        6.34 s, estimated 7 s
Ran all test suites.
Done in 7.00s.

Test Suites: 8 passed, 8 total Tests: 91 passed, 91 total Snapshots: 0 total Time: 9.109 s, estimated 10 s Ran all test suites. Done in 9.63s.

- [x] Process 
```console
 PASS  src/getValidatedProcessCredentials.spec.ts
 PASS  src/resolveProcessCredentials.spec.ts
 PASS  src/fromProcess.spec.ts

Test Suites: 3 passed, 3 total
Tests:       17 passed, 17 total
Snapshots:   0 total
Time:        4.939 s, estimated 5 s
Ran all test suites.
Done in 5.44s.

Test Suites: 1 passed, 1 total Tests: 6 passed, 6 total Snapshots: 0 total Time: 3.716 s Ran all test suites. Done in 4.33s.

- [x] Container (PR: https://github.com/smithy-lang/smithy-typescript/pull/1247)
```console
 PASS  packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.spec.ts
  isImdsCredentials
    ✓ should accept valid ImdsCredentials objects (1 ms)
    ✓ should reject credentials without an AccessKeyId
    ✓ should reject credentials without a SecretAccessKey
    ✓ should reject credentials without a Token
    ✓ should reject credentials without an Expiration
    ✓ should reject scalar values
  fromImdsCredentials
    ✓ should convert IMDS credentials to a credentials object (1 ms)
    ✓ should convert IMDS credentials to a credentials object without accountId when it's not provided (1 ms)

Test Suites: 1 passed, 1 total
Tests:       8 passed, 8 total
Snapshots:   0 total
Time:        3.257 s, estimated 4 s

PR to update AwsCredentialIdentity interface: https://github.com/smithy-lang/smithy-typescript/pull/1240

Testing

To-Do:


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.