Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 10 additions & 29 deletions lib/charms/observability_libs/v1/cert_handler.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
"""## Overview.
"""# [DEPRECATED] CertHandler Library.

This document explains how to use the `CertHandler` class to
create and manage TLS certificates through the `tls_certificates` interface.
The `cert_handler` library is deprecated and will be **removed in October 2025**.
Please migrate to the `tls_certificates_interface.v4` charm library.

The goal of the CertHandler is to provide a wrapper to the `tls_certificates`
library functions to make the charm integration smoother.

## Library Usage

This library should be used to create a `CertHandler` object, as per the
following example:

```python
self.cert_handler = CertHandler(
charm=self,
key="my-app-cert-manager",
cert_subject="unit_name", # Optional
)
```

You can then observe the library's custom event and make use of the key and cert:
```python
self.framework.observe(self.cert_handler.on.cert_changed, self._on_server_cert_changed)

container.push(keypath, self.cert_handler.private_key)
container.push(certpath, self.cert_handler.server_cert)
```

Since this library uses [Juju Secrets](https://juju.is/docs/juju/secret) it requires Juju >= 3.0.3.
"""
import abc
import hashlib
import ipaddress
import json
import socket
import warnings
from itertools import filterfalse
from typing import Dict, List, Optional, Union

Expand Down Expand Up @@ -68,11 +44,16 @@

LIBID = "b5cd5cd580f3428fa5f59a8876dcbe6a"
LIBAPI = 1
LIBPATCH = 17
LIBPATCH = 18

VAULT_SECRET_LABEL = "cert-handler-private-vault"


warnings.warn(
"The `cert_handler` library is deprecated and will be removed in October 2025. Please migrate to the `tls_certificates_interface.v4` charm library.",
DeprecationWarning,
)

def is_ip_address(value: str) -> bool:
"""Return True if the input value is a valid IPv4 address; False otherwise."""
try:
Expand Down
Loading