InstanceProfileProvider
in package
Credential provider that provides credentials from the EC2 metadata service.
Table of Contents
- CRED_PATH = 'meta-data/iam/security-credentials/'
- ENV_DISABLE = 'AWS_EC2_METADATA_DISABLED'
- ENV_RETRIES = 'AWS_METADATA_SERVICE_NUM_ATTEMPTS'
- ENV_TIMEOUT = 'AWS_METADATA_SERVICE_TIMEOUT'
- SERVER_URI = 'http://169.254.169.254/latest/'
- TOKEN_PATH = 'api/token'
- $attempts : int
- $client : callable
- $profile : string
- $retries : int
- $secureMode : bool
- $timeout : float|mixed
- __construct() : mixed
- The constructor accepts the following options:
- __invoke() : PromiseInterface
- Loads instance profile credentials.
- createErrorMessage() : mixed
- decodeResult() : mixed
- getExceptionStatusCode() : mixed
- handleRetryableException() : mixed
- request() : PromiseInterface
Constants
CRED_PATH
public
mixed
CRED_PATH
= 'meta-data/iam/security-credentials/'
ENV_DISABLE
public
mixed
ENV_DISABLE
= 'AWS_EC2_METADATA_DISABLED'
ENV_RETRIES
public
mixed
ENV_RETRIES
= 'AWS_METADATA_SERVICE_NUM_ATTEMPTS'
ENV_TIMEOUT
public
mixed
ENV_TIMEOUT
= 'AWS_METADATA_SERVICE_TIMEOUT'
SERVER_URI
public
mixed
SERVER_URI
= 'http://169.254.169.254/latest/'
TOKEN_PATH
public
mixed
TOKEN_PATH
= 'api/token'
Properties
$attempts
private
int
$attempts
$client
private
callable
$client
$profile
private
string
$profile
$retries
private
int
$retries
$secureMode
private
bool
$secureMode
= true
$timeout
private
float|mixed
$timeout
Methods
__construct()
The constructor accepts the following options:
public
__construct([array<string|int, mixed> $config = [] ]) : mixed
- timeout: Connection timeout, in seconds.
- profile: Optional EC2 profile name, if known.
- retries: Optional number of retries to be attempted.
Parameters
- $config : array<string|int, mixed> = []
-
Configuration options.
Return values
mixed —__invoke()
Loads instance profile credentials.
public
__invoke() : PromiseInterface
Return values
PromiseInterface —createErrorMessage()
private
createErrorMessage(mixed $previous) : mixed
Parameters
- $previous : mixed
Return values
mixed —decodeResult()
private
decodeResult(mixed $response) : mixed
Parameters
- $response : mixed
Return values
mixed —getExceptionStatusCode()
private
getExceptionStatusCode(Exception $e) : mixed
Parameters
- $e : Exception
Return values
mixed —handleRetryableException()
private
handleRetryableException(Exception $e, mixed $retryOptions, mixed $message) : mixed
Parameters
- $e : Exception
- $retryOptions : mixed
- $message : mixed
Return values
mixed —request()
private
request(string $url[, string $method = 'GET' ][, array<string|int, mixed> $headers = [] ]) : PromiseInterface
Parameters
- $url : string
- $method : string = 'GET'
- $headers : array<string|int, mixed> = []
Return values
PromiseInterface —Returns a promise that is fulfilled with the body of the response as a string.