# cloudcoil-models-cert-manager
Versioned cert-manager models for cloudcoil.
## 🔧 Installation
Using [uv](https://github.com/astral-sh/uv) (recommended):
```bash
# Install with cert-manager support
uv add cloudcoil.models.cert_manager
```
Using pip:
```bash
pip install cloudcoil.models.cert_manager
```
## 💡 Examples
### Using cert-manager Models
```python
from cloudcoil import apimachinery
import cloudcoil.models.cert_manager.v1 as cm
# Create a Certificate
certificate = cm.Certificate(
metadata=apimachinery.ObjectMeta(name="example-cert", namespace="default"),
spec=cm.CertificateSpec(
secret_name="example-cert-tls",
issuer_ref=cm.IssuerRef(name="example-issuer"),
dns_names=["example.com"]
)
).create()
# List Certificates
for cert in cm.Certificate.list(namespace="default"):
print(f"Found certificate: {cert.metadata.name}")
# Update a Certificate
certificate.spec.dns_names.append("www.example.com")
certificate.save()
# Delete a Certificate
cm.Certificate.delete("example-cert", namespace="default")
```
### Using the Fluent Builder API
Cloudcoil provides a powerful fluent builder API for cert-manager resources with full IDE support and rich autocomplete capabilities:
```python
from cloudcoil.models.cert_manager.v1 import Certificate, ClusterIssuer
# Create a Certificate using the fluent builder
# The fluent style is great for one-liners and simple configurations
certificate = (
Certificate.builder()
.metadata(lambda metadata: metadata
.name("example-cert")
.namespace("default")
.labels({"env": "prod"})
)
.spec(lambda cert_spec: cert_spec
.secret_name("example-cert-tls")
.issuer_ref(lambda issuer: issuer
.name("example-issuer")
.kind("ClusterIssuer")
)
.dns_names(["example.com", "www.example.com"])
.subject(lambda subject: subject
.organizations(["Example Corp"])
)
)
.build()
)
# Create a ClusterIssuer using the builder
cluster_issuer = (
ClusterIssuer.builder()
.metadata(lambda m: m.name("letsencrypt-prod"))
.spec(
lambda s: s.acme(
lambda acme: acme.email("admin@example.com")
.server("https://acme-v02.api.letsencrypt.org/directory")
.private_key_secret_ref(lambda ref: ref.name("letsencrypt-account-key"))
.solvers(
lambda solvers: solvers.add(
lambda solver: solver.http01(
lambda http: http.ingress(lambda ing: ing.class_("nginx"))
)
)
)
)
)
.build()
)
```
### Using the Context Manager Builder API
For complex nested resources, Cloudcoil also provides a context manager-based builder pattern that can make the structure more clear:
```python
from cloudcoil.models.cert_manager.v1 import Certificate, ClusterIssuer
# Create a certificate using context managers
with Certificate.new() as cert:
with cert.metadata() as metadata:
metadata.name("example-cert")
metadata.namespace("default")
metadata.labels({"env": "prod"})
with cert.spec() as spec:
spec.secret_name("example-cert-tls")
with spec.issuer_ref() as issuer_ref:
issuer_ref.name("example-issuer")
issuer_ref.kind("ClusterIssuer")
spec.dns_names(["example.com", "www.example.com"])
with spec.subject() as subject:
subject.organizations(["Example Corp"])
final_cert = cert.build()
# Create a ClusterIssuer using context managers
with ClusterIssuer.new() as issuer:
with issuer.metadata() as metadata:
metadata.name("letsencrypt-prod")
with issuer.spec() as spec:
with spec.acme() as acme:
acme.email("admin@example.com")
acme.server("https://acme-v02.api.letsencrypt.org/directory")
with acme.private_key_secret_ref() as key_ref:
key_ref.name("letsencrypt-account-key")
with acme.solvers() as solvers:
with solvers.add() as solver:
with solver.http01() as http:
with http.ingress() as ingress:
ingress.class_("nginx")
final_issuer = issuer.build()
```
The context manager builder provides:
- 🎭 Clear visual nesting of resource structure
- 🔒 Automatic resource cleanup
- 🎯 Familiar Python context manager pattern
- ✨ Same great IDE support as the fluent builder
### Mixing Builder Styles
CloudCoil's intelligent builder system automatically detects which style you're using and provides appropriate IDE support:
```python
from cloudcoil.models.cert_manager.v1 import Certificate
from cloudcoil import apimachinery
# Mixing styles lets you choose the best approach for each part
with Certificate.new() as cert:
# Direct object initialization with full type checking
cert.metadata(apimachinery.ObjectMeta(
name="example-cert",
namespace="default",
labels={"env": "prod"}
))
with cert.spec() as spec:
# Simple fields directly
spec.secret_name("example-cert-tls")
# Fluent style
spec.issuer_ref(lambda ref: ref
.name("example-issuer")
.kind("ClusterIssuer")
)
# Direct assignment
spec.dns_names(["example.com", "www.example.com"])
# Context manager style
with spec.subject() as subject:
subject.organizations(["Example Corp"])
final_cert = cert.build()
```
This flexibility allows you to:
- 🔀 Choose the most appropriate style for each part of your configuration
- 📖 Maximize readability for both simple and complex structures
- 🎨 Format your code according to your team's preferences
- 🧠 Get full IDE support with automatic style detection
- ✨ Enjoy rich autocomplete in all styles
- ⚡ Benefit from type checking across mixed styles
- 🎯 Receive immediate feedback on type errors
- 🔍 See documentation for all fields regardless of style
## 📚 Documentation
For complete documentation, visit [cloudcoil.github.io/cloudcoil](https://cloudcoil.github.io/cloudcoil)
## 📜 License
Apache License, Version 2.0 - see [LICENSE](LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "cloudcoil.models.cert-manager",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Sambhav Kothari <sambhavs.email@gmail.com>",
"keywords": "async, cert-manager, cloud-native, cloudcoil, cloudcoil-models, kubernetes, pydantic, python",
"author": null,
"author_email": "Sambhav Kothari <sambhavs.email@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/db/ce/5384092753cffbfd313b4e65a90afa4fd0e16d37c3bc1dce39c2613d4989/cloudcoil_models_cert_manager-1.16.3.4.tar.gz",
"platform": null,
"description": "# cloudcoil-models-cert-manager\n\nVersioned cert-manager models for cloudcoil.\n## \ud83d\udd27 Installation\n\nUsing [uv](https://github.com/astral-sh/uv) (recommended):\n\n```bash\n# Install with cert-manager support\nuv add cloudcoil.models.cert_manager\n```\n\nUsing pip:\n\n```bash\npip install cloudcoil.models.cert_manager\n```\n\n## \ud83d\udca1 Examples\n\n### Using cert-manager Models\n\n```python\nfrom cloudcoil import apimachinery\nimport cloudcoil.models.cert_manager.v1 as cm\n\n# Create a Certificate\ncertificate = cm.Certificate(\n metadata=apimachinery.ObjectMeta(name=\"example-cert\", namespace=\"default\"),\n spec=cm.CertificateSpec(\n secret_name=\"example-cert-tls\",\n issuer_ref=cm.IssuerRef(name=\"example-issuer\"),\n dns_names=[\"example.com\"]\n )\n).create()\n\n# List Certificates\nfor cert in cm.Certificate.list(namespace=\"default\"):\n print(f\"Found certificate: {cert.metadata.name}\")\n\n# Update a Certificate\ncertificate.spec.dns_names.append(\"www.example.com\")\ncertificate.save()\n\n# Delete a Certificate\ncm.Certificate.delete(\"example-cert\", namespace=\"default\")\n```\n\n### Using the Fluent Builder API\n\nCloudcoil provides a powerful fluent builder API for cert-manager resources with full IDE support and rich autocomplete capabilities:\n\n```python\nfrom cloudcoil.models.cert_manager.v1 import Certificate, ClusterIssuer\n\n# Create a Certificate using the fluent builder\n# The fluent style is great for one-liners and simple configurations\ncertificate = (\n Certificate.builder()\n .metadata(lambda metadata: metadata\n .name(\"example-cert\")\n .namespace(\"default\")\n .labels({\"env\": \"prod\"})\n )\n .spec(lambda cert_spec: cert_spec\n .secret_name(\"example-cert-tls\")\n .issuer_ref(lambda issuer: issuer\n .name(\"example-issuer\")\n .kind(\"ClusterIssuer\")\n )\n .dns_names([\"example.com\", \"www.example.com\"])\n .subject(lambda subject: subject\n .organizations([\"Example Corp\"])\n )\n )\n .build()\n)\n\n# Create a ClusterIssuer using the builder\ncluster_issuer = (\n ClusterIssuer.builder()\n .metadata(lambda m: m.name(\"letsencrypt-prod\"))\n .spec(\n lambda s: s.acme(\n lambda acme: acme.email(\"admin@example.com\")\n .server(\"https://acme-v02.api.letsencrypt.org/directory\")\n .private_key_secret_ref(lambda ref: ref.name(\"letsencrypt-account-key\"))\n .solvers(\n lambda solvers: solvers.add(\n lambda solver: solver.http01(\n lambda http: http.ingress(lambda ing: ing.class_(\"nginx\"))\n )\n )\n )\n )\n )\n .build()\n)\n```\n\n### Using the Context Manager Builder API\n\nFor complex nested resources, Cloudcoil also provides a context manager-based builder pattern that can make the structure more clear:\n\n```python\nfrom cloudcoil.models.cert_manager.v1 import Certificate, ClusterIssuer\n\n# Create a certificate using context managers\nwith Certificate.new() as cert:\n with cert.metadata() as metadata:\n metadata.name(\"example-cert\")\n metadata.namespace(\"default\")\n metadata.labels({\"env\": \"prod\"})\n \n with cert.spec() as spec:\n spec.secret_name(\"example-cert-tls\")\n \n with spec.issuer_ref() as issuer_ref:\n issuer_ref.name(\"example-issuer\")\n issuer_ref.kind(\"ClusterIssuer\")\n \n spec.dns_names([\"example.com\", \"www.example.com\"])\n \n with spec.subject() as subject:\n subject.organizations([\"Example Corp\"])\n\nfinal_cert = cert.build()\n\n# Create a ClusterIssuer using context managers\nwith ClusterIssuer.new() as issuer:\n with issuer.metadata() as metadata:\n metadata.name(\"letsencrypt-prod\")\n \n with issuer.spec() as spec:\n with spec.acme() as acme:\n acme.email(\"admin@example.com\")\n acme.server(\"https://acme-v02.api.letsencrypt.org/directory\")\n \n with acme.private_key_secret_ref() as key_ref:\n key_ref.name(\"letsencrypt-account-key\")\n \n with acme.solvers() as solvers:\n with solvers.add() as solver:\n with solver.http01() as http:\n with http.ingress() as ingress:\n ingress.class_(\"nginx\")\n\nfinal_issuer = issuer.build()\n```\n\nThe context manager builder provides:\n- \ud83c\udfad Clear visual nesting of resource structure\n- \ud83d\udd12 Automatic resource cleanup\n- \ud83c\udfaf Familiar Python context manager pattern\n- \u2728 Same great IDE support as the fluent builder\n\n### Mixing Builder Styles\n\nCloudCoil's intelligent builder system automatically detects which style you're using and provides appropriate IDE support:\n\n```python\nfrom cloudcoil.models.cert_manager.v1 import Certificate\nfrom cloudcoil import apimachinery\n\n# Mixing styles lets you choose the best approach for each part\nwith Certificate.new() as cert:\n # Direct object initialization with full type checking\n cert.metadata(apimachinery.ObjectMeta(\n name=\"example-cert\",\n namespace=\"default\",\n labels={\"env\": \"prod\"}\n ))\n \n with cert.spec() as spec:\n # Simple fields directly\n spec.secret_name(\"example-cert-tls\")\n # Fluent style\n spec.issuer_ref(lambda ref: ref\n .name(\"example-issuer\")\n .kind(\"ClusterIssuer\")\n )\n # Direct assignment\n spec.dns_names([\"example.com\", \"www.example.com\"])\n # Context manager style\n with spec.subject() as subject:\n subject.organizations([\"Example Corp\"])\n\nfinal_cert = cert.build()\n```\n\nThis flexibility allows you to:\n- \ud83d\udd00 Choose the most appropriate style for each part of your configuration\n- \ud83d\udcd6 Maximize readability for both simple and complex structures\n- \ud83c\udfa8 Format your code according to your team's preferences\n- \ud83e\udde0 Get full IDE support with automatic style detection\n- \u2728 Enjoy rich autocomplete in all styles\n- \u26a1 Benefit from type checking across mixed styles\n- \ud83c\udfaf Receive immediate feedback on type errors\n- \ud83d\udd0d See documentation for all fields regardless of style\n\n## \ud83d\udcda Documentation\n\nFor complete documentation, visit [cloudcoil.github.io/cloudcoil](https://cloudcoil.github.io/cloudcoil)\n\n## \ud83d\udcdc License\n\nApache License, Version 2.0 - see [LICENSE](LICENSE)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Versioned cert-manager models for cloudcoil",
"version": "1.16.3.4",
"project_urls": {
"Changelog": "https://github.com/cloudcoil/models-cert-manager/releases",
"Documentation": "https://cloudcoil.github.io/cloudcoil",
"Homepage": "https://github.com/cloudcoil/cloudcoil",
"Issues": "https://github.com/cloudcoil/models-cert-manager/issues",
"Repository": "https://github.com/cloudcoil/models-cert-manager"
},
"split_keywords": [
"async",
" cert-manager",
" cloud-native",
" cloudcoil",
" cloudcoil-models",
" kubernetes",
" pydantic",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9bc9f83ebe1251e4f5ba790086b1918a694c7aaba66f248808554bc627a3120a",
"md5": "a6099b125b67efbd67857d173e545a53",
"sha256": "2fef5e07b70100ca2f0b4cdc57aa3ef795bf547ff3b6a3841900ed8f611b8cd1"
},
"downloads": -1,
"filename": "cloudcoil_models_cert_manager-1.16.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a6099b125b67efbd67857d173e545a53",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 98549,
"upload_time": "2025-01-25T22:12:35",
"upload_time_iso_8601": "2025-01-25T22:12:35.875874Z",
"url": "https://files.pythonhosted.org/packages/9b/c9/f83ebe1251e4f5ba790086b1918a694c7aaba66f248808554bc627a3120a/cloudcoil_models_cert_manager-1.16.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dbce5384092753cffbfd313b4e65a90afa4fd0e16d37c3bc1dce39c2613d4989",
"md5": "6ea19236470479735cdf92bd5eaeb1b2",
"sha256": "e776cb0aca3e0f3878a343a4d8c573ae248ea2e3498fbe354f317952d7c492cc"
},
"downloads": -1,
"filename": "cloudcoil_models_cert_manager-1.16.3.4.tar.gz",
"has_sig": false,
"md5_digest": "6ea19236470479735cdf92bd5eaeb1b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 158111,
"upload_time": "2025-01-25T22:12:38",
"upload_time_iso_8601": "2025-01-25T22:12:38.053461Z",
"url": "https://files.pythonhosted.org/packages/db/ce/5384092753cffbfd313b4e65a90afa4fd0e16d37c3bc1dce39c2613d4989/cloudcoil_models_cert_manager-1.16.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-25 22:12:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloudcoil",
"github_project": "models-cert-manager",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cloudcoil.models.cert-manager"
}