From f6d2e1488ad46275529c89df599549dfe8d07ab7 Mon Sep 17 00:00:00 2001 From: sbiscigl Date: Wed, 15 Nov 2023 10:23:48 -0500 Subject: [PATCH] re-add sqs customization that was dropped in json migration --- .../aws/sqs/model/QueueAttributeName.h | 6 +++- .../source/model/QueueAttributeName.cpp | 28 +++++++++++++++++ .../config/ServiceGeneratorConfig.java | 2 ++ .../cpp/sqs/SQSJsonCppClientGenerator.java | 31 +++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/sqs/SQSJsonCppClientGenerator.java diff --git a/generated/src/aws-cpp-sdk-sqs/include/aws/sqs/model/QueueAttributeName.h b/generated/src/aws-cpp-sdk-sqs/include/aws/sqs/model/QueueAttributeName.h index b18957ca368..235e3c72878 100644 --- a/generated/src/aws-cpp-sdk-sqs/include/aws/sqs/model/QueueAttributeName.h +++ b/generated/src/aws-cpp-sdk-sqs/include/aws/sqs/model/QueueAttributeName.h @@ -37,7 +37,11 @@ namespace Model DeduplicationScope, FifoThroughputLimit, RedriveAllowPolicy, - SqsManagedSseEnabled + SqsManagedSseEnabled, + SentTimestamp, + ApproximateFirstReceiveTimestamp, + ApproximateReceiveCount, + SenderId }; namespace QueueAttributeNameMapper diff --git a/generated/src/aws-cpp-sdk-sqs/source/model/QueueAttributeName.cpp b/generated/src/aws-cpp-sdk-sqs/source/model/QueueAttributeName.cpp index f6ee0b06f84..c7d7602d612 100644 --- a/generated/src/aws-cpp-sdk-sqs/source/model/QueueAttributeName.cpp +++ b/generated/src/aws-cpp-sdk-sqs/source/model/QueueAttributeName.cpp @@ -42,6 +42,10 @@ namespace Aws static const int FifoThroughputLimit_HASH = HashingUtils::HashString("FifoThroughputLimit"); static const int RedriveAllowPolicy_HASH = HashingUtils::HashString("RedriveAllowPolicy"); static const int SqsManagedSseEnabled_HASH = HashingUtils::HashString("SqsManagedSseEnabled"); + static const int SentTimestamp_HASH = HashingUtils::HashString("SentTimestamp"); + static const int ApproximateFirstReceiveTimestamp_HASH = HashingUtils::HashString("ApproximateFirstReceiveTimestamp"); + static const int ApproximateReceiveCount_HASH = HashingUtils::HashString("ApproximateReceiveCount"); + static const int SenderId_HASH = HashingUtils::HashString("SenderId"); QueueAttributeName GetQueueAttributeNameForName(const Aws::String& name) @@ -135,6 +139,22 @@ namespace Aws { return QueueAttributeName::SqsManagedSseEnabled; } + else if (hashCode == SentTimestamp_HASH) + { + return QueueAttributeName::SentTimestamp; + } + else if (hashCode == ApproximateFirstReceiveTimestamp_HASH) + { + return QueueAttributeName::ApproximateFirstReceiveTimestamp; + } + else if (hashCode == ApproximateReceiveCount_HASH) + { + return QueueAttributeName::ApproximateReceiveCount; + } + else if (hashCode == SenderId_HASH) + { + return QueueAttributeName::SenderId; + } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { @@ -195,6 +215,14 @@ namespace Aws return "RedriveAllowPolicy"; case QueueAttributeName::SqsManagedSseEnabled: return "SqsManagedSseEnabled"; + case QueueAttributeName::SentTimestamp: + return "SentTimestamp"; + case QueueAttributeName::ApproximateFirstReceiveTimestamp: + return "ApproximateFirstReceiveTimestamp"; + case QueueAttributeName::ApproximateReceiveCount: + return "ApproximateReceiveCount"; + case QueueAttributeName::SenderId: + return "SenderId"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) diff --git a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/config/ServiceGeneratorConfig.java b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/config/ServiceGeneratorConfig.java index 8175604b071..3045d68fb5f 100644 --- a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/config/ServiceGeneratorConfig.java +++ b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/config/ServiceGeneratorConfig.java @@ -25,6 +25,7 @@ import com.amazonaws.util.awsclientgenerator.generators.cpp.rds.RDSCppClientGenerator; import com.amazonaws.util.awsclientgenerator.generators.cpp.s3.S3RestXmlCppClientGenerator; import com.amazonaws.util.awsclientgenerator.generators.cpp.s3control.S3ControlRestXmlCppClientGenerator; +import com.amazonaws.util.awsclientgenerator.generators.cpp.sqs.SQSJsonCppClientGenerator; import com.amazonaws.util.awsclientgenerator.generators.cpp.sqs.SQSQueryXmlCppClientGenerator; import java.util.HashMap; @@ -52,6 +53,7 @@ public class ServiceGeneratorConfig { SPEC_OVERRIDE_MAPPING.put("cpp-glacier-rest-json", new GlacierRestJsonCppClientGenerator()); SPEC_OVERRIDE_MAPPING.put("cpp-lambda-rest-json", new LambdaRestJsonCppClientGenerator()); SPEC_OVERRIDE_MAPPING.put("cpp-sqs-query", new SQSQueryXmlCppClientGenerator()); + SPEC_OVERRIDE_MAPPING.put("cpp-sqs-json", new SQSJsonCppClientGenerator()); SPEC_OVERRIDE_MAPPING.put("cpp-s3-rest-xml", new S3RestXmlCppClientGenerator()); SPEC_OVERRIDE_MAPPING.put("cpp-s3-crt-rest-xml", new S3RestXmlCppClientGenerator()); SPEC_OVERRIDE_MAPPING.put("cpp-s3control-rest-xml", new S3ControlRestXmlCppClientGenerator()); diff --git a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/sqs/SQSJsonCppClientGenerator.java b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/sqs/SQSJsonCppClientGenerator.java new file mode 100644 index 00000000000..69102516551 --- /dev/null +++ b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/sqs/SQSJsonCppClientGenerator.java @@ -0,0 +1,31 @@ +package com.amazonaws.util.awsclientgenerator.generators.cpp.sqs; + +import com.amazonaws.util.awsclientgenerator.domainmodels.SdkFileEntry; +import com.amazonaws.util.awsclientgenerator.domainmodels.codegeneration.ServiceModel; +import com.amazonaws.util.awsclientgenerator.domainmodels.codegeneration.Shape; +import com.amazonaws.util.awsclientgenerator.generators.cpp.JsonCppClientGenerator; + +public class SQSJsonCppClientGenerator extends JsonCppClientGenerator { + + public SQSJsonCppClientGenerator() throws Exception { + super(); + } + + @Override + public SdkFileEntry[] generateSourceFiles(ServiceModel serviceModel) throws Exception { + Shape queueAttributeNameShape = serviceModel.getShapes().get("QueueAttributeName"); + + /* + * Add missing unmodeled queue attribute shapes that were already present + * in a customization for the QueryXML client generation. + */ + if(queueAttributeNameShape != null) { + queueAttributeNameShape.getEnumValues().add("SentTimestamp"); + queueAttributeNameShape.getEnumValues().add("ApproximateFirstReceiveTimestamp"); + queueAttributeNameShape.getEnumValues().add("ApproximateReceiveCount"); + queueAttributeNameShape.getEnumValues().add("SenderId"); + } + + return super.generateSourceFiles(serviceModel); + } +}