Skip to content

create_threat_entity_set

create_threat_entity_set(
    detector_id: DetectorId,
    *,
    config_overrides: Optional[GuardDutyClientConfig] = None,
    name: Optional[Name] = None,
    format: Optional[ThreatEntitySetFormat] = None,
    location: Optional[Location] = None,
    expected_bucket_owner: Optional[ExpectedBucketOwner] = None,
    activate: Optional[Boolean] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateThreatEntitySetResponse

Creates a new threat entity set. In a threat entity set, you can provide known malicious threat entities for your Amazon Web Services environment. GuardDuty generates findings based on the entries in the threat entity sets. Only users of the administrator account can manage entity sets, which automatically apply to member accounts.

Parameters:

  • detector_id (DetectorId) –

    The unique ID of the detector of the GuardDuty account for which you want to create a threat entity set.

    To find the detectorId in the current Region, see the Settings page in the GuardDuty console, or run the ListDetectors API.

  • name (Optional[Name], default: None ) –

    A user-friendly name to identify the threat entity set.

    The name of your list can include lowercase letters, uppercase letters, numbers, dash (-), and underscore (_).

  • format (Optional[ThreatEntitySetFormat], default: None ) –

    The format of the file that contains the threat entity set.

  • location (Optional[Location], default: None ) –

    The URI of the file that contains the threat entity set. The format of the Location URL must be a valid Amazon S3 URL format. Invalid URL formats will result in an error, regardless of whether you activate the entity set or not. For more information about format of the location URLs, see Format of location URL under Step 2: Adding trusted or threat intelligence data in the Amazon GuardDuty User Guide.

  • expected_bucket_owner (Optional[ExpectedBucketOwner], default: None ) –

    The Amazon Web Services account ID that owns the Amazon S3 bucket specified in the location parameter.

  • activate (Optional[Boolean], default: None ) –

    A boolean value that indicates whether GuardDuty should start using the uploaded threat entity set to generate findings.

  • client_token (Optional[ClientToken], default: None ) –

    The idempotency token for the create request.

  • tags (Optional[TagMap], default: None ) –

    The tags to be added to a new threat entity set resource.

Raises:

Source code in docs_src/capo_guardduty/_services/guard_duty.py
def create_threat_entity_set(
    self,
    detector_id: "capo_guardduty.types.detector_id.DetectorId",
    *,
    config_overrides: Optional[GuardDutyClientConfig] = None,
    name: Optional["capo_guardduty.types.name.Name"] = None,
    format: Optional[
        "capo_guardduty.types.threat_entity_set_format.ThreatEntitySetFormat"
    ] = None,
    location: Optional["capo_guardduty.types.location.Location"] = None,
    expected_bucket_owner: Optional[
        "capo_guardduty.types.expected_bucket_owner.ExpectedBucketOwner"
    ] = None,
    activate: Optional["capo_guardduty.types.boolean.Boolean"] = None,
    client_token: Optional["capo_guardduty.types.client_token.ClientToken"] = None,
    tags: Optional["capo_guardduty.types.tag_map.TagMap"] = None,
) -> "capo_guardduty.types.create_threat_entity_set_response.CreateThreatEntitySetResponse":
    """<p>Creates a new threat entity set. In a threat entity set, you can provide known malicious threat entities for your Amazon Web Services environment. GuardDuty generates findings based on the entries in the threat entity sets. Only users of the administrator account can manage entity sets, which automatically apply to member accounts.</p>

    Args:
        detector_id: <p>The unique ID of the detector of the GuardDuty account for which you want to create a threat entity set.</p> <p>To find the <code>detectorId</code> in the current Region, see the Settings page in the GuardDuty console, or run the <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html">ListDetectors</a> API.</p>
        name: <p>A user-friendly name to identify the threat entity set.</p> <p>The name of your list can include lowercase letters, uppercase letters, numbers, dash (-), and underscore (_).</p>
        format: <p>The format of the file that contains the threat entity set.</p>
        location: <p>The URI of the file that contains the threat entity set. The format of the <code>Location</code> URL must be a valid Amazon S3 URL format. Invalid URL formats will result in an error, regardless of whether you activate the entity set or not. For more information about format of the location URLs, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-lists-create-activate.html">Format of location URL under Step 2: Adding trusted or threat intelligence data</a> in the <i>Amazon GuardDuty User Guide</i>.</p>
        expected_bucket_owner: <p>The Amazon Web Services account ID that owns the Amazon S3 bucket specified in the <b>location</b> parameter.</p>
        activate: <p>A boolean value that indicates whether GuardDuty should start using the uploaded threat entity set to generate findings.</p>
        client_token: <p>The idempotency token for the create request.</p>
        tags: <p>The tags to be added to a new threat entity set resource.</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_threat_entity_set_request.CreateThreatEntitySetRequest]",
    ) -> OperationResponse[
        "capo_guardduty.types.create_threat_entity_set_response.CreateThreatEntitySetResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.create_threat_entity_set

        output, http_response = (
            capo_guardduty._operations.guard_duty_api_service.create_threat_entity_set.create_threat_entity_set(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateThreatEntitySet")
    )
    input_: capo_guardduty.types.create_threat_entity_set_request.CreateThreatEntitySetRequest = {
        "detector_id": detector_id
    }
    if name is not None:
        input_["name"] = name
    if format is not None:
        input_["format"] = format
    if location is not None:
        input_["location"] = location
    if expected_bucket_owner is not None:
        input_["expected_bucket_owner"] = expected_bucket_owner
    if activate is not None:
        input_["activate"] = activate
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output