コード例 #1
0
ファイル: StsClient.php プロジェクト: AWSRandall/aws-sdk-php
 /**
  * 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');
     }
     $c = $result['Credentials'];
     return new Credentials($c['AccessKeyId'], $c['SecretAccessKey'], isset($c['SessionToken']) ? $c['SessionToken'] : null, isset($c['Expiration']) && $c['Expiration'] instanceof \DateTimeInterface ? (int) $c['Expiration']->format('U') : null);
 }
コード例 #2
0
 /**
  * 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');
     }
     $c = $result['Credentials'];
     return new Credentials($c['AccessKeyId'], $c['SecretAccessKey'], isset($c['SessionToken']) ? $c['SessionToken'] : null, isset($c['Expiration']) ? $c['Expiration'] : null);
 }
コード例 #3
0
 protected function getRows(\Aws\Result $changeSetResult)
 {
     $rows = [];
     foreach ($changeSetResult->search('Changes[]') as $change) {
         $resourceChange = $change['ResourceChange'];
         $rows[] = [$this->decorateChangesetAction($resourceChange['Action']), $resourceChange['LogicalResourceId'], isset($resourceChange['PhysicalResourceId']) ? $resourceChange['PhysicalResourceId'] : '', $resourceChange['ResourceType'], isset($resourceChange['Replacement']) ? Decorator::decorateChangesetReplacement($resourceChange['Replacement']) : ''];
     }
     return $rows;
 }
コード例 #4
0
ファイル: FeatureContext.php プロジェクト: s12v/sns
 /**
  * @Then /^the topic "([^"]*)" should not exist$/
  */
 public function theTopicShouldNotExist($name)
 {
     PHPUnit_Framework_Assert::assertTrue($this->result->hasKey('Topics'));
     $topics = $this->result->get('Topics');
     PHPUnit_Framework_Assert::assertTrue(is_array($topics));
     PHPUnit_Framework_Assert::assertNotEmpty($topics);
     $arn = $this->getArnByName($name);
     $filtered = array_filter($topics, function ($topic) use($arn) {
         return $topic['TopicArn'] === $arn;
     });
     PHPUnit_Framework_Assert::assertEmpty($filtered);
 }
コード例 #5
0
ファイル: StsClient.php プロジェクト: briareos/aws-sdk-php
 /**
  * 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'));
 }
コード例 #6
0
ファイル: ResultPaginator.php プロジェクト: xgin/aws-sdk-php
 private function determineNextToken(Result $result)
 {
     if (!$this->config['output_token']) {
         return null;
     }
     if ($this->config['more_results'] && !$result->search($this->config['more_results'])) {
         return null;
     }
     $nextToken = is_array($this->config['output_token']) ? array_filter($result->search(json_encode($this->config['output_token']))) : $result->search($this->config['output_token']);
     return $nextToken;
 }
コード例 #7
0
 /**
  * @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;
 }
コード例 #8
0
 private function determineNextToken(Result $result)
 {
     if (!$this->config['output_token']) {
         return null;
     }
     if ($this->config['more_results'] && !$result->search($this->config['more_results'])) {
         return null;
     }
     $nextToken = is_scalar($this->config['output_token']) ? [$this->config['input_token'] => $this->config['output_token']] : array_combine($this->config['input_token'], $this->config['output_token']);
     return array_filter(array_map(function ($outputToken) use($result) {
         return $result->search($outputToken);
     }, $nextToken));
 }