air_sdk.endpoints.links

View as Markdown

Stub file for links endpoint type hints.

Classes

NameDescription
LinksLabelsProperties/labels of a link.
LinkLink model representing a network link.
LinkEndpointAPIAPI client for link endpoints.

Module Contents

class air_sdk.endpoints.links.LinksLabels

Bases: typing.TypedDict

Properties/labels of a link.

cable_length: str
class air_sdk.endpoints.links.Link

Bases: air_sdk.bc.BaseCompatMixin, air_sdk.air_model.AirModel

Link model representing a network link.

id: str

Unique identifier for the link

Timestamp when the link was created

Timestamp when the link was last modified

interfaces: list[Interface]

The two interfaces connected by this link

labels: LinksLabels | None

Optional labels/properties of the link (e.g. cable_length)

get_model_api() -> type[LinkEndpointAPI]
model_api: LinkEndpointAPI
delete() -> None

Delete the link.

Example:

>>> link.delete()
class air_sdk.endpoints.links.LinkEndpointAPI

Bases: air_sdk.air_model.BaseEndpointAPI[air_sdk.endpoints.links.Link]

API client for link endpoints.

API_PATH: str
model: type[Link]
create(
*,
interfaces: list[Interface | PrimaryKey],
labels: LinksLabels | None = ...
) -> Link

Create a new link between interfaces.

Parameters:

  • interfaces – The two interfaces to connect
  • labels – Optional labels/properties of the link (e.g. cable_length)

Returns:

The created link

Example:

>>> link = api.links.create(interfaces=[interface1, interface2])
>>> link = api.links.create(
... interfaces=[interface1, interface2],
... labels={'cable_length': '5m'},
... )
list(
*,
interface: Interface | PrimaryKey = ...,
limit: int = ...,
node: Node | PrimaryKey = ...,
offset: int = ...,
search: str = ...,
ordering: str = ...,
simulation: Simulation | PrimaryKey = ...

List all links.

Parameters:

  • interface – Filter by specific interface
  • limit – Number of results to return per page
  • node – Filter by specific node
  • offset – The initial index from which to return the results
  • ordering – Order objects by field. Prefix with ”-” for desc order
  • search – Search by interface name or node name of all interfaces in a case-insensitive manner
  • simulation – Filter by specific simulation

Returns:

Iterator of Link instances

Example:

>>> # List all links
>>> for link in api.links.list():
... print(link.id)
>>> # Filter by interface
>>> for link in api.links.list(interface=interface1):
... print(link.id)
>>> # Order by creation date descending
>>> for link in api.links.list(ordering='-created'):
... print(link.id)
>>> # Search by node name
>>> for link in api.links.list(search='node-name'):
... print(link.interfaces[0].node.name, link.interfaces[1].node.name)
get(pk: PrimaryKey) -> Link

Get a specific link by ID.

Parameters:

  • pk – The link ID (string or UUID)

Returns:

The Link instance

Example:

>>> link = api.links.get('link-id')
delete(pk: PrimaryKey) -> None

Delete a specific link by ID.

Parameters:

  • pk – The link ID (string or UUID)

Example:

>>> api.links.delete('link-id')