code: def disable_port(port: int, ignore_disabled: bool = True) -> None:
      """Make a request to the cloud controlplane to close a port of the flow."""
      app_id = os.getenv("LIGHTNING_CLOUD_APP_ID", None)
      project_id = os.getenv("LIGHTNING_CLOUD_PROJECT_ID", None)
  
      if not app_id or not project_id:
          raise Exception(
              "The app_id and project_id should be defined."
          )
  
      client = LightningClient()
      list_apps_resp = client.lightningapp_instance_service_list_lightningapp_instances(
          project_id=project_id
      )
      lit_app: Optional[Externalv1LightningappInstance] = None
  
      for lapp in list_apps_resp.lightningapps:
          if lapp.id == app_id:
              lit_app = lapp
  
      if not lit_app:
          raise RuntimeError(
              "App was not found. Please open an issue at https://github.com/lightning-AI/lightning/issues."
          )
  
      found_nc = None
  
      for nc in lit_app.spec.network_config:
          if nc.port == port:
              if not nc.enable and not ignore_disabled:
                  raise RuntimeError(
                      f"The port {port} was already disabled."
                  )
  
              nc.enable = False
              found_nc = nc
              break
  
      client.lightningapp_instance_service_update_lightningapp_instance(
          project_id=project_id,
          id=lit_app.id,
          body=AppinstancesIdBody(name=lit_app.name, spec=lit_app.spec),
      )
  
      if not found_nc:
          ports = [nc.port for nc in lit_app.spec.network_config]
          raise ValueError(
              f"The provided port doesn't exists. Available ports are {ports}."
          )
  
      assert found_nc
  
file_path: pytorch-lightning/src/lightning/app/utilities/port.py
imports: import os
  import socket
  from typing import Optional
  from lightning_cloud.openapi import AppinstancesIdBody, Externalv1LightningappInstance, V1NetworkConfig
  from lightning.app.utilities.network import LightningClient, find_free_network_port
label_desc: Use image node_id 4 for calling a global function with example usage: disable_port(port, ignore_disabled) without return types