Skip to content

Commit 34a018f

Browse files
authored
Cbor Serialization/Deserialization & Protocol Tests (#3538)
* Update generated protocol tests to include RpcV2Cbor * Add code generation logic for Cbor clients and protocol tests * Core changes for Cbor (AWSProtocolTest errors, Array.h equality operator, Datetime constructor, AwsProtocolTestHelper, protocol_tests_gen.py)) * Update ServiceGeneratorConfig.java to map smithy-rpc-v2-cbor to CborClientGenerator class * Add recursive depth backtracking for cbor deserialize maps and lists * Cbor code gen - Fix logic to determine if pointer or not * Cbor serialization initial map size counting to use guarded if statement * Fix cbor encode/decode recursive variable declarations hiding previous * Updated protocol tests * cbor indef map make outer map's peektype variable name different for recursive variables * Update protocol tests * CborDecode - Cast uints to int * Cbor deserialization error logging and early exit * Remove negative timestamp support, check has_value() on peektypes for string/int, add indefinite blob logic * Add int64_t type for cbor for bounds purposes * Update protocol tests * CborCppClientGenerator throw runtime exception for eventStream handling for now * CborDecodeValue no need to clear StringStream * Update protocol tests gen to use overrided ValidateBody function so object compairsons are scoped to AwsProtocolTestHelpers * Fix cbor client generation add path segment bug * clang-format generated protocol tests (updated protocol_tests_gen.py)
1 parent 450a7b4 commit 34a018f

File tree

1,443 files changed

+73193
-56548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,443 files changed

+73193
-56548
lines changed

generated/protocol-tests/test-clients/aws-cpp-sdk-ec2-protocol/include/aws/ec2-protocol/EC2ProtocolClient.h

Lines changed: 751 additions & 708 deletions
Large diffs are not rendered by default.

generated/protocol-tests/test-clients/aws-cpp-sdk-ec2-protocol/include/aws/ec2-protocol/EC2ProtocolEndpointProvider.h

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,20 @@
44
*/
55

66
#pragma once
7-
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
87
#include <aws/core/client/GenericClientConfiguration.h>
98
#include <aws/core/endpoint/DefaultEndpointProvider.h>
109
#include <aws/core/endpoint/EndpointParameter.h>
1110
#include <aws/core/utils/memory/stl/AWSString.h>
1211
#include <aws/core/utils/memory/stl/AWSVector.h>
13-
1412
#include <aws/ec2-protocol/EC2ProtocolEndpointRules.h>
13+
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
1514

16-
17-
namespace Aws
18-
{
19-
namespace EC2Protocol
20-
{
21-
namespace Endpoint
22-
{
15+
namespace Aws {
16+
namespace EC2Protocol {
17+
namespace Endpoint {
2318
using EndpointParameters = Aws::Endpoint::EndpointParameters;
24-
using Aws::Endpoint::EndpointProviderBase;
2519
using Aws::Endpoint::DefaultEndpointProvider;
20+
using Aws::Endpoint::EndpointProviderBase;
2621

2722
using EC2ProtocolClientContextParameters = Aws::Endpoint::ClientContextParameters;
2823

@@ -43,19 +38,16 @@ using EC2ProtocolDefaultEpProviderBase =
4338
/**
4439
* Default endpoint provider used for this service
4540
*/
46-
class AWS_EC2PROTOCOL_API EC2ProtocolEndpointProvider : public EC2ProtocolDefaultEpProviderBase
47-
{
48-
public:
49-
using EC2ProtocolResolveEndpointOutcome = Aws::Endpoint::ResolveEndpointOutcome;
50-
51-
EC2ProtocolEndpointProvider()
52-
: EC2ProtocolDefaultEpProviderBase(Aws::EC2Protocol::EC2ProtocolEndpointRules::GetRulesBlob(), Aws::EC2Protocol::EC2ProtocolEndpointRules::RulesBlobSize)
53-
{}
54-
55-
~EC2ProtocolEndpointProvider()
56-
{
57-
}
41+
class AWS_EC2PROTOCOL_API EC2ProtocolEndpointProvider : public EC2ProtocolDefaultEpProviderBase {
42+
public:
43+
using EC2ProtocolResolveEndpointOutcome = Aws::Endpoint::ResolveEndpointOutcome;
44+
45+
EC2ProtocolEndpointProvider()
46+
: EC2ProtocolDefaultEpProviderBase(Aws::EC2Protocol::EC2ProtocolEndpointRules::GetRulesBlob(),
47+
Aws::EC2Protocol::EC2ProtocolEndpointRules::RulesBlobSize) {}
48+
49+
~EC2ProtocolEndpointProvider() {}
5850
};
59-
} // namespace Endpoint
60-
} // namespace EC2Protocol
61-
} // namespace Aws
51+
} // namespace Endpoint
52+
} // namespace EC2Protocol
53+
} // namespace Aws

generated/protocol-tests/test-clients/aws-cpp-sdk-ec2-protocol/include/aws/ec2-protocol/EC2ProtocolEndpointRules.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@
44
*/
55

66
#pragma once
7-
#include <cstddef>
87
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
98

10-
namespace Aws
11-
{
12-
namespace EC2Protocol
13-
{
14-
class EC2ProtocolEndpointRules
15-
{
16-
public:
17-
static const size_t RulesBlobStrLen;
18-
static const size_t RulesBlobSize;
9+
#include <cstddef>
10+
11+
namespace Aws {
12+
namespace EC2Protocol {
13+
class EC2ProtocolEndpointRules {
14+
public:
15+
static const size_t RulesBlobStrLen;
16+
static const size_t RulesBlobSize;
1917

20-
static const char* GetRulesBlob();
18+
static const char* GetRulesBlob();
2119
};
22-
} // namespace EC2Protocol
23-
} // namespace Aws
20+
} // namespace EC2Protocol
21+
} // namespace Aws

generated/protocol-tests/test-clients/aws-cpp-sdk-ec2-protocol/include/aws/ec2-protocol/EC2ProtocolErrorMarshaller.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@
55

66
#pragma once
77

8-
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
98
#include <aws/core/client/AWSErrorMarshaller.h>
9+
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
1010

11-
namespace Aws
12-
{
13-
namespace Client
14-
{
11+
namespace Aws {
12+
namespace Client {
1513

16-
class AWS_EC2PROTOCOL_API EC2ProtocolErrorMarshaller : public Aws::Client::XmlErrorMarshaller
17-
{
18-
public:
14+
class AWS_EC2PROTOCOL_API EC2ProtocolErrorMarshaller : public Aws::Client::XmlErrorMarshaller {
15+
public:
1916
Aws::Client::AWSError<Aws::Client::CoreErrors> FindErrorByName(const char* exceptionName) const override;
2017
};
2118

22-
} // namespace Client
23-
} // namespace Aws
19+
} // namespace Client
20+
} // namespace Aws

generated/protocol-tests/test-clients/aws-cpp-sdk-ec2-protocol/include/aws/ec2-protocol/EC2ProtocolErrors.h

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
#include <aws/core/client/CoreErrors.h>
1010
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
1111

12-
namespace Aws
13-
{
14-
namespace EC2Protocol
15-
{
16-
enum class EC2ProtocolErrors
17-
{
18-
//From Core//
12+
namespace Aws {
13+
namespace EC2Protocol {
14+
enum class EC2ProtocolErrors {
15+
// From Core//
1916
//////////////////////////////////////////////////////////////////////////////////////////
2017
INCOMPLETE_SIGNATURE = 0,
2118
INTERNAL_FAILURE = 1,
@@ -24,9 +21,9 @@ enum class EC2ProtocolErrors
2421
INVALID_PARAMETER_COMBINATION = 4,
2522
INVALID_QUERY_PARAMETER = 5,
2623
INVALID_PARAMETER_VALUE = 6,
27-
MISSING_ACTION = 7, // SDK should never allow
28-
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
29-
MISSING_PARAMETER = 9, // SDK should never allow
24+
MISSING_ACTION = 7, // SDK should never allow
25+
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
26+
MISSING_PARAMETER = 9, // SDK should never allow
3027
OPT_IN_REQUIRED = 10,
3128
REQUEST_EXPIRED = 11,
3229
SERVICE_UNAVAILABLE = 12,
@@ -47,7 +44,7 @@ enum class EC2ProtocolErrors
4744
UNKNOWN = 100,
4845
///////////////////////////////////////////////////////////////////////////////////////////
4946

50-
ACTIVE_VPC_PEERING_CONNECTION_PER_VPC_LIMIT_EXCEEDED= static_cast<int>(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1,
47+
ACTIVE_VPC_PEERING_CONNECTION_PER_VPC_LIMIT_EXCEEDED = static_cast<int>(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1,
5148
ADDRESS_LIMIT_EXCEEDED,
5249
ATTACHMENT_LIMIT_EXCEEDED,
5350
BUNDLING_IN_PROGRESS,
@@ -224,9 +221,8 @@ enum class EC2ProtocolErrors
224221
V_P_C_RESOURCE_NOT_SPECIFIED
225222
};
226223

227-
class AWS_EC2PROTOCOL_API EC2ProtocolError : public Aws::Client::AWSError<EC2ProtocolErrors>
228-
{
229-
public:
224+
class AWS_EC2PROTOCOL_API EC2ProtocolError : public Aws::Client::AWSError<EC2ProtocolErrors> {
225+
public:
230226
EC2ProtocolError() {}
231227
EC2ProtocolError(const Aws::Client::AWSError<Aws::Client::CoreErrors>& rhs) : Aws::Client::AWSError<EC2ProtocolErrors>(rhs) {}
232228
EC2ProtocolError(Aws::Client::AWSError<Aws::Client::CoreErrors>&& rhs) : Aws::Client::AWSError<EC2ProtocolErrors>(rhs) {}
@@ -237,10 +233,9 @@ class AWS_EC2PROTOCOL_API EC2ProtocolError : public Aws::Client::AWSError<EC2Pro
237233
T GetModeledError();
238234
};
239235

240-
namespace EC2ProtocolErrorMapper
241-
{
242-
AWS_EC2PROTOCOL_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetErrorForName(const char* errorName);
236+
namespace EC2ProtocolErrorMapper {
237+
AWS_EC2PROTOCOL_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetErrorForName(const char* errorName);
243238
}
244239

245-
} // namespace EC2Protocol
246-
} // namespace Aws
240+
} // namespace EC2Protocol
241+
} // namespace Aws

generated/protocol-tests/test-clients/aws-cpp-sdk-ec2-protocol/include/aws/ec2-protocol/EC2ProtocolRequest.h

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,36 @@
44
*/
55

66
#pragma once
7-
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
8-
#include <aws/core/endpoint/AWSEndpoint.h>
97
#include <aws/core/AmazonSerializableWebServiceRequest.h>
10-
#include <aws/core/utils/UnreferencedParam.h>
8+
#include <aws/core/endpoint/AWSEndpoint.h>
119
#include <aws/core/http/HttpRequest.h>
10+
#include <aws/core/utils/UnreferencedParam.h>
11+
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>
1212

13-
namespace Aws
14-
{
15-
namespace EC2Protocol
16-
{
17-
class AWS_EC2PROTOCOL_API EC2ProtocolRequest : public Aws::AmazonSerializableWebServiceRequest
18-
{
19-
public:
20-
using EndpointParameter = Aws::Endpoint::EndpointParameter;
21-
using EndpointParameters = Aws::Endpoint::EndpointParameters;
22-
23-
virtual ~EC2ProtocolRequest () {}
24-
25-
void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); }
26-
27-
inline Aws::Http::HeaderValueCollection GetHeaders() const override
28-
{
29-
auto headers = GetRequestSpecificHeaders();
30-
31-
if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0))
32-
{
33-
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::FORM_CONTENT_TYPE ));
34-
}
35-
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2020-01-08"));
36-
return headers;
37-
}
13+
namespace Aws {
14+
namespace EC2Protocol {
15+
class AWS_EC2PROTOCOL_API EC2ProtocolRequest : public Aws::AmazonSerializableWebServiceRequest {
16+
public:
17+
using EndpointParameter = Aws::Endpoint::EndpointParameter;
18+
using EndpointParameters = Aws::Endpoint::EndpointParameters;
19+
20+
virtual ~EC2ProtocolRequest() {}
3821

39-
protected:
40-
virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); }
22+
void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); }
4123

42-
};
24+
inline Aws::Http::HeaderValueCollection GetHeaders() const override {
25+
auto headers = GetRequestSpecificHeaders();
26+
27+
if (headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0)) {
28+
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::FORM_CONTENT_TYPE));
29+
}
30+
headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2020-01-08"));
31+
return headers;
32+
}
4333

34+
protected:
35+
virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); }
36+
};
4437

45-
} // namespace EC2Protocol
46-
} // namespace Aws
38+
} // namespace EC2Protocol
39+
} // namespace Aws

0 commit comments

Comments
 (0)