Skip to content

Commit

Permalink
re-add sqs customization that was dropped in json migration
Browse files Browse the repository at this point in the history
  • Loading branch information
sbiscigl committed Nov 15, 2023
1 parent 33c4270 commit f6d2e14
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ namespace Model
DeduplicationScope,
FifoThroughputLimit,
RedriveAllowPolicy,
SqsManagedSseEnabled
SqsManagedSseEnabled,
SentTimestamp,
ApproximateFirstReceiveTimestamp,
ApproximateReceiveCount,
SenderId
};

namespace QueueAttributeNameMapper
Expand Down
28 changes: 28 additions & 0 deletions generated/src/aws-cpp-sdk-sqs/source/model/QueueAttributeName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit f6d2e14

Please sign in to comment.