Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bd04a63
Smithy code gen for pagination
kai-ion Jan 13, 2026
153df50
Smithy code gen for pagination
kai-ion Jan 13, 2026
1461605
updated parser to use c2j mapping names
kai-ion Jan 14, 2026
262eae8
updated writer to use c2j mapping names and deleted space in map.json
kai-ion Jan 14, 2026
b647665
fix file location
kai-ion Jan 15, 2026
03c06ef
added a compilation test
kai-ion Jan 15, 2026
d58423e
updated cppwriter to use smithy library
kai-ion Jan 15, 2026
7c55bf5
changed parsers to be more generic
kai-ion Jan 15, 2026
6b29534
added service name util
kai-ion Jan 15, 2026
6084c35
filter out deprecated service
kai-ion Jan 15, 2026
6ef01e7
edgecases for backwards compatibility
kai-ion Jan 16, 2026
1eb974f
edgecases for backwards compatibility
kai-ion Jan 16, 2026
aabd2e6
temporary fix for AccessAnalyzer which uses service-level pagination …
kai-ion Jan 16, 2026
0ebc50f
temporary fix for amp
kai-ion Jan 17, 2026
14d1c8b
temporary fix for B2BI
kai-ion Jan 17, 2026
619c29a
harded for missing abbreviation trait
kai-ion Jan 17, 2026
e742bc6
added new detection logic for conflicting service name and add sdk su…
kai-ion Jan 17, 2026
08cd208
added new new detection logic for conflicting service name and add sd…
kai-ion Jan 17, 2026
927dee5
added new new new detection logic (next/Next token) for conflicting s…
kai-ion Jan 17, 2026
9884429
added a patch for Chatbotclient paginator. CamelCase
kai-ion Jan 20, 2026
26a722d
added a patch for cloudfront. uses a new suffix 2020_05_31
kai-ion Jan 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ClientPagination.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/core/utils/pagination/Paginator.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/pagination/ListBucketsPaginationTraits.h>
#include <aws/s3/model/pagination/ListDirectoryBucketsPaginationTraits.h>
#include <aws/s3/model/pagination/ListObjectsV2PaginationTraits.h>
#include <aws/s3/model/pagination/ListPartsPaginationTraits.h>

namespace Aws {
namespace S3 {

using ListBucketsPaginator =
Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListBucketsRequest, Pagination::ListBucketsPaginationTraits>;
using ListDirectoryBucketsPaginator =
Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListDirectoryBucketsRequest, Pagination::ListDirectoryBucketsPaginationTraits>;
using ListObjectsV2Paginator =
Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListObjectsV2Request, Pagination::ListObjectsV2PaginationTraits>;
using ListPartsPaginator = Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListPartsRequest, Pagination::ListPartsPaginationTraits>;

} // namespace S3
} // namespace Aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/s3/S3Client.h>
#include <aws/s3/S3_EXPORTS.h>
#include <aws/s3/model/ListBucketsRequest.h>
#include <aws/s3/model/ListBucketsResult.h>

namespace Aws {
namespace S3 {
namespace Pagination {

struct ListBucketsPaginationTraits {
using RequestType = Model::ListBucketsRequest;
using ResultType = Model::ListBucketsResult;
using OutcomeType = Model::ListBucketsOutcome;
using ClientType = S3Client;

static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListBuckets(request); }

static bool HasMoreResults(const ResultType& result) { return !result.GetContinuationToken().empty(); }

static void SetNextRequest(const ResultType& result, RequestType& request) {
request.SetContinuationToken(result.GetContinuationToken());
}
};

} // namespace Pagination
} // namespace S3
} // namespace Aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/s3/S3Client.h>
#include <aws/s3/S3_EXPORTS.h>
#include <aws/s3/model/ListDirectoryBucketsRequest.h>
#include <aws/s3/model/ListDirectoryBucketsResult.h>

namespace Aws {
namespace S3 {
namespace Pagination {

struct ListDirectoryBucketsPaginationTraits {
using RequestType = Model::ListDirectoryBucketsRequest;
using ResultType = Model::ListDirectoryBucketsResult;
using OutcomeType = Model::ListDirectoryBucketsOutcome;
using ClientType = S3Client;

static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListDirectoryBuckets(request); }

static bool HasMoreResults(const ResultType& result) { return !result.GetContinuationToken().empty(); }

static void SetNextRequest(const ResultType& result, RequestType& request) {
request.SetContinuationToken(result.GetContinuationToken());
}
};

} // namespace Pagination
} // namespace S3
} // namespace Aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/s3/S3Client.h>
#include <aws/s3/S3_EXPORTS.h>
#include <aws/s3/model/ListObjectsV2Request.h>
#include <aws/s3/model/ListObjectsV2Result.h>

namespace Aws {
namespace S3 {
namespace Pagination {

struct ListObjectsV2PaginationTraits {
using RequestType = Model::ListObjectsV2Request;
using ResultType = Model::ListObjectsV2Result;
using OutcomeType = Model::ListObjectsV2Outcome;
using ClientType = S3Client;

static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListObjectsV2(request); }

static bool HasMoreResults(const ResultType& result) { return !result.GetNextContinuationToken().empty(); }

static void SetNextRequest(const ResultType& result, RequestType& request) {
request.SetContinuationToken(result.GetNextContinuationToken());
}
};

} // namespace Pagination
} // namespace S3
} // namespace Aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/s3/S3Client.h>
#include <aws/s3/S3_EXPORTS.h>
#include <aws/s3/model/ListPartsRequest.h>
#include <aws/s3/model/ListPartsResult.h>

namespace Aws {
namespace S3 {
namespace Pagination {

struct ListPartsPaginationTraits {
using RequestType = Model::ListPartsRequest;
using ResultType = Model::ListPartsResult;
using OutcomeType = Model::ListPartsOutcome;
using ClientType = S3Client;

static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListParts(request); }

static bool HasMoreResults(const ResultType& result) { return !result.GetNextPartNumberMarker().empty(); }

static void SetNextRequest(const ResultType& result, RequestType& request) {
request.SetPartNumberMarker(result.GetNextPartNumberMarker());
}
};

} // namespace Pagination
} // namespace S3
} // namespace Aws
25 changes: 25 additions & 0 deletions generated/tests/s3-gen-tests/S3PaginationCompilationTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

// Header compilation test for S3 pagination headers
// This test ensures all generated pagination headers compile successfully

#include <aws/s3/S3ClientPagination.h>
#include <aws/s3/model/pagination/ListBucketsPaginationTraits.h>
#include <aws/s3/model/pagination/ListDirectoryBucketsPaginationTraits.h>
#include <aws/s3/model/pagination/ListPartsPaginationTraits.h>
#include <aws/s3/model/pagination/ListObjectsV2PaginationTraits.h>

#include <aws/testing/AwsCppSdkGTestSuite.h>

class S3PaginationCompilationTest : public Aws::Testing::AwsCppSdkGTestSuite
{
};

TEST_F(S3PaginationCompilationTest, S3PaginationHeadersCompile)
{
// Test passes if compilation succeeds
SUCCEED();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
`java-library`
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation("software.amazon.smithy:smithy-model:1.51.0")
implementation("software.amazon.smithy:smithy-codegen-core:1.51.0")
implementation("software.amazon.smithy:smithy-aws-traits:1.51.0")
implementation("software.amazon.smithy:smithy-waiters:1.51.0")
implementation("software.amazon.smithy:smithy-rules-engine:1.51.0")
implementation("software.amazon.smithy:smithy-aws-endpoints:1.51.0")
implementation("software.amazon.smithy:smithy-aws-iam-traits:1.51.0")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
package com.amazonaws.util.awsclientsmithygenerator.generators;

import software.amazon.smithy.model.node.ObjectNode;
import software.amazon.smithy.model.shapes.ShapeId;

public class ClientCodegenSettings {
private final ShapeId service;

public ClientCodegenSettings(ObjectNode settings) {
this.service = ShapeId.from(settings.expectStringMember("service").getValue());
}

public ShapeId getService() {
return service;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
package com.amazonaws.util.awsclientsmithygenerator.generators;

import software.amazon.smithy.build.PluginContext;
import software.amazon.smithy.model.shapes.*;
import software.amazon.smithy.aws.traits.ServiceTrait;
import com.amazonaws.util.awsclientsmithygenerator.generators.CppWriter;
import com.amazonaws.util.awsclientsmithygenerator.generators.ServiceNameUtil;
import java.util.*;
import java.util.function.Consumer;

public class CompilationTestParser<T> {
private final ServiceShape service;
private final CppWriterDelegator writerDelegator;
private final String testType;
private final Consumer<CppWriter> renderFunction;
private final Map<String, String> c2jMap;

public CompilationTestParser(PluginContext context, ServiceShape service, List<T> operations,
String testType, Consumer<CppWriter> renderFunction, Map<String, String> c2jMap) {
this.service = service;
this.writerDelegator = new CppWriterDelegator(context.getFileManifest());
this.testType = testType;
this.renderFunction = renderFunction;
this.c2jMap = c2jMap;
}

public void run() {
generateCompilationTest();
writerDelegator.flushWriters();
}

private void generateCompilationTest() {
String serviceName = ServiceNameUtil.getServiceName(service);
String c2jServiceName = ServiceNameUtil.getC2jServiceName(service, c2jMap);

writerDelegator.useFileWriter(
"generated/tests/" + c2jServiceName + "-gen-tests/" + serviceName + testType + "CompilationTests.cpp",
renderFunction
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
package com.amazonaws.util.awsclientsmithygenerator.generators;

import software.amazon.smithy.codegen.core.ImportContainer;
import software.amazon.smithy.codegen.core.Symbol;
import java.util.HashSet;
import java.util.Set;

/**
* CppImportContainer tracks symbols used in code generation.
* For C++, we handle includes manually via writeInclude method.
*/
public class CppImportContainer implements ImportContainer {
private final Set<String> imports = new HashSet<>();

@Override
public void importSymbol(Symbol symbol, String alias) {
// Track the symbol's namespace for potential future use
if (symbol.getNamespace() != null && !symbol.getNamespace().isEmpty()) {
imports.add(symbol.getNamespace());
}
}

public Set<String> getImports() {
return imports;
}

@Override
public String toString() {
// Return empty string since we handle includes manually
return "";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
package com.amazonaws.util.awsclientsmithygenerator.generators;

import software.amazon.smithy.codegen.core.SymbolWriter;

public class CppWriter extends SymbolWriter<CppWriter, CppImportContainer> {

public CppWriter() {
super(new CppImportContainer());

// Add custom formatter for symbols
putFormatter('T', (arg, indent) -> {
if (!(arg instanceof software.amazon.smithy.codegen.core.Symbol symbol)) {
throw new software.amazon.smithy.codegen.core.CodegenException("Expected a symbol but got " + arg);
}

// Record our symbol so we can generate appropriate includes later if needed
getImportContainer().importSymbol(symbol, null);

// For C++, use namespace::name syntax (e.g. Aws::S3::Model::ListBucketsRequest)
if (symbol.getNamespace() != null && !symbol.getNamespace().isEmpty()) {
return symbol.getNamespace() + "::" + symbol.getName();
}
return symbol.getName();
});
}

public CppWriter writeInclude(String header) {
write("#include <$L>", header);
return this;
}

public CppWriter writeNamespaceOpen(String namespace) {
openBlock("namespace $L\n{", namespace);
return this;
}

public CppWriter writeNamespaceClose(String namespace) {
closeBlock("} // namespace $L", namespace);
return this;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Being a bit nitpicky but Instead of manually opening and closing namespace blocks, why don't we do something like this:

public CppWriter writeNamespaceOpen(String namespace) {
        writer.openBlock("namespace $L\n{", namespace);
        return this;
 }

and the same for writeNamespaceClose, but with writer.closeBlock. Its functionally the exact same (block functions indent/dedent which doesn't matter since we clang format anyway) , but we should try to use these functions when opening/closing blocks

}
Loading
Loading