Skip to content

Terminate commercial peer

A workflow for terminating a Commercial Peer subscription.

initial_input_form_generator(subscription_id)

Ask the user for confirmation whether to terminate the selected Commercial Peer subscription.

Source code in gso/workflows/commercial_peer/terminate_commercial_peer.py
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
    """Ask the user for confirmation whether to terminate the selected Commercial Peer subscription."""
    commercial_peer_subscription = CommercialPeer.from_subscription(subscription_id)

    class TerminateForm(SubmitFormPage):
        termination_label: Label = "Are you sure you want to delete the Commercial Peer subscription?"
        tt_number: TTNumber

        @model_validator(mode="before")
        def commercial_peer_must_have_empty_peering_connections(cls, data: Any) -> Any:
            if commercial_peer_subscription.commercial_peer.peering_connection_list:
                msg = "Commercial Peer must not have any peering connections assigned to it before it can be deleted."
                raise ValueError(msg)
            return data

    user_input = yield TerminateForm
    return user_input.model_dump()

terminate_commercial_peer()

Terminate a Commercial Peer subscription.

Source code in gso/workflows/commercial_peer/terminate_commercial_peer.py
@terminate_workflow("Terminate Commercial Peer", initial_input_form=initial_input_form_generator)
def terminate_commercial_peer() -> StepList:
    """Terminate a Commercial Peer subscription."""
    return begin