libqtaws  0.1.0
UnofficialAWSlibraryforQt
Public Types | Public Member Functions | Static Public Member Functions | List of all members
AwsRegion Class Reference

Provides AWS region information. More...

Public Types

enum  CardinalDirection {
  North = 0x00, NorthNorthEast = 0x10, NorthEast = 0x20, EastNorthEast = 0x30,
  East = 0x40, EastSouthEast = 0x50, SouthEast = 0x60, SouthSouthEast = 0x70,
  South = 0x80, SouthSouthWest = 0x90, SouthWest = 0xA0, WestSouthWest = 0xB0,
  West = 0xC0, WestNorthWest = 0xD0, NorthWest = 0xE0, NortNorthWest = 0xF0
}
 
enum  MacroRegion {
  AsiaPacific = 0x100, Europe = 0x300, SouthAmerica = 0xA00, UnitedStates = 0xB00,
  UnitedStatesGov = 0xC00
}
 AWS macro-regions.
 
enum  Region {
  InvalidRegion = 0, AP_Northeast_1 = AsiaPacific + NorthEast + 0x1, AP_Southeast_1 = AsiaPacific + SouthEast + 0x1, AP_Southeast_2 = AsiaPacific + SouthEast + 0x2,
  EU_West_1 = Europe + West + 0x1, SA_East_1 = SouthAmerica + East + 0x1, US_East_1 = UnitedStates + East + 0x1, US_Gov_West_1 = UnitedStatesGov + West + 0x1,
  US_West_1 = UnitedStates + West + 0x1, US_West_2 = UnitedStates + West + 0x2
}
 AWS regions.
 

Public Member Functions

 AwsRegion (const Region region)
 Constructs a new AwsRegion object. More...
 
 AwsRegion (const QString &regionName)
 Constructs a new AwsRegion object. More...
 
 ~AwsRegion ()
 AwsRegion destructor.
 
bool isValid () const
 Is this AWS region object valid? More...
 
Region region () const
 Get the region this object represents. More...
 
QString name () const
 Get the canonical AWS name for this region. More...
 
QString fullName () const
 Get the full name for this region. More...
 
QString hostName (const QString &serviceName) const
 Get name of the host the supports a given service for this region. More...
 
bool isSupported (const QString &serviceName, const AwsEndpoint::Transports transports=AwsEndpoint::AnyTransport) const
 Is a given service supported for this region? More...
 
QStringList supportedServices (const AwsEndpoint::Transports transports=AwsEndpoint::AnyTransport) const
 Get a list of services supported by this region. More...
 

Static Public Member Functions

static QString name (const Region &region)
 Get the canonical AWS name for a region. More...
 
static QString fullName (const Region &region)
 Get the full name for an AWS region. More...
 
static Region fromName (const QString &regionName)
 Get an AwsRegion::Region enumeration value from a region name. More...
 

Detailed Description

Provides AWS region information.

Basic usage example:

const AwsRegion region(AwsRegion::AP_Northeast_1);
region.name(); // "ap-northeast-1"
region.fullName(); // "Asia Pacific (Tokyo) Region"
region.hostName("iam"); // "iam.amazonaws.com"
See also
http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

Member Enumeration Documentation

Bit flags representing the possible cardinal directions of AWS regions within macro-regions.

Constructor & Destructor Documentation

AwsRegion::AwsRegion ( const Region  region)

Constructs a new AwsRegion object.

Parameters
regionAWS region for this object to represent.
AwsRegion::AwsRegion ( const QString &  regionName)

Constructs a new AwsRegion object.

If regionName is not recognised as a valid AWS region, AwsRegion::isValid will return false for the created object.

Parameters
regionNameName of the AWS region for this object to represent.

Member Function Documentation

AwsRegion::Region AwsRegion::fromName ( const QString &  regionName)
static

Get an AwsRegion::Region enumeration value from a region name.

Note
The region name is evaluated in a case-insensitve manner.
Parameters
regionNameAWS region name to get an enumeration value for.
Returns
An AwsRegion::Region enumeration value corresponding to the specified AWS region name, or AwsRegion::InvalidRegion if the region name is not valid or not recognised.
QString AwsRegion::fullName ( ) const

Get the full name for this region.

This returns a humand-readable name for this object's region. For example, for the AwsRegion::US_East_1 region, this will return something like "US East (Northern Virginia) Region".

These full names were gleaned from http://aws.amazon.com/about-aws/globalinfrastructure/ and http://docs.aws.amazon.com/general/latest/gr/rande.html.

Returns
The full name for this region.
See also
http://aws.amazon.com/about-aws/globalinfrastructure/
http://docs.aws.amazon.com/general/latest/gr/rande.html
QString AwsRegion::fullName ( const Region region)
static

Get the full name for an AWS region.

This returns a humand-readable name for the specified AWS region. For example, for the AwsRegion::US_East_1 region, this will return something like "US East (Northern Virginia) Region".

These full names were gleaned from http://aws.amazon.com/about-aws/globalinfrastructure/ and http://docs.aws.amazon.com/general/latest/gr/rande.html.

Parameters
regionAWS region to get the full name of.
Returns
The full name for the specified AWS region.
See also
http://aws.amazon.com/about-aws/globalinfrastructure/
http://docs.aws.amazon.com/general/latest/gr/rande.html
QString AwsRegion::hostName ( const QString &  serviceName) const

Get name of the host the supports a given service for this region.

Parameters
serviceNameThe service to get the hostname for.
Returns
The name of the host that supports the given service for this region, or a null string if the this service is not supported for this region.
bool AwsRegion::isSupported ( const QString &  serviceName,
const AwsEndpoint::Transports  transports = AwsEndpoint::AnyTransport 
) const

Is a given service supported for this region?

Parameters
serviceNameThe service to check support for.
transportsAn optional set of transports to test for support.
Returns
The name of the host that supports the given service for this region for at least one of the specified transports, or a null string if the this service is not supported for this region with any such transports.
bool AwsRegion::isValid ( ) const

Is this AWS region object valid?

Any AwsRegion object created using one of the valid AwsRegion::Region enumeration values (ie any but AwsRegion::InvalidRegion) will be considered valid.

However, if an unknown region name is supplied to the overloaded AwsRegion(const QString &regionName) constructor, then the constructed object will be considered invalid.

Returns
true if this object is valid, false otherwise.
QString AwsRegion::name ( ) const

Get the canonical AWS name for this region.

Returns
The canonical AWS name for this region, or null string if this object is invalid.
See also
isValid
QString AwsRegion::name ( const Region region)
static

Get the canonical AWS name for a region.

Parameters
regionAWS region to get the canonical name of.
Returns
The canonical AWS name for region, or null string if region is invalid.
AwsRegion::Region AwsRegion::region ( ) const

Get the region this object represents.

If this object was given an AwsRegion::Region value during construction, this function will simply return that enumeration value.

If this object was constructed from an AWS region name, then this function will return the AwsRegion::Region enumeration value corresponding to that AWS region name, or AwsRegion::InvalidRegion if the given region name did not name a known, valid AWS region.

Returns
The region this object represents, or AwsRegion::InvalidRegion if this object does not represent a valid region.
QStringList AwsRegion::supportedServices ( const AwsEndpoint::Transports  transports = AwsEndpoint::AnyTransport) const

Get a list of services supported by this region.

Parameters
transportsOptional set of transports to test for support.
Returns
A list of the names of all AWS services support by this region for at least one of the specified transports. The list may be empty.

The documentation for this class was generated from the following files: