/** * 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')); }
/** * 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); }
/** * 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); }
/** * @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); }