Skip to content

create_firewall_policy

create_firewall_policy(
    firewall_policy_name: ResourceName,
    firewall_policy: FirewallPolicy,
    *,
    config_overrides: Optional[NetworkFirewallClientConfig] = None,
    description: Optional[Description] = None,
    tags: Optional[TagList] = None,
    dry_run: Optional[Boolean] = None,
    encryption_configuration: Optional[EncryptionConfiguration] = None,
) -> CreateFirewallPolicyResponse

Creates the firewall policy for the firewall according to the specifications.

An Network Firewall firewall policy defines the behavior of a firewall, in a collection of stateless and stateful rule groups and other settings. You can use one firewall policy for multiple firewalls.

Parameters:

  • firewall_policy_name (ResourceName) –

    The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it.

  • firewall_policy (FirewallPolicy) –

    The rule groups and policy actions to use in the firewall policy.

  • description (Optional[Description], default: None ) –

    A description of the firewall policy.

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

    The key:value pairs to associate with the resource.

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

    Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.

    If set to TRUE, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to FALSE, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.

    If set to FALSE, Network Firewall makes the requested changes to your resources.

  • encryption_configuration (Optional[EncryptionConfiguration], default: None ) –

    A complex type that contains settings for encryption of your firewall policy resources.

Raises:

  • InsufficientCapacityException –

    Amazon Web Services doesn't currently have enough available capacity to fulfill your request. Try your request later.

  • InternalServerError –

    Your request is valid, but Network Firewall couldn't perform the operation because of a system problem. Retry your request.

  • InvalidRequestException –

    The operation failed because of a problem with your request. Examples include:

    • You specified an unsupported parameter name or value.

    • You tried to update a property with a value that isn't among the available types.

    • Your request references an ARN that is malformed, or corresponds to a resource that isn't valid in the context of the request.

  • LimitExceededException –

    Unable to perform the operation because doing so would violate a limit setting.

  • ThrottlingException –

    Unable to process the request due to throttling limitations.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_network_firewall/_services/network_firewall.py
def create_firewall_policy(
    self,
    firewall_policy_name: "capo_network_firewall.types.resource_name.ResourceName",
    firewall_policy: "capo_network_firewall.types.firewall_policy.FirewallPolicy",
    *,
    config_overrides: Optional[NetworkFirewallClientConfig] = None,
    description: Optional[
        "capo_network_firewall.types.description.Description"
    ] = None,
    tags: Optional["capo_network_firewall.types.tag_list.TagList"] = None,
    dry_run: Optional["capo_network_firewall.types.boolean.Boolean"] = None,
    encryption_configuration: Optional[
        "capo_network_firewall.types.encryption_configuration.EncryptionConfiguration"
    ] = None,
) -> "capo_network_firewall.types.create_firewall_policy_response.CreateFirewallPolicyResponse":
    """<p>Creates the firewall policy for the firewall according to the specifications. </p> <p>An Network Firewall firewall policy defines the behavior of a firewall, in a collection of stateless and stateful rule groups and other settings. You can use one firewall policy for multiple firewalls. </p>

    Args:
        firewall_policy_name: <p>The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it.</p>
        firewall_policy: <p>The rule groups and policy actions to use in the firewall policy.</p>
        description: <p>A description of the firewall policy.</p>
        tags: <p>The key:value pairs to associate with the resource.</p>
        dry_run: <p>Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request. </p> <p>If set to <code>TRUE</code>, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to <code>FALSE</code>, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid. </p> <p>If set to <code>FALSE</code>, Network Firewall makes the requested changes to your resources. </p>
        encryption_configuration: <p>A complex type that contains settings for encryption of your firewall policy resources.</p>

    Raises:
        capo_network_firewall.errors.insufficient_capacity_exception.InsufficientCapacityException: <p>Amazon Web Services doesn't currently have enough available capacity to fulfill your request. Try your request later. </p>
        capo_network_firewall.errors.internal_server_error.InternalServerError: <p>Your request is valid, but Network Firewall couldn't perform the operation because of a system problem. Retry your request. </p>
        capo_network_firewall.errors.invalid_request_exception.InvalidRequestException: <p>The operation failed because of a problem with your request. Examples include: </p> <ul> <li> <p>You specified an unsupported parameter name or value.</p> </li> <li> <p>You tried to update a property with a value that isn't among the available types.</p> </li> <li> <p>Your request references an ARN that is malformed, or corresponds to a resource that isn't valid in the context of the request.</p> </li> </ul>
        capo_network_firewall.errors.limit_exceeded_exception.LimitExceededException: <p>Unable to perform the operation because doing so would violate a limit setting. </p>
        capo_network_firewall.errors.throttling_exception.ThrottlingException: <p>Unable to process the request due to throttling limitations.</p>
        capo_network_firewall.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_network_firewall.types.create_firewall_policy_request.CreateFirewallPolicyRequest]",
    ) -> OperationResponse[
        "capo_network_firewall.types.create_firewall_policy_response.CreateFirewallPolicyResponse"
    ]:
        import capo_network_firewall._operations.network_firewall_20201112.create_firewall_policy

        output, http_response = (
            capo_network_firewall._operations.network_firewall_20201112.create_firewall_policy.create_firewall_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFirewallPolicy")
    )
    input_: capo_network_firewall.types.create_firewall_policy_request.CreateFirewallPolicyRequest = {
        "firewall_policy_name": firewall_policy_name,
        "firewall_policy": firewall_policy,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration

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