/** * Creates credentials from the result of an STS operations * * @param Result $result Result of an STS operation * * @return Credentials * @throws \InvalidArgumentException if the result contains no credentials */ public function createCredentials(Result $result) { if (!$result->hasKey('Credentials')) { throw new \InvalidArgumentException('Result contains no credentials'); } return new Credentials($result->getPath('Credentials/AccessKeyId'), $result->getPath('Credentials/SecretAccessKey'), $result->getPath('Credentials/SessionToken'), $result->getPath('Credentials/Expiration')); }
/** * @param Result $awsResult * @param $resultDocument * @return CloudSearchResult * @throws \Exception */ private function convertResult(Result $awsResult, $resultDocument) { $time = $awsResult->getPath('status/timems'); $amountOfHits = $awsResult->getPath('hits/found'); $start = $awsResult->getPath('hits/start'); $cursor = $awsResult->getPath('hits/cursor'); $facets = $awsResult->getPath('facets'); $result = new CloudSearchResult($amountOfHits, $start, $time, $facets, $cursor); $result->fillWithHits($awsResult->getPath('hits/hit'), $resultDocument); return $result; }