libqtaws  0.1.0
UnofficialAWSlibraryforQt
awsendpoint.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_H
21 #define AWSENDPOINT_H
22 
23 #include "qtawsglobal.h"
24 
25 #include <QFlag>
26 #include <QStringList>
27 #include <QUrl>
28 
29 QTAWS_BEGIN_NAMESPACE
30 
31 class AwsEndpointPrivate;
32 
33 class QTAWS_EXPORT AwsEndpoint {
34 
35 public:
37  enum Transport {
38  HTTP = 0x01,
39  HTTPS = 0x02,
40  SMTP = 0x04,
41  AnyTransport = HTTP|HTTPS|SMTP
42  };
43  Q_DECLARE_FLAGS(Transports, Transport)
44 
45  AwsEndpoint(const QByteArray &hostName);
46  AwsEndpoint(const QString &hostName);
47 
48  ~AwsEndpoint();
49 
50  static QUrl getEndpoint(const QString &regionName, const QString &serviceName,
51  const Transports transport = AnyTransport);
52 
53  static bool isSupported(const QString &regionName, const QString &serviceName,
54  const Transports transport = AnyTransport);
55 
56  bool isSupported(const Transport transport) const;
57 
58  bool isValid() const;
59 
60  QString fullServiceName() const;
61  static QString fullServiceName(const QString &serviceName);
62 
63  QString hostName() const;
64 
65  QString regionName() const;
66 
67  QString serviceName() const;
68 
69  QStringList supportedRegions(const Transports transport = AnyTransport) const;
70 
71  static QStringList supportedRegions(const QString &serviceName,
72  const Transports transport = AnyTransport);
73 
74  static QStringList supportedServices(const QString &regionName,
75  const Transports transport = AnyTransport);
76 
77 private:
78  Q_DECLARE_PRIVATE(AwsEndpoint)
79  AwsEndpointPrivate * const d_ptr;
80  friend class TestAwsEndpoint;
81 };
82 
83 Q_DECLARE_OPERATORS_FOR_FLAGS(AwsEndpoint::Transports)
84 
85 QTAWS_END_NAMESPACE
86 
87 #endif
Transport
Network transport supported by one or more AWS endpoints.
Definition: awsendpoint.h:37
Provides AWS endpoint information.
Definition: awsendpoint.h:33