Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add credentialProvider as an optional parameter of ConfigurationOptions #1339

Merged
merged 2 commits into from Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-TypeScript-5f321e6b.json
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "TypeScript",
"description": "Add `credentialProvider` as an optional parameter of `ConfigurationOptions`."
}
5 changes: 5 additions & 0 deletions lib/config.d.ts
Expand Up @@ -2,6 +2,7 @@ import {Agent as httpAgent} from 'http';
import {Agent as httpsAgent} from 'https';
import {AWSError} from './error';
import {Credentials, CredentialsOptions} from './credentials';
import {CredentialProviderChain} from './credentials/credential_provider_chain';
import {ConfigurationServicePlaceholders, ConfigurationServiceApiVersions} from './config_service_placeholders';

export class ConfigBase extends ConfigurationOptions{
Expand Down Expand Up @@ -171,6 +172,10 @@ export abstract class ConfigurationOptions {
* The AWS credentials to sign requests with.
*/
credentials?: Credentials|CredentialsOptions
/**
* The provider chain used to resolve credentials if no static credentials property is set.
*/
credentialProvider?: CredentialProviderChain
/**
* AWS access key ID.
*
Expand Down
11 changes: 10 additions & 1 deletion ts/config.ts
Expand Up @@ -93,4 +93,13 @@ var config = AWS.config.loadFromPath('/to/path');
// test update allowing unknown keys
AWS.config.update({
fake: 'fake'
}, true);
}, true);

// Test constructing with a CredentialProviderChain
var options = {
credentialProvider: new AWS.CredentialProviderChain([
() => new AWS.EC2MetadataCredentials()
])
};
var s3 = new AWS.S3(options);
var ses = new AWS.SES(options);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisradek I am not exactly sure what the extent of the expected test should be. I feel like this covers the intent of what the change now provides. Obviously, if this is wrong I'll need a little bit more guidance on what to do next.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RLovelett
This should be fine. We really just want to make sure the code compiles correctly, and that we don't break it in the future. This captures the intent.