# cloudcoil-models-knative-serving
Versioned knative-serving models for cloudcoil.
> [!WARNING]
> This repository is auto-generated from the [cloudcoil repository](https://github.com/cloudcoil/cloudcoil/tree/main/models/knative-serving). Please do not submit pull requests here. Instead, submit them to the main repository at https://github.com/cloudcoil/cloudcoil.
## 🔧 Installation
> [!NOTE]
> For versioning information and compatibility, see the [Versioning Guide](https://github.com/cloudcoil/cloudcoil/blob/main/VERSIONING.md).
Using [uv](https://github.com/astral-sh/uv) (recommended):
```bash
# Install with Knative Serving support
uv add cloudcoil.models.knative-serving
```
Using pip:
```bash
pip install cloudcoil.models.knative-serving
```
## 💡 Examples
### Using Knative Serving Models
```python
from cloudcoil import apimachinery
import cloudcoil.models.knative_serving.serving.v1 as serving
# Create a Service
service = serving.Service(
metadata=apimachinery.ObjectMeta(name="hello"),
spec=serving.ServiceSpec(
template=serving.Template(
spec=serving.Spec(
containers=[
serving.Container(
image="gcr.io/knative-samples/helloworld-go",
ports=[serving.Port(container_port=8080)],
env=[
serving.Env(name="TARGET", value="World")
]
)
]
)
)
)
).create()
# List Services
for svc in serving.Service.list():
print(f"Found Service: {svc.metadata.name}")
```
### Using the Fluent Builder API
Cloudcoil provides a powerful fluent builder API for Knative Serving resources:
```python
from cloudcoil.models.knative_serving.serving.v1 import Service
# Create a Service using the fluent builder
service = (
Service.builder()
# Metadata configuration
.metadata(lambda metadata: metadata
.name("hello")
.namespace("default")
.labels({"app": "hello"})
)
# Complex nested structures with proper collection handling
.spec(lambda spec: spec
.template(lambda template: template
.metadata(lambda t_metadata: t_metadata
.labels({"app": "hello"})
)
.spec(lambda revision_spec: revision_spec
# Container list with nested collection handling
.containers(lambda containers: containers.add(
lambda container: container
.name("hello")
.image("gcr.io/knative-samples/helloworld-go")
# Collections use add() helper for better type support
.ports(lambda ports: ports
.add(lambda p: p.container_port(8080))
)
.env(lambda env: env
.add(lambda e: e.name("TARGET").value("World"))
.add(lambda e: e.name("PORT").value("8080"))
)
# Resource requirements can be chained
.resources(lambda r: r
.requests({"cpu": "100m", "memory": "128Mi"})
.limits({"cpu": "200m", "memory": "256Mi"})
)
))
)
)
)
.build()
)
```
### Using the Context Manager Builder API
For complex serving configurations, you can use the context manager-based builder:
```python
from cloudcoil.models.knative_serving.serving.v1 import Service
# Create a Service using context managers
with Service.new() as service:
with service.metadata() as metadata:
metadata.name("hello")
metadata.namespace("default")
with service.spec() as spec:
with spec.template() as template:
with template.spec() as revision_spec:
with revision_spec.containers() as container_list:
with container_list.add() as container:
container.name("hello")
container.image("gcr.io/knative-samples/helloworld-go")
with container.ports() as port_list:
with port_list.add() as port:
port.container_port(8080)
with container.env() as env_list:
with env_list.add() as env:
env.name("TARGET")
env.value("World")
final_service = service.build()
```
### Mixing Builder Styles
You can mix different builder styles based on your needs:
```python
from cloudcoil.models.knative_serving.serving.v1 import Service
from cloudcoil import apimachinery
# Create a Service using mixed styles
with Service.new() as service:
# Direct object initialization
service.metadata(apimachinery.ObjectMeta(
name="hello"
))
# Fluent style for spec
service.spec(lambda s: s
.template(lambda t: t
.spec(lambda rs: rs
.containers(lambda containers: containers.add(
lambda container: container
.name("hello")
.image("gcr.io/knative-samples/helloworld-go")
# Collections use add() helper for better type support
.ports(lambda ports: ports
.add(lambda p: p.container_port(8080))
)
))
)
)
)
final_service = service.build()
```
## 📚 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.knative-serving",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Sambhav Kothari <sambhavs.email@gmail.com>",
"keywords": "async, cloud-native, cloudcoil, cloudcoil-models, knative-serving, kubernetes, pydantic, python",
"author": null,
"author_email": "Sambhav Kothari <sambhavs.email@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a4/70/157e2d6cc9164976cb41e7818631c6ab8db979783810eb1bab8046d4d80c/cloudcoil_models_knative_serving-1.17.0.1.tar.gz",
"platform": null,
"description": "# cloudcoil-models-knative-serving\n\nVersioned knative-serving models for cloudcoil.\n> [!WARNING] \n> This repository is auto-generated from the [cloudcoil repository](https://github.com/cloudcoil/cloudcoil/tree/main/models/knative-serving). Please do not submit pull requests here. Instead, submit them to the main repository at https://github.com/cloudcoil/cloudcoil.\n\n## \ud83d\udd27 Installation\n\n> [!NOTE]\n> For versioning information and compatibility, see the [Versioning Guide](https://github.com/cloudcoil/cloudcoil/blob/main/VERSIONING.md).\n\nUsing [uv](https://github.com/astral-sh/uv) (recommended):\n\n```bash\n# Install with Knative Serving support\nuv add cloudcoil.models.knative-serving\n```\n\nUsing pip:\n\n```bash\npip install cloudcoil.models.knative-serving\n```\n\n## \ud83d\udca1 Examples\n\n### Using Knative Serving Models\n\n```python\nfrom cloudcoil import apimachinery\nimport cloudcoil.models.knative_serving.serving.v1 as serving\n\n# Create a Service\nservice = serving.Service(\n metadata=apimachinery.ObjectMeta(name=\"hello\"),\n spec=serving.ServiceSpec(\n template=serving.Template(\n spec=serving.Spec(\n containers=[\n serving.Container(\n image=\"gcr.io/knative-samples/helloworld-go\",\n ports=[serving.Port(container_port=8080)],\n env=[\n serving.Env(name=\"TARGET\", value=\"World\")\n ]\n )\n ]\n )\n )\n )\n).create()\n\n# List Services\nfor svc in serving.Service.list():\n print(f\"Found Service: {svc.metadata.name}\")\n```\n\n### Using the Fluent Builder API\n\nCloudcoil provides a powerful fluent builder API for Knative Serving resources:\n\n```python\nfrom cloudcoil.models.knative_serving.serving.v1 import Service\n\n# Create a Service using the fluent builder\nservice = (\n Service.builder()\n # Metadata configuration\n .metadata(lambda metadata: metadata\n .name(\"hello\")\n .namespace(\"default\")\n .labels({\"app\": \"hello\"})\n )\n # Complex nested structures with proper collection handling\n .spec(lambda spec: spec\n .template(lambda template: template\n .metadata(lambda t_metadata: t_metadata\n .labels({\"app\": \"hello\"})\n )\n .spec(lambda revision_spec: revision_spec\n # Container list with nested collection handling\n .containers(lambda containers: containers.add(\n lambda container: container\n .name(\"hello\")\n .image(\"gcr.io/knative-samples/helloworld-go\")\n # Collections use add() helper for better type support\n .ports(lambda ports: ports\n .add(lambda p: p.container_port(8080))\n )\n .env(lambda env: env\n .add(lambda e: e.name(\"TARGET\").value(\"World\"))\n .add(lambda e: e.name(\"PORT\").value(\"8080\"))\n )\n # Resource requirements can be chained\n .resources(lambda r: r\n .requests({\"cpu\": \"100m\", \"memory\": \"128Mi\"})\n .limits({\"cpu\": \"200m\", \"memory\": \"256Mi\"})\n )\n ))\n )\n )\n )\n .build()\n)\n```\n\n### Using the Context Manager Builder API\n\nFor complex serving configurations, you can use the context manager-based builder:\n\n```python\nfrom cloudcoil.models.knative_serving.serving.v1 import Service\n\n# Create a Service using context managers\nwith Service.new() as service:\n with service.metadata() as metadata:\n metadata.name(\"hello\")\n metadata.namespace(\"default\")\n \n with service.spec() as spec:\n with spec.template() as template:\n with template.spec() as revision_spec:\n with revision_spec.containers() as container_list:\n with container_list.add() as container:\n container.name(\"hello\")\n container.image(\"gcr.io/knative-samples/helloworld-go\")\n with container.ports() as port_list:\n with port_list.add() as port:\n port.container_port(8080)\n with container.env() as env_list:\n with env_list.add() as env:\n env.name(\"TARGET\")\n env.value(\"World\")\n\nfinal_service = service.build()\n```\n\n### Mixing Builder Styles\n\nYou can mix different builder styles based on your needs:\n\n```python\nfrom cloudcoil.models.knative_serving.serving.v1 import Service\nfrom cloudcoil import apimachinery\n\n# Create a Service using mixed styles\nwith Service.new() as service:\n # Direct object initialization\n service.metadata(apimachinery.ObjectMeta(\n name=\"hello\"\n ))\n \n # Fluent style for spec\n service.spec(lambda s: s\n .template(lambda t: t\n .spec(lambda rs: rs\n .containers(lambda containers: containers.add(\n lambda container: container\n .name(\"hello\")\n .image(\"gcr.io/knative-samples/helloworld-go\")\n # Collections use add() helper for better type support\n .ports(lambda ports: ports\n .add(lambda p: p.container_port(8080))\n )\n ))\n )\n )\n )\n\nfinal_service = service.build()\n```\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 knative-serving models for cloudcoil",
"version": "1.17.0.1",
"project_urls": {
"Changelog": "https://github.com/cloudcoil/models-knative-serving/releases",
"Documentation": "https://cloudcoil.github.io/cloudcoil",
"Homepage": "https://github.com/cloudcoil/cloudcoil",
"Issues": "https://github.com/cloudcoil/models-knative-serving/issues",
"Repository": "https://github.com/cloudcoil/models-knative-serving"
},
"split_keywords": [
"async",
" cloud-native",
" cloudcoil",
" cloudcoil-models",
" knative-serving",
" kubernetes",
" pydantic",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4dea851a0dc15784a48628ae6d716adae5947de3ad9a1a817c32542dd191d1d7",
"md5": "3b8ddc65330783ef6e2b736ab2d4562e",
"sha256": "bede3b477e46caf156f843d5dd7823448bff0948cddb4c54c34be6ac47bc687f"
},
"downloads": -1,
"filename": "cloudcoil_models_knative_serving-1.17.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3b8ddc65330783ef6e2b736ab2d4562e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 63333,
"upload_time": "2025-02-10T04:27:36",
"upload_time_iso_8601": "2025-02-10T04:27:36.531564Z",
"url": "https://files.pythonhosted.org/packages/4d/ea/851a0dc15784a48628ae6d716adae5947de3ad9a1a817c32542dd191d1d7/cloudcoil_models_knative_serving-1.17.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a470157e2d6cc9164976cb41e7818631c6ab8db979783810eb1bab8046d4d80c",
"md5": "3d7e32003ec1738c33728c64f932cb00",
"sha256": "2187e08c281fa630f676b5d4fab6b1d91d8a5160f6d00ba6a9a9cb8eccfddbd2"
},
"downloads": -1,
"filename": "cloudcoil_models_knative_serving-1.17.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3d7e32003ec1738c33728c64f932cb00",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 118057,
"upload_time": "2025-02-10T04:27:39",
"upload_time_iso_8601": "2025-02-10T04:27:39.078410Z",
"url": "https://files.pythonhosted.org/packages/a4/70/157e2d6cc9164976cb41e7818631c6ab8db979783810eb1bab8046d4d80c/cloudcoil_models_knative_serving-1.17.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-10 04:27:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloudcoil",
"github_project": "models-knative-serving",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cloudcoil.models.knative-serving"
}