Skip to content

allocate_ipam_pool_cidr async

allocate_ipam_pool_cidr(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    ipam_pool_id: Optional[IpamPoolId] = None,
    cidr: Optional[String] = None,
    netmask_length: Optional[Integer] = None,
    client_token: Optional[String] = None,
    description: Optional[String] = None,
    preview_next_cidr: Optional[Boolean] = None,
    allowed_cidrs: Optional[IpamPoolAllocationAllowedCidrs] = None,
    disallowed_cidrs: Optional[IpamPoolAllocationDisallowedCidrs] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
) -> AllocateIpamPoolCidrResult

Allocate a CIDR from 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.

In IPAM, an allocation is a CIDR assignment from an IPAM pool to another IPAM pool or to a resource. For more information, see Allocate CIDRs in the Amazon VPC IPAM User Guide.

This action creates an allocation with strong consistency. The returned CIDR will not overlap with any other allocations from the same pool.

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 from which you would like to allocate a CIDR.

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

    The CIDR you would like to allocate from the IPAM pool. Note the following:

    • If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.

    • If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.

    Possible values: Any available IPv4 or IPv6 CIDR.

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

    The netmask length of the CIDR you would like to allocate from the IPAM pool. Note the following:

    • If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.

    • If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.

    Possible netmask lengths for IPv4 addresses are 0 - 32. Possible netmask lengths for IPv6 addresses are 0 - 128.

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

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

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

    A description for the allocation.

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

    A preview of the next available CIDR in a pool.

  • allowed_cidrs (Optional[IpamPoolAllocationAllowedCidrs], default: None ) –

    Include a particular CIDR range that can be returned by the pool. Allowed CIDRs are only allowed if using netmask length for allocation.

  • disallowed_cidrs (Optional[IpamPoolAllocationDisallowedCidrs], default: None ) –

    Exclude a particular CIDR range from being returned by the pool. Disallowed CIDRs are only allowed if using netmask length for allocation.

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

    The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

    If you specify tags, the request is authorized against the allocation resource in addition to the pool resource.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def allocate_ipam_pool_cidr(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = 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,
    netmask_length: Optional["capo_ec2.types.integer.Integer"] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    description: Optional["capo_ec2.types.string.String"] = None,
    preview_next_cidr: Optional["capo_ec2.types.boolean.Boolean"] = None,
    allowed_cidrs: Optional[
        "capo_ec2.types.ipam_pool_allocation_allowed_cidrs.IpamPoolAllocationAllowedCidrs"
    ] = None,
    disallowed_cidrs: Optional[
        "capo_ec2.types.ipam_pool_allocation_disallowed_cidrs.IpamPoolAllocationDisallowedCidrs"
    ] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
) -> "capo_ec2.types.allocate_ipam_pool_cidr_result.AllocateIpamPoolCidrResult":
    """<p>Allocate a CIDR from 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.</p> <p>In IPAM, an allocation is a CIDR assignment from an IPAM pool to another IPAM pool or to a resource. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/ipam/allocate-cidrs-ipam.html">Allocate CIDRs</a> in the <i>Amazon VPC IPAM User Guide</i>.</p> <note> <p>This action creates an allocation with strong consistency. The returned CIDR will not overlap with any other allocations from the same pool.</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 from which you would like to allocate a CIDR.</p>
        cidr: <p>The CIDR you would like to allocate from the IPAM pool. Note the following:</p> <ul> <li> <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p> </li> <li> <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p> </li> </ul> <p>Possible values: Any available IPv4 or IPv6 CIDR.</p>
        netmask_length: <p>The netmask length of the CIDR you would like to allocate from the IPAM pool. Note the following:</p> <ul> <li> <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p> </li> <li> <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p> </li> </ul> <p>Possible netmask lengths for IPv4 addresses are 0 - 32. Possible netmask lengths for IPv6 addresses are 0 - 128.</p>
        client_token: <p>A unique, case-sensitive identifier that 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>
        description: <p>A description for the allocation.</p>
        preview_next_cidr: <p>A preview of the next available CIDR in a pool.</p>
        allowed_cidrs: <p>Include a particular CIDR range that can be returned by the pool. Allowed CIDRs are only allowed if using netmask length for allocation.</p>
        disallowed_cidrs: <p>Exclude a particular CIDR range from being returned by the pool. Disallowed CIDRs are only allowed if using netmask length for allocation.</p>
        tag_specifications: <p>The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p> <p>If you specify tags, the request is authorized against the allocation resource in addition to the pool resource.</p>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.allocate_ipam_pool_cidr_request.AllocateIpamPoolCidrRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.allocate_ipam_pool_cidr_result.AllocateIpamPoolCidrResult"
    ]:
        import capo_ec2._operations.amazon_ec2.allocate_ipam_pool_cidr

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.allocate_ipam_pool_cidr.async_allocate_ipam_pool_cidr(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AllocateIpamPoolCidr")
    )
    input_: capo_ec2.types.allocate_ipam_pool_cidr_request.AllocateIpamPoolCidrRequest = {}
    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 netmask_length is not None:
        input_["netmask_length"] = netmask_length
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if preview_next_cidr is not None:
        input_["preview_next_cidr"] = preview_next_cidr
    if allowed_cidrs is not None:
        input_["allowed_cidrs"] = allowed_cidrs
    if disallowed_cidrs is not None:
        input_["disallowed_cidrs"] = disallowed_cidrs
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications

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