/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// // THIS CODE IS AUTOGENERATED, DO NOT MODIFY ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// #include "AWS/ServiceAPI/CloudGemDynamicContentClientComponent.h" namespace CloudGemDynamicContent { namespace ServiceAPI { const char* LmbrAWS_CodeGen_Component_UUID= "{30f2b6b0-e3fe-11e6-ac87-40e230988dca}"; const char* LmbrAWS_CodeGen_NotificationBus1_UUID= "{a5160fb4-cbfb-453e-8713-311ac05165b9}"; const char* LmbrAWS_CodeGen_RequestBus1_UUID= "{f9d01db8-3b10-4afc-92be-2e7ecfc6678d}"; const char* LmbrAWS_CodeGen_ResponseHandler_UUID= "{3873e63a-2e53-44fa-85bd-7585e8c2017f}"; const char* LmbrAWS_CodeGen_ServiceStatus_UUID= "{038a7126-89ec-4bac-8f09-2574e80712a9}"; const char* LmbrAWS_CodeGen_PortalFileInfo_UUID= "{cf6f02c5-12ad-49ae-9281-3c4aacb30d4a}"; const char* LmbrAWS_CodeGen_PortalFileRequest_UUID= "{f6e760d2-e139-42e2-8b9c-b9a8dbbf8abc}"; const char* LmbrAWS_CodeGen_PortalFileRequestList_UUID= "{9035bd2a-ab01-436c-85f8-a7391ad539a4}"; const char* LmbrAWS_CodeGen_PortalFileListResults_UUID= "{f0a7dafb-d85c-46c5-b3e1-a90086d18f1e}"; const char* LmbrAWS_CodeGen_RequestDataItem_UUID= "{c2a0371d-37a7-49bd-be3c-488c8401d83f}"; const char* LmbrAWS_CodeGen_RequestData_UUID= "{a7bee76e-cf1a-4b42-8bda-5353d2c51f4c}"; const char* LmbrAWS_CodeGen_FileRequestResult_UUID= "{89ea2795-e558-48ee-8a8a-3d4e984c3133}"; const char* LmbrAWS_CodeGen_FileRequestResults_UUID= "{850ec908-0416-44f4-8567-3f6192e08984}"; void Configure() { // Insert any necessary CloudGemFramework configuration here } // redefs bool WriteJson(CloudGemFramework::JsonWriter& writer, const int& item) { return writer.Int(item); } bool WriteJson(CloudGemFramework::JsonWriter& writer, const AZStd::string& item) { return writer.String(item); } bool WriteJson(CloudGemFramework::JsonWriter& writer, const double& item) { return writer.Double(item); } bool WriteJson(CloudGemFramework::JsonWriter& writer, const ServiceStatus& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("status"); ok = ok && WriteJson(writer, item.status); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalFileInfo& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("FileName"); ok = ok && WriteJson(writer, item.FileName); ok = ok && writer.Key("StagingStatus"); ok = ok && WriteJson(writer, item.StagingStatus); ok = ok && writer.Key("StagingStart"); ok = ok && WriteJson(writer, item.StagingStart); ok = ok && writer.Key("StagingEnd"); ok = ok && WriteJson(writer, item.StagingEnd); ok = ok && writer.Key("Parent"); ok = ok && WriteJson(writer, item.Parent); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalFileRequest& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("FileName"); ok = ok && WriteJson(writer, item.FileName); ok = ok && writer.Key("StagingStatus"); ok = ok && WriteJson(writer, item.StagingStatus); ok = ok && writer.Key("StagingStart"); ok = ok && WriteJson(writer, item.StagingStart); ok = ok && writer.Key("StagingEnd"); ok = ok && WriteJson(writer, item.StagingEnd); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalFileRequestListPropertyFileList& list) { bool ok = true; ok = ok && writer.StartArray(); for (auto item : list) { ok = ok && WriteJson(writer, item); } ok = ok && writer.EndArray(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalFileRequestList& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("FileList"); ok = ok && WriteJson(writer, item.FileList); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalFileListResultsPropertyResults& list) { bool ok = true; ok = ok && writer.StartArray(); for (auto item : list) { ok = ok && WriteJson(writer, item); } ok = ok && writer.EndArray(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalFileListResults& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("results"); ok = ok && WriteJson(writer, item.results); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const RequestDataItem& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("FileName"); ok = ok && WriteJson(writer, item.FileName); ok = ok && writer.Key("FileVersion"); ok = ok && WriteJson(writer, item.FileVersion); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const RequestDataPropertyFileList& list) { bool ok = true; ok = ok && writer.StartArray(); for (auto item : list) { ok = ok && WriteJson(writer, item); } ok = ok && writer.EndArray(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const RequestData& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("FileList"); ok = ok && WriteJson(writer, item.FileList); ok = ok && writer.Key("ManifestData"); ok = ok && WriteJson(writer, item.ManifestData); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const FileRequestResult& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("FileName"); ok = ok && WriteJson(writer, item.FileName); ok = ok && writer.Key("FileStatus"); ok = ok && WriteJson(writer, item.FileStatus); ok = ok && writer.Key("PresignedURL"); ok = ok && WriteJson(writer, item.PresignedURL); ok = ok && writer.Key("Signature"); ok = ok && WriteJson(writer, item.Signature); ok = ok && writer.Key("Size"); ok = ok && WriteJson(writer, item.Size); ok = ok && writer.Key("Hash"); ok = ok && WriteJson(writer, item.Hash); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const FileRequestResultArray& list) { bool ok = true; ok = ok && writer.StartArray(); for (auto item : list) { ok = ok && WriteJson(writer, item); } ok = ok && writer.EndArray(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const FileRequestResults& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("ResultList"); ok = ok && WriteJson(writer, item.ResultList); ok = ok && writer.EndObject(); return ok; } // Generated Function Parameters bool GetServiceStatusRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool GetServiceStatusRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool GetPortalInfoRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.SetPathParameter("{""file_name""}", file_name); ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool GetPortalInfoRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool DeletePortalInfoRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.SetPathParameter("{""file_name""}", file_name); ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool DeletePortalInfoRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool GetPortalContentRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool GetPortalContentRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool DeletePortalContentRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool DeletePortalContentRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool PostPortalContentRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool PostPortalContentRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; ok = ok && CloudGemDynamicContent::ServiceAPI::WriteJson(writer, request_content); return ok; } bool PostClientContentRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool PostClientContentRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; ok = ok && CloudGemDynamicContent::ServiceAPI::WriteJson(writer, request_content); return ok; } // CloudGemDynamicContentNotificationBus void CloudGemDynamicContentNotifications::OnGetServiceStatusRequestSuccess(const ServiceStatus response) { } void CloudGemDynamicContentNotifications::OnGetServiceStatusRequestError(const CloudGemFramework::Error error) { } void CloudGemDynamicContentNotifications::OnGetPortalInfoRequestSuccess(const PortalFileInfo response) { } void CloudGemDynamicContentNotifications::OnGetPortalInfoRequestError(const CloudGemFramework::Error error) { } void CloudGemDynamicContentNotifications::OnDeletePortalInfoRequestSuccess(const PortalFileRequestList response) { } void CloudGemDynamicContentNotifications::OnDeletePortalInfoRequestError(const CloudGemFramework::Error error) { } void CloudGemDynamicContentNotifications::OnGetPortalContentRequestSuccess(const PortalFileListResults response) { } void CloudGemDynamicContentNotifications::OnGetPortalContentRequestError(const CloudGemFramework::Error error) { } void CloudGemDynamicContentNotifications::OnDeletePortalContentRequestSuccess(const PortalFileRequestList response) { } void CloudGemDynamicContentNotifications::OnDeletePortalContentRequestError(const CloudGemFramework::Error error) { } void CloudGemDynamicContentNotifications::OnPostPortalContentRequestSuccess(const PortalFileListResults response) { } void CloudGemDynamicContentNotifications::OnPostPortalContentRequestError(const CloudGemFramework::Error error) { } void CloudGemDynamicContentNotifications::OnPostClientContentRequestSuccess(const FileRequestResults response) { } void CloudGemDynamicContentNotifications::OnPostClientContentRequestError(const CloudGemFramework::Error error) { } // BehaviorContext CloudGemDynamicContentNotificationBus handler implementation void BehaviorCloudGemDynamicContentNotificationBusHandler::OnGetServiceStatusRequestSuccess(const ServiceStatus response) { Call(FN_OnGetServiceStatusRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnGetServiceStatusRequestError(const CloudGemFramework::Error error) { Call(FN_OnGetServiceStatusRequestError, error); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnGetPortalInfoRequestSuccess(const PortalFileInfo response) { Call(FN_OnGetPortalInfoRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnGetPortalInfoRequestError(const CloudGemFramework::Error error) { Call(FN_OnGetPortalInfoRequestError, error); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnDeletePortalInfoRequestSuccess(const PortalFileRequestList response) { Call(FN_OnDeletePortalInfoRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnDeletePortalInfoRequestError(const CloudGemFramework::Error error) { Call(FN_OnDeletePortalInfoRequestError, error); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnGetPortalContentRequestSuccess(const PortalFileListResults response) { Call(FN_OnGetPortalContentRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnGetPortalContentRequestError(const CloudGemFramework::Error error) { Call(FN_OnGetPortalContentRequestError, error); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnDeletePortalContentRequestSuccess(const PortalFileRequestList response) { Call(FN_OnDeletePortalContentRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnDeletePortalContentRequestError(const CloudGemFramework::Error error) { Call(FN_OnDeletePortalContentRequestError, error); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnPostPortalContentRequestSuccess(const PortalFileListResults response) { Call(FN_OnPostPortalContentRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnPostPortalContentRequestError(const CloudGemFramework::Error error) { Call(FN_OnPostPortalContentRequestError, error); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnPostClientContentRequestSuccess(const FileRequestResults response) { Call(FN_OnPostClientContentRequestSuccess, response); } void BehaviorCloudGemDynamicContentNotificationBusHandler::OnPostClientContentRequestError(const CloudGemFramework::Error error) { Call(FN_OnPostClientContentRequestError, error); } // CloudGemDynamicContentRequestBus void CloudGemDynamicContentRequests::GetServiceStatus(CloudGemDynamicContentResponseHandler* responseHandler) { } void CloudGemDynamicContentRequests::GetPortalInfo(const AZStd::string& file_name, CloudGemDynamicContentResponseHandler* responseHandler) { } void CloudGemDynamicContentRequests::DeletePortalInfo(const AZStd::string& file_name, CloudGemDynamicContentResponseHandler* responseHandler) { } void CloudGemDynamicContentRequests::GetPortalContent(CloudGemDynamicContentResponseHandler* responseHandler) { } void CloudGemDynamicContentRequests::DeletePortalContent(CloudGemDynamicContentResponseHandler* responseHandler) { } void CloudGemDynamicContentRequests::PostPortalContent(const PortalFileRequestList& request_content, CloudGemDynamicContentResponseHandler* responseHandler) { } void CloudGemDynamicContentRequests::PostClientContent(const RequestData& request_content, CloudGemDynamicContentResponseHandler* responseHandler) { } // CloudGemDynamicContentResponseHandler void CloudGemDynamicContentResponseHandler::HandleGetServiceStatusSuccess(GetServiceStatusRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnGetServiceStatusRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandleGetServiceStatusError(GetServiceStatusRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnGetServiceStatusRequestError, job->error); } void CloudGemDynamicContentResponseHandler::HandleGetPortalInfoSuccess(GetPortalInfoRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnGetPortalInfoRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandleGetPortalInfoError(GetPortalInfoRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnGetPortalInfoRequestError, job->error); } void CloudGemDynamicContentResponseHandler::HandleDeletePortalInfoSuccess(DeletePortalInfoRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnDeletePortalInfoRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandleDeletePortalInfoError(DeletePortalInfoRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnDeletePortalInfoRequestError, job->error); } void CloudGemDynamicContentResponseHandler::HandleGetPortalContentSuccess(GetPortalContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnGetPortalContentRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandleGetPortalContentError(GetPortalContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnGetPortalContentRequestError, job->error); } void CloudGemDynamicContentResponseHandler::HandleDeletePortalContentSuccess(DeletePortalContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnDeletePortalContentRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandleDeletePortalContentError(DeletePortalContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnDeletePortalContentRequestError, job->error); } void CloudGemDynamicContentResponseHandler::HandlePostPortalContentSuccess(PostPortalContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnPostPortalContentRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandlePostPortalContentError(PostPortalContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnPostPortalContentRequestError, job->error); } void CloudGemDynamicContentResponseHandler::HandlePostClientContentSuccess(PostClientContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnPostClientContentRequestSuccess, job->result); } void CloudGemDynamicContentResponseHandler::HandlePostClientContentError(PostClientContentRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemDynamicContentNotificationBus, OnPostClientContentRequestError, job->error); } // CloudGemDynamicContentClientComponent void CloudGemDynamicContentClientComponent::Init() { m_defaultResponseHandler = AZStd::make_shared(); CloudGemDynamicContent::ServiceAPI::Configure(); } void CloudGemDynamicContentClientComponent::Activate() { CloudGemDynamicContentRequestBus::Handler::BusConnect(m_entity->GetId()); } void CloudGemDynamicContentClientComponent::Deactivate() { CloudGemDynamicContentRequestBus::Handler::BusDisconnect(); } void CloudGemDynamicContentClientComponent::GetServiceStatus(CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job GetServiceStatusRequestJob* requestJob = GetServiceStatusRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](GetServiceStatusRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandleGetServiceStatusSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](GetServiceStatusRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandleGetServiceStatusError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemDynamicContentClientComponent::GetPortalInfo(const AZStd::string& file_name, CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job GetPortalInfoRequestJob* requestJob = GetPortalInfoRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](GetPortalInfoRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandleGetPortalInfoSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](GetPortalInfoRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandleGetPortalInfoError(failedJob, entityId); } } ); requestJob->parameters.file_name = file_name; requestJob->Start(); } void CloudGemDynamicContentClientComponent::DeletePortalInfo(const AZStd::string& file_name, CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job DeletePortalInfoRequestJob* requestJob = DeletePortalInfoRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](DeletePortalInfoRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandleDeletePortalInfoSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](DeletePortalInfoRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandleDeletePortalInfoError(failedJob, entityId); } } ); requestJob->parameters.file_name = file_name; requestJob->Start(); } void CloudGemDynamicContentClientComponent::GetPortalContent(CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job GetPortalContentRequestJob* requestJob = GetPortalContentRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](GetPortalContentRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandleGetPortalContentSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](GetPortalContentRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandleGetPortalContentError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemDynamicContentClientComponent::DeletePortalContent(CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job DeletePortalContentRequestJob* requestJob = DeletePortalContentRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](DeletePortalContentRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandleDeletePortalContentSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](DeletePortalContentRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandleDeletePortalContentError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemDynamicContentClientComponent::PostPortalContent(const PortalFileRequestList& request_content, CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job PostPortalContentRequestJob* requestJob = PostPortalContentRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](PostPortalContentRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandlePostPortalContentSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](PostPortalContentRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandlePostPortalContentError(failedJob, entityId); } } ); requestJob->parameters.request_content = request_content; requestJob->Start(); } void CloudGemDynamicContentClientComponent::PostClientContent(const RequestData& request_content, CloudGemDynamicContentResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemDynamicContentResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job PostClientContentRequestJob* requestJob = PostClientContentRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](PostClientContentRequestJob* successJob) { // handle success CloudGemDynamicContentResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandlePostClientContentSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](PostClientContentRequestJob* failedJob) { // handle error CloudGemDynamicContentResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandlePostClientContentError(failedJob, entityId); } } ); requestJob->parameters.request_content = request_content; requestJob->Start(); } bool ServiceStatus::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "status") == 0) return reader.Accept(status); return reader.Ignore(); } void ServiceStatus::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_ServiceStatus") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("status", BehaviorValueProperty(&ServiceStatus::status)) ; } } bool PortalFileInfo::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "FileName") == 0) return reader.Accept(FileName); if (strcmp(key, "StagingStatus") == 0) return reader.Accept(StagingStatus); if (strcmp(key, "StagingStart") == 0) return reader.Accept(StagingStart); if (strcmp(key, "StagingEnd") == 0) return reader.Accept(StagingEnd); if (strcmp(key, "Parent") == 0) return reader.Accept(Parent); return reader.Ignore(); } void PortalFileInfo::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_PortalFileInfo") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("FileName", BehaviorValueProperty(&PortalFileInfo::FileName)) ->Property("StagingStatus", BehaviorValueProperty(&PortalFileInfo::StagingStatus)) ->Property("StagingStart", BehaviorValueProperty(&PortalFileInfo::StagingStart)) ->Property("StagingEnd", BehaviorValueProperty(&PortalFileInfo::StagingEnd)) ->Property("Parent", BehaviorValueProperty(&PortalFileInfo::Parent)) ; } } bool PortalFileRequest::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "FileName") == 0) return reader.Accept(FileName); if (strcmp(key, "StagingStatus") == 0) return reader.Accept(StagingStatus); if (strcmp(key, "StagingStart") == 0) return reader.Accept(StagingStart); if (strcmp(key, "StagingEnd") == 0) return reader.Accept(StagingEnd); return reader.Ignore(); } void PortalFileRequest::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_PortalFileRequest") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("FileName", BehaviorValueProperty(&PortalFileRequest::FileName)) ->Property("StagingStatus", BehaviorValueProperty(&PortalFileRequest::StagingStatus)) ->Property("StagingStart", BehaviorValueProperty(&PortalFileRequest::StagingStart)) ->Property("StagingEnd", BehaviorValueProperty(&PortalFileRequest::StagingEnd)) ; } } bool PortalFileRequestList::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "FileList") == 0) return reader.Accept(FileList); return reader.Ignore(); } void PortalFileRequestList::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_PortalFileRequestList") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("FileList", BehaviorValueProperty(&PortalFileRequestList::FileList)) ; } } bool PortalFileListResults::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "results") == 0) return reader.Accept(results); return reader.Ignore(); } void PortalFileListResults::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_PortalFileListResults") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("results", BehaviorValueProperty(&PortalFileListResults::results)) ; } } bool RequestDataItem::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "FileName") == 0) return reader.Accept(FileName); if (strcmp(key, "FileVersion") == 0) return reader.Accept(FileVersion); return reader.Ignore(); } void RequestDataItem::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_RequestDataItem") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("FileName", BehaviorValueProperty(&RequestDataItem::FileName)) ->Property("FileVersion", BehaviorValueProperty(&RequestDataItem::FileVersion)) ; } } bool RequestData::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "FileList") == 0) return reader.Accept(FileList); if (strcmp(key, "ManifestData") == 0) return reader.Accept(ManifestData); return reader.Ignore(); } void RequestData::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_RequestData") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("FileList", BehaviorValueProperty(&RequestData::FileList)) ->Property("ManifestData", BehaviorValueProperty(&RequestData::ManifestData)) ; } } bool FileRequestResult::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "FileName") == 0) return reader.Accept(FileName); if (strcmp(key, "FileStatus") == 0) return reader.Accept(FileStatus); if (strcmp(key, "PresignedURL") == 0) return reader.Accept(PresignedURL); if (strcmp(key, "Signature") == 0) return reader.Accept(Signature); if (strcmp(key, "Size") == 0) return reader.Accept(Size); if (strcmp(key, "Hash") == 0) return reader.Accept(Hash); return reader.Ignore(); } void FileRequestResult::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_FileRequestResult") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("FileName", BehaviorValueProperty(&FileRequestResult::FileName)) ->Property("FileStatus", BehaviorValueProperty(&FileRequestResult::FileStatus)) ->Property("PresignedURL", BehaviorValueProperty(&FileRequestResult::PresignedURL)) ->Property("Signature", BehaviorValueProperty(&FileRequestResult::Signature)) ->Property("Size", BehaviorValueProperty(&FileRequestResult::Size)) ->Property("Hash", BehaviorValueProperty(&FileRequestResult::Hash)) ; } } bool FileRequestResults::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "ResultList") == 0) return reader.Accept(ResultList); return reader.Ignore(); } void FileRequestResults::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemDynamicContent_FileRequestResults") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("ResultList", BehaviorValueProperty(&FileRequestResults::ResultList)) ; } } } }