Boto3Plugin¶
Boto3Plugin
¶
Bases: BasePlugin
boto3/botocore interception plugin.
Patches botocore.client.BaseClient._make_api_call at the class level. Uses reference counting so nested sandboxes work correctly.
Each service:operation pair has its own FIFO deque of Boto3MockConfig objects.
Source code in src/tripwire/plugins/boto3_plugin.py
mock_call
¶
Register a mock for a single boto3 API call invocation.
Args: service: The AWS service name (e.g., "s3"). operation: The API operation name in PascalCase (e.g., "GetObject"). returns: Value to return when this mock is consumed. raises: If provided, this exception is raised instead of returning. required: If False, the mock is not reported as unused at teardown.
Source code in src/tripwire/plugins/boto3_plugin.py
sentinel
¶
install_patches
¶
Install botocore._make_api_call patch and set dummy AWS credentials.
Setting dummy credentials prevents botocore's credential provider from hitting the EC2 metadata service (169.254.169.254), which would leak DNS and HTTP calls to other plugin interceptors.
Source code in src/tripwire/plugins/boto3_plugin.py
restore_patches
¶
Restore original botocore._make_api_call and AWS credential env vars.
Source code in src/tripwire/plugins/boto3_plugin.py
assert_boto3_call
¶
Typed helper: assert the next boto3 API call interaction.
Wraps assert_interaction() for ergonomic use. All three fields (service, operation, params) are required.