AWSCoreBus.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 <AzCore/std/string/string.h>
  10. #include <AzCore/EBus/EBus.h>
  11. namespace AZ
  12. {
  13. class JobContext;
  14. }
  15. namespace AWSCore
  16. {
  17. class AwsApiJobConfig;
  18. }
  19. namespace AWSCore
  20. {
  21. static constexpr AZStd::string_view AWSMenuIdentifier = "o3de.menu.editor.aws";
  22. static constexpr AZStd::string_view EditorMainWindowMenuBarIdentifier = "o3de.menubar.editor.mainwindow";
  23. static constexpr AZStd::string_view HelpMenuIdentifier = "o3de.menu.editor.help";
  24. static constexpr AZStd::string_view EditorMainWindowActionContextIdentifier = "o3de.context.editor.mainwindow";
  25. static constexpr AZStd::string_view ActionContext = "o3de.context.editor.mainwindow";
  26. static constexpr const char AWS_MENU_TEXT[] = "&AWS";
  27. //! AWSCore request interface
  28. class AWSCoreRequests
  29. : public AZ::EBusTraits
  30. {
  31. public:
  32. //! Get the job context to make an AWS call.
  33. virtual AZ::JobContext* GetDefaultJobContext() = 0;
  34. // Returns the default client configuration setting to use as a starting point in AWS requests
  35. virtual AwsApiJobConfig* GetDefaultConfig() = 0;
  36. // Allow multiple threads to concurrently make requests
  37. using MutexType = AZStd::recursive_mutex;
  38. //////////////////////////////////////////////////////////////////////////
  39. // EBusTraits overrides
  40. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  41. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  42. //////////////////////////////////////////////////////////////////////////
  43. };
  44. using AWSCoreRequestBus = AZ::EBus<AWSCoreRequests>;
  45. //! AWSCoreEditor request interface
  46. //! Used to check whether AWS feature gems activated
  47. class AWSCoreEditorRequests
  48. : public AZ::EBusTraits
  49. {
  50. public:
  51. virtual void CreateSubMenu(const AZStd::string& parentMenuIdentifier, const char* const menuDetails[], int sort) = 0;
  52. virtual void AddExternalLinkAction(const AZStd::string& menuIdentifier, const char* const actionDetails[], int sort) = 0;
  53. //////////////////////////////////////////////////////////////////////////
  54. // EBusTraits overrides
  55. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  56. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  57. //////////////////////////////////////////////////////////////////////////
  58. };
  59. using AWSCoreEditorRequestBus = AZ::EBus<AWSCoreEditorRequests>;
  60. // Bus used to send notifications about AWSCore initialization
  61. class AWSCoreNotifications
  62. : public AZ::EBusTraits
  63. {
  64. public:
  65. //////////////////////////////////////////////////////////////////////////
  66. // EBusTraits overrides
  67. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
  68. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  69. //////////////////////////////////////////////////////////////////////////
  70. //! Sent when AWSCore has initialized the NativeSDK.
  71. //! SDK Shutdown on deactivate of AWSCoreSystemComponent.
  72. //! Dependent gems expected to shutdown/reset AWS NativeSDK service clients on corresponding system component reset.
  73. virtual void OnSDKInitialized() = 0;
  74. //! Sent when AWSCore is shutting down AWSNativeSDK
  75. virtual void OnSDKShutdownStarted() = 0;
  76. };
  77. using AWSCoreNotificationsBus = AZ::EBus<AWSCoreNotifications>;
  78. } // namespace AWSCore