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::HttpRequestJob Class Reference

Inherits AWSCore::AwsApiJob.

Inherited by AWSCore::ServiceJob [protected].

Classes

class  Response
 

Public Types

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
 
- Public Types inherited from AWSCore::AwsApiJob
using IConfig = IAwsApiJobConfig
 
using Config = AwsApiJobConfig
 

Public Member Functions

 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.
 
- Public Member Functions inherited from AWSCore::AwsApiJob
 AZ_CLASS_ALLOCATOR (AwsApiJob, AZ::SystemAllocator)
 

Static Public Member Functions

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 Public Member Functions inherited from AWSCore::AwsApiJob
static ConfigGetDefaultConfig ()
 

Protected Member Functions

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)
 
- Protected Member Functions inherited from AWSCore::AwsApiJob
 AwsApiJob (bool isAutoDelete, IConfig *config=GetDefaultConfig())
 

Additional Inherited Members

- Static Protected Attributes inherited from AWSCore::AwsApiJob
static const char * COMPONENT_DISPLAY_NAME
 Used for error messages.
 

Member Function Documentation

◆ CustomizeRequest()

virtual void AWSCore::HttpRequestJob::CustomizeRequest ( const std::shared_ptr< Aws::Http::HttpRequest > &  request)
inlineprotectedvirtual

Override to customize HTTP request right before it is sent. Configuration specified in this class will already have been configured in the request. WARNING: This gets called on the job's thread, so observe thread safety precautions.

◆ InitializeRequest()

virtual std::shared_ptr< Aws::Http::HttpRequest > AWSCore::HttpRequestJob::InitializeRequest ( )
protectedvirtual

Override to provide a custom instantiation of the HttpRequest. The default implementation uses the URL and method specified in this class. This is required mainly because Aws::Http::HttpRequest demands that these parameters be configured at the time of construction. You can also use this opportunity to set properties of the HttpRequestJob you want reflected in the request. WARNING: This gets called on the job's thread, so observe thread safety precautions.

◆ ProcessResponse()

virtual void AWSCore::HttpRequestJob::ProcessResponse ( const std::shared_ptr< Aws::Http::HttpResponse > &  response)
inlineprotectedvirtual

Override to process the response to the HTTP request before callbacks are fired. WARNING: This gets called on the job's thread, so observe thread safety precautions.

◆ SetRequestHeader()

void AWSCore::HttpRequestJob::SetRequestHeader ( HeaderField  field,
AZStd::string  value 
)

Get and set pre-defined header fields. Equivalent to manually setting the corresponding header field, e.g. HeaderField::CONTENT_LENGTH maps to "Content-Length".


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