PHP Class Scalr\Service\Aws\Client\QueryClient

HTTP Query-based requests are defined as any HTTP requests using the HTTP verb GET or POST and a Query parameter named either Action or Operation.
Since: 21.09.2012
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Service\Aws\Client\AbstractClient, implements Scalr\Service\Aws\Client\ClientInterface
Show file Open project: scalr/scalr

Protected Properties

Property Type Description
$apiVersion string AWS API Version
$awsAccessKeyId string AWS Access Key Id
$secretAccessKey string Secret Access Key
$url string Base url for API requests

Public Methods

Method Description
__construct ( string $awsAccessKeyId, string $secretAccessKey, string $apiVersion, string $url = null ) Constructor
call ( string $action, array $options, string $path = '/' ) : Scalr\Service\Aws\Client\ClientResponseInterface Calls Amazon web service method.
createRequest ( ) : Scalr\System\Http\Client\Request Creates a new http Request object.
getApiVersion ( ) : string Gets API Version date
getType ( )
getUrl ( ) : string Gets base url for API requests
setApiVersion ( string $apiVersion ) Sets Api Version
setUrl ( string $url ) Sets query url

Protected Methods

Method Description
getExpirationTime ( ) : string Gets expiration time for Expires option.
signRequestV2 ( Scalr\System\Http\Client\Request $request ) Signs request with signature version 2
signRequestV4 ( Scalr\System\Http\Client\Request $request, string $region = null, string $file = null ) Signs request with signature version 4
tryCall ( Scalr\System\Http\Client\Request $httpRequest, integer $attempts = 3, integer $interval = 200 ) : Scalr\Service\Aws\Client\QueryClientResponse Tries to send request on several attempts.

Method Details

__construct() public method

Constructor
public __construct ( string $awsAccessKeyId, string $secretAccessKey, string $apiVersion, string $url = null )
$awsAccessKeyId string AWS Access Key Id
$secretAccessKey string AWS Secret Access Key
$apiVersion string YYYY-MM-DD representation of AWS API version
$url string

call() public method

It ensures execution of the certain AWS action by transporting the request and receiving response.
public call ( string $action, array $options, string $path = '/' ) : Scalr\Service\Aws\Client\ClientResponseInterface
$action string An Web service API action name.
$options array An options array. It may contain "_host" option which overrides host.
$path string optional A relative path.
return Scalr\Service\Aws\Client\ClientResponseInterface

createRequest() public method

Creates a new http Request object.
public createRequest ( ) : Scalr\System\Http\Client\Request
return Scalr\System\Http\Client\Request Returns a new http Request object.

getApiVersion() public method

Gets API Version date
public getApiVersion ( ) : string
return string Returns API Version Date in YYYY-MM-DD format

getExpirationTime() protected method

Gets expiration time for Expires option.
protected getExpirationTime ( ) : string
return string Returns expiration time form Expires option that's used in AWS api requests.

getType() public method

public getType ( )

getUrl() public method

Gets base url for API requests
public getUrl ( ) : string
return string Returns base url for API requests

setApiVersion() public method

Sets Api Version
public setApiVersion ( string $apiVersion )
$apiVersion string YYYY-MM-DD representation of AWS API version

setUrl() public method

Sets query url
public setUrl ( string $url )
$url string Base url for API requests

signRequestV2() protected method

Only POST http method is supported
protected signRequestV2 ( Scalr\System\Http\Client\Request $request )
$request Scalr\System\Http\Client\Request Http request object

signRequestV4() protected method

Signs request with signature version 4
protected signRequestV4 ( Scalr\System\Http\Client\Request $request, string $region = null, string $file = null )
$request Scalr\System\Http\Client\Request Http Request
$region string optional Overrides region as destination region for multi-regional operations
$file string optional Path to the file transmitted in request for signature calculation

tryCall() protected method

Tries to send request on several attempts.
protected tryCall ( Scalr\System\Http\Client\Request $httpRequest, integer $attempts = 3, integer $interval = 200 ) : Scalr\Service\Aws\Client\QueryClientResponse
$httpRequest Scalr\System\Http\Client\Request
$attempts integer Attempts count.
$interval integer An sleep interval between an attempts in microseconds.
return Scalr\Service\Aws\Client\QueryClientResponse Returns response on success

Property Details

$apiVersion protected property

AWS API Version
protected string $apiVersion
return string

$awsAccessKeyId protected property

AWS Access Key Id
protected string $awsAccessKeyId
return string

$secretAccessKey protected property

Secret Access Key
protected string $secretAccessKey
return string

$url protected property

Base url for API requests
protected string $url
return string