Skip to content

create_ip_set async

create_ip_set(
    detector_id: DetectorId,
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    name: Optional[Name] = None,
    format: Optional[IpSetFormat] = None,
    location: Optional[Location] = None,
    activate: Optional[Boolean] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
    expected_bucket_owner: Optional[AccountId] = None,
) -> CreateIPSetResponse

Creates a new IPSet, which is called a trusted IP list in the console user interface. An IPSet is a list of IP addresses that are trusted for secure communication with Amazon Web Services infrastructure and applications. GuardDuty doesn't generate findings for IP addresses that are included in IPSets. Only users from the administrator account can use this operation.

Parameters:

  • detector_id (DetectorId) –

    The unique ID of the detector of the GuardDuty account for which you want to create an IPSet.

    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 ) –

    The user-friendly name to identify the IPSet.

    Allowed characters are alphanumeric, whitespace, dash (-), and underscores (_).

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

    The format of the file that contains the IPSet.

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

    The URI of the file that contains the IPSet.

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

    A Boolean value that indicates whether GuardDuty is to start using the uploaded IPSet.

  • 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 IP set resource.

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

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

Raises:

Source code in docs_src/capo_guardduty/_services/async_guard_duty.py
async def create_ip_set(
    self,
    detector_id: "capo_guardduty.types.detector_id.DetectorId",
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    name: Optional["capo_guardduty.types.name.Name"] = None,
    format: Optional["capo_guardduty.types.ip_set_format.IpSetFormat"] = None,
    location: Optional["capo_guardduty.types.location.Location"] = 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,
    expected_bucket_owner: Optional[
        "capo_guardduty.types.account_id.AccountId"
    ] = None,
) -> "capo_guardduty.types.create_ip_set_response.CreateIPSetResponse":
    """<p>Creates a new IPSet, which is called a trusted IP list in the console user interface. An IPSet is a list of IP addresses that are trusted for secure communication with Amazon Web Services infrastructure and applications. GuardDuty doesn't generate findings for IP addresses that are included in IPSets. Only users from the administrator account can use this operation.</p>

    Args:
        detector_id: <p>The unique ID of the detector of the GuardDuty account for which you want to create an IPSet.</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>The user-friendly name to identify the IPSet.</p> <p> Allowed characters are alphanumeric, whitespace, dash (-), and underscores (_).</p>
        format: <p>The format of the file that contains the IPSet.</p>
        location: <p>The URI of the file that contains the IPSet. </p>
        activate: <p>A Boolean value that indicates whether GuardDuty is to start using the uploaded IPSet.</p>
        client_token: <p>The idempotency token for the create request.</p>
        tags: <p>The tags to be added to a new IP set resource.</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>

    Raises:
        capo_guardduty.errors.access_denied_exception.AccessDeniedException: <p>An access denied exception object.</p>
        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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_guardduty.types.create_ip_set_request.CreateIPSetRequest]",
    ) -> AsyncOperationResponse[
        "capo_guardduty.types.create_ip_set_response.CreateIPSetResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.create_ip_set

        (
            output,
            http_response,
        ) = await capo_guardduty._operations.guard_duty_api_service.create_ip_set.async_create_ip_set(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateIPSet")
    )
    input_: capo_guardduty.types.create_ip_set_request.CreateIPSetRequest = {
        "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 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
    if expected_bucket_owner is not None:
        input_["expected_bucket_owner"] = expected_bucket_owner

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output