Skip to content

replace_network_acl_association

replace_network_acl_association(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    association_id: Optional[NetworkAclAssociationId] = None,
    network_acl_id: Optional[NetworkAclId] = None,
) -> ReplaceNetworkAclAssociationResult

Changes which network ACL a subnet is associated with. By default when you create a subnet, it's automatically associated with the default network ACL. For more information, see Network ACLs in the Amazon VPC User Guide.

This is an idempotent operation.

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.

  • association_id (Optional[NetworkAclAssociationId], default: None ) –

    The ID of the current association between the original network ACL and the subnet.

  • network_acl_id (Optional[NetworkAclId], default: None ) –

    The ID of the new network ACL to associate with the subnet.

Raises:

Examples:

To replace the network ACL associated with a subnet This example associates the specified network ACL with the subnet for the specified network ACL association.

>>> client.replace_network_acl_association(association_id='aclassoc-e5b95c8c', network_acl_id='acl-5fb85d36')
Source code in docs_src/capo_ec2/_services/ec2.py
def replace_network_acl_association(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    association_id: Optional[
        "capo_ec2.types.network_acl_association_id.NetworkAclAssociationId"
    ] = None,
    network_acl_id: Optional["capo_ec2.types.network_acl_id.NetworkAclId"] = None,
) -> "capo_ec2.types.replace_network_acl_association_result.ReplaceNetworkAclAssociationResult":
    """<p>Changes which network ACL a subnet is associated with. By default when you create a subnet, it's automatically associated with the default network ACL. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html">Network ACLs</a> in the <i>Amazon VPC User Guide</i>.</p> <p>This is an idempotent operation.</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>
        association_id: <p>The ID of the current association between the original network ACL and the subnet.</p>
        network_acl_id: <p>The ID of the new network ACL to associate with the subnet.</p>

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

    Examples:
        To replace the network ACL associated with a subnet
        This example associates the specified network ACL with the subnet for the specified network ACL association.

        >>> client.replace_network_acl_association(association_id='aclassoc-e5b95c8c', network_acl_id='acl-5fb85d36')
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.replace_network_acl_association_request.ReplaceNetworkAclAssociationRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.replace_network_acl_association_result.ReplaceNetworkAclAssociationResult"
    ]:
        import capo_ec2._operations.amazon_ec2.replace_network_acl_association

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ReplaceNetworkAclAssociation")
    )
    input_: capo_ec2.types.replace_network_acl_association_request.ReplaceNetworkAclAssociationRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if association_id is not None:
        input_["association_id"] = association_id
    if network_acl_id is not None:
        input_["network_acl_id"] = network_acl_id

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