-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Java V2 Add examples for Control Tower #7668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
...v2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerActions.java
Outdated
Show resolved
Hide resolved
...v2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerActions.java
Outdated
Show resolved
Hide resolved
...v2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerActions.java
Outdated
Show resolved
Hide resolved
...2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerScenario.java
Outdated
Show resolved
Hide resolved
...2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerScenario.java
Outdated
Show resolved
Hide resolved
...2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerScenario.java
Outdated
Show resolved
Hide resolved
javav2/example_code/controltower/src/main/java/com/example/controltower/HelloControlTower.java
Outdated
Show resolved
Hide resolved
javav2/example_code/controltower/src/main/java/resources/config.properties
Outdated
Show resolved
Hide resolved
...v2/example_code/controltower/src/main/java/com/example/controltower/ControlTowerActions.java
Outdated
Show resolved
Hide resolved
rlhagerm
left a comment
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)
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.