import { RefreshOptions } from './oauth2client' ; import { BaseExternalAccountClient , EXTERNAL_ACCOUNT_TYPE , } from './baseexternalclient' ; import { IdentityPoolClient , IdentityPoolClientOptions , } from './identitypoolclient' ; import { AwsClient , AwsClientOptions } from './awsclient' ; export type ExternalAccountClientOptions = IdentityPoolClientOptions | AwsClientOptions ; /**
 * Dummy class with no constructor. Developers are expected to use fromJSON.
 */ export class ExternalAccountClient { constructor ( ) { throw new Error ( 'ExternalAccountClients should be initialized via: ' + 'ExternalAccountClient.fromJSON(), ' + 'directly via explicit constructors, eg. ' + 'new AwsClient(options), new IdentityPoolClient(options) or via ' + 'new GoogleAuth(options).getClient()' ) ; } param options param additionalOptions return static fromJSON ( options , additionalOptions ? ) { if ( options && options . type === EXTERNAL_ACCOUNT_TYPE ) { if ( ( options as AwsClientOptions ) . credential_source ?. environment_id ) { return new AwsClient ( options as AwsClientOptions , additionalOptions ) ; } else { return new IdentityPoolClient ( options as IdentityPoolClientOptions , additionalOptions ) ; } } else { return null ; } } }