Skip to main content

Versioned kpack models for cloudcoil

Project description

cloudcoil-models-kpack

Versioned kpack models for cloudcoil.

[!WARNING]
This repository is auto-generated from the cloudcoil repository. 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.

Using uv (recommended):

# Install with kpack support
uv add cloudcoil.models.kpack

Using pip:

pip install cloudcoil.models.kpack

💡 Examples

Using kpack Models

from cloudcoil import apimachinery
import cloudcoil.models.kpack.v1alpha2 as kpack
import cloudcoil.models.kpack.core as core
import cloudcoil.models.kubernetes.core.v1 as k8score

# Create an Image resource
image = kpack.Image(
    metadata=apimachinery.ObjectMeta(name="my-app"),
    spec=kpack.ImageSpec(
        tag="registry.example.com/my-app",
        builder_=k8score.ObjectReference(
            name="my-builder",
            kind="ClusterBuilder"
        ),
        source=core.SourceConfig(
            git=core.Git(
                url="https://github.com/my-org/my-app.git",
                revision="main"
            )
        )
    )
).create()

# Create a Builder
builder = kpack.BuilderResource(
    metadata=apimachinery.ObjectMeta(name="my-builder"),
    spec=kpack.BuilderSpec(
        tag="registry.example.com/builder",
        stack=k8score.ObjectReference(
            name="base",
            kind="ClusterStack"
        ),
        store=k8score.ObjectReference(
            name="default",
            kind="ClusterStore"
        )
    )
).create()

# List Images
for img in kpack.Image.list():
    print(f"Found image: {img.metadata.name}")

# Update an Image
image.spec.source.git.revision = "v1.0.0"
image.save()

# Delete resources
kpack.Image.delete("my-app")
kpack.BuilderResource.delete("my-builder")

Using the Fluent Builder API

from cloudcoil.models.kpack.v1alpha2 import Image

# Create an Image using the fluent builder
image = (
    Image.builder()
    .metadata(lambda m: m
        .name("my-app")
        .namespace("default")
    )
    .spec(lambda s: s
        .tag("registry.example.com/my-app")
        .builder_(lambda b: b
            .name("my-builder")
            .kind("ClusterBuilder")
        )
        .source(lambda src: src
            .git(lambda g: g
                .url("https://github.com/my-org/my-app.git")
                .revision("main")
            )
        )
    )
    .build()
)

Using the Context Manager Builder API

from cloudcoil.models.kpack.v1alpha2 import Image, BuilderResource

# Create an image using context managers
with Image.new() as app_image:
    with app_image.metadata() as metadata:
        metadata.name("my-app")
        metadata.namespace("default")
    
    with app_image.spec() as spec:
        spec.tag("registry.example.com/my-app")
        
        with spec.builder_() as builder:
            builder.name("my-builder")
            builder.kind("ClusterBuilder")
        
        with spec.source() as source:
            with source.git() as git:
                git.url("https://github.com/my-org/my-app.git")
                git.revision("main")

final_image = app_image.build()

# Create a builder using context managers
with BuilderResource.new() as builder:
    with builder.metadata() as metadata:
        metadata.name("my-builder")
        metadata.namespace("default")
    
    with builder.spec() as spec:
        spec.tag("registry.example.com/builder")
        
        with spec.stack() as stack:
            stack.name("base")
            stack.kind("ClusterStack")
        
        with spec.store() as store:
            store.name("default")
            store.kind("ClusterStore")
        
        # Add buildpacks to the builder
        with spec.buildpacks() as buildpacks:
            with buildpacks.add() as pack:
                pack.id("paketo-buildpacks/java")
                pack.version("3.0.0")

final_builder = builder.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

📚 Documentation

For complete documentation, visit cloudcoil.github.io/cloudcoil

📜 License

Apache License, Version 2.0 - see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudcoil_models_kpack-0.16.1.0.tar.gz (94.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudcoil_models_kpack-0.16.1.0-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file cloudcoil_models_kpack-0.16.1.0.tar.gz.

File metadata

File hashes

Hashes for cloudcoil_models_kpack-0.16.1.0.tar.gz
Algorithm Hash digest
SHA256 b15a7428bc451dd4ec7761e4844f904be04051d26e6ba830d22333bae9b5bc24
MD5 8512781b2d5b67c25d4597745d2e5f09
BLAKE2b-256 c864901a905d52501cdd3d015887dcfe40ae8763f9253b6e9d257b27c88ffe44

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcoil_models_kpack-0.16.1.0.tar.gz:

Publisher: pypi_publish.yml on cloudcoil/models-kpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cloudcoil_models_kpack-0.16.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudcoil_models_kpack-0.16.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d0c1711930fc32ad5de92e0bc5d7cc423eeedabd7c775ab81305b1b5735f4bf
MD5 8f1601660daba7d7cf9b30299b372bd3
BLAKE2b-256 21987454efa29519cd542d5e6f4017ec58b09f0e2b0937dc0b214ea6ab3fc38d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcoil_models_kpack-0.16.1.0-py3-none-any.whl:

Publisher: pypi_publish.yml on cloudcoil/models-kpack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page