IPs

class cherryservers_sdk_python.ips.IP(client: C, model: T)[source]

Cherry Servers IP address resource.

This class represents an existing Cherry Servers resource and should only be initialized by IPClient.

delete() None[source]

Delete Cherry Servers IP address resource.

get_id() str[source]

Get resource ID.

update(update_schema: UpdateRequest) None[source]

Update Cherry Servers IP address resource.

class cherryservers_sdk_python.ips.IPModel(*, id: str, address: str | None = None, address_family: int | None = None, cidr: str | None = None, gateway: str | None = None, type: str | None = None, region: RegionModel | None = None, routed_to: IPModel | None = None, targeted_to: AttachedServerModel | None = None, project: ProjectModel | None = None, ptr_record: str | None = None, a_record: str | None = None, tags: dict[str, str] | None = None, href: str | None = None)[source]

Cherry Servers IP address model.

This model is frozen by default, since it represents an actual Cherry Servers IP address resource state.

id

IP address ID.

Type:

int

address

IP address.

Type:

str | None

address_family

IP address family, such as 4 or 6.

Type:

str | None

cidr

IP address CIDR.

Type:

str | None

gateway

IP address gateway address, if applicable.

Type:

str | None

type

IP address type, such as floating-ip or primary-ip.

Type:

str | None

region

IP address region.

Type:

cherryservers_sdk_python.regions.RegionModel | None

routed_to

IP address that this address is routed, if applicable.

Type:

cherryservers_sdk_python.ips.IPModel | None

targeted_to

Server that this address is targeted to, if applicable.

Type:

cherryservers_sdk_python.ips.AttachedServerModel | None

project

The project that the IP address belongs to.

Type:

cherryservers_sdk_python.projects.ProjectModel | None

ptr_record

IP address PTR record, if applicable.

Type:

str | None

a_record

IP address A record, if applicable.

Type:

str | None

tags

IP address user-defined tags.

Type:

dict[str, str] | None

href

IP address href.

Type:

str | None

class cherryservers_sdk_python.ips.AttachedServerModel(*, id: int, href: str | None = None, hostname: str | None = None)[source]

Cherry Servers attached server model.

This model is frozen by default, since it represents an actual Cherry Servers server resource.

This is a minimal server model meant for other resource models than contain a server. Avoids circular references.

id

Server ID. Non-existent server will have value 0.

Type:

int

href

Server href.

Type:

str | None

hostname

Server hostname.

Type:

str | None

class cherryservers_sdk_python.ips.IPClient(api_client: _client.CherryApiClient, request_timeout: int = 120)[source]

Cherry Servers IP address client.

Manage Cherry Servers IP address resources. This class should typically be initialized by

cherryservers_sdk_python.facade.CherryApiFacade.

Example

facade = cherryservers_sdk_python.facade.CherryApiFacade(token="my-token")

# Get IP address by id.
ip = facade.ips.get_by_id("c8b0cb54-cbd6-a90f-d291-769b6db0f1b9")

# List all project IPs.
ips = facade.ips.get_by_project(123456)

# Create an IP address.
creation_req = cherryservers_sdk_python.ips.CreationRequest(
    region="LT-Siauliai",
    ptr_record="test",
    a_record="test",
    targeted_to=606764,
    tags={"env": "test"},
)
fip = facade.ips.create(creation_req, project_id=123456)

# Update IP address.
update_req = cherryservers_sdk_python.ips.UpdateRequest(
    ptr_record="",
    a_record="",
)
fip.update(update_req)

# Delete IP address.
fip.delete()
create(creation_schema: CreationRequest, project_id: int) IP[source]

Create a new IP address.

delete(ip_id: str) None[source]

Delete IP address by ID.

get_by_id(ip_id: str) IP[source]

Retrieve a IP address by ID.

list_by_project(project_id: int) list[IP][source]

Retrieve all IPs that belong to a specified project.

update(ip_id: str, update_schema: UpdateRequest) IP[source]

Update IP address by ID.

class cherryservers_sdk_python.ips.CreationRequest(*, region: str, routed_to: str | None = None, targeted_to: int | None = None, ptr_record: str | None = None, a_record: str | None = None, tags: dict[str, str] | None = None)[source]

Cherry Servers IP address creation request schema.

region

IP address region slug. Required.

Type:

str

routed_to

ID of the IP address that the created address will be routed to. Mutually exclusive with targeted_to.

Type:

str | None

targeted_to

ID of the server that the created address will be targeted to. Mutually exclusive with routed_to.

Type:

int | None

ptr_record

IP address PTR record.

Type:

str | None

a_record

IP address A record.

Type:

str | None

tags

User-defined IP address tags.

Type:

dict[str, str] | None

class cherryservers_sdk_python.ips.UpdateRequest(*, ptr_record: str | None = None, a_record: str | None = None, routed_to: str | None = None, targeted_to: int | None = None, tags: dict[str, str] | None = None)[source]

Cherry Servers IP address update request schema.

ptr_record

IP address PTR record.

Type:

str | None

a_record

IP address A record.

Type:

str | None

routed_to

ID of the IP address that this address will be routed to. Mutually exclusive with targeted_to.

Type:

str | None

targeted_to

ID of the server that this address will be targeted to. Mutually exclusive with routed_to. Set to 0 to unassign IP address from server.

Type:

int | None

tags

User-defined IP address tags.

Type:

dict[str, str] | None