Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support query compatible trait only for json protocol #3204

Merged
merged 16 commits into from
Nov 26, 2024
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this just the java file fails clang format in the pipeline, locally , no matter which version

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
51 changes: 32 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,45 @@ 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 {
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;
};

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
Loading