Skip to content

create_local_gateway_route

create_local_gateway_route(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    destination_cidr_block: Optional[String] = None,
    local_gateway_route_table_id: Optional[LocalGatewayRoutetableId] = None,
    local_gateway_virtual_interface_group_id: Optional[
        LocalGatewayVirtualInterfaceGroupId
    ] = None,
    dry_run: Optional[Boolean] = None,
    network_interface_id: Optional[NetworkInterfaceId] = None,
    destination_prefix_list_id: Optional[PrefixListResourceId] = None,
) -> CreateLocalGatewayRouteResult

Creates a static route for the specified local gateway route table. You must specify one of the following targets:

  • LocalGatewayVirtualInterfaceGroupId

  • NetworkInterfaceId

Parameters:

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

    The CIDR range used for destination matches. Routing decisions are based on the most specific match.

  • local_gateway_route_table_id (Optional[LocalGatewayRoutetableId], default: None ) –

    The ID of the local gateway route table.

  • local_gateway_virtual_interface_group_id (Optional[LocalGatewayVirtualInterfaceGroupId], default: None ) –

    The ID of the virtual interface group.

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

  • network_interface_id (Optional[NetworkInterfaceId], default: None ) –

    The ID of the network interface.

  • destination_prefix_list_id (Optional[PrefixListResourceId], default: None ) –

    The ID of the prefix list. Use a prefix list in place of DestinationCidrBlock. You cannot use DestinationPrefixListId and DestinationCidrBlock in the same request.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def create_local_gateway_route(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    destination_cidr_block: Optional["capo_ec2.types.string.String"] = None,
    local_gateway_route_table_id: Optional[
        "capo_ec2.types.local_gateway_routetable_id.LocalGatewayRoutetableId"
    ] = None,
    local_gateway_virtual_interface_group_id: Optional[
        "capo_ec2.types.local_gateway_virtual_interface_group_id.LocalGatewayVirtualInterfaceGroupId"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    network_interface_id: Optional[
        "capo_ec2.types.network_interface_id.NetworkInterfaceId"
    ] = None,
    destination_prefix_list_id: Optional[
        "capo_ec2.types.prefix_list_resource_id.PrefixListResourceId"
    ] = None,
) -> (
    "capo_ec2.types.create_local_gateway_route_result.CreateLocalGatewayRouteResult"
):
    """<p>Creates a static route for the specified local gateway route table. You must specify one of the following targets: </p> <ul> <li> <p> <code>LocalGatewayVirtualInterfaceGroupId</code> </p> </li> <li> <p> <code>NetworkInterfaceId</code> </p> </li> </ul>

    Args:
        destination_cidr_block: <p>The CIDR range used for destination matches. Routing decisions are based on the most specific match.</p>
        local_gateway_route_table_id: <p>The ID of the local gateway route table.</p>
        local_gateway_virtual_interface_group_id: <p>The ID of the virtual interface group.</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>
        network_interface_id: <p>The ID of the network interface.</p>
        destination_prefix_list_id: <p> The ID of the prefix list. Use a prefix list in place of <code>DestinationCidrBlock</code>. You cannot use <code>DestinationPrefixListId</code> and <code>DestinationCidrBlock</code> in the same request. </p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.create_local_gateway_route_request.CreateLocalGatewayRouteRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.create_local_gateway_route_result.CreateLocalGatewayRouteResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_local_gateway_route

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLocalGatewayRoute")
    )
    input_: capo_ec2.types.create_local_gateway_route_request.CreateLocalGatewayRouteRequest = {}
    if destination_cidr_block is not None:
        input_["destination_cidr_block"] = destination_cidr_block
    if local_gateway_route_table_id is not None:
        input_["local_gateway_route_table_id"] = local_gateway_route_table_id
    if local_gateway_virtual_interface_group_id is not None:
        input_["local_gateway_virtual_interface_group_id"] = (
            local_gateway_virtual_interface_group_id
        )
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if network_interface_id is not None:
        input_["network_interface_id"] = network_interface_id
    if destination_prefix_list_id is not None:
        input_["destination_prefix_list_id"] = destination_prefix_list_id

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