Creates a single GuardDuty detector. A detector is a resource that represents the GuardDuty service. To start using GuardDuty, you must create a detector in each Region where you enable the service. You can have only one detector per account per Region. All data sources are enabled in a new detector by default.
-
When you don't specify any features, with an exception to RUNTIME_MONITORING, all the optional features are enabled by default.
-
When you specify some of the features, any feature that is not specified in the API call gets enabled by default, with an exception to RUNTIME_MONITORING.
Specifying both EKS Runtime Monitoring (EKS_RUNTIME_MONITORING) and Runtime Monitoring (RUNTIME_MONITORING) will cause an error. You can add only one of these two features because Runtime Monitoring already includes the threat detection for Amazon EKS resources. For more information, see Runtime Monitoring.
There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see Regions and endpoints.
Parameters:
-
enable
(Optional[Boolean], default:
None
)
–
A Boolean value that specifies whether the detector is to be enabled.
-
client_token
(Optional[ClientToken], default:
None
)
–
The idempotency token for the create request.
-
finding_publishing_frequency
(Optional[FindingPublishingFrequency], default:
None
)
–
A value that specifies how frequently updated findings are exported.
-
data_sources
(Optional[DataSourceConfigurations], default:
None
)
–
Describes which data sources will be enabled for the detector.
There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see Regions and endpoints.
-
tags
(Optional[TagMap], default:
None
)
–
The tags to be added to a new detector resource.
-
features
(Optional[DetectorFeatureConfigurations], default:
None
)
–
A list of features that will be configured for the detector.
Raises:
Source code in docs_src/capo_guardduty/_services/guard_duty.py
| def create_detector(
self,
*,
config_overrides: Optional[GuardDutyClientConfig] = None,
enable: Optional["capo_guardduty.types.boolean.Boolean"] = None,
client_token: Optional["capo_guardduty.types.client_token.ClientToken"] = None,
finding_publishing_frequency: Optional[
"capo_guardduty.types.finding_publishing_frequency.FindingPublishingFrequency"
] = None,
data_sources: Optional[
"capo_guardduty.types.data_source_configurations.DataSourceConfigurations"
] = None,
tags: Optional["capo_guardduty.types.tag_map.TagMap"] = None,
features: Optional[
"capo_guardduty.types.detector_feature_configurations.DetectorFeatureConfigurations"
] = None,
) -> "capo_guardduty.types.create_detector_response.CreateDetectorResponse":
"""<p>Creates a single GuardDuty detector. A detector is a resource that represents the GuardDuty service. To start using GuardDuty, you must create a detector in each Region where you enable the service. You can have only one detector per account per Region. All data sources are enabled in a new detector by default.</p> <ul> <li> <p>When you don't specify any <code>features</code>, with an exception to <code>RUNTIME_MONITORING</code>, all the optional features are enabled by default.</p> </li> <li> <p>When you specify some of the <code>features</code>, any feature that is not specified in the API call gets enabled by default, with an exception to <code>RUNTIME_MONITORING</code>. </p> </li> </ul> <p>Specifying both EKS Runtime Monitoring (<code>EKS_RUNTIME_MONITORING</code>) and Runtime Monitoring (<code>RUNTIME_MONITORING</code>) will cause an error. You can add only one of these two features because Runtime Monitoring already includes the threat detection for Amazon EKS resources. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/runtime-monitoring.html">Runtime Monitoring</a>.</p> <p>There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
Args:
enable: <p>A Boolean value that specifies whether the detector is to be enabled.</p>
client_token: <p>The idempotency token for the create request.</p>
finding_publishing_frequency: <p>A value that specifies how frequently updated findings are exported.</p>
data_sources: <p>Describes which data sources will be enabled for the detector.</p> <p>There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
tags: <p>The tags to be added to a new detector resource.</p>
features: <p>A list of features that will be configured for the detector.</p>
Raises:
capo_guardduty.errors.bad_request_exception.BadRequestException: <p>A bad request exception object.</p>
capo_guardduty.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal server error exception object.</p>
capo_guardduty.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_guardduty.types.create_detector_request.CreateDetectorRequest]",
) -> OperationResponse[
"capo_guardduty.types.create_detector_response.CreateDetectorResponse"
]:
import capo_guardduty._operations.guard_duty_api_service.create_detector
output, http_response = (
capo_guardduty._operations.guard_duty_api_service.create_detector.create_detector(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateDetector")
)
input_: capo_guardduty.types.create_detector_request.CreateDetectorRequest = {}
if enable is not None:
input_["enable"] = enable
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
if finding_publishing_frequency is not None:
input_["finding_publishing_frequency"] = finding_publishing_frequency
if data_sources is not None:
input_["data_sources"] = data_sources
if tags is not None:
input_["tags"] = tags
if features is not None:
input_["features"] = features
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|