/* Ċ Ġ* ĠCopyright ĠAmazon . com , ĠInc . Ġor Ġits Ġaffiliates . ĠAll ĠRights ĠReserved . Ċ Ġ* ĠSPDX - License - Identifier : ĠApache - 2 . 0 . Ċ Ġ*/ Ċ Ċ package Ġaws . sdk . kotlin . runtime . auth Ċ Ċ import Ġaws . sdk . kotlin . runtime . Aws Sdk Setting Ċ import Ġaws . sdk . kotlin . runtime . ConfigurationException Ċ import Ġaws . smithy . kotlin . runtime . util . Platform Ċ Ċ /** Ċ Ġ* ĠA Ġ[ Credentials Provider ] Ġwhich Ġreads Ġfrom Ġ` AWS _ ACCESS _ KEY _ ID `, Ġ` AWS _ SECRET _ ACCESS _ KEY `, Ġand Ġ` AWS _ SESSION _ TOKEN `. Ċ Ġ*/ Ċ public Ġclass ĠEnvironment Credentials Provider Ċ public Ġconstructor ( private Ġval Ġget Env : Ġ( String ) Ġ-> ĠString ?) Ġ: ĠCredentials Provider Ġ{ ĊĠĠĠ Ġpublic Ġconstructor () Ġ: Ġthis ( Platform :: getenv ) ĊĊĠĠĠ Ġprivate Ġfun Ġrequire Env ( variable : ĠString ): ĠString Ġ= ĊĠĠĠĠĠĠĠ Ġget Env ( variable ) Ġ?: Ġthrow ĠConfiguration Exception (" Unable Ġto Ġget Ġvalue Ġfrom Ġenvironment Ġvariable Ġ$ variable ") ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget Credentials (): ĠCredentials Ġ= ĠCredentials ( ĊĠĠĠĠĠĠĠ Ġaccess KeyId Ġ= Ġrequire Env ( Aws Sdk Setting . Aws Access KeyId . environment Variable ), ĊĠĠĠĠĠĠĠ Ġsecret AccessKey Ġ= Ġrequire Env ( Aws Sdk Setting . Aws Secret AccessKey . environment Variable ), ĊĠĠĠĠĠĠĠ Ġsession Token Ġ= Ġget Env ( Aws Sdk Setting . Aws Session Token . environment Variable ), ĊĠĠĠ Ġ) Ċ } Ċ