PrimaryIPsClient

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

Primary IPs scoped actions client

Type:

ResourceActionsClient

assign(primary_ip: PrimaryIP | BoundPrimaryIP, assignee_id: int, assignee_type: str = 'server') BoundAction[source]

Assigns a Primary IP to a assignee_id.

Parameters:
  • primary_ipBoundPrimaryIP or PrimaryIP

  • assignee_id – int Assignee the Primary IP shall be assigned to

  • assignee_type – str Assignee the Primary IP shall be assigned to

Returns:

BoundAction

change_dns_ptr(primary_ip: PrimaryIP | BoundPrimaryIP, ip: str, dns_ptr: str) BoundAction[source]

Changes the dns ptr that will appear when getting the dns ptr belonging to this Primary IP.

Parameters:
  • primary_ipBoundPrimaryIP or PrimaryIP

  • ip – str The IP address for which to set the reverse DNS entry

  • dns_ptr – str Hostname to set as a reverse DNS PTR entry, will reset to original default value if None

Returns:

BoundAction

change_protection(primary_ip: PrimaryIP | BoundPrimaryIP, delete: bool | None = None) BoundAction[source]

Changes the protection configuration of the Primary IP.

Parameters:
  • primary_ipBoundPrimaryIP or PrimaryIP

  • delete – boolean If true, prevents the Primary IP from being deleted

Returns:

BoundAction

create(type: str, datacenter: Datacenter | BoundDatacenter | None, name: str, assignee_type: str | None = 'server', assignee_id: int | None = None, auto_delete: bool | None = False, labels: dict | None = None) CreatePrimaryIPResponse[source]

Creates a new Primary IP assigned to a server.

Parameters:
  • type – str Primary IP type Choices: ipv4, ipv6

  • assignee_type – str

  • assignee_id – int (optional)

  • datacenter – Datacenter

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

  • name – str

  • auto_delete – bool (optional)

Returns:

CreatePrimaryIPResponse

delete(primary_ip: PrimaryIP | BoundPrimaryIP) bool[source]

Deletes a Primary IP. If it is currently assigned to an assignee it will automatically get unassigned.

Parameters:

primary_ipBoundPrimaryIP or PrimaryIP

Returns:

boolean

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

Get all primary ips from this account

Parameters:
  • label_selector – str (optional) Can be used to filter Primary IPs by labels. The response will only contain Primary IPs matching the label selector.able values.

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

Returns:

List[BoundPrimaryIP]

get_by_id(id: int) BoundPrimaryIP[source]

Returns a specific Primary IP object.

Parameters:

id – int

Returns:

BoundPrimaryIP

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

Get Primary IP by name

Parameters:

name – str Used to get Primary IP by name.

Returns:

BoundPrimaryIP

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

Get a list of primary ips from this account

Parameters:
  • label_selector – str (optional) Can be used to filter Primary IPs by labels. The response will only contain Primary IPs matching the label selectorable values.

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

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

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

  • ip – str (optional) Can be used to filter resources by their ip. The response will only contain the resources matching the specified ip.

Returns:

(List[BoundPrimaryIP], Meta)

unassign(primary_ip: PrimaryIP | BoundPrimaryIP) BoundAction[source]

Unassigns a Primary IP, resulting in it being unreachable. You may assign it to a server again at a later time.

Parameters:

primary_ipBoundPrimaryIP or PrimaryIP

Returns:

BoundAction

update(primary_ip: PrimaryIP | BoundPrimaryIP, auto_delete: bool | None = None, labels: dict[str, str] | None = None, name: str | None = None) BoundPrimaryIP[source]

Updates the name, auto_delete or labels of a Primary IP.

Parameters:
  • primary_ipBoundPrimaryIP or PrimaryIP

  • auto_delete – bool (optional) Delete this Primary IP when the resource it is assigned to is deleted

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

  • name – str (optional) New name to set

Returns:

BoundPrimaryIP

class BoundPrimaryIP(client: PrimaryIPsClient, data: dict, complete: bool = True)[source]
assign(assignee_id: int, assignee_type: str) BoundAction[source]

Assigns a Primary IP to a assignee.

Parameters:
  • assignee_id – int` Id of an assignee the Primary IP shall be assigned to

  • assignee_type – string` Assignee type (e.g server) the Primary IP shall be assigned to

Returns:

BoundAction

change_dns_ptr(ip: str, dns_ptr: str) BoundAction[source]

Changes the hostname that will appear when getting the hostname belonging to this Primary IP.

Parameters:
  • ip – str The IP address for which to set the reverse DNS entry

  • dns_ptr – str Hostname to set as a reverse DNS PTR entry, will reset to original default value if None

Returns:

BoundAction

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

Changes the protection configuration of the Primary IP.

Parameters:

delete – boolean If true, prevents the Primary IP from being deleted

Returns:

BoundAction

delete() bool[source]

Deletes a Primary IP. If it is currently assigned to a server it will automatically get unassigned.

Returns:

boolean

model

alias of PrimaryIP

unassign() BoundAction[source]

Unassigns a Primary IP, resulting in it being unreachable. You may assign it to a server again at a later time.

Returns:

BoundAction

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

Updates the description or labels of a Primary IP.

Parameters:
  • auto_delete – bool (optional) Auto delete IP when assignee gets deleted

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

  • name – str (optional) New Name to set

Returns:

BoundPrimaryIP

class PrimaryIP(id: int | None = None, type: str | None = None, ip: str | None = None, dns_ptr: list[dict] | None = None, datacenter: BoundDatacenter | None = None, blocked: bool | None = None, protection: dict | None = None, labels: dict[str, dict] | None = None, created: str | None = None, name: str | None = None, assignee_id: int | None = None, assignee_type: str | None = None, auto_delete: bool | None = None)[source]

Primary IP Domain

Parameters:
  • id – int ID of the Primary IP

  • ip – str IP address of the Primary IP

  • type – str Type of Primary IP. Choices: ipv4, ipv6

  • dns_ptr – List[Dict] Array of reverse DNS entries

  • datacenterDatacenter Datacenter the Primary IP was created in.

  • blocked – boolean Whether the IP is blocked

  • protection – dict Protection configuration for the Primary IP

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

  • created – datetime Point in time when the Primary IP was created

  • name – str Name of the Primary IP

  • assignee_id – int Assignee ID the Primary IP is assigned to

  • assignee_type – str Assignee Type of entity the Primary IP is assigned to

  • auto_delete – bool Delete the Primary IP when the Assignee it is assigned to is deleted.