Skip to content

create_managed_prefix_list

create_managed_prefix_list(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    prefix_list_name: Optional[String] = None,
    entries: Optional[AddPrefixListEntries] = None,
    max_entries: Optional[Integer] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
    address_family: Optional[String] = None,
    client_token: Optional[String] = None,
) -> CreateManagedPrefixListResult

Creates a managed prefix list. You can specify entries for the prefix list. Each entry consists of a CIDR block and an optional description.

Parameters:

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

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • prefix_list_name (Optional[String], default: None ) –

    A name for the prefix list.

    Constraints: Up to 255 characters in length. The name cannot start with com.amazonaws.

  • entries (Optional[AddPrefixListEntries], default: None ) –

    One or more entries for the prefix list.

  • max_entries (Optional[Integer], default: None ) –

    The maximum number of entries for the prefix list.

  • tag_specifications (Optional[TagSpecificationList], default: None ) –

    The tags to apply to the prefix list during creation.

  • address_family (Optional[String], default: None ) –

    The IP address type.

    Valid Values: IPv4 | IPv6

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

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

    Constraints: Up to 255 UTF-8 characters in length.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def create_managed_prefix_list(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    prefix_list_name: Optional["capo_ec2.types.string.String"] = None,
    entries: Optional[
        "capo_ec2.types.add_prefix_list_entries.AddPrefixListEntries"
    ] = None,
    max_entries: Optional["capo_ec2.types.integer.Integer"] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
    address_family: Optional["capo_ec2.types.string.String"] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
) -> (
    "capo_ec2.types.create_managed_prefix_list_result.CreateManagedPrefixListResult"
):
    """<p>Creates a managed prefix list. You can specify entries for the prefix list. Each entry consists of a CIDR block and an optional description.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        prefix_list_name: <p>A name for the prefix list.</p> <p>Constraints: Up to 255 characters in length. The name cannot start with <code>com.amazonaws</code>.</p>
        entries: <p>One or more entries for the prefix list.</p>
        max_entries: <p>The maximum number of entries for the prefix list.</p>
        tag_specifications: <p>The tags to apply to the prefix list during creation.</p>
        address_family: <p>The IP address type.</p> <p>Valid Values: <code>IPv4</code> | <code>IPv6</code> </p>
        client_token: <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p> <p>Constraints: Up to 255 UTF-8 characters in length.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.create_managed_prefix_list_request.CreateManagedPrefixListRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.create_managed_prefix_list_result.CreateManagedPrefixListResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_managed_prefix_list

        output, http_response = (
            capo_ec2._operations.amazon_ec2.create_managed_prefix_list.create_managed_prefix_list(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateManagedPrefixList")
    )
    input_: capo_ec2.types.create_managed_prefix_list_request.CreateManagedPrefixListRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if prefix_list_name is not None:
        input_["prefix_list_name"] = prefix_list_name
    if entries is not None:
        input_["entries"] = entries
    if max_entries is not None:
        input_["max_entries"] = max_entries
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    if address_family is not None:
        input_["address_family"] = address_family
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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