3
0

HttpRequestorSystemComponent.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "HttpRequestManager.h"
  10. #include <AzCore/Component/Component.h>
  11. #include <HttpRequestor/HttpRequestorBus.h>
  12. #include <aws/core/client/ClientConfiguration.h>
  13. namespace HttpRequestor
  14. {
  15. class HttpRequestorSystemComponent
  16. : public AZ::Component
  17. , protected HttpRequestorRequestBus::Handler
  18. {
  19. public:
  20. AZ_COMPONENT(HttpRequestorSystemComponent, "{CF29468F-1F67-497F-B4FF-C0F123584864}");
  21. static void Reflect(AZ::ReflectContext* context);
  22. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  23. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  24. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  25. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  26. protected:
  27. ////////////////////////////////////////////////////////////////////////
  28. // HttpRequestorRequestBus interface implementation
  29. ////////////////////////////////////////////////////////////////////////
  30. void AddRequest(const AZStd::string& URI, Aws::Http::HttpMethod method, const Callback& callback) override;
  31. void AddRequestWithClientConfiguration(
  32. const AZStd::string& URI,
  33. Aws::Http::HttpMethod method,
  34. const Callback& callback,
  35. const Aws::Client::ClientConfiguration clientConfiguration) override;
  36. void AddRequestWithHeaders(
  37. const AZStd::string& URI, Aws::Http::HttpMethod method, const Headers& headers, const Callback& callback) override;
  38. void AddRequestWithHeadersAndClientConfiguration(
  39. const AZStd::string& URI,
  40. Aws::Http::HttpMethod method,
  41. const Headers& headers,
  42. const Callback& callback,
  43. const Aws::Client::ClientConfiguration clientConfiguration) override;
  44. void AddRequestWithHeadersAndBody(
  45. const AZStd::string& URI,
  46. Aws::Http::HttpMethod method,
  47. const Headers& headers,
  48. const AZStd::string& body,
  49. const Callback& callback) override;
  50. void AddRequestWithHeadersBodyAndClientConfiguration(
  51. const AZStd::string& URI,
  52. Aws::Http::HttpMethod method,
  53. const Headers& headers,
  54. const AZStd::string& body,
  55. const Callback& callback,
  56. const Aws::Client::ClientConfiguration clientConfiguration) override;
  57. void AddTextRequest(const AZStd::string& URI, Aws::Http::HttpMethod method, const TextCallback& callback) override;
  58. void AddTextRequestWithClientConfiguration(
  59. const AZStd::string& URI,
  60. Aws::Http::HttpMethod method,
  61. const TextCallback& callback,
  62. const Aws::Client::ClientConfiguration clientConfiguration) override;
  63. void AddTextRequestWithHeaders(
  64. const AZStd::string& URI, Aws::Http::HttpMethod method, const Headers& headers, const TextCallback& callback) override;
  65. void AddTextRequestWithHeadersAndClientConfiguration(
  66. const AZStd::string& URI,
  67. Aws::Http::HttpMethod method,
  68. const Headers& headers,
  69. const TextCallback& callback,
  70. const Aws::Client::ClientConfiguration clientConfiguration = Aws::Client::ClientConfiguration()) override;
  71. void AddTextRequestWithHeadersAndBody(
  72. const AZStd::string& URI,
  73. Aws::Http::HttpMethod method,
  74. const Headers& headers,
  75. const AZStd::string& body,
  76. const TextCallback& callback) override;
  77. void AddTextRequestWithHeadersBodyAndClientConfiguration(
  78. const AZStd::string& URI,
  79. Aws::Http::HttpMethod method,
  80. const Headers& headers,
  81. const AZStd::string& body,
  82. const TextCallback& callback,
  83. const Aws::Client::ClientConfiguration clientConfiguration = Aws::Client::ClientConfiguration()) override;
  84. AZStd::chrono::milliseconds GetLastRoundTripTime() const override;
  85. ////////////////////////////////////////////////////////////////////////
  86. // AZ::Component interface implementation
  87. void Init() override;
  88. void Activate() override;
  89. void Deactivate() override;
  90. ////////////////////////////////////////////////////////////////////////
  91. private:
  92. ManagerPtr m_httpManager;
  93. };
  94. }