Base class for Cloud Gem service request jobs. More...
#include <ServiceRequestJob.h>
Inherits AWSCore::ServiceClientJob< RequestType::ServiceTraits >, and RequestType.
Inherited by AWSCore::ServiceRequestJob< RequestType >::Function.
Classes | |
class | Function |
A derived class that calls lambda functions on job completion. More... | |
Public Types | |
using | IConfig = IServiceRequestJobConfig |
Aliases for the configuration types used for this job class. | |
using | Config = ServiceRequestJobConfig< RequestType > |
using | ServiceRequestJobType = ServiceRequestJob< RequestType > |
An alias for this type, useful in derived classes. | |
using | ServiceClientJobType = ServiceClientJob< typename RequestType::ServiceTraits > |
using | OnSuccessFunction = AZStd::function< void(ServiceRequestJob *job)> |
using | OnFailureFunction = AZStd::function< void(ServiceRequestJob *job)> |
Public Types inherited from AWSCore::ServiceClientJob< RequestType::ServiceTraits > | |
using | IConfig = IServiceClientJobConfig |
using | Config = ServiceClientJobConfig< RequestType::ServiceTraits > |
Public Types inherited from AWSCore::ServiceJob | |
using | IConfig = IServiceJobConfig |
using | Config = ServiceJobConfig |
Public Member Functions | |
AZ_CLASS_ALLOCATOR (ServiceRequestJob, AZ::SystemAllocator) | |
ServiceRequestJob (bool isAutoDelete, IConfig *config=GetDefaultConfig()) | |
bool | HasCredentials (IConfig *config) |
bool | WasSuccess () |
Returns true if no error has occurred. | |
void | Reset (bool isClearDependent) override |
template<class Allocator > | |
ServiceRequestJob< RequestType > * | Create (OnSuccessFunction onSuccess, OnFailureFunction onFailure, IConfig *config) |
Public Member Functions inherited from AWSCore::ServiceClientJob< RequestType::ServiceTraits > | |
AZ_CLASS_ALLOCATOR (ServiceClientJob, AZ::SystemAllocator) | |
ServiceClientJob (bool isAutoDelete, IConfig *config=GetDefaultConfig()) | |
Public Member Functions inherited from AWSCore::ServiceJob | |
AZ_CLASS_ALLOCATOR (ServiceJob, AZ::SystemAllocator) | |
ServiceJob (bool isAutoDelete, IConfig *config) | |
HttpRequestJob & | GetHttpRequestJob () |
Access the underlying HttpRequestJob if lower-level access is needed. | |
const HttpRequestJob & | GetHttpRequestJob () const |
void | Start () |
Start the asynchronous job. | |
Static Public Member Functions | |
template<class Allocator = AZ::SystemAllocator> | |
static ServiceRequestJob * | Create (OnSuccessFunction onSuccess, OnFailureFunction onFailure=OnFailureFunction{}, IConfig *config=GetDefaultConfig()) |
static Config * | GetDefaultConfig () |
Static Public Member Functions inherited from AWSCore::ServiceClientJob< RequestType::ServiceTraits > | |
static Config * | GetDefaultConfig () |
Static Public Member Functions inherited from AWSCore::ServiceJob | |
static Config * | GetDefaultConfig () |
Protected Member Functions | |
virtual bool | PrepareRequest () |
virtual bool | IsValid () const |
virtual void | OnSuccess () |
Called when a request completes without error. | |
virtual void | OnFailure () |
Called when an error occurs. | |
virtual void | DoCleanup () |
Provided so derived functions that do not auto delete can clean up. | |
Protected Member Functions inherited from AWSCore::HttpRequestJob | |
virtual std::shared_ptr< Aws::Http::HttpRequest > | InitializeRequest () |
virtual void | CustomizeRequest (const std::shared_ptr< Aws::Http::HttpRequest > &request) |
virtual void | ProcessResponse (const std::shared_ptr< Aws::Http::HttpResponse > &response) |
AZ_CLASS_ALLOCATOR (HttpRequestJob, AZ::SystemAllocator) | |
HttpRequestJob (bool isAutoDelete, IConfig *config) | |
void | SetUrl (AZStd::string url) |
Get and set the URL for this request. | |
const AZStd::string & | GetUrl () const |
void | SetMethod (HttpMethod method) |
Get and set the HTTP method for this request. | |
bool | SetMethod (const AZStd::string &method) |
HttpMethod | GetMethod () const |
void | SetRequestHeader (AZStd::string key, AZStd::string value) |
Get and set headers for the HTTP request. | |
bool | GetRequestHeader (const AZStd::string &key, AZStd::string *result=nullptr) |
void | SetRequestHeader (HeaderField field, AZStd::string value) |
bool | GetRequestHeader (HeaderField field, AZStd::string *result=nullptr) |
StringMap & | GetRequestHeaders () |
Get the collection of all request headers. | |
const StringMap & | GetRequestHeaders () const |
void | SetAccept (AZStd::string accept) |
Syntactic sugar to set popular headers. Equivalent to manually setting the corresponding header field. | |
void | SetAcceptCharSet (AZStd::string accept) |
void | SetContentLength (AZStd::string contentLength) |
void | SetContentType (AZStd::string contentType) |
void | SetAWSAuthSigner (const std::shared_ptr< Aws::Client::AWSAuthSigner > &authSigner) |
Get and set AWS authorization signer for the request. | |
const std::shared_ptr< Aws::Client::AWSAuthSigner > & | GetAWSAuthSigner () const |
void | SetBody (AZStd::string body) |
Get and set the body for the HTTP request. (You are responsible for setting the Content-Length header.) | |
const AZStd::string & | GetBody () const |
AZStd::string & | GetBody () |
template<typename SuccessCallbackT , typename FailureCallbackT > | |
void | SetCallbacks (SuccessCallbackT &&successCB, FailureCallbackT &&failureCB) |
Set callback functions for success and failure. These will be executed on the main thread. | |
Protected Member Functions inherited from AWSCore::AwsApiJob | |
AwsApiJob (bool isAutoDelete, IConfig *config=GetDefaultConfig()) | |
AZ_CLASS_ALLOCATOR (AwsApiJob, AZ::SystemAllocator) | |
Protected Attributes | |
const Aws::String & | m_requestUrl |
std::shared_ptr< Aws::Client::AWSAuthV4Signer > | m_AWSAuthSigner { nullptr } |
bool | m_missingCredentials { false } |
Additional Inherited Members | |
Protected Types inherited from AWSCore::ServiceClientJob< RequestType::ServiceTraits > | |
using | ServiceClientJobType = ServiceClientJob< RequestType::ServiceTraits > |
Protected Types inherited from AWSCore::HttpRequestJob | |
enum class | HttpMethod { HTTP_GET , HTTP_POST , HTTP_DELETE , HTTP_PUT , HTTP_HEAD , HTTP_PATCH } |
enum class | HeaderField { DATE , AWS_DATE , AWS_SECURITY_TOKEN , ACCEPT , ACCEPT_CHAR_SET , ACCEPT_ENCODING , AUTHORIZATION , AWS_AUTHORIZATION , COOKIE , CONTENT_LENGTH , CONTENT_TYPE , USER_AGENT , VIA , HOST , AMZ_TARGET , X_AMZ_EXPIRES , CONTENT_MD5 } |
using | SuccessFn = AZStd::function< void(const AZStd::shared_ptr< Response > &response)> |
using | FailureFn = AZStd::function< void(const AZStd::shared_ptr< Response > &response)> |
using | StringMap = AZStd::unordered_map< AZStd::string, AZStd::string > |
using | IConfig = IHttpRequestJobConfig |
using | Config = HttpRequestJobConfig |
Protected Types inherited from AWSCore::AwsApiJob | |
using | IConfig = IAwsApiJobConfig |
using | Config = AwsApiJobConfig |
Static Protected Member Functions inherited from AWSCore::HttpRequestJob | |
static Config * | GetDefaultConfig () |
static void | StaticInit () |
static void | StaticShutdown () |
static const char * | HttpMethodToString (HttpMethod) |
Converts an HttpMethod to a string. Used for debug output. | |
static const char * | HttpMethodToString (Aws::Http::HttpMethod) |
static AZStd::optional< HttpMethod > | StringToHttpMethod (const AZStd::string &method) |
Converts a string to an HttpMethod. | |
Static Protected Member Functions inherited from AWSCore::AwsApiJob | |
static Config * | GetDefaultConfig () |
Static Protected Attributes inherited from AWSCore::AwsApiJob | |
static const char * | COMPONENT_DISPLAY_NAME |
Used for error messages. | |
Base class for Cloud Gem service request jobs.
|
inlineprotectedvirtual |
Called to prepare the request. By default no changes are made to the parameters object. Override to defer the preparation of parameters until running on the job's worker thread, instead of setting parameters before calling Start.
|
inlineoverride |
Override AZ:Job defined method to reset request state when the job object is reused.
|
protected |
The URL created by appending the API path to the service URL. The path may contain {param} format parameters. The RequestType::parameters.BuildRequest method is responsible for replacing these parts of the url.