Move the header files in the AWS Core gem based on the latest gem structure guideline (#5178)

Signed-off-by: Junbo Liang <68558268+junbo75@users.noreply.github.com>
This commit is contained in:
Junbo Liang
2021-12-01 14:28:27 -08:00
committed by GitHub
parent 028f3e05db
commit a486d1a8ad
58 changed files with 69 additions and 67 deletions
@@ -0,0 +1,73 @@
/*
* 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 <AzCore/EBus/EBus.h>
#include <AzCore/std/string/string.h>
namespace AWSCore
{
using DynamoDBAttributeValueMap = AZStd::unordered_map<AZStd::string, AZStd::string>;
//! AWS Script Behavior notifications for ScriptCanvas behaviors that interact with AWS DynamoDB
class AWSScriptBehaviorDynamoDBNotifications
: public AZ::EBusTraits
{
public:
///////////////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Called when a successful script behavior dynamodb get item call has occurred
virtual void OnGetItemSuccess(const DynamoDBAttributeValueMap& resultBody) = 0;
//! Called when script behavior dynamodb get item call has failed
virtual void OnGetItemError(const AZStd::string& errorBody) = 0;
};
using AWSScriptBehaviorDynamoDBNotificationBus = AZ::EBus<AWSScriptBehaviorDynamoDBNotifications>;
class AWSScriptBehaviorDynamoDBNotificationBusHandler
: public AWSScriptBehaviorDynamoDBNotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
AZ_EBUS_BEHAVIOR_BINDER(
AWSScriptBehaviorDynamoDBNotificationBusHandler, "{476BEB41-5C5E-4C18-9801-170309E658BE}",
AZ::SystemAllocator, OnGetItemSuccess, OnGetItemError);
void OnGetItemSuccess(const DynamoDBAttributeValueMap& resultBody) override
{
Call(FN_OnGetItemSuccess, resultBody);
}
void OnGetItemError(const AZStd::string& errorBody) override
{
Call(FN_OnGetItemError, errorBody);
}
};
class AWSScriptBehaviorDynamoDB
{
public:
AZ_RTTI(AWSScriptBehaviorDynamoDB, "{569E74F6-1268-4199-9653-A3B603FC9F4F}");
AWSScriptBehaviorDynamoDB() = default;
virtual ~AWSScriptBehaviorDynamoDB() = default;
static void Reflect(AZ::ReflectContext* context);
static void GetItem(const AZStd::string& tableResourceKey, const DynamoDBAttributeValueMap& keyMap);
static void GetItemRaw(const AZStd::string& table, const DynamoDBAttributeValueMap& keyMap, const AZStd::string& region);
private:
static bool ValidateGetItemRequest(
const AZStd::string& table, const DynamoDBAttributeValueMap& keyMap, const AZStd::string& region);
};
} // namespace AWSCore
@@ -0,0 +1,70 @@
/*
* 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 <AzCore/EBus/EBus.h>
#include <AzCore/std/string/string.h>
namespace AWSCore
{
//! AWS Script Behavior notifications for ScriptCanvas behaviors that interact with AWS Lambda
class AWSScriptBehaviorLambdaNotifications
: public AZ::EBusTraits
{
public:
///////////////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Called when a successful script behavior lambda invoke call has occurred
virtual void OnInvokeSuccess(const AZStd::string& resultBody) = 0;
//! Called when script behavior lambda invoke call has failed
virtual void OnInvokeError(const AZStd::string& errorBody) = 0;
};
using AWSScriptBehaviorLambdaNotificationBus = AZ::EBus<AWSScriptBehaviorLambdaNotifications>;
class AWSScriptBehaviorLambdaNotificationBusHandler
: public AWSScriptBehaviorLambdaNotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
AZ_EBUS_BEHAVIOR_BINDER(AWSScriptBehaviorLambdaNotificationBusHandler, "{533E8AC9-CBD7-4718-9FBB-622C5E70045F}",
AZ::SystemAllocator, OnInvokeSuccess, OnInvokeError);
void OnInvokeSuccess(const AZStd::string& resultBody) override
{
Call(FN_OnInvokeSuccess, resultBody);
}
void OnInvokeError(const AZStd::string& errorBody) override
{
Call(FN_OnInvokeError, errorBody);
}
};
class AWSScriptBehaviorLambda
{
public:
AZ_RTTI(AWSScriptBehaviorLambda, "{9E71534D-34B3-4723-B180-2552513DDA3D}");
AWSScriptBehaviorLambda() = default;
virtual ~AWSScriptBehaviorLambda() = default;
static void Reflect(AZ::ReflectContext* context);
static void Invoke(const AZStd::string& functionResourceKey, const AZStd::string& payload);
static void InvokeRaw(const AZStd::string& functionName, const AZStd::string& payload, const AZStd::string& region);
private:
static bool ValidateInvokeRequest(const AZStd::string& functionName, const AZStd::string& region);
};
} // namespace AWSCore
@@ -0,0 +1,103 @@
/*
* 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 <AzCore/EBus/EBus.h>
#include <AzCore/std/string/string.h>
namespace AWSCore
{
//! AWS Script Behavior notifications for ScriptCanvas behaviors that interact with AWS S3
class AWSScriptBehaviorS3Notifications
: public AZ::EBusTraits
{
public:
///////////////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Called when a successful script behavior s3 head object call has occurred
virtual void OnHeadObjectSuccess(const AZStd::string& resultBody) = 0;
//! Called when script behavior s3 head object call has failed
virtual void OnHeadObjectError(const AZStd::string& errorBody) = 0;
//! Called when a successful script behavior s3 get object call has occurred
virtual void OnGetObjectSuccess(const AZStd::string& resultBody) = 0;
//! Called when script behavior s3 get object call has failed
virtual void OnGetObjectError(const AZStd::string& errorBody) = 0;
};
using AWSScriptBehaviorS3NotificationBus = AZ::EBus<AWSScriptBehaviorS3Notifications>;
class AWSScriptBehaviorS3NotificationBusHandler
: public AWSScriptBehaviorS3NotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
AZ_EBUS_BEHAVIOR_BINDER(AWSScriptBehaviorS3NotificationBusHandler, "{CB7E8710-F256-48A6-BC03-D3E3001AEB1E}",
AZ::SystemAllocator, OnHeadObjectSuccess, OnHeadObjectError, OnGetObjectSuccess, OnGetObjectError);
void OnHeadObjectSuccess(const AZStd::string& resultBody) override
{
Call(FN_OnHeadObjectSuccess, resultBody);
}
void OnHeadObjectError(const AZStd::string& errorBody) override
{
Call(FN_OnHeadObjectError, errorBody);
}
void OnGetObjectSuccess(const AZStd::string& resultBody) override
{
Call(FN_OnGetObjectSuccess, resultBody);
}
void OnGetObjectError(const AZStd::string& errorBody) override
{
Call(FN_OnGetObjectError, errorBody);
}
};
class AWSScriptBehaviorS3
{
static constexpr const char AWSScriptBehaviorS3Name[] = "AWSScriptBehaviorS3";
static constexpr const char OutputFileIsEmptyErrorMessage[] = "Request validation failed, output file is empty.";
static constexpr const char OutputFileFailedToResolveErrorMessage[] = "Request validation failed, cannot resolve the output file path.";
static constexpr const char OutputFileIsDirectoryErrorMessage[] = "Request validation failed, output file is a directory.";
static constexpr const char OutputFileDirectoryNotExistErrorMessage[] = "Request validation failed, output file directory doesn't exist.";
static constexpr const char OutputFileIsReadOnlyErrorMessage[] = "Request validation failed, output file is read-only.";
static constexpr const char BucketNameIsEmptyErrorMessage[] = "Request validation failed, bucket name is empty";
static constexpr const char ObjectKeyNameIsEmptyErrorMessage[] = "Request validation failed, object key name is empty.";
static constexpr const char RegionNameIsEmptyErrorMessage[] = "Request validation failed, region name is empty.";
public:
AZ_RTTI(AWSScriptBehaviorS3, "{7F4E956C-7463-4236-B320-C992D36A9C6E}");
AWSScriptBehaviorS3() = default;
virtual ~AWSScriptBehaviorS3() = default;
static void Reflect(AZ::ReflectContext* context);
static void GetObject(const AZStd::string& bucketResourceKey, const AZStd::string& objectKey, const AZStd::string& outFile);
static void GetObjectRaw(const AZStd::string& bucket, const AZStd::string& objectKey, const AZStd::string& region, const AZStd::string& outFile);
static void HeadObject(const AZStd::string& bucketResourceKey, const AZStd::string& objectKey);
static void HeadObjectRaw(const AZStd::string& bucket, const AZStd::string& objectKey, const AZStd::string& region);
private:
using S3NotificationFunctionType = void(AWSScriptBehaviorS3Notifications::*)(const AZStd::string&);
static bool ValidateGetObjectRequest(S3NotificationFunctionType notificationFunc,
const AZStd::string& bucket, const AZStd::string& objectKey, const AZStd::string& region, AZStd::string& outFile);
static bool ValidateHeadObjectRequest(S3NotificationFunctionType notificationFunc,
const AZStd::string& bucket, const AZStd::string& key, const AZStd::string& region);
};
}
@@ -0,0 +1,37 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AWSCore
{
class AWSScriptBehaviorBase;
//! Bootstraps and provides AWS ScriptCanvas behaviors
class AWSScriptBehaviorsComponent
: public AZ::Component
{
public:
AZ_COMPONENT(AWSScriptBehaviorsComponent, "{9F37F23F-4229-4A1F-BAA6-4A4AB8422B47}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
// AZ::Component interface implementation
void Activate() override;
void Deactivate() override;
};
} // namespace AWSCore