Aws\Credentials\EcsCredentialProvider::__invoke PHP Метод

__invoke() публичный Метод

Load ECS credentials
public __invoke ( ) : GuzzleHttp\Promise\PromiseInterface
Результат GuzzleHttp\Promise\PromiseInterface
    public function __invoke()
    {
        $client = $this->client;
        $request = new Request('GET', self::getEcsUri());
        return $client($request, ['timeout' => $this->timeout])->then(function (ResponseInterface $response) {
            $result = $this->decodeResult((string) $response->getBody());
            return new Credentials($result['AccessKeyId'], $result['SecretAccessKey'], $result['Token'], strtotime($result['Expiration']));
        })->otherwise(function ($reason) {
            $reason = is_array($reason) ? $reason['exception'] : $reason;
            $msg = $reason->getMessage();
            throw new CredentialsException("Error retrieving credential from ECS ({$msg})");
        });
    }