temporary_credentials.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. import {Credentials} from '../credentials';
  2. import {AWSError} from '../error';
  3. import STS = require('../../clients/sts');
  4. export class TemporaryCredentials extends Credentials {
  5. /**
  6. * Creates a new temporary credentials object.
  7. * @param {Object} options - a map of options that are passed to the AWS.STS.assumeRole() or AWS.STS.getSessionToken() operations. If a RoleArn parameter is passed in, credentials will be based on the IAM role.
  8. * @param {Object} masterCredentials - The master (non-temporary) credentials used to get and refresh credentials from AWS STS.
  9. */
  10. constructor(options: TemporaryCredentials.TemporaryCredentialsOptions, masterCredentials?: Credentials);
  11. /**
  12. * Creates a new temporary credentials object.
  13. * @param {Object} options - a map of options that are passed to the AWS.STS.assumeRole() or AWS.STS.getSessionToken() operations. If a RoleArn parameter is passed in, credentials will be based on the IAM role.
  14. */
  15. constructor(options?: TemporaryCredentials.TemporaryCredentialsOptions);
  16. /**
  17. * Refreshes credentials using AWS.STS.assumeRole() or AWS.STS.getSessionToken(), depending on whether an IAM role ARN was passed to the credentials constructor().
  18. */
  19. refresh(callback: (err?: AWSError) => void): void;
  20. /**
  21. * The master (non-temporary) credentials used to get and refresh temporary credentials from AWS STS.
  22. */
  23. masterCredentials: Credentials
  24. }
  25. // Needed to expose interfaces on the class
  26. declare namespace TemporaryCredentials {
  27. export type TemporaryCredentialsOptions = STS.Types.AssumeRoleRequest|STS.Types.GetSessionTokenRequest;
  28. }