Skip to content

Commit

Permalink
Support query compatible trait only for json protocol (#3204)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbera87 authored Nov 26, 2024
1 parent 4bccd6b commit ceca736
Show file tree
Hide file tree
Showing 13 changed files with 237 additions and 165 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run: |
clang-format --version
if [ -s diff_output.patch ]; then
python3 clang-format-diff.py -p1 -style=file:.clang-format < diff_output.patch > formatted_differences.patch 2> error.log || true
python3 clang-format-diff.py -iregex '.*\.(cpp|cc|c\+\+|cxx|c|h|hh|hpp)' -p1 -style=file:.clang-format < diff_output.patch > formatted_differences.patch 2> error.log || true
if [ -s error.log ]; then
echo "Errors from clang-format-diff.py:"
cat error.log
Expand All @@ -77,4 +77,4 @@ jobs:
cat formatted_differences.patch
rm formatted_differences.patch
exit 1
fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Aws
namespace Client
{

class AWS_SQS_API SQSErrorMarshaller : public Aws::Client::JsonErrorMarshaller
class AWS_SQS_API SQSErrorMarshaller : public Aws::Client::JsonErrorMarshallerQueryCompatible
{
public:
Aws::Client::AWSError<Aws::Client::CoreErrors> FindErrorByName(const char* exceptionName) const override;
Expand Down
1 change: 1 addition & 0 deletions generated/src/aws-cpp-sdk-sqs/include/aws/sqs/SQSRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace SQS
if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0))
{
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::AMZN_JSON_CONTENT_TYPE_1_0 ));
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::X_AMZN_QUERY_MODE,"true"));
}
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2012-11-05"));
return headers;
Expand Down
1 change: 1 addition & 0 deletions src/aws-cpp-sdk-core/include/aws/core/client/AWSError.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace Aws
// Allow ErrorMarshaller to set error payload.
friend class XmlErrorMarshaller;
friend class JsonErrorMarshaller;
friend class JsonErrorMarshallerQueryCompatible;
template<typename T> friend class AWSError;
public:
/**
Expand Down
49 changes: 30 additions & 19 deletions src/aws-cpp-sdk-core/include/aws/core/client/AWSErrorMarshaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,43 @@ namespace Aws
{
using AWSErrorMarshaller::Marshall;
public:
/**
* Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns
* and AWSError with CoreErrors::UNKNOWN as the error type.
*/
AWSError<CoreErrors> Marshall(const Aws::Http::HttpResponse& response) const override;
/**
* Converts an exceptionName and message into an Error object, if it
* can be parsed. Otherwise, it returns and AWSError with
* CoreErrors::UNKNOWN as the error type.
*/
virtual AWSError<CoreErrors> Marshall(const Aws::Http::HttpResponse& response) const override;

AWSError<CoreErrors> BuildAWSError(const std::shared_ptr<Http::HttpResponse>& httpResponse) const override;
AWSError<CoreErrors> BuildAWSError(const std::shared_ptr<Http::HttpResponse>& httpResponse) const override;

protected:
const Aws::Utils::Json::JsonValue& GetJsonPayloadFromError(const AWSError<CoreErrors>&) const;
const Aws::Utils::Json::JsonValue& GetJsonPayloadFromError(const AWSError<CoreErrors>&) const;
};

class AWS_CORE_API XmlErrorMarshaller : public AWSErrorMarshaller
{
using AWSErrorMarshaller::Marshall;
public:
/**
* Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns
* and AWSError with CoreErrors::UNKNOWN as the error type.
*/
AWSError<CoreErrors> Marshall(const Aws::Http::HttpResponse& response) const override;
class AWS_CORE_API JsonErrorMarshallerQueryCompatible : public JsonErrorMarshaller {
public:
/**
* Converts an exceptionName and message into an Error object, if it
* can be parsed. Otherwise, it returns and AWSError with
* CoreErrors::UNKNOWN as the error type.
*/
AWSError<CoreErrors> Marshall(const Aws::Http::HttpResponse& response) const override;
};

AWSError<CoreErrors> BuildAWSError(const std::shared_ptr<Http::HttpResponse>& httpResponse) const override;
class AWS_CORE_API XmlErrorMarshaller : public AWSErrorMarshaller {
using AWSErrorMarshaller::Marshall;

protected:
const Aws::Utils::Xml::XmlDocument& GetXmlPayloadFromError(const AWSError<CoreErrors>&) const;
public:
/**
* Converts an exceptionName and message into an Error object, if it can be parsed. Otherwise, it returns
* and AWSError with CoreErrors::UNKNOWN as the error type.
*/
AWSError<CoreErrors> Marshall(const Aws::Http::HttpResponse& response) const override;

AWSError<CoreErrors> BuildAWSError(const std::shared_ptr<Http::HttpResponse>& httpResponse) const override;

protected:
const Aws::Utils::Xml::XmlDocument& GetXmlPayloadFromError(const AWSError<CoreErrors>&) const;
};

} // namespace Client
Expand Down
1 change: 1 addition & 0 deletions src/aws-cpp-sdk-core/include/aws/core/http/HttpRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace Aws
extern AWS_CORE_API const char CHUNKED_VALUE[];
extern AWS_CORE_API const char AWS_CHUNKED_VALUE[];
extern AWS_CORE_API const char X_AMZN_ERROR_TYPE[];
extern AWS_CORE_API const char X_AMZN_QUERY_MODE[];

class HttpRequest;
class HttpResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/aws-cpp-sdk-core/source/client/AWSClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,4 +1048,4 @@ void AWSClient::AppendRecursionDetectionHeader(std::shared_ptr<Aws::Http::HttpRe
xAmznTraceIdVal = xAmznTraceIdValEncodedStr.str();

ioRequest->SetHeaderValue(Aws::Http::X_AMZN_TRACE_ID_HEADER, xAmznTraceIdVal);
}
}
Loading

0 comments on commit ceca736

Please sign in to comment.