libqtaws  0.1.0
UnofficialAWSlibraryforQt-InternalDocumentation
awsbasiccredentials.cpp
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 #include "awsbasiccredentials.h"
21 #include "awsbasiccredentials_p.h"
22 
23 QTAWS_BEGIN_NAMESPACE
24 
25 /**
26  * @class AwsBasicCredentials
27  *
28  * @brief Basic non-refreshable implementation of AwsAbstractCredentials.
29  */
30 
31 /**
32  * @brief Constructs a new AwsBasicCredentials object.
33  *
34  * Constructs a new AwsBasicCredentials object, with the specified AWS access key, AWS secret
35  * key, and AWS security token.
36  *
37  * @param accessKeyId The AWS access key ID to use for this credentials object.
38  * @param secretKey The AWS secret access key to use for this credentials object.
39  * @param token The AWS security token to use for this credentials object.
40  * @param parent This object's parent.
41  */
43  const QString &accessKeyId,
44  const QString &secretKey,
45  const QString &token,
46  QObject * const parent)
47  : AwsAbstractCredentials(parent), d_ptr(new AwsBasicCredentialsPrivate(this))
48 {
50  d->accessKeyId = accessKeyId;
51  d->secretKey = secretKey;
52  d->token = token;
53 }
54 
55 /**
56  * @brief Constructs a new AwsBasicCredentials object.
57  *
58  * Constructs a new AwsBasicCredentials object, with the specified AWS access key and AWS secret
59  * key. The object's security token will be left as null string, unless set later via setToken().
60  *
61  * @param accessKeyId The AWS access key ID to use for this credentials object.
62  * @param secretKey The AWS secret access key to use for this credentials object.
63  * @param parent This object's parent.
64  */
66  const QString &accessKeyId,
67  const QString &secretKey,
68  QObject * const parent)
69  : AwsAbstractCredentials(parent), d_ptr(new AwsBasicCredentialsPrivate(this))
70 {
72  d->accessKeyId = accessKeyId;
73  d->secretKey = secretKey;
74 }
75 
76 AwsBasicCredentials::~AwsBasicCredentials()
77 {
78  delete d_ptr;
79 }
80 
82 {
83  Q_D(const AwsBasicCredentials);
84  return d->accessKeyId;
85 }
86 
88 {
89  Q_D(const AwsBasicCredentials);
90  return d->secretKey;
91 }
92 
94 {
95  Q_D(const AwsBasicCredentials);
96  return d->token;
97 }
98 
99 /**
100  * @brief Set the AWS access key ID for this credentials object.
101  *
102  * @param accessKeyId The AWS access key ID to set for this credentials object.
103  */
104 void AwsBasicCredentials::setAccessKeyId(const QString &accessKeyId)
105 {
106  Q_D(AwsBasicCredentials);
107  d->accessKeyId = accessKeyId;
108  emit changed();
109 }
110 
111 /**
112  * @brief Set the AWS secret access key for this credentials object.
113  *
114  * @param secretKey The AWS secret access key to set for this credentials object.
115  */
116 void AwsBasicCredentials::setSecretKey(const QString &secretKey)
117 {
118  Q_D(AwsBasicCredentials);
119  d->secretKey = secretKey;
120  emit changed();
121 }
122 
123 /**
124  * @brief Set the AWS security token for this credentials object.
125  *
126  * @param token The AWS security token to set for this credentials object.
127  */
128 void AwsBasicCredentials::setToken(const QString &token)
129 {
130  Q_D(AwsBasicCredentials);
131  d->token = token;
132  emit changed();
133 }
134 
135 /**
136  * @internal
137  *
138  * @class AwsBasicCredentialsPrivate
139  *
140  * @brief Private implementation for AwsBasicCredentials.
141  *
142  * @see http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
143  */
144 
145 /**
146  * @internal
147  *
148  * @brief Constructs a new AwsBasicCredentialsPrivate object.
149  *
150  * @param q Pointer to this object's public AwsBasicCredentials instance.
151  */
153  : q_ptr(q)
154 {
155 
156 }
157 
158 QTAWS_END_NAMESPACE
Basic non-refreshable implementation of AwsAbstractCredentials.
virtual QString token() const
AWS security token for this credentials object.
virtual QString secretKey() const
AWS secret access key for this credentials object.
Interface class for providing AWS credentials.
void changed()
Signal emitted when this object's credentials have been updated.
virtual void setSecretKey(const QString &secretKey)
Set the AWS secret access key for this credentials object.
virtual QString accessKeyId() const
AWS access key ID for this credentials object.
virtual void setAccessKeyId(const QString &accessKeyId)
Set the AWS access key ID for this credentials object.
AwsBasicCredentialsPrivate(AwsBasicCredentials *const q)
Constructs a new AwsBasicCredentialsPrivate object.
AwsBasicCredentialsPrivate *const d_ptr
Internal d-pointer.
virtual void setToken(const QString &token)
Set the AWS security token for this credentials object.
Private implementation for AwsBasicCredentials.
AwsBasicCredentials(const QString &accessKeyid, const QString &secretKey, const QString &token, QObject *const parent=0)
Constructs a new AwsBasicCredentials object.