NetworksClient

class NetworksClient(client: Client)[source]
actions: ResourceActionsClient

Networks scoped actions client

Type:

ResourceActionsClient

add_route(network: Network | BoundNetwork, route: NetworkRoute) BoundAction[source]

Adds a route entry to a network.

Parameters:
Returns:

BoundAction

add_subnet(network: Network | BoundNetwork, subnet: NetworkSubnet) BoundAction[source]

Adds a subnet entry to a network.

Parameters:
Returns:

BoundAction

change_ip_range(network: Network | BoundNetwork, ip_range: str) BoundAction[source]

Changes the IP range of a network.

Parameters:
Returns:

BoundAction

change_protection(network: Network | BoundNetwork, delete: bool | None = None) BoundAction[source]

Changes the protection configuration of a network.

Parameters:
  • networkBoundNetwork or Network

  • delete – boolean If True, prevents the network from being deleted

Returns:

BoundAction

create(name: str, ip_range: str, subnets: list[NetworkSubnet] | None = None, routes: list[NetworkRoute] | None = None, expose_routes_to_vswitch: bool | None = None, labels: dict[str, str] | None = None) BoundNetwork[source]

Creates a network with range ip_range.

Parameters:
  • name – str Name of the network

  • ip_range – str IP range of the whole network which must span all included subnets and route destinations

  • subnets – List[NetworkSubnet] Array of subnets allocated

  • routes – List[NetworkRoute] Array of routes set in this network

  • expose_routes_to_vswitch – Optional[bool] Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.

  • labels – Dict[str, str] (optional) User-defined labels (key-value pairs)

Returns:

BoundNetwork

delete(network: Network | BoundNetwork) bool[source]

Deletes a network.

Parameters:

networkBoundNetwork or Network

Returns:

boolean

delete_route(network: Network | BoundNetwork, route: NetworkRoute) BoundAction[source]

Removes a route entry to a network.

Parameters:
Returns:

BoundAction

delete_subnet(network: Network | BoundNetwork, subnet: NetworkSubnet) BoundAction[source]

Removes a subnet entry from a network

Parameters:
Returns:

BoundAction

get_actions(network: Network | BoundNetwork, status: list[str] | None = None, sort: list[str] | None = None) list[BoundAction][source]

Returns all action objects for a network.

Parameters:
  • networkBoundNetwork or Network

  • status – List[str] (optional) Response will have only actions with specified statuses. Choices: running success error

  • sort – List[str] (optional) Specify how the results are sorted. Choices: id id:asc id:desc command command:asc command:desc status status:asc status:desc progress progress:asc progress:desc started started:asc started:desc finished finished:asc finished:desc

Returns:

List[BoundAction]

get_actions_list(network: Network | BoundNetwork, status: list[str] | None = None, sort: list[str] | None = None, page: int | None = None, per_page: int | None = None) ActionsPageResult[source]

Returns all action objects for a network.

Parameters:
  • networkBoundNetwork or Network

  • status – List[str] (optional) Response will have only actions with specified statuses. Choices: running success error

  • sort – List[str] (optional) Specify how the results are sorted. Choices: id id:asc id:desc command command:asc command:desc status status:asc status:desc progress progress:asc progress:desc started started:asc started:desc finished finished:asc finished:desc

  • page – int (optional) Specifies the page to fetch

  • per_page – int (optional) Specifies how many results are returned by page

Returns:

(List[BoundAction], Meta)

get_all(name: str | None = None, label_selector: str | None = None) list[BoundNetwork][source]

Get all networks from this account

Parameters:
  • name – str (optional) Can be used to filter networks by their name.

  • label_selector – str (optional) Can be used to filter networks by labels. The response will only contain networks matching the label selector.

Returns:

List[BoundNetwork]

get_by_id(id: int) BoundNetwork[source]

Get a specific network

Parameters:

id – int

Returns:

BoundNetwork

get_by_name(name: str) BoundNetwork | None[source]

Get network by name

Parameters:

name – str Used to get network by name.

Returns:

BoundNetwork

get_list(name: str | None = None, label_selector: str | None = None, page: int | None = None, per_page: int | None = None) NetworksPageResult[source]

Get a list of networks from this account

Parameters:
  • name – str (optional) Can be used to filter networks by their name.

  • label_selector – str (optional) Can be used to filter networks by labels. The response will only contain networks matching the label selector.

  • page – int (optional) Specifies the page to fetch

  • per_page – int (optional) Specifies how many results are returned by page

Returns:

(List[BoundNetwork], Meta)

update(network: Network | BoundNetwork, name: str | None = None, expose_routes_to_vswitch: bool | None = None, labels: dict[str, str] | None = None) BoundNetwork[source]

Updates a network. You can update a network’s name and a network’s labels.

Parameters:
  • networkBoundNetwork or Network

  • name – str (optional) New name to set

  • expose_routes_to_vswitch – Optional[bool] Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.

  • labels – Dict[str, str] (optional) User-defined labels (key-value pairs)

Returns:

BoundNetwork

class BoundNetwork(client: NetworksClient, data: dict, complete: bool = True)[source]
add_route(route: NetworkRoute) BoundAction[source]

Adds a route entry to a network.

Parameters:

routeNetworkRoute The NetworkRoute you want to add to the Network

Returns:

BoundAction

add_subnet(subnet: NetworkSubnet) BoundAction[source]

Adds a subnet entry to a network.

Parameters:

subnetNetworkSubnet The NetworkSubnet you want to add to the Network

Returns:

BoundAction

change_ip_range(ip_range: str) BoundAction[source]

Changes the IP range of a network.

Parameters:

ip_range – str The new prefix for the whole network.

Returns:

BoundAction

change_protection(delete: bool | None = None) BoundAction[source]

Changes the protection configuration of a network.

Parameters:

delete – boolean If True, prevents the network from being deleted

Returns:

BoundAction

delete() bool[source]

Deletes a network.

Returns:

boolean

delete_route(route: NetworkRoute) BoundAction[source]

Removes a route entry to a network.

Parameters:

routeNetworkRoute The NetworkRoute you want to remove from the Network

Returns:

BoundAction

delete_subnet(subnet: NetworkSubnet) BoundAction[source]

Removes a subnet entry from a network

Parameters:

subnetNetworkSubnet The NetworkSubnet you want to remove from the Network

Returns:

BoundAction

get_actions(status: list[str] | None = None, sort: list[str] | None = None) list[BoundAction][source]

Returns all action objects for a network.

Parameters:
  • status – List[str] (optional) Response will have only actions with specified statuses. Choices: running success error

  • sort – List[str] (optional) Specify how the results are sorted. Choices: id id:asc id:desc command command:asc command:desc status status:asc status:desc progress progress:asc progress:desc started started:asc started:desc finished finished:asc finished:desc

Returns:

List[BoundAction]

get_actions_list(status: list[str] | None = None, sort: list[str] | None = None, page: int | None = None, per_page: int | None = None) ActionsPageResult[source]

Returns all action objects for a network.

Parameters:
  • status – List[str] (optional) Response will have only actions with specified statuses. Choices: running success error

  • sort – List[str] (optional) Specify how the results are sorted. Choices: id id:asc id:desc command command:asc command:desc status status:asc status:desc progress progress:asc progress:desc started started:asc started:desc finished finished:asc finished:desc

  • page – int (optional) Specifies the page to fetch

  • per_page – int (optional) Specifies how many results are returned by page

Returns:

(List[BoundAction], Meta)

model

alias of Network

update(name: str | None = None, expose_routes_to_vswitch: bool | None = None, labels: dict[str, str] | None = None) BoundNetwork[source]

Updates a network. You can update a network’s name and a networks’s labels.

Parameters:
  • name – str (optional) New name to set

  • expose_routes_to_vswitch – Optional[bool] Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.

  • labels – Dict[str, str] (optional) User-defined labels (key-value pairs)

Returns:

BoundNetwork

class Network(id: int, name: str | None = None, created: str | None = None, ip_range: str | None = None, subnets: list[NetworkSubnet] | None = None, routes: list[NetworkRoute] | None = None, expose_routes_to_vswitch: bool | None = None, servers: list[BoundServer] | None = None, protection: dict | None = None, labels: dict[str, str] | None = None)[source]

Network Domain

Parameters:
  • id – int ID of the network

  • name – str Name of the network

  • ip_range – str IPv4 prefix of the whole network

  • subnets – List[NetworkSubnet] Subnets allocated in this network

  • routes – List[NetworkRoute] Routes set in this network

  • expose_routes_to_vswitch – bool Indicates if the routes from this network should be exposed to the vSwitch connection.

  • servers – List[BoundServer] Servers attached to this network

  • protection – dict Protection configuration for the network

  • labels – dict User-defined labels (key-value pairs)

class NetworkSubnet(ip_range: str, type: str | None = None, network_zone: str | None = None, gateway: str | None = None, vswitch_id: int | None = None)[source]

Network Subnet Domain

Parameters:
  • type – str Type of sub network.

  • ip_range – str Range to allocate IPs from.

  • network_zone – str Name of network zone.

  • gateway – str Gateway for the route.

  • vswitch_id – int ID of the vSwitch.

TYPE_CLOUD = 'cloud'

Subnet Type cloud

TYPE_SERVER = 'server'

Subnet Type server, deprecated, use TYPE_CLOUD instead

TYPE_VSWITCH = 'vswitch'

Subnet Type vSwitch

class NetworkRoute(destination: str, gateway: str)[source]

Network Route Domain

Parameters:
  • destination – str Destination network or host of this route.

  • gateway – str Gateway for the route.

class CreateNetworkResponse(network: BoundNetwork, action: BoundAction)[source]

Create Network Response Domain

Parameters:
  • networkBoundNetwork The network which was created

  • actionBoundAction The Action which shows the progress of the network Creation