Skip to content

release_ipam_pool_allocation

release_ipam_pool_allocation(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    ipam_pool_id: Optional[IpamPoolId] = None,
    cidr: Optional[String] = None,
    ipam_pool_allocation_id: Optional[IpamPoolAllocationId] = None,
) -> ReleaseIpamPoolAllocationResult

Release an allocation within an IPAM pool. The Region you use should be the IPAM pool locale. The locale is the Amazon Web Services Region where this IPAM pool is available for allocations. You can only use this action to release manual allocations. To remove an allocation for a resource without deleting the resource, set its monitored state to false using ModifyIpamResourceCidr. For more information, see Release an allocation in the Amazon VPC IPAM User Guide.

All EC2 API actions follow an eventual consistency model.

Parameters:

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

    A check for 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.

  • ipam_pool_id (Optional[IpamPoolId], default: None ) –

    The ID of the IPAM pool which contains the allocation you want to release.

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

    The CIDR of the allocation you want to release.

  • ipam_pool_allocation_id (Optional[IpamPoolAllocationId], default: None ) –

    The ID of the allocation.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def release_ipam_pool_allocation(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    ipam_pool_id: Optional["capo_ec2.types.ipam_pool_id.IpamPoolId"] = None,
    cidr: Optional["capo_ec2.types.string.String"] = None,
    ipam_pool_allocation_id: Optional[
        "capo_ec2.types.ipam_pool_allocation_id.IpamPoolAllocationId"
    ] = None,
) -> "capo_ec2.types.release_ipam_pool_allocation_result.ReleaseIpamPoolAllocationResult":
    """<p>Release an allocation within an IPAM pool. The Region you use should be the IPAM pool locale. The locale is the Amazon Web Services Region where this IPAM pool is available for allocations. You can only use this action to release manual allocations. To remove an allocation for a resource without deleting the resource, set its monitored state to false using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyIpamResourceCidr.html">ModifyIpamResourceCidr</a>. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/ipam/release-alloc-ipam.html">Release an allocation</a> in the <i>Amazon VPC IPAM User Guide</i>. </p> <note> <p>All EC2 API actions follow an <a href="https://docs.aws.amazon.com/ec2/latest/devguide/eventual-consistency.html">eventual consistency</a> model.</p> </note>

    Args:
        dry_run: <p>A check for 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>
        ipam_pool_id: <p>The ID of the IPAM pool which contains the allocation you want to release.</p>
        cidr: <p>The CIDR of the allocation you want to release.</p>
        ipam_pool_allocation_id: <p>The ID of the allocation.</p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.release_ipam_pool_allocation_request.ReleaseIpamPoolAllocationRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.release_ipam_pool_allocation_result.ReleaseIpamPoolAllocationResult"
    ]:
        import capo_ec2._operations.amazon_ec2.release_ipam_pool_allocation

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ReleaseIpamPoolAllocation")
    )
    input_: capo_ec2.types.release_ipam_pool_allocation_request.ReleaseIpamPoolAllocationRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if ipam_pool_id is not None:
        input_["ipam_pool_id"] = ipam_pool_id
    if cidr is not None:
        input_["cidr"] = cidr
    if ipam_pool_allocation_id is not None:
        input_["ipam_pool_allocation_id"] = ipam_pool_allocation_id

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