[CL4B] GuardDuty Basics Scenario in Python#7624
[CL4B] GuardDuty Basics Scenario in Python#7624tejasgn1 wants to merge 1 commit intoawsdocs:mainfrom
Conversation
| # GuardDuty code examples for the SDK for Python. | ||
| guardduty_Hello: | ||
| title: Hello &GD; | ||
| title_abbrev: Hello &GD; |
There was a problem hiding this comment.
The entity abbreviation is GDU
| from test_tools.eventbridge_stubber import EventBridgeStubber | ||
| from test_tools.glacier_stubber import GlacierStubber | ||
| from test_tools.glue_stubber import GlueStubber | ||
| from test_tools.guardduty_stubber import GuardDutyStubber |
There was a problem hiding this comment.
Same issue with the stubber as the Inspector version.
| guardduty_wrapper = GuardDutyWrapper.from_client() | ||
|
|
||
| # List existing detectors | ||
| detector_ids = guardduty_wrapper.list_detectors() |
There was a problem hiding this comment.
The Hello example should be self-contained, and not use the wrapper functions.
| self.detector_id = existing_detectors[0] | ||
| print(f"Using existing detector: {self.detector_id}") | ||
| else: | ||
| self.detector_id = self._create_new_detector() |
There was a problem hiding this comment.
The new detector creation fails with an error that there is already a detector. This seems ok, but then the scenario exits without continuing.
| versions: | ||
| - sdk_version: 3 | ||
| github: python/example_code/guardduty | ||
| excerpts: |
There was a problem hiding this comment.
This one includes both classes, which is good. But it should also use a synopsis list.
| from botocore.exceptions import ClientError | ||
|
|
||
|
|
||
| def test_scenario_create_detector_success(scenario_data, monkeypatch): |
There was a problem hiding this comment.
We probably don't want to do any monkeypatch tests unless we have a good reason to. The stubber methods should be sufficient.
| @pytest.mark.integ | ||
| def test_guardduty_integration(): | ||
| """ | ||
| Integration test that works with existing detectors or creates a new one, |
There was a problem hiding this comment.
Same comments about the tests as in the Inspector PR.
|
|
||
| print( | ||
| "GuardDuty detectors continue to monitor your account and may incur charges. " | ||
| "You can disable the detector to stop monitoring, or delete it entirely." |
There was a problem hiding this comment.
This statement mentions disabling the detector, but that is not a choice in the options.
The changes in this PR were generated using CodeLoom-4-BedRock(CL4B) for GuardDuty service in Python language