Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

tejasgn1
Copy link
Contributor

@tejasgn1 tejasgn1 commented Oct 9, 2025

The changes in this PR were generated using CodeLoom-4-BedRock(CL4B) for GuardDuty service in Python language

@tejasgn1 tejasgn1 requested a review from rlhagerm October 9, 2025 21:32
@github-actions github-actions bot added the Python This issue relates to the AWS SDK for Python (boto3) label Oct 9, 2025
@tejasgn1 tejasgn1 self-assigned this Oct 9, 2025
# GuardDuty code examples for the SDK for Python.
guardduty_Hello:
title: Hello &GD;
title_abbrev: Hello &GD;
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue with the stubber as the Inspector version.

guardduty_wrapper = GuardDutyWrapper.from_client()

# List existing detectors
detector_ids = guardduty_wrapper.list_detectors()
Copy link
Contributor

Choose a reason for hiding this comment

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

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()
Copy link
Contributor

Choose a reason for hiding this comment

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

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

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):
Copy link
Contributor

Choose a reason for hiding this comment

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

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

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."
Copy link
Contributor

Choose a reason for hiding this comment

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

This statement mentions disabling the detector, but that is not a choice in the options.

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

Labels

Python This issue relates to the AWS SDK for Python (boto3)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.