libqtaws
0.1.0
UnofficialAWSlibraryforQt
|
Provides AWS endpoint information. More...
Public Types | |
enum | Transport { HTTP = 0x01, HTTPS = 0x02, SMTP = 0x04, AnyTransport = HTTP|HTTPS|SMTP } |
Network transport supported by one or more AWS endpoints. | |
Public Member Functions | |
AwsEndpoint (const QByteArray &hostName) | |
Constructs a new AwsEndpoint object. More... | |
AwsEndpoint (const QString &hostName) | |
Constructs a new AwsEndpoint object. More... | |
~AwsEndpoint () | |
AwsEndpoint destructor. | |
bool | isSupported (const Transport transport) const |
Is the given transport supported by this endpoint? More... | |
bool | isValid () const |
Is this endpoint valid? More... | |
QString | fullServiceName () const |
Get this endpoint's full service name. More... | |
QString | hostName () const |
Get the name of host represented by this endpoint. More... | |
QString | regionName () const |
Get this endpoint's primary region name. More... | |
QString | serviceName () const |
Get this endpoint's service name. More... | |
QStringList | supportedRegions (const Transports transport=AnyTransport) const |
Get the full list of regions this endpoint supports. More... | |
Static Public Member Functions | |
static QUrl | getEndpoint (const QString ®ionName, const QString &serviceName, const Transports transport=AnyTransport) |
Get a QUrl for an AWS endpoint. More... | |
static bool | isSupported (const QString ®ionName, const QString &serviceName, const Transports transport=AnyTransport) |
Is a region / service / transport combination supported by Amazon? More... | |
static QString | fullServiceName (const QString &serviceName) |
Get the full name for given service. More... | |
static QStringList | supportedRegions (const QString &serviceName, const Transports transport=AnyTransport) |
Get a list of regions that supported for a given service. More... | |
static QStringList | supportedServices (const QString ®ionName, const Transports transport=AnyTransport) |
Get a list of services that support a given region. More... | |
Provides AWS endpoint information.
This class parses the endpoint.xml
data available at http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml
The endpoint.xml
file is embedded as a resource in the libqtaws library - not fetched remotely at runtime.
Example usage:
AwsEndpoint::AwsEndpoint | ( | const QByteArray & | hostName | ) |
Constructs a new AwsEndpoint object.
hostName | Name of an AWS host, encoded as UTF-8. |
AwsEndpoint::AwsEndpoint | ( | const QString & | hostName | ) |
Constructs a new AwsEndpoint object.
hostName | Name of an AWS host. |
QString AwsEndpoint::fullServiceName | ( | ) | const |
Get this endpoint's full service name.
The full service name is a human-readbale form. For example, the full name for the cloudsearch
service is Amazon CloudSearch
. Likewise, the full name for the rds
service is Amazon Relational Database Service
.
|
static |
Get the full name for given service.
The full service name is a human-readbale form. For example, the full name for the cloudsearch
service is Amazon CloudSearch
. Likewise, the full name for the rds
service is Amazon Relational Database Service
.
serviceName | Canonical AWS service name to get the full name of. |
|
static |
Get a QUrl for an AWS endpoint.
This function will return a QUrl object for accessing an AWS service. The region and service names must match those used by Amazon.
If the specified region and/or service are not known to be valid for AWS, or the service is not supported in the specified region, then an invalid QUrl will be returned.
false
.The transport
parameter may be used to specify one or more transports to consider. If the specified AWS endpoint exists, but does not support //any// of the given transports, then an invalid QUrl is returned.
Where it makes sense to do so, the resulting QUrl's scheme will be set according to the requested transport. For example, if the selected transport is AwsEndpoint::HTTPS, then the resulting QUrl's schems will be set to "https".
If transport
includes both AwsEndpoint::HTTP //and// AwsEndpoint::HTTPS, and both are supported by the AWS endpoint, then "https" will be chosed in preference to "http".
iam
service in ap-southeast-2
, the return endpoint is for a host (iam.amazonaws.com
) which provides the ami
services for all regions, not just ap-southeast-2
. Services known to behave like this include: cloudfront
, iam
, importexport
, route53
, and sts
.Example usage:
regionName | Endpoint's region name. |
serviceName | Endpoint's service name. |
transport | Optional network transport(s) for the endpoint. |
QString AwsEndpoint::hostName | ( | ) | const |
Get the name of host represented by this endpoint.
|
static |
Is a region / service / transport combination supported by Amazon?
regionName | AWS region name to check support for. |
serviceName | AWS service name to check support for. |
transport | Optional transport to check support for. |
true
if the service is supported in the regionName
region for at least one of the specified transports, false
otherwise. bool AwsEndpoint::isSupported | ( | const Transport | transport | ) | const |
Is the given transport supported by this endpoint?
transport | Transport to check for support for. |
true
if the transport is supported by this endpoint, false
otherwise. bool AwsEndpoint::isValid | ( | ) | const |
Is this endpoint valid?
An endpoint is considered valid if the host specified during construction is a known AWS host, and thus we know what region and service(s) it supports.
For example:
true
if this endpoint is valid, false
otherwise. QString AwsEndpoint::regionName | ( | ) | const |
Get this endpoint's primary region name.
It is possible for a single endpiont to support multuple regions, such as iam.amazonaws.com
, which provides the ami
servive for all (non-government) regions.
In these cases, this function returns the primary region in which the service is located. The AwsEndpoint::supportedRegions function may be used to fetch the full list of regions this endpoint supports.
QString AwsEndpoint::serviceName | ( | ) | const |
QStringList AwsEndpoint::supportedRegions | ( | const Transports | transport = AnyTransport | ) | const |
Get the full list of regions this endpoint supports.
Alternatvely, AwsEndpoint::regionName may be used to get this endpoint's primary region.
transport | Optional transport to check for support. |
|
static |
Get a list of regions that supported for a given service.
serviceName | AWS service to get the supported regions for. |
transport | Optional transport(s) to check for support. |
|
static |
Get a list of services that support a given region.
regionName | AWS region to get the supported services for. |
transport | Optional transport(s) to check for support. |