Skip to content

create_connection

create_connection(
    global_network_id: GlobalNetworkId,
    device_id: DeviceId,
    connected_device_id: DeviceId,
    *,
    config_overrides: Optional[NetworkManagerClientConfig] = None,
    link_id: Optional[LinkId] = None,
    connected_link_id: Optional[LinkId] = None,
    description: Optional[ConstrainedString] = None,
    tags: Optional[TagList] = None,
) -> CreateConnectionResponse

Creates a connection between two devices. The devices can be a physical or virtual appliance that connects to a third-party appliance in a VPC, or a physical appliance that connects to another physical appliance in an on-premises network.

Parameters:

  • global_network_id (GlobalNetworkId) –

    The ID of the global network.

  • device_id (DeviceId) –

    The ID of the first device in the connection.

  • connected_device_id (DeviceId) –

    The ID of the second device in the connection.

  • link_id (Optional[LinkId], default: None ) –

    The ID of the link for the first device.

  • connected_link_id (Optional[LinkId], default: None ) –

    The ID of the link for the second device.

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

    A description of the connection.

    Length Constraints: Maximum length of 256 characters.

  • tags (Optional[TagList], default: None ) –

    The tags to apply to the resource during creation.

Raises:

Source code in docs_src/capo_networkmanager/_services/network_manager.py
def create_connection(
    self,
    global_network_id: "capo_networkmanager.types.global_network_id.GlobalNetworkId",
    device_id: "capo_networkmanager.types.device_id.DeviceId",
    connected_device_id: "capo_networkmanager.types.device_id.DeviceId",
    *,
    config_overrides: Optional[NetworkManagerClientConfig] = None,
    link_id: Optional["capo_networkmanager.types.link_id.LinkId"] = None,
    connected_link_id: Optional["capo_networkmanager.types.link_id.LinkId"] = None,
    description: Optional[
        "capo_networkmanager.types.constrained_string.ConstrainedString"
    ] = None,
    tags: Optional["capo_networkmanager.types.tag_list.TagList"] = None,
) -> (
    "capo_networkmanager.types.create_connection_response.CreateConnectionResponse"
):
    """<p>Creates a connection between two devices. The devices can be a physical or virtual appliance that connects to a third-party appliance in a VPC, or a physical appliance that connects to another physical appliance in an on-premises network.</p>

    Args:
        global_network_id: <p>The ID of the global network.</p>
        device_id: <p>The ID of the first device in the connection.</p>
        connected_device_id: <p>The ID of the second device in the connection.</p>
        link_id: <p>The ID of the link for the first device.</p>
        connected_link_id: <p>The ID of the link for the second device.</p>
        description: <p>A description of the connection.</p> <p>Length Constraints: Maximum length of 256 characters.</p>
        tags: <p>The tags to apply to the resource during creation.</p>

    Raises:
        capo_networkmanager.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_networkmanager.errors.conflict_exception.ConflictException: <p>There was a conflict processing the request. Updating or deleting the resource can cause an inconsistent state.</p>
        capo_networkmanager.errors.internal_server_exception.InternalServerException: <p>The request has failed due to an internal error.</p>
        capo_networkmanager.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>A service limit was exceeded.</p>
        capo_networkmanager.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_networkmanager.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints.</p>
        capo_networkmanager.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_networkmanager.types.create_connection_request.CreateConnectionRequest]",
    ) -> OperationResponse[
        "capo_networkmanager.types.create_connection_response.CreateConnectionResponse"
    ]:
        import capo_networkmanager._operations.network_manager.create_connection

        output, http_response = (
            capo_networkmanager._operations.network_manager.create_connection.create_connection(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateConnection")
    )
    input_: capo_networkmanager.types.create_connection_request.CreateConnectionRequest = {
        "global_network_id": global_network_id,
        "device_id": device_id,
        "connected_device_id": connected_device_id,
    }
    if link_id is not None:
        input_["link_id"] = link_id
    if connected_link_id is not None:
        input_["connected_link_id"] = connected_link_id
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

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