libqtaws
0.1.0
UnofficialAWSlibraryforQt-InternalDocumentation
|
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... | |
Private Attributes | |
AwsEndpointPrivate *const | d_ptr |
Internal d-pointer. | |
Friends | |
class | TestAwsEndpoint |
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:
Definition at line 33 of file awsendpoint.h.
AwsEndpoint::AwsEndpoint | ( | const QByteArray & | hostName | ) |
Constructs a new AwsEndpoint object.
hostName | Name of an AWS host, encoded as UTF-8. |
Definition at line 74 of file awsendpoint.cpp.
References AwsEndpointPrivate::hosts, and AwsEndpointPrivate::mutex.
AwsEndpoint::AwsEndpoint | ( | const QString & | hostName | ) |
Constructs a new AwsEndpoint object.
hostName | Name of an AWS host. |
Definition at line 93 of file awsendpoint.cpp.
References hostName(), AwsEndpointPrivate::hosts, and AwsEndpointPrivate::mutex.
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
.
Definition at line 262 of file awsendpoint.cpp.
References serviceName().
|
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. |
Definition at line 280 of file awsendpoint.cpp.
References AwsEndpointPrivate::loadEndpointData(), AwsEndpointPrivate::mutex, and AwsEndpointPrivate::services.
|
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. |
Definition at line 163 of file awsendpoint.cpp.
References AwsEndpointPrivate::RegionEndpointInfo::hostName, AwsEndpointPrivate::loadEndpointData(), AwsEndpointPrivate::mutex, regionName(), AwsEndpointPrivate::regions, serviceName(), and AwsEndpointPrivate::RegionEndpointInfo::transports.
Referenced by AwsRegion::hostName().
QString AwsEndpoint::hostName | ( | ) | const |
Get the name of host represented by this endpoint.
Definition at line 193 of file awsendpoint.cpp.
Referenced by AwsEndpoint(), and isValid().
|
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. Definition at line 209 of file awsendpoint.cpp.
References AwsEndpointPrivate::loadEndpointData(), AwsEndpointPrivate::mutex, and AwsEndpointPrivate::regions.
Referenced by isSupported(), and AwsRegion::isSupported().
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. Definition at line 225 of file awsendpoint.cpp.
References isSupported(), regionName(), and serviceName().
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. Definition at line 246 of file awsendpoint.cpp.
References hostName(), regionName(), and serviceName().
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.
Definition at line 304 of file awsendpoint.cpp.
Referenced by getEndpoint(), isSupported(), isValid(), supportedRegions(), and supportedServices().
QString AwsEndpoint::serviceName | ( | ) | const |
Get this endpoint's service name.
Definition at line 317 of file awsendpoint.cpp.
Referenced by fullServiceName(), getEndpoint(), isSupported(), isValid(), and supportedRegions().
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. |
Definition at line 336 of file awsendpoint.cpp.
References serviceName().
|
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. |
Definition at line 350 of file awsendpoint.cpp.
References AwsEndpointPrivate::loadEndpointData(), AwsEndpointPrivate::mutex, regionName(), AwsEndpointPrivate::regions, serviceName(), and AwsEndpointPrivate::services.
|
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. |
Definition at line 376 of file awsendpoint.cpp.
References AwsEndpointPrivate::loadEndpointData(), AwsEndpointPrivate::mutex, regionName(), and AwsEndpointPrivate::regions.
Referenced by AwsRegion::supportedServices().