Skip to content

Conversation

@scmacdon
Copy link
Contributor

@scmacdon scmacdon commented Dec 4, 2025

This pull request adds Java V2 examples for Control Tower.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@scmacdon scmacdon self-assigned this Dec 4, 2025
@scmacdon scmacdon added Java-v2 This issue relates to the AWS SDK for Java V2 Basics A basic code example showing the core actions for a particular service. labels Dec 4, 2025
@scmacdon scmacdon changed the title Java V2 Add Java V2 examples for Control Tower Java V2 Add examples for Control Tower Dec 4, 2025
@brmur brmur requested a review from rlhagerm December 8, 2025 15:34
@brmur brmur marked this pull request as draft December 10, 2025 17:35
Copy link
Collaborator

@rlhagerm rlhagerm left a comment

Choose a reason for hiding this comment

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

I only got as far as enabling the baseline before it failed with an exception (see comments). Also a few of the print statements seem incomplete or oddly formatted.

return paginator.subscribe(response -> {
if (response.baselines() != null && !response.baselines().isEmpty()) {
response.baselines().forEach(baseline -> {
System.out.format("Baseline: {}", baseline.name());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line isn't printing the names, it is just printing :

Baseline: {}Baseline: {}Baseline: {}Baseline: {}Baseline: {}Baseline: {}Baseline: {}Baseline: {}Baseline: {}Baseline: {}Successfully listed baselines.

And then it prints the names separately, but all on one line.

&& !response.enabledBaselines().isEmpty()) {

response.enabledBaselines().forEach(baseline -> {
System.out.format("Enabled baseline: {}", baseline.baselineIdentifier());
Copy link
Collaborator

Choose a reason for hiding this comment

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

The printout here looks odd also, and is missing line breaks.

Enabled baseline: {}Successfully listed enabled baselines. Total: {}1

.targetIdentifier(targetIdentifier)
.build();

return getAsyncClient().enableBaseline(request)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I got as far as trying to enable the baseline, and the scenario failed with the following error:

Enabling Control Tower Baseline...Scenario failed: Invalid request body (Service: ControlTower, Status Code: 400, Request ID: 1d0001c9-c819-42ff-bf6e-d81bee1089fd)java.util.concurrent.CompletionException: Error enabling baseline: Invalid request body (Service: ControlTower, Status Code: 400, Request ID: 1d0001c9-c819-42ff-bf6e-d81bee1089fd) at com.example.controltower.scenario.ControlTowerActions.lambda$enableBaselineAsync$0(ControlTowerActions.java:438)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Basics A basic code example showing the core actions for a particular service. Java-v2 This issue relates to the AWS SDK for Java V2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants