function ChainableTemporaryCredentials(options) {
    AWS.Credentials.call(this);
    options = options || {};
    this.errorCode = 'ChainableTemporaryCredentialsProviderFailure';
    this.expired = true;
    this.tokenCodeFn = null;

    var params = AWS.util.copy(options.params) || {};
    if (params.RoleArn) {
      params.RoleSessionName = params.RoleSessionName || 'temporary-credentials';
    }
    if (params.SerialNumber) {
      if (!options.tokenCodeFn || (typeof options.tokenCodeFn !== 'function')) {
        throw new AWS.util.error(
          new Error('tokenCodeFn must be a function when params.SerialNumber is given'),
          {code: this.errorCode}
        );
      } else {
        this.tokenCodeFn = options.tokenCodeFn;
      }
    }
    this.service = new STS({
      params: params,
      credentials: options.masterCredentials || AWS.config.credentials
    });
  }
function ChainableTemporaryCredentials(options) {
    AWS.Credentials.call(this);
    options = options || {};
    this.errorCode = 'ChainableTemporaryCredentialsProviderFailure';
    this.expired = true;
    this.tokenCodeFn = null;

    var params = AWS.util.copy(options.params) || {};
    if (params.RoleArn) {
      params.RoleSessionName = params.RoleSessionName || 'temporary-credentials';
    }
    if (params.SerialNumber) {
      if (!options.tokenCodeFn || (typeof options.tokenCodeFn !== 'function')) {
        throw new AWS.util.error(
          new Error('tokenCodeFn must be a function when params.SerialNumber is given'),
          {code: this.errorCode}
        );
      } else {
        this.tokenCodeFn = options.tokenCodeFn;
      }
    }
    this.service = new STS({
      params: params,
      credentials: options.masterCredentials || AWS.config.credentials
    });
  }
function ChainableTemporaryCredentials ( options ) { AWS . Credentials . call ( this ) ; options = options || { } ; this . errorCode = 'ChainableTemporaryCredentialsProviderFailure' ; this . expired = true ; this . tokenCodeFn = null ; var params = AWS . util . copy ( options . params ) || { } ; if ( params . RoleArn ) { params . RoleSessionName = params . RoleSessionName || 'temporary-credentials' ; } if ( params . SerialNumber ) { if ( ! options . tokenCodeFn || ( typeof options . tokenCodeFn !== 'function' ) ) { throw new AWS . util . error ( new Error ( 'tokenCodeFn must be a function when params.SerialNumber is given' ) , { code : this . errorCode } ) ; } else { this . tokenCodeFn = options . tokenCodeFn ; } } this . service = new STS ( { params : params , credentials : options . masterCredentials || AWS . config . credentials } ) ; }
Creates a new temporary credentials object.

@param options [map] a set of options
@option options params [map] ({}) 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. If a `SerialNumber` parameter is passed in, {tokenCodeFn} must
also be passed in or an error will be thrown.
@option options masterCredentials [AWS.Credentials] the master credentials
used to get and refresh temporary credentials from AWS STS. By default,
AWS.config.credentials or AWS.config.credentialProvider will be used.
@option options tokenCodeFn [Function] (null) Function to provide
`TokenCode`, if `SerialNumber` is provided for profile in {params}. Function
is called with value of `SerialNumber` and `callback`, and should provide
the `TokenCode` or an error to the callback in the format
`callback(err, token)`.
@example Creating a new credentials object for generic temporary credentials
AWS.config.credentials = new AWS.ChainableTemporaryCredentials();
@example Creating a new credentials object for an IAM role
AWS.config.credentials = new AWS.ChainableTemporaryCredentials({
params: {
RoleArn: 'arn:aws:iam::1234567890:role/TemporaryCredentials'
}
});
@see AWS.STS.assumeRole
@see AWS.STS.getSessionToken
Creates a new temporary credentials object .
Creates a new temporary credentials object.