-
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
| excerpts: | ||
| - description: | ||
| snippet_tags: | ||
| - controltower.java2.list_landing_zones.main |
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.
Incorrect snippet name.
| do { | ||
| ListLandingZonesRequest.Builder requestBuilder = ListLandingZonesRequest.builder(); | ||
| if (nextToken != null) { | ||
| requestBuilder.nextToken(nextToken); |
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 code should use the paginator.
| return baselines; | ||
|
|
||
| } catch (ControlTowerException e) { | ||
| String errorCode = e.awsErrorDetails().errorCode(); |
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 exception code looks different from the established patterns in the rest of the Java examples. It looks too similar to the .NET code, are you sure it is correct? Same question for all of the exception handlers.
| String nextToken = null; | ||
|
|
||
| do { | ||
| ListEnabledBaselinesRequest.Builder requestBuilder = ListEnabledBaselinesRequest.builder(); |
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.
Code should use the paginator.
|
|
||
| try { | ||
|
|
||
| ControlTowerClient controlTowerClient = ControlTowerClient.builder() |
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.
Is the Java code not using async operations any more?
| waitForInputToContinue(scanner); | ||
| /* | ||
| logger.info(DASHES); |
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.
Commented out code.
| */ | ||
| } catch (ControlTowerException e) { |
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.
Where is the rest of the scenario? The specification includes a lot more than just listing enabled baselines. See the sections on Baselines and the sections on Controls in the specification here: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/scenarios/basics/controltower/SPECIFICATION.md
| public static void main(String[] args) { | ||
| try { | ||
| ControlTowerClient controlTowerClient = ControlTowerClient.builder() | ||
| .region(Region.US_EAST_1) |
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.
Hard coded region.
| @@ -0,0 +1,3 @@ | |||
| dataAccessRoleArn = <enter data access role ARN> | |||
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.
What does this file have to do with the scenario? DocumentClassifier?
| * @throws ControlTowerException if a service-specific error occurs | ||
| * @throws SdkException if an SDK error occurs | ||
| */ | ||
| public static BaselineOperationStatus getBaselineOperation(ControlTowerClient controlTowerClient, |
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.
These methods are never called by the scenario?
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.