libqtaws  0.1.0
UnofficialAWSlibraryforQt
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;
41  QString regionName;
42  QString serviceName;
43 
44  AwsEndpointPrivate(AwsEndpoint * const q);
45 
46 protected:
48  struct HostInfo {
49  QStringList regionNames;
50  QString serviceName;
51  };
52 
54  struct RegionEndpointInfo {
55  QString hostName;
56  AwsEndpoint::Transports transports;
57  };
58 
60  typedef QHash<QString, RegionEndpointInfo> RegionServices;
61 
63  struct RegionInfo {
64  RegionServices services;
65  };
66 
68  struct ServiceInfo {
69  QString fullName;
70  QStringList regionNames;
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;
90  friend class TestAwsEndpoint;
91  friend class TestAwsSignatureV4;
92 };
93 
94 QTAWS_END_NAMESPACE
95 
96 #endif
Provides AWS endpoint information.
Definition: awsendpoint.h:33