From bce3320fb50bb6d9cf95468da66a550d7701aec6 Mon Sep 17 00:00:00 2001
From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
Date: Wed, 22 Dec 2021 15:18:54 -0800
Subject: [PATCH] Remove unused files from Gems/AWSCore
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
---
.../Disabled/HttpClientComponent_white.png | 3 -
.../Icons/Components/HttpClientComponent.png | 3 -
.../Viewport/HttpClientComponent.png | 3 -
.../Editor/Translation/scriptcanvas_en_us.ts | 171 ------------------
.../Include/Framework/HttpClientComponent.h | 69 -------
.../Code/Include/Framework/JobExecuter.h | 66 -------
.../Include/Framework/MultipartFormData.h | 76 --------
.../Source/Framework/MultipartFormData.cpp | 123 -------------
Gems/AWSCore/Code/awscore_files.cmake | 4 -
9 files changed, 518 deletions(-)
delete mode 100644 Assets/Editor/Icons/Components/Disabled/HttpClientComponent_white.png
delete mode 100644 Assets/Editor/Icons/Components/HttpClientComponent.png
delete mode 100644 Assets/Editor/Icons/Components/Viewport/HttpClientComponent.png
delete mode 100644 Gems/AWSCore/Code/Include/Framework/HttpClientComponent.h
delete mode 100644 Gems/AWSCore/Code/Include/Framework/JobExecuter.h
delete mode 100644 Gems/AWSCore/Code/Include/Framework/MultipartFormData.h
delete mode 100644 Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp
diff --git a/Assets/Editor/Icons/Components/Disabled/HttpClientComponent_white.png b/Assets/Editor/Icons/Components/Disabled/HttpClientComponent_white.png
deleted file mode 100644
index 12b5be2ccc..0000000000
--- a/Assets/Editor/Icons/Components/Disabled/HttpClientComponent_white.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bfc2ef8c6dbf2fba078e27e4e94384099e090468e679327dd826a5cbf22b04ed
-size 1019
diff --git a/Assets/Editor/Icons/Components/HttpClientComponent.png b/Assets/Editor/Icons/Components/HttpClientComponent.png
deleted file mode 100644
index 7a619a5a59..0000000000
--- a/Assets/Editor/Icons/Components/HttpClientComponent.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:708b12d41229afab78e0f7d59097ae3de855fea8525a920c5c214fc0ce79f1bd
-size 1209
diff --git a/Assets/Editor/Icons/Components/Viewport/HttpClientComponent.png b/Assets/Editor/Icons/Components/Viewport/HttpClientComponent.png
deleted file mode 100644
index 16e4917180..0000000000
--- a/Assets/Editor/Icons/Components/Viewport/HttpClientComponent.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:fab63af9b50790dca25330058e70517987ea8bf11c00f9353dd951ebdbd1dbe5
-size 5008
diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts
index 6d436b7caf..bfbd8cf316 100644
--- a/Assets/Editor/Translation/scriptcanvas_en_us.ts
+++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts
@@ -49513,106 +49513,6 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
-
- Handler: HttpClientComponentNotificationBus
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_NAME
- HttpClientComponentNotificationBus
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_CATEGORY
- Networking
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_NAME
- Class/Bus: HttpClientComponentNotificationBus Event/Method: OnHttpRequestSuccess
- OnHttpRequestSuccess
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_CATEGORY
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_OUT_NAME
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_OUT_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_IN_NAME
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_IN_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_OUTPUT0_NAME
- Simple Type: Number C++ Type: int
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_OUTPUT0_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_OUTPUT1_NAME
- Simple Type: String C++ Type: AZStd::basic_string<char, AZStd::char_traits<char>, allocator>
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTSUCCESS_OUTPUT1_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_NAME
- Class/Bus: HttpClientComponentNotificationBus Event/Method: OnHttpRequestFailure
- OnHttpRequestFailure
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_CATEGORY
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_OUT_NAME
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_OUT_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_IN_NAME
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_IN_TOOLTIP
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_OUTPUT0_NAME
- Simple Type: Number C++ Type: int
-
-
-
- HANDLER_HTTPCLIENTCOMPONENTNOTIFICATIONBUS_ONHTTPREQUESTFAILURE_OUTPUT0_TOOLTIP
-
-
-
Handler: InputEventNotificationBus
@@ -79046,77 +78946,6 @@ The element is removed from its current parent and added as a child of the new p
-
- EBus: HttpClientComponentRequestBus
-
- HTTPCLIENTCOMPONENTREQUESTBUS_NAME
- HttpClientComponentRequestBus
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_TOOLTIP
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_CATEGORY
- Networking
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_NAME
- Class/Bus: HttpClientComponentRequestBus Event/Method: MakeHttpRequest
- MakeHttpRequest
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_TOOLTIP
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_CATEGORY
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_OUT_NAME
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_OUT_TOOLTIP
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_IN_NAME
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_IN_TOOLTIP
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_PARAM0_NAME
- Simple Type: String C++ Type: AZStd::basic_string<char, AZStd::char_traits<char>, allocator>
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_PARAM0_TOOLTIP
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_PARAM1_NAME
- Simple Type: String C++ Type: AZStd::basic_string<char, AZStd::char_traits<char>, allocator>
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_PARAM1_TOOLTIP
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_PARAM2_NAME
- Simple Type: String C++ Type: AZStd::basic_string<char, AZStd::char_traits<char>, allocator>
-
-
-
- HTTPCLIENTCOMPONENTREQUESTBUS_MAKEHTTPREQUEST_PARAM2_TOOLTIP
-
-
-
Handler: AWSBehaviorURLNotificationsBus
diff --git a/Gems/AWSCore/Code/Include/Framework/HttpClientComponent.h b/Gems/AWSCore/Code/Include/Framework/HttpClientComponent.h
deleted file mode 100644
index 48b59cc56a..0000000000
--- a/Gems/AWSCore/Code/Include/Framework/HttpClientComponent.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-
-#include
-
-
-namespace AWSCore
-{
- /////////////////////////////////////////////
- // EBus Definitions
- /////////////////////////////////////////////
- class HttpClientComponentRequests
- : public AZ::ComponentBus
- {
- public:
- virtual ~HttpClientComponentRequests() {}
- virtual void MakeHttpRequest(AZStd::string url, AZStd::string method, AZStd::string jsonBody) {}
- };
-
- using HttpClientComponentRequestBus = AZ::EBus;
-
- class HttpClientComponentNotifications
- : public AZ::ComponentBus
- {
- public:
- ~HttpClientComponentNotifications() override = default;
- virtual void OnHttpRequestSuccess(int responseCode, AZStd::string responseBody) {}
- virtual void OnHttpRequestFailure(int responseCode) {}
- };
-
- using HttpClientComponentNotificationBus = AZ::EBus;
-
- /////////////////////////////////////////////
- // Entity Component
- /////////////////////////////////////////////
- class HttpClientComponent
- : public AZ::Component
- , public HttpClientComponentRequestBus::Handler
- {
- public:
- AZ_COMPONENT(HttpClientComponent, "{23ECDBDF-129A-4670-B9B4-1E0B541ACD61}");
- ~HttpClientComponent() override = default;
-
- void Init() override;
- void Activate() override;
- void Deactivate() override;
-
- void MakeHttpRequest(AZStd::string, AZStd::string, AZStd::string) override;
-
- static void Reflect(AZ::ReflectContext*);
- };
-
-} // namespace AWSCore
diff --git a/Gems/AWSCore/Code/Include/Framework/JobExecuter.h b/Gems/AWSCore/Code/Include/Framework/JobExecuter.h
deleted file mode 100644
index 899644ed61..0000000000
--- a/Gems/AWSCore/Code/Include/Framework/JobExecuter.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-#include
-#include
-
-#include
-
-namespace AWSCore
-{
-
- /// AZ:Job type used by the JobExecuter. It is used call the callback
- /// function provided by the AWS SDK.
- using ExecuterJob = AZ::JobFunction>;
-
- /// This class provides a simple alternative to using the the AwsRequestJob,
- /// AwsApiClientJob, or AwsApiJob classes. Those classes provide configuration
- /// management and more abstracted usage patterns. With JobExecutor you need
- /// to do all the configuration management and work directly with the AWS API.
- ///
- /// An AWS API async executer that uses the AZ::Job system to make AWS service calls.
- /// To use, set the Aws::Client::ClientConfiguration executor field so it points to
- /// an instance of this class, then use that client configuration object when creating
- /// AWS service client objects. This will cause the Async APIs on the AWS service
- /// client object to use the AZ::Job system to execute the request.
- class JobExecuter
- : public Aws::Utils::Threading::Executor
- {
-
- public:
- /// Initialize a JobExecuter object.
- ///
- /// \param context - The JobContext that will be used to execute the jobs created
- /// by the JobExecuter.
- ///
- /// By default the global JobContext is used. However, the AWS SDK currently
- /// only supports blocking calls, so, to avoid impacting other jobs, it is
- /// recommended that you create a JobContext with a JobManager dedicated to
- /// dedicated to processing these jobs. This context can also be used with
- /// AwsApiCore::HttpJob.
- JobExecuter(AZ::JobContext* context)
- : m_context{ context }
- {
- }
-
- protected:
- AZ::JobContext* m_context;
-
- /// Called by the AWS SDK to queue a callback for execution.
- bool SubmitToThread(std::function&& callback) override
- {
- ExecuterJob* job = aznew ExecuterJob(callback, true, m_context);
- job->Start();
- }
-
- };
-
-} // namespace AWCore
-
diff --git a/Gems/AWSCore/Code/Include/Framework/MultipartFormData.h b/Gems/AWSCore/Code/Include/Framework/MultipartFormData.h
deleted file mode 100644
index 153cbac644..0000000000
--- a/Gems/AWSCore/Code/Include/Framework/MultipartFormData.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-#include
-#include
-#include
-
-namespace AWSCore
-{
- /// Class for generating multi-part form data capable of sending files via HTTP POST.
- /// The current implementation writes the entire contents of the file to an output buffer in a single operation,
- /// i.e. there is no streaming for large files.
- /// A stream-based solution would require better bridging of types between CGF and AWS.
- class MultipartFormData
- {
- public:
- struct ComposeResult
- {
- AZStd::string m_content; // Use for the request body
- AZStd::string m_contentLength; // Use for the 'Content-Length' HTTP header field
- AZStd::string m_contentType; // Use for the 'Content-Type' HTTP header field
- };
-
- public:
- AZ_CLASS_ALLOCATOR(MultipartFormData, AZ::SystemAllocator, 0);
-
- /// Add a field/value pair to the form
- void AddField(AZStd::string name, AZStd::string value);
-
- /// Add a file's contents to the form
- void AddFile(AZStd::string fieldName, AZStd::string fileName, const char* path);
- void AddFileBytes(AZStd::string fieldName, AZStd::string fileName, const void* bytes, size_t length);
-
- /// Set a custom boundary delimiter to use in the form. This is optional; a random one will be generated normally.
- void SetCustomBoundary(AZStd::string boundary);
-
- /// Compose the form's contents and returns those contents along with metadata.
- ComposeResult ComposeForm();
-
- private:
- struct Field
- {
- AZStd::string m_fieldName;
- AZStd::string m_value;
- };
-
- struct FileField
- {
- AZStd::string m_fieldName;
- AZStd::string m_fileName;
- AZStd::vector m_fileData;
- };
-
- using Fields = AZStd::vector;
- using FileFields = AZStd::vector;
-
- private:
- void Prepare();
- size_t EstimateBodySize() const;
-
- private:
- AZStd::string m_boundary;
- AZStd::string m_separator;
- AZStd::string m_composedBody;
- Fields m_fields;
- FileFields m_fileFields;
- };
-
-} // namespace AWSCore
diff --git a/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp b/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp
deleted file mode 100644
index 47059ac156..0000000000
--- a/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#include
-#include
-
-namespace AWSCore
-{
- namespace Detail
- {
- namespace
- {
- const char FIELD_HEADER_FMT[] = "--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n";
- const char FILE_HEADER_FMT[] = "--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n\r\n";
- const char FOOTER_FMT[] = "--%s--\r\n";
- const char ENTRY_SEPARATOR[] = "\r\n";
- }
- }
-
- void MultipartFormData::AddField(AZStd::string name, AZStd::string value)
- {
- m_fields.emplace_back(Field{ std::move(name), std::move(value) });
- }
-
- void MultipartFormData::AddFile(AZStd::string fieldName, AZStd::string fileName, const char* path)
- {
- AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetDirectInstance();
-
- AZ::IO::HandleType fileHandle;
-
- if (fileIO->Open(path, AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, fileHandle)) {
- m_fileFields.emplace_back(FileField{ std::move(fieldName), std::move(fileName) , AZStd::vector{} });
- auto destFileBuffer = &m_fileFields.back().m_fileData;
- AZ::u64 size;
- if (fileIO->Size(path, size) && size > 0) {
- destFileBuffer->resize(size);
- fileIO->Read(fileHandle, &destFileBuffer->at(0), destFileBuffer->size());
- }
- }
- fileIO->Close(fileHandle);
- }
-
- void MultipartFormData::AddFileBytes(AZStd::string fieldName, AZStd::string fileName, const void* bytes, size_t length)
- {
- m_fileFields.emplace_back(FileField{ std::move(fieldName), std::move(fileName) , AZStd::vector{} });
- m_fileFields.back().m_fileData.reserve(length);
- m_fileFields.back().m_fileData.assign(static_cast(bytes), static_cast(bytes) + length);
- }
-
- void MultipartFormData::SetCustomBoundary(AZStd::string boundary)
- {
- m_boundary = boundary;
- }
-
- void MultipartFormData::Prepare()
- {
- if (m_boundary.empty())
- {
- char buffer[33];
- AZ::Uuid::CreateRandom().ToString(buffer, sizeof(buffer), false, false);
- m_boundary = buffer;
- }
- }
-
- size_t MultipartFormData::EstimateBodySize() const
- {
- // Estimate the size of the final string as best we can to avoid unnecessary copies
- const size_t boundarySize = m_boundary.length();
- const size_t individualFieldBaseSize = boundarySize + sizeof(Detail::FIELD_HEADER_FMT) + sizeof(Detail::ENTRY_SEPARATOR);
- const size_t individualFileBaseSize = boundarySize + sizeof(Detail::FILE_HEADER_FMT) + sizeof(Detail::ENTRY_SEPARATOR);
- size_t estimatedSize = sizeof(Detail::FOOTER_FMT) + boundarySize;
-
- for (const auto& field : m_fields)
- {
- estimatedSize += individualFieldBaseSize + field.m_fieldName.length() + field.m_value.length();
- }
-
- for (const auto& fileField : m_fileFields)
- {
- estimatedSize += individualFileBaseSize + fileField.m_fieldName.length() + fileField.m_fileName.length() + fileField.m_fileData.size();
- }
-
- return estimatedSize;
- }
-
- MultipartFormData::ComposeResult MultipartFormData::ComposeForm()
- {
- ComposeResult result;
- Prepare();
-
- // Build the form body
- result.m_content.reserve(EstimateBodySize());
-
- for (const auto& field : m_fields)
- {
- result.m_content.append(AZStd::string::format(Detail::FIELD_HEADER_FMT, m_boundary.c_str(), field.m_fieldName.c_str()));
- result.m_content.append(field.m_value);
- result.m_content.append(Detail::ENTRY_SEPARATOR);
- }
-
- for (const auto& fileField : m_fileFields)
- {
- result.m_content.append(AZStd::string::format(Detail::FILE_HEADER_FMT, m_boundary.c_str(), fileField.m_fieldName.c_str(), fileField.m_fileName.c_str()));
- result.m_content.append(fileField.m_fileData.begin(), fileField.m_fileData.end());
- result.m_content.append(Detail::ENTRY_SEPARATOR);
- }
-
- result.m_content.append(AZStd::string::format(Detail::FOOTER_FMT, m_boundary.c_str()));
-
- // Populate the metadata
- result.m_contentLength = AZStd::string::format("%zu", result.m_content.length());
- result.m_contentType = AZStd::string::format("multipart/form-data; boundary=%s", m_boundary.c_str());
-
- return result;
- }
-
-
-} // namespace AWSCore
diff --git a/Gems/AWSCore/Code/awscore_files.cmake b/Gems/AWSCore/Code/awscore_files.cmake
index 9abc162f8a..c59802119c 100644
--- a/Gems/AWSCore/Code/awscore_files.cmake
+++ b/Gems/AWSCore/Code/awscore_files.cmake
@@ -16,13 +16,10 @@ set(FILES
Include/Framework/AWSApiRequestJob.h
Include/Framework/AWSApiRequestJobConfig.h
Include/Framework/Error.h
- Include/Framework/HttpClientComponent.h
Include/Framework/HttpRequestJob.h
Include/Framework/HttpRequestJobConfig.h
- Include/Framework/JobExecuter.h
Include/Framework/JsonObjectHandler.h
Include/Framework/JsonWriter.h
- Include/Framework/MultipartFormData.h
Include/Framework/RequestBuilder.h
Include/Framework/ServiceClientJob.h
Include/Framework/ServiceClientJobConfig.h
@@ -61,7 +58,6 @@ set(FILES
Source/Framework/HttpRequestJob.cpp
Source/Framework/HttpRequestJobConfig.cpp
Source/Framework/JsonObjectHandler.cpp
- Source/Framework/MultipartFormData.cpp
Source/Framework/RequestBuilder.cpp
Source/Framework/ServiceJob.cpp
Source/Framework/ServiceJobConfig.cpp