Skip to content

create_secondary_network async

create_secondary_network(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    client_token: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
    ipv4_cidr_block: Optional[String] = None,
    network_type: Optional[SecondaryNetworkType] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
) -> CreateSecondaryNetworkResult

Creates a secondary network.

The allowed size for a secondary network CIDR block is between /28 netmask (16 IP addresses) and /12 netmask (1,048,576 IP addresses).

Parameters:

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

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

  • 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.

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

    The IPv4 CIDR block for the secondary network. The CIDR block size must be between /12 and /28.

  • network_type (Optional[SecondaryNetworkType], default: None ) –

    The type of secondary network.

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

    The tags to assign to the secondary network.

Raises:

Examples:

To create a secondary network This example creates a rdma secondary network with a /16 CIDR block.

>>> await client.create_secondary_network(ipv4_cidr_block='10.0.0.0/16', network_type='rdma', client_token='550e8400-e29b-41d4-a716-446655440000', tag_specifications=[{'ResourceType': 'secondary-network', 'Tags': [{'Key': 'Name', 'Value': 'Prod Secondary Network'}]}])
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_secondary_network(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    ipv4_cidr_block: Optional["capo_ec2.types.string.String"] = None,
    network_type: Optional[
        "capo_ec2.types.secondary_network_type.SecondaryNetworkType"
    ] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
) -> "capo_ec2.types.create_secondary_network_result.CreateSecondaryNetworkResult":
    """<p>Creates a secondary network.</p> <p>The allowed size for a secondary network CIDR block is between /28 netmask (16 IP addresses) and /12 netmask (1,048,576 IP addresses).</p>

    Args:
        client_token: <p>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">Ensure Idempotency</a>.</p>
        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>
        ipv4_cidr_block: <p>The IPv4 CIDR block for the secondary network. The CIDR block size must be between /12 and /28.</p>
        network_type: <p>The type of secondary network.</p>
        tag_specifications: <p>The tags to assign to the secondary network.</p>

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

    Examples:
        To create a secondary network
        This example creates a rdma secondary network with a /16 CIDR block.

        >>> await client.create_secondary_network(ipv4_cidr_block='10.0.0.0/16', network_type='rdma', client_token='550e8400-e29b-41d4-a716-446655440000', tag_specifications=[{'ResourceType': 'secondary-network', 'Tags': [{'Key': 'Name', 'Value': 'Prod Secondary Network'}]}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_secondary_network_request.CreateSecondaryNetworkRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_secondary_network_result.CreateSecondaryNetworkResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_secondary_network

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSecondaryNetwork")
    )
    input_: capo_ec2.types.create_secondary_network_request.CreateSecondaryNetworkRequest = {}
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if ipv4_cidr_block is not None:
        input_["ipv4_cidr_block"] = ipv4_cidr_block
    if network_type is not None:
        input_["network_type"] = network_type
    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