Skip to content
5 changes: 5 additions & 0 deletions src/aws-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ file(GLOB SMITHY_IDENTITY_SIGNER_HEADERS "include/smithy/identity/signer/*.h")
file(GLOB SMITHY_IDENTITY_SIGNER_BUILTIN_HEADERS "include/smithy/identity/signer/built-in/*.h")
file(GLOB SMITHY_INTERCEPTOR_HEADERS "include/smithy/interceptor/*.h")
file(GLOB SMITHY_INTERCEPTOR_IMPL_HEADERS "include/smithy/interceptor/impl/*.h")
file(GLOB SMITHY_CLIENT_SCHEMA_HEADERS "include/smithy/client/schema/*.h")

file(GLOB AWS_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
file(GLOB AWS_TINYXML2_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/external/tinyxml2/*.cpp")
Expand Down Expand Up @@ -136,6 +137,7 @@ file(GLOB SMITHY_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/smithy/*.cpp")
file(GLOB SMITHY_CLIENT_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/smithy/client/*.cpp")
file(GLOB SMITHY_IDENTITY_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/smithy/identity/*.cpp")
file(GLOB SMITHY_TRACING_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/smithy/tracing/*.cpp")
file(GLOB SMITHY_CLIENT_SCHEMA_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/source/smithy/client/schema/*.cpp")

include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
Expand Down Expand Up @@ -316,6 +318,7 @@ file(GLOB AWS_NATIVE_SDK_COMMON_HEADERS
${OPTEL_HEADERS}
${SMITHY_INTERCEPTOR_HEADERS}
${SMITHY_INTERCEPTOR_IMPL_HEADERS}
${SMITHY_CLIENT_SCHEMA_HEADERS}
)

# misc platform-specific, not related to features (encryption/http clients)
Expand Down Expand Up @@ -378,6 +381,7 @@ file(GLOB AWS_NATIVE_SDK_NON_UNITY_SRC
${UTILS_CHECKSUM_SOURCE}
${UTILS_CRYPTO_SOURCE}
${OPTEL_SOURCE}
${SMITHY_CLIENT_SCHEMA_SOURCE}
)

file(GLOB AWS_NATIVE_SDK_UNITY_SRC
Expand Down Expand Up @@ -462,6 +466,7 @@ if(MSVC)
source_group("Header Files\\smithy\\identity\\signer\\built-in" FILES ${SMITHY_IDENTITY_SIGNER_BUILTIN_HEADERS})
source_group("Header Files\\smithy\\interceptor" FILES ${SMITHY_INTERCEPTOR_HEADERS})
source_group("Header Files\\smithy\\interceptor" FILES ${SMITHY_INTERCEPTOR_IMPL_HEADERS})
source_group("Header Files\\smithy\\client\\schema" FILES ${SMITHY_CLIENT_SCHEMA_HEADERS})

# http client conditional headers
if(ENABLE_CURL_CLIENT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#pragma once

#include <aws/core/Core_EXPORTS.h>
#include <aws/core/utils/memory/AWSMemory.h>
#include <smithy/Smithy_EXPORTS.h>
#include <smithy/client/schema/ShapeSerializer.h>

#include <memory>

namespace smithy {
namespace schema {

class AWS_CORE_API CborShapeSerialize final : public ShapeSerializer {
class SMITHY_API CborShapeSerialize final : public ShapeSerializer {
public:
CborShapeSerializer();
~CborShapeSerializer();

void BeginStructure(const Schema& schema) override;
bool BeginStructure(const Schema& schema) override;
void EndStructure() override;

void WriteBoolean(const Schema& schema, bool value) override;
Expand All @@ -26,21 +25,21 @@ class AWS_CORE_API CborShapeSerialize final : public ShapeSerializer {
void WriteEnum(const Schema& schema, int value) override;
void WriteNull(const Schema& schema) override;

void BeginList(const Schema& schema, size_t count) override;
bool BeginList(const Schema& schema, size_t count) override;
void EndList() override;

void BeginMap(const Schema& schema, size_t count) override;
bool BeginMap(const Schema& schema, size_t count) override;
void WriteMapKey(const Aws::String& key) override;
void EndMap() override;

void BeginNestedStructure(const Schema& schema) override;
bool BeginNestedStructure(const Schema& schema) override;
void EndNestedStructure() override;

Aws::String GetPayload() const;

private:
struct Impl;
std::unique_ptr<Impl> m_impl;
class Impl;
Aws::UniquePtr<Impl> m_impl;
};

} // namespace schema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#pragma once

#include <aws/core/client/AWSError.h>
#include <aws/core/utils/memory/AWSMemory.h>
#include <smithy/Smithy_EXPORTS.h>
#include <smithy/client/schema/ShapeSerializer.h>

#include <memory>

namespace smithy {
namespace schema {

class JsonShapeSerializer final : public ShapeSerializer {
class SMITHY_API JsonShapeSerializer final : public ShapeSerializer {
public:
using SerializerOutcome = Aws::Utils::Outcome<Aws::String, Aws::Client::AWSError<Aws::Client::CoreErrors>>;
JsonShapeSerializer();
~JsonShapeSerializer();

void BeginStructure(const Schema& schema) override;
bool BeginStructure(const Schema& schema) override;
void EndStructure() override;

void WriteBoolean(const Schema& schema, bool value) override;
Expand All @@ -25,21 +27,21 @@ class JsonShapeSerializer final : public ShapeSerializer {
void WriteEnum(const Schema& schema, int value) override;
void WriteNull(const Schema& schema) override;

void BeginList(const Schema& schema, size_t count) override;
bool BeginList(const Schema& schema, size_t count) override;
void EndList() override;

void BeginMap(const Schema& schema, size_t count) override;
bool BeginMap(const Schema& schema, size_t count) override;
void WriteMapKey(const Aws::String& key) override;
void EndMap() override;

void BeginNestedStructure(const Schema& schema) override;
bool BeginNestedStructure(const Schema& schema) override;
void EndNestedStructure() override;

Aws::String GetPayload() const;
SerializerOutcome GetPayload();

private:
struct Impl;
std::unique_ptr<Impl> m_impl;
class Impl;
Aws::UniquePtr<Impl> m_impl;
};

} // namespace schema
Expand Down
10 changes: 10 additions & 0 deletions src/aws-cpp-sdk-core/include/smithy/client/schema/JsonWriteUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws {
namespace Schema {

void WriteQuotedJsonString(Aws::String& buf, const Aws::String& value);

} // namespace Schema
} // namespace Aws
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#pragma once

#include <aws/core/utils/memory/AWSMemory.h>
#include <smithy/Smithy_EXPORTS.h>
#include <smithy/client/schema/ShapeSerializer.h>

#include <memory>

namespace smithy {
namespace schema {

class QueryShapeSerializer final : public ShapeSerializer {
class SMITHY_API QueryShapeSerializer final : public ShapeSerializer {
public:
QueryShapeSerializer(const Aws::String& action, const Aws::String& version);
~QueryShapeSerializer();

void BeginStructure(const Schema& schema) override;
bool BeginStructure(const Schema& schema) override;
void EndStructure() override;

void WriteBoolean(const Schema& schema, bool value) override;
Expand All @@ -25,21 +25,21 @@ class QueryShapeSerializer final : public ShapeSerializer {
void WriteEnum(const Schema& schema, int value) override;
void WriteNull(const Schema& schema) override;

void BeginList(const Schema& schema, size_t count) override;
bool BeginList(const Schema& schema, size_t count) override;
void EndList() override;

void BeginMap(const Schema& schema, size_t count) override;
bool BeginMap(const Schema& schema, size_t count) override;
void WriteMapKey(const Aws::String& key) override;
void EndMap() override;

void BeginNestedStructure(const Schema& schema) override;
bool BeginNestedStructure(const Schema& schema) override;
void EndNestedStructure() override;

Aws::String GetPayload() const;

private:
struct Impl;
std::unique_ptr<Impl> m_impl;
class Impl;
Aws::UniquePtr<Impl> m_impl;
};

} // namespace schema
Expand Down
7 changes: 4 additions & 3 deletions src/aws-cpp-sdk-core/include/smithy/client/schema/Schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ enum class ShapeType : uint8_t {
class Schema {
public:
Schema() = default;
Schema(const Aws::String& memberName, ShapeType type) : m_type(type), m_memberName(memberName) {}

ShapeType GetType() const { return m_type; }
const char* GetId() const { return m_id; }
const char* GetMemberName() const { return m_memberName; }
Aws::String GetMemberName() const { return m_memberName; }
int GetMemberIndex() const { return m_memberIndex; }
bool IsMember() const { return m_memberName != nullptr; }
bool IsMember() const { return !m_memberName.empty(); }

const Schema* GetMember(const char* name) const;
const Schema* GetMember(int index) const;
Expand All @@ -50,7 +51,7 @@ class Schema {
private:
const char* m_id = nullptr;
ShapeType m_type = ShapeType::Structure;
const char* m_memberName = nullptr;
Aws::String m_memberName;
int m_memberIndex = 0;
const Schema* m_members = nullptr;
uint16_t m_memberCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ShapeSerializer {
public:
virtual ~ShapeSerializer() = default;

virtual void BeginStructure(const Schema& schema) = 0;
virtual bool BeginStructure(const Schema& schema) = 0;
virtual void EndStructure() = 0;

virtual void WriteBoolean(const Schema& schema, bool value) = 0;
Expand All @@ -27,14 +27,14 @@ class ShapeSerializer {
virtual void WriteEnum(const Schema& schema, int value) = 0;
virtual void WriteNull(const Schema& schema) = 0;

virtual void BeginList(const Schema& schema, size_t count) = 0;
virtual bool BeginList(const Schema& schema, size_t count) = 0;
virtual void EndList() = 0;

virtual void BeginMap(const Schema& schema, size_t count) = 0;
virtual bool BeginMap(const Schema& schema, size_t count) = 0;
virtual void WriteMapKey(const Aws::String& key) = 0;
virtual void EndMap() = 0;

virtual void BeginNestedStructure(const Schema& schema) = 0;
virtual bool BeginNestedStructure(const Schema& schema) = 0;
virtual void EndNestedStructure() = 0;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#pragma once

#include <aws/core/utils/memory/AWSMemory.h>
#include <smithy/Smithy_EXPORTS.h>
#include <smithy/client/schema/ShapeSerializer.h>

#include <memory>

namespace smithy {
namespace schema {

class XmlShapeSerializer final : public ShapeSerializer {
class SMITHY_API XmlShapeSerializer final : public ShapeSerializer {
public:
XmlShapeSerializer();
~XmlShapeSerializer();

void BeginStructure(const Schema& schema) override;
bool BeginStructure(const Schema& schema) override;
void EndStructure() override;

void WriteBoolean(const Schema& schema, bool value) override;
Expand All @@ -25,21 +25,21 @@ class XmlShapeSerializer final : public ShapeSerializer {
void WriteEnum(const Schema& schema, int value) override;
void WriteNull(const Schema& schema) override;

void BeginList(const Schema& schema, size_t count) override;
bool BeginList(const Schema& schema, size_t count) override;
void EndList() override;

void BeginMap(const Schema& schema, size_t count) override;
bool BeginMap(const Schema& schema, size_t count) override;
void WriteMapKey(const Aws::String& key) override;
void EndMap() override;

void BeginNestedStructure(const Schema& schema) override;
bool BeginNestedStructure(const Schema& schema) override;
void EndNestedStructure() override;

Aws::String GetPayload() const;

private:
struct Impl;
std::unique_ptr<Impl> m_impl;
class Impl;
Aws::UniquePtr<Impl> m_impl;
};

} // namespace schema
Expand Down
Loading
Loading