libqtaws  0.1.0
UnofficialAWSlibraryforQt-InternalDocumentation
awsendpoint_p.h
1 /*
2  Copyright 2013-2015 Paul Colby
3 
4  This file is part of libqtaws.
5 
6  Libqtaws is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Libqtaws is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with libqtaws. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef AWSENDPOINT_P_H
21 #define AWSENDPOINT_P_H
22 
23 #include "qtawsglobal.h"
24 
25 #include "awsendpoint.h"
26 
27 #include <QMutex>
28 #include <QString>
29 #include <QStringList>
30 #include <QXmlStreamReader>
31 #include <QVariant>
32 
33 QTAWS_BEGIN_NAMESPACE
34 
35 class AwsEndpoint;
36 
37 class QTAWS_EXPORT AwsEndpointPrivate {
38 
39 public:
40  QString hostName; ///< This endpoint's hostname.
41  QString regionName; ///< This endpoint's region name.
42  QString serviceName; ///< This endpoint's service name.
43 
45 
46 protected:
47  /// The per-host information to load from the endpoints.xml file.
48  struct HostInfo {
49  QStringList regionNames; ///< AWS regions supported by the host.
50  QString serviceName; ///< AWS service supported by the host.
51  };
52 
53  /// The per-region endpoint-specific information to load from the endpoints.xml file.
55  QString hostName; ///< AWS endpoint's hostname.
56  AwsEndpoint::Transports transports; ///< Transports supported by this AWS endpoint.
57  };
58 
59  /// Hash of service names to RegionEndpointInfo.
60  typedef QHash<QString, RegionEndpointInfo> RegionServices;
61 
62  /// The per-region information to load from the endpoints.xml file.
63  struct RegionInfo {
64  RegionServices services; ///< AWS services supported by the AWS region.
65  };
66 
67  /// The per-service information to load from the endpoints.xml file.
68  struct ServiceInfo {
69  QString fullName; ///< AWS service's full human-friendly name.
70  QStringList regionNames; ///< AWS regions support by this service.
71  };
72 
73  static QHash<QString, HostInfo> hosts;
74  static QHash<QString, RegionInfo> regions;
75  static QHash<QString, ServiceInfo> services;
76 
77  static QMutex mutex;
78 
79  static void loadEndpointData(const QString &fileName = QLatin1String(":/aws/endpoints.xml"));
80  static void loadEndpointData(QIODevice &device);
81  static void loadEndpointData(QXmlStreamReader &xml);
82  static void parseRegion(QXmlStreamReader &xml);
83  static void parseRegions(QXmlStreamReader &xml);
84  static void parseService(QXmlStreamReader &xml);
85  static void parseServices(QXmlStreamReader &xml);
86 
87 private:
88  Q_DECLARE_PUBLIC(AwsEndpoint)
89  AwsEndpoint * const q_ptr; ///< Internal q-pointer.
90  friend class TestAwsEndpoint;
91  friend class TestAwsSignatureV4;
92 };
93 
94 QTAWS_END_NAMESPACE
95 
96 #endif
QString serviceName
AWS service supported by the host.
Definition: awsendpoint_p.h:50
The per-host information to load from the endpoints.xml file.
Definition: awsendpoint_p.h:48
RegionServices services
AWS services supported by the AWS region.
Definition: awsendpoint_p.h:64
QStringList regionNames
AWS regions supported by the host.
Definition: awsendpoint_p.h:49
QString fullName
AWS service's full human-friendly name.
Definition: awsendpoint_p.h:69
static QMutex mutex
Mutex for protecting access to static members.
Definition: awsendpoint_p.h:77
QHash< QString, RegionEndpointInfo > RegionServices
Hash of service names to RegionEndpointInfo.
Definition: awsendpoint_p.h:60
static QHash< QString, RegionInfo > regions
Hash of region names to RegionInfo.
Definition: awsendpoint_p.h:74
QString regionName
This endpoint's region name.
Definition: awsendpoint_p.h:41
Provides AWS endpoint information.
Definition: awsendpoint.h:33
AwsEndpoint::Transports transports
Transports supported by this AWS endpoint.
Definition: awsendpoint_p.h:56
QString serviceName
This endpoint's service name.
Definition: awsendpoint_p.h:42
Private implementation for AwsEndpoint.
Definition: awsendpoint_p.h:37
static QHash< QString, ServiceInfo > services
Hash of service names to ServiceInfo.
Definition: awsendpoint_p.h:75
The per-service information to load from the endpoints.xml file.
Definition: awsendpoint_p.h:68
QString hostName
AWS endpoint's hostname.
Definition: awsendpoint_p.h:55
The per-region information to load from the endpoints.xml file.
Definition: awsendpoint_p.h:63
QStringList regionNames
AWS regions support by this service.
Definition: awsendpoint_p.h:70
The per-region endpoint-specific information to load from the endpoints.xml file. ...
Definition: awsendpoint_p.h:54
QString hostName
This endpoint's hostname.
Definition: awsendpoint_p.h:40
static QHash< QString, HostInfo > hosts
Hash of hostnames to HostInfo.
Definition: awsendpoint_p.h:73