AwsAbstractRequest Class
(QtAws::Core::AwsAbstractRequest)The AwsAbstractRequest class provides an interface for AWS requests. More...
Public Functions
| AwsAbstractRequest() | |
| AwsAbstractRequest(const AwsAbstractRequest &other) | |
| virtual | ~AwsAbstractRequest() |
| virtual QByteArray | data() const |
| virtual bool | isValid() const = 0 |
| virtual QNetworkRequest | networkRequest(const QUrl &endpoint, const AwsAbstractSignature &signature, const AwsAbstractCredentials &credentials) const |
| virtual QNetworkAccessManager::Operation | operation() const |
| virtual AwsAbstractResponse * | send(QNetworkAccessManager &manager, const QUrl &endpoint, const AwsAbstractSignature &signature, const AwsAbstractCredentials &credentials) const |
| AwsAbstractRequest & | operator=(const AwsAbstractRequest &other) |
| virtual bool | operator==(const AwsAbstractRequest &other) const |
Protected Functions
| virtual AwsAbstractResponse * | response(QNetworkReply * const reply) const = 0 |
| void | setData(const QByteArray &data) |
| void | setOperation(const QNetworkAccessManager::Operation operation) |
| virtual QNetworkRequest | unsignedRequest(const QUrl &endpoint) const = 0 |
Detailed Description
The AwsAbstractRequest class provides an interface for AWS requests.
Typically, a user would pass a derived class (such as SqsCreateQueueRequest) to an AwsAbstractClient-derived class (such as SqsClient) to send a request to an AWS service.
Note, by design, requests based on this class are endpoint-agnostic. That is, you may instantiate a request (such as an SqsCreateQueueRequest), and pass it to multiple clients (such as a US instance of SqsClient as well as an AU instance of SqsClient). Thus it is the caller (typically an AwsAbstractClient-derived class) that is responsible for for setting the region / endpoint information, allowing requests to be reused unmodified multiple times, and/or in multiple regions.
Member Function Documentation
AwsAbstractRequest::AwsAbstractRequest()
Constructs an AwsAbstractRequest object.
AwsAbstractRequest::AwsAbstractRequest(const AwsAbstractRequest &other)
Constructs a copy of other.
[virtual] AwsAbstractRequest::~AwsAbstractRequest()
Destroys the AWS request.
[virtual] QByteArray AwsAbstractRequest::data() const
Returns data to be included with PUT and/or POST operations.
See also setData().
[pure virtual] bool AwsAbstractRequest::isValid() const
Returns true if this request is valid; false otherwise.
Derived classes must implement this function to provide a level of request validation relevant to the type of request being implemented.
In this context, "valid" means that with valid credentials, the request's networkRequest method should return a request that the caller can reasonably expect AWS to accept (ignoring server side access restrictions and the like).
[virtual] QNetworkRequest AwsAbstractRequest::networkRequest(const QUrl &endpoint, const AwsAbstractSignature &signature, const AwsAbstractCredentials &credentials) const
Returns a QNetwokrRequest object that can be used to send this AWS request to Amazon.
This base implementation fetches the basic request for endpoint via unsignedRequest, then uses signature and credentials to sign the request before returning to the caller.
Derived classes may override this if their specific AWS service required more advanced logic (or disallow signing, for example).
[virtual] QNetworkAccessManager::Operation AwsAbstractRequest::operation() const
Returns the network operation to use when sending this request.
This defaults to QNetworkAccessManager::GetOperation unless overridden or changed via setOperation.
See also setOperation().
[pure virtual protected] AwsAbstractResponse *AwsAbstractRequest::response(QNetworkReply * const reply) const
Return an AWS response object for reply.
Derived classes must implement this pure virtual function to return the relevant AwsAbstractResponse-derived object for their request type.
For example, the SqsCreateQueueRequest::response implementation returns an instance of the related SqsCreateQueueResponse class. Typically an AwsAbstractClient-derived class will cast this the returned pointer to the relevant known type in its send method.
[virtual] AwsAbstractResponse *AwsAbstractRequest::send(QNetworkAccessManager &manager, const QUrl &endpoint, const AwsAbstractSignature &signature, const AwsAbstractCredentials &credentials) const
Sends this request to the Amazon endpoint via network access manager.
If appropriate, signature and credentials will be used to sign the request.
Returns an AwsAbstractResponse-derived object representing the AWS service's response.
[protected] void AwsAbstractRequest::setData(const QByteArray &data)
Sets the data to be used with POST and/or PUT operations.
See also data().
[protected] void AwsAbstractRequest::setOperation(const QNetworkAccessManager::Operation operation)
Sets the network operation to use when submitting this request.
See also operation().
[pure virtual protected] QNetworkRequest AwsAbstractRequest::unsignedRequest(const QUrl &endpoint) const
Returns a network request for this AWS request for the given AWS endpoint.
Derived classes must implement this pure virtual function to build network requests that the networkRequest function can sign, before being subitted to Amazon.
AwsAbstractRequest &AwsAbstractRequest::operator=(const AwsAbstractRequest &other)
Sets the AwsAbstractRequest object to be equal to other.
[virtual] bool AwsAbstractRequest::operator==(const AwsAbstractRequest &other) const
Returns true if this request is equal to other; false otherwise.
© 2018 Paul Colby Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.