Documentation

AwsClientInterface extends ClientInterface

Interface that all AWS clients implement

Table of Contents

Constants

CREATE_REQUEST  = 'client.create_request'
HTTP_DATE  = 'D, d M Y H:i:s \G\M\T'

Methods

addSubscriber()  : self
Add an event subscriber to the dispatcher
createRequest()  : RequestInterface
Create and return a new {@see RequestInterface} configured for the client.
delete()  : EntityEnclosingRequestInterface
Create a DELETE request for the client
dispatch()  : Event
Helper to dispatch Guzzle events and set the event name on the event
execute()  : mixed
Execute one or more commands
factory()  : FromConfigInterface
Static factory method used to turn an array or collection of configuration data into an instantiated object.
get()  : RequestInterface
Create a GET request for the client
getAllEvents()  : array<string|int, mixed>
Get a list of all of the events emitted from the class
getApiVersion()  : string
Get the API version of the client (e.g. 2006-03-01)
getBaseUrl()  : string|null
Get the client's base URL as either an expanded or raw URI template
getCommand()  : CommandInterface
Get a command by name. First, the client will see if it has a service description and if the service description defines a command by the supplied name. If no dynamic command is found, the client will look for a concrete command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.
getConfig()  : mixed|Collection
Get a configuration setting or all of the configuration settings. The Collection result of this method can be modified to change the configuration settings of a client.
getCredentials()  : CredentialsInterface
Returns the AWS credentials associated with the client
getDescription()  : ServiceDescriptionInterface|null
Get the service description of the client
getEventDispatcher()  : EventDispatcherInterface
Get the EventDispatcher of the request
getIterator()  : ResourceIteratorInterface
Get a resource iterator from the client.
getRegion()  : string
Get the name of the region to which the client is configured to send requests
getRegions()  : array<string|int, mixed>
Get a list of available regions and region data
getSignature()  : SignatureInterface
Returns the signature implementation used with the client
getWaiter()  : WaiterInterface
Get a named waiter object
getWaiterFactory()  : WaiterFactoryInterface
Get the waiter factory being used by the client
head()  : RequestInterface
Create a HEAD request for the client
options()  : RequestInterface
Create an OPTIONS request for the client
patch()  : EntityEnclosingRequestInterface
Create a PATCH request for the client
post()  : EntityEnclosingRequestInterface
Create a POST request for the client
put()  : EntityEnclosingRequestInterface
Create a PUT request for the client
send()  : Response|array<string|int, mixed>
Sends a single request or an array of requests in parallel
setBaseUrl()  : self
Set the base URL of the client
setConfig()  : self
Set the configuration object to use with the client
setCredentials()  : self
Sets the credentials object associated with the client
setDescription()  : ClientInterface
Set the service description of the client
setEventDispatcher()  : self
Set the EventDispatcher of the request
setRegion()  : self
Change the region to which the client is configured to send requests
setSslVerification()  : self
Set SSL verification options.
setUserAgent()  : self
Set the User-Agent header to be used on all requests from the client
setWaiterFactory()  : self
Set the waiter factory to use with the client
waitUntil()  : self
Wait until a resource is available or an associated waiter returns true

Constants

CREATE_REQUEST

public mixed CREATE_REQUEST = 'client.create_request'

HTTP_DATE

public string HTTP_DATE = 'D, d M Y H:i:s \G\M\T'

RFC 1123 HTTP-Date

Methods

createRequest()

Create and return a new {@see RequestInterface} configured for the client.

public createRequest([string $method = RequestInterface::GET ][, string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, string|resource|array<string|int, mixed>|EntityBodyInterface $body = null ][, array<string|int, mixed> $options = array() ]) : RequestInterface

Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URI can contain the query string as well. Use an array to provide a URI template and additional variables to use in the URI template expansion.

Parameters
$method : string = RequestInterface::GET

HTTP method. Defaults to GET

$uri : string|array<string|int, mixed> = null

Resource URI.

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$body : string|resource|array<string|int, mixed>|EntityBodyInterface = null

Entity body of request (POST/PUT) or response (GET)

$options : array<string|int, mixed> = array()

Array of options to apply to the request

Tags
throws
InvalidArgumentException

if a URI array is passed that does not contain exactly two elements: the URI followed by template variables

Return values
RequestInterface

delete()

Create a DELETE request for the client

public delete([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, string|resource|EntityBodyInterface $body = null ][, array<string|int, mixed> $options = array() ]) : EntityEnclosingRequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$body : string|resource|EntityBodyInterface = null

Body to send in the request

$options : array<string|int, mixed> = array()

Options to apply to the request

Tags
see
ClientInterface::createRequest()
Return values
EntityEnclosingRequestInterface

dispatch()

Helper to dispatch Guzzle events and set the event name on the event

public dispatch(string $eventName[, array<string|int, mixed> $context = array() ]) : Event
Parameters
$eventName : string

Name of the event to dispatch

$context : array<string|int, mixed> = array()

Context of the event

Return values
Event

Returns the created event object

execute()

Execute one or more commands

public execute(CommandInterface|array<string|int, mixed>|Traversable $command) : mixed
Parameters
$command : CommandInterface|array<string|int, mixed>|Traversable

Command, array of commands or Traversable object containing commands to execute

Tags
throws
InvalidArgumentException

if an invalid command is passed

throws
CommandTransferException

if an exception is encountered when transferring multiple commands

Return values
mixed

Returns the result of the executed command or an array of commands if executing multiple commands

get()

Create a GET request for the client

public get([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, array<string|int, mixed> $options = array() ]) : RequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$options : array<string|int, mixed> = array()

Options to apply to the request. For BC compatibility, you can also pass a string to tell Guzzle to download the body of the response to a particular location. Use the 'body' option instead for forward compatibility.

Tags
see
ClientInterface::createRequest()
Return values
RequestInterface

getAllEvents()

Get a list of all of the events emitted from the class

public static getAllEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>

getApiVersion()

Get the API version of the client (e.g. 2006-03-01)

public getApiVersion() : string
Return values
string

getBaseUrl()

Get the client's base URL as either an expanded or raw URI template

public getBaseUrl([bool $expand = true ]) : string|null
Parameters
$expand : bool = true

Set to FALSE to get the raw base URL without URI template expansion

Return values
string|null

getCommand()

Get a command by name. First, the client will see if it has a service description and if the service description defines a command by the supplied name. If no dynamic command is found, the client will look for a concrete command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.

public getCommand(string $name[, array<string|int, mixed> $args = array() ]) : CommandInterface
Parameters
$name : string

Name of the command to retrieve

$args : array<string|int, mixed> = array()

Arguments to pass to the command

Tags
throws
InvalidArgumentException

if no command can be found by name

Return values
CommandInterface

getConfig()

Get a configuration setting or all of the configuration settings. The Collection result of this method can be modified to change the configuration settings of a client.

public getConfig([bool|string $key = false ]) : mixed|Collection

A client should honor the following special values:

  • request.options: Associative array of default RequestFactory options to apply to each request
  • request.params: Associative array of request parameters (data values) to apply to each request
  • curl.options: Associative array of cURL configuration settings to apply to each request
  • ssl.certificate_authority: Path a CAINFO, CAPATH, true to use strict defaults, or false to disable verification
  • redirect.disable: Set to true to disable redirects
Parameters
$key : bool|string = false

Configuration value to retrieve. Set to FALSE to retrieve all values of the client. The object return can be modified, and modifications will affect the client's config.

Tags
see
RequestFactoryInterface::applyOptions

for a full list of request.options options

Return values
mixed|Collection

getIterator()

Get a resource iterator from the client.

public getIterator(string|CommandInterface $command[, array<string|int, mixed> $commandOptions = null ][, array<string|int, mixed> $iteratorOptions = array() ]) : ResourceIteratorInterface
Parameters
$command : string|CommandInterface

Command class or command name.

$commandOptions : array<string|int, mixed> = null

Command options used when creating commands.

$iteratorOptions : array<string|int, mixed> = array()

Iterator options passed to the iterator when it is instantiated.

Return values
ResourceIteratorInterface

getRegion()

Get the name of the region to which the client is configured to send requests

public getRegion() : string
Return values
string

getRegions()

Get a list of available regions and region data

public getRegions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getWaiter()

Get a named waiter object

public getWaiter(string $waiter[, array<string|int, mixed> $input = array() ]) : WaiterInterface
Parameters
$waiter : string

Name of the waiter

$input : array<string|int, mixed> = array()

Values used as input for the underlying operation and to control the waiter

Return values
WaiterInterface

head()

Create a HEAD request for the client

public head([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, array<string|int, mixed> $options = array() ]) : RequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$options : array<string|int, mixed> = array()

Options to apply to the request

Tags
see
ClientInterface::createRequest()
Return values
RequestInterface

options()

Create an OPTIONS request for the client

public options([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed> $options = array() ]) : RequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$options : array<string|int, mixed> = array()

Options to apply to the request

Tags
see
ClientInterface::createRequest()
Return values
RequestInterface

patch()

Create a PATCH request for the client

public patch([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, string|resource|EntityBodyInterface $body = null ][, array<string|int, mixed> $options = array() ]) : EntityEnclosingRequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$body : string|resource|EntityBodyInterface = null

Body to send in the request

$options : array<string|int, mixed> = array()

Options to apply to the request

Tags
see
ClientInterface::createRequest()
Return values
EntityEnclosingRequestInterface

post()

Create a POST request for the client

public post([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, array<string|int, mixed>|Collection|string|EntityBodyInterface $postBody = null ][, array<string|int, mixed> $options = array() ]) : EntityEnclosingRequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$postBody : array<string|int, mixed>|Collection|string|EntityBodyInterface = null

POST body. Can be a string, EntityBody, or associative array of POST fields to send in the body of the request. Prefix a value in the array with the @ symbol to reference a file.

$options : array<string|int, mixed> = array()

Options to apply to the request

Tags
see
ClientInterface::createRequest()
Return values
EntityEnclosingRequestInterface

put()

Create a PUT request for the client

public put([string|array<string|int, mixed> $uri = null ][, array<string|int, mixed>|Collection $headers = null ][, string|resource|EntityBodyInterface $body = null ][, array<string|int, mixed> $options = array() ]) : EntityEnclosingRequestInterface
Parameters
$uri : string|array<string|int, mixed> = null

Resource URI

$headers : array<string|int, mixed>|Collection = null

HTTP headers

$body : string|resource|EntityBodyInterface = null

Body to send in the request

$options : array<string|int, mixed> = array()

Options to apply to the request

Tags
see
ClientInterface::createRequest()
Return values
EntityEnclosingRequestInterface

send()

Sends a single request or an array of requests in parallel

public send(array<string|int, mixed>|RequestInterface $requests) : Response|array<string|int, mixed>
Parameters
$requests : array<string|int, mixed>|RequestInterface

One or more RequestInterface objects to send

Return values
Response|array<string|int, mixed>

Returns a single Response or an array of Response objects

setBaseUrl()

Set the base URL of the client

public setBaseUrl(string $url) : self
Parameters
$url : string

The base service endpoint URL of the webservice

Return values
self

setConfig()

Set the configuration object to use with the client

public setConfig(array<string|int, mixed>|Collection $config) : self
Parameters
$config : array<string|int, mixed>|Collection

Parameters that define how the client behaves

Return values
self

setRegion()

Change the region to which the client is configured to send requests

public setRegion(string $region) : self
Parameters
$region : string

Name of the region

Return values
self

setSslVerification()

Set SSL verification options.

public setSslVerification([string|bool $certificateAuthority = true ][, bool $verifyPeer = true ][, int $verifyHost = 2 ]) : self

Setting $certificateAuthority to TRUE will result in the bundled cacert.pem being used to verify against the remote host.

Alternate certificates to verify against can be specified with the $certificateAuthority option set to the full path to a certificate file, or the path to a directory containing certificates.

Setting $certificateAuthority to FALSE will turn off peer verification, unset the bundled cacert.pem, and disable host verification. Please don't do this unless you really know what you're doing, and why you're doing it.

Parameters
$certificateAuthority : string|bool = true

bool, file path, or directory path

$verifyPeer : bool = true

FALSE to stop from verifying the peer's certificate.

$verifyHost : int = 2

Set to 1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that it matches the hostname provided.

Return values
self

setUserAgent()

Set the User-Agent header to be used on all requests from the client

public setUserAgent(string $userAgent[, bool $includeDefault = false ]) : self
Parameters
$userAgent : string

User agent string

$includeDefault : bool = false

Set to true to prepend the value to Guzzle's default user agent string

Return values
self

waitUntil()

Wait until a resource is available or an associated waiter returns true

public waitUntil(string $waiter[, array<string|int, mixed> $input = array() ]) : self
Parameters
$waiter : string

Name of the waiter

$input : array<string|int, mixed> = array()

Values used as input for the underlying operation and to control the waiter

Return values
self

        
On this page

Search results