SSH Keys

class cherryservers_sdk_python.sshkeys.SSHKey(client: C, model: T)[source]

Cherry Servers SSH key resource.

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

delete() None[source]

Delete Cherry Servers SSH key resource.

get_id() int[source]

Get resource ID.

get_model() T

Get resource model.

This model is frozen, since it represents actual resource state.

update(update_schema: UpdateRequest) None[source]

Update Cherry Servers SSH key resource.

class cherryservers_sdk_python.sshkeys.SSHKeyModel(*, id: int, label: str | None = None, key: str | None = None, fingerprint: str | None = None, user: UserModel | None = None, updated: str | None = None, created: str | None = None, href: str | None = None)[source]

Cherry Servers SSH key model.

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

id

SSH key ID.

Type:

int

label

SSH key label.

Type:

str | None

key

Public SSH key.

Type:

str | None

fingerprint

SSH key fingerprint.

Type:

str | None

user

SSH key user.

Type:

cherryservers_sdk_python.users.UserModel | None

updated

Timestamp of the last SSH key update.

Type:

str | None

created

Timestamp of the SSH key creation.

Type:

str | None

href

SSH key href.

Type:

str | None

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

Cherry Servers SSH key client.

Manage Cherry Servers SSH key resources. This class should typically be initialized by cherryservers_sdk_python.facade.CherryApiFacade.

Example

# Create SSH key.
facade = cherryservers_sdk_python.facade.CherryApiFacade(token="my-token")
req = cherryservers_sdk_python.sshkeys.CreationRequest(
    label = "test",
    key = "my-public-api-key"
)
sshkey = facade.sshkeys.create(req)

# Update SSH key.
upd_req = cherryservers_sdk_python.sshkeys.UpdateRequest(
    label = "test-updated"
)
sshkey.update(upd_req)

# Remove SSH key.
sshkey.delete()
create(creation_schema: CreationRequest) SSHKey[source]

Create a new SSH key.

delete(sshkey_id: int) None[source]

Delete SSH key by ID.

get_all() list[SSHKey][source]

Retrieve all SSH keys.

get_by_id(sshkey_id: int) SSHKey[source]

Retrieve an SSH key by ID.

update(sshkey_id: int, update_schema: UpdateRequest) SSHKey[source]

Update SSH key by ID.

class cherryservers_sdk_python.sshkeys.CreationRequest(*, label: str, key: str)[source]

Cherry Servers SSH key creation request schema.

label

SSH key label.

Type:

str

key

Public SSH key.

Type:

str

class cherryservers_sdk_python.sshkeys.UpdateRequest(*, label: str | None = None, key: str | None = None)[source]

Cherry Servers SSH key update request schema.

label

SSH key label.

Type:

str | None

key

Public SSH key.

Type:

str | None