CertificateClient
- class CertificatesClient(client: Client)[source]
- actions: ResourceActionsClient
Certificates scoped actions client
- Type:
- create(name: str, certificate: str, private_key: str, labels: dict[str, str] | None = None) BoundCertificate[source]
- Creates a new Certificate with the given name, certificate and private_key. This methods allows only creating
custom uploaded certificates. If you want to create a managed certificate use
create_managed()
- Parameters:
name – str
certificate – str Certificate and chain in PEM format, in order so that each record directly certifies the one preceding
private_key – str Certificate key in PEM format
labels – Dict[str, str] (optional) User-defined labels (key-value pairs)
- Returns:
- create_managed(name: str, domain_names: list[str], labels: dict[str, str] | None = None) CreateManagedCertificateResponse[source]
- Creates a new managed Certificate with the given name and domain names. This methods allows only creating
managed certificates for domains that are using the Hetzner DNS service. If you want to create a custom uploaded certificate use
create()
- Parameters:
name – str
domain_names – List[str] Domains and subdomains that should be contained in the Certificate
labels – Dict[str, str] (optional) User-defined labels (key-value pairs)
- Returns:
- delete(certificate: Certificate | BoundCertificate) bool[source]
Deletes a certificate.
- Parameters:
certificate –
BoundCertificateorCertificate- Returns:
True
- get_actions(certificate: Certificate | BoundCertificate, status: list[Literal['running', 'success', 'error']] | None = None, sort: list[Literal['id', 'id:asc', 'id:desc', 'command', 'command:asc', 'command:desc', 'status', 'status:asc', 'status:desc', 'started', 'started:asc', 'started:desc', 'finished', 'finished:asc', 'finished:desc']] | None = None) list[BoundAction][source]
Returns all Actions for a Certificate.
- Parameters:
certificate – Certificate to get the Actions for.
status – Filter the Actions by status.
sort – Sort Actions by field and direction.
- get_actions_list(certificate: Certificate | BoundCertificate, status: list[Literal['running', 'success', 'error']] | None = None, sort: list[Literal['id', 'id:asc', 'id:desc', 'command', 'command:asc', 'command:desc', 'status', 'status:asc', 'status:desc', 'started', 'started:asc', 'started:desc', 'finished', 'finished:asc', 'finished:desc']] | None = None, page: int | None = None, per_page: int | None = None) ActionsPageResult[source]
Returns a paginated list of Actions for a Certificate.
- Parameters:
certificate – Certificate to get the Actions for.
status – Filter the Actions by status.
sort – Sort Actions by field and direction.
page – Page number to get.
per_page – Maximum number of Actions returned per page.
- get_all(name: str | None = None, label_selector: str | None = None) list[BoundCertificate][source]
Get all certificates
- Parameters:
name – str (optional) Can be used to filter certificates by their name.
label_selector – str (optional) Can be used to filter certificates by labels. The response will only contain certificates matching the label selector.
- Returns:
List[
BoundCertificate]
- get_by_id(id: int) BoundCertificate[source]
Get a specific certificate by its ID.
- Parameters:
id – int
- Returns:
- get_by_name(name: str) BoundCertificate | None[source]
Get certificate by name
- Parameters:
name – str Used to get certificate by name.
- Returns:
- get_list(name: str | None = None, label_selector: str | None = None, page: int | None = None, per_page: int | None = None) CertificatesPageResult[source]
Get a list of certificates
- Parameters:
name – str (optional) Can be used to filter certificates by their name.
label_selector – str (optional) Can be used to filter certificates by labels. The response will only contain certificates 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[
BoundCertificate],Meta)
- retry_issuance(certificate: Certificate | BoundCertificate) BoundAction[source]
Returns all action objects for a Certificate.
- Parameters:
certificate –
BoundCertificateorCertificate- Returns:
- update(certificate: Certificate | BoundCertificate, name: str | None = None, labels: dict[str, str] | None = None) BoundCertificate[source]
Updates a Certificate. You can update a certificate name and labels.
- Parameters:
certificate –
BoundCertificateorCertificatename – str (optional) New name to set
labels – Dict[str, str] (optional) User-defined labels (key-value pairs)
- Returns:
- class BoundCertificate(client: CertificatesClient, data: dict[str, Any], complete: bool = True)[source]
-
- get_actions(status: list[Literal['running', 'success', 'error']] | None = None, sort: list[Literal['id', 'id:asc', 'id:desc', 'command', 'command:asc', 'command:desc', 'status', 'status:asc', 'status:desc', 'started', 'started:asc', 'started:desc', 'finished', 'finished:asc', 'finished:desc']] | None = None) list[BoundAction][source]
Returns all Actions for a Certificate.
- Parameters:
status – Filter the Actions by status.
sort – Sort Actions by field and direction.
- get_actions_list(status: list[Literal['running', 'success', 'error']] | None = None, sort: list[Literal['id', 'id:asc', 'id:desc', 'command', 'command:asc', 'command:desc', 'status', 'status:asc', 'status:desc', 'started', 'started:asc', 'started:desc', 'finished', 'finished:asc', 'finished:desc']] | None = None, page: int | None = None, per_page: int | None = None) ActionsPageResult[source]
Returns a paginated list of Actions for a Certificate.
- Parameters:
status – Filter the Actions by status.
sort – Sort Actions by field and direction.
page – Page number to get.
per_page – Maximum number of Actions returned per page.
- model
alias of
Certificate
- retry_issuance() BoundAction[source]
Retry a failed Certificate issuance or renewal. :return: BoundAction
- update(name: str | None = None, labels: dict[str, str] | None = None) BoundCertificate[source]
Updates an certificate. You can update an certificate name and the certificate labels.
- Parameters:
name – str (optional) New name to set
labels – Dict[str, str] (optional) User-defined labels (key-value pairs)
- Returns:
- class Certificate(id: int | None = None, name: str | None = None, certificate: str | None = None, not_valid_before: str | None = None, not_valid_after: str | None = None, domain_names: list[str] | None = None, fingerprint: str | None = None, created: str | None = None, labels: dict[str, str] | None = None, type: str | None = None, status: ManagedCertificateStatus | None = None)[source]
Certificate Domain
- Parameters:
id – int ID of Certificate
name – str Name of Certificate
certificate – str Certificate and chain in PEM format, in order so that each record directly certifies the one preceding
not_valid_before – datetime Point in time when the Certificate becomes valid
not_valid_after – datetime Point in time when the Certificate becomes invalid
domain_names – List[str] List of domains and subdomains covered by this certificate
fingerprint – str Fingerprint of the Certificate
labels – dict User-defined labels (key-value pairs)
created – datetime Point in time when the certificate was created
type – str Type of Certificate
status – ManagedCertificateStatus Current status of a type managed Certificate, always none for type uploaded Certificates