mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-14 02:27:23 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
53
aws/Aws/Sts/StsClient.php
Normal file
53
aws/Aws/Sts/StsClient.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
namespace Aws\Sts;
|
||||
|
||||
use Aws\AwsClient;
|
||||
use Aws\Result;
|
||||
use Aws\Credentials\Credentials;
|
||||
|
||||
/**
|
||||
* This client is used to interact with the **AWS Security Token Service (AWS STS)**.
|
||||
*
|
||||
* @method \Aws\Result assumeRole(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise assumeRoleAsync(array $args = [])
|
||||
* @method \Aws\Result assumeRoleWithSAML(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise assumeRoleWithSAMLAsync(array $args = [])
|
||||
* @method \Aws\Result assumeRoleWithWebIdentity(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise assumeRoleWithWebIdentityAsync(array $args = [])
|
||||
* @method \Aws\Result decodeAuthorizationMessage(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise decodeAuthorizationMessageAsync(array $args = [])
|
||||
* @method \Aws\Result getCallerIdentity(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise getCallerIdentityAsync(array $args = [])
|
||||
* @method \Aws\Result getFederationToken(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise getFederationTokenAsync(array $args = [])
|
||||
* @method \Aws\Result getSessionToken(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise getSessionTokenAsync(array $args = [])
|
||||
*/
|
||||
class StsClient extends AwsClient
|
||||
{
|
||||
/**
|
||||
* 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
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue