Open 3D Engine AWSCore Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AWSCore::ServiceRequestJob< RequestType > Class Template Reference

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)
 
HttpRequestJobGetHttpRequestJob ()
 Access the underlying HttpRequestJob if lower-level access is needed.
 
const HttpRequestJobGetHttpRequestJob () const
 
void Start ()
 Start the asynchronous job.
 

Static Public Member Functions

template<class Allocator = AZ::SystemAllocator>
static ServiceRequestJobCreate (OnSuccessFunction onSuccess, OnFailureFunction onFailure=OnFailureFunction{}, IConfig *config=GetDefaultConfig())
 
static ConfigGetDefaultConfig ()
 
- Static Public Member Functions inherited from AWSCore::ServiceClientJob< RequestType::ServiceTraits >
static ConfigGetDefaultConfig ()
 
- Static Public Member Functions inherited from AWSCore::ServiceJob
static ConfigGetDefaultConfig ()
 

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 ConfigGetDefaultConfig ()
 
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 ConfigGetDefaultConfig ()
 
- Static Protected Attributes inherited from AWSCore::AwsApiJob
static const char * COMPONENT_DISPLAY_NAME
 Used for error messages.
 

Detailed Description

template<class RequestType>
class AWSCore::ServiceRequestJob< RequestType >

Base class for Cloud Gem service request jobs.

Member Function Documentation

◆ PrepareRequest()

template<class RequestType >
virtual bool AWSCore::ServiceRequestJob< RequestType >::PrepareRequest ( )
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.

Returns
true if the request was prepared successfully.

◆ Reset()

template<class RequestType >
void AWSCore::ServiceRequestJob< RequestType >::Reset ( bool  isClearDependent)
inlineoverride

Override AZ:Job defined method to reset request state when the job object is reused.

Member Data Documentation

◆ m_requestUrl

template<class RequestType >
const Aws::String& AWSCore::ServiceRequestJob< RequestType >::m_requestUrl
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.


The documentation for this class was generated from the following file: