Skip to main content

Versioned prometheus-operator models for cloudcoil

Project description

cloudcoil-models-prometheus-operator

Versioned prometheus-operator models for cloudcoil.

🔧 Installation

Using uv (recommended):

# Install with Prometheus Operator support
uv add cloudcoil.models.prometheus-operator

Using pip:

pip install cloudcoil.models.prometheus-operator

💡 Examples

Using Prometheus Operator Models

from cloudcoil import apimachinery
import cloudcoil.models.prometheus_operator.v1 as prometheus_operator

# Create a Prometheus instance
prometheus = prometheus_operator.Prometheus(
    metadata=apimachinery.ObjectMeta(name="main"),
    spec=prometheus_operator.PrometheusSpec(
        external_url="http://monitoring.my.systems/prometheus",
        resources=apimachinery.ResourceRequirements(
            requests={
                "memory": "400Mi"
            }
        )
    )
).create()

# Create an Alertmanager instance
alert_manager = prometheus_operator.Alertmanager(
    metadata=apimachinery.ObjectMeta(name="main"),
    spec=prometheus_operator.AlertmanagerSpec(
        replicas=3,
        external_url="http://monitoring.my.systems/alertmanager",
        resources=apimachinery.ResourceRequirements(
            requests={
                "memory": "400Mi"
            }
        )
    )
).create()

# List Prometheus instances
for prom in prometheus_operator.Prometheus.list():
    print(f"Found Prometheus: {prom.metadata.name}")

Using the Fluent Builder API

Cloudcoil provides a powerful fluent builder API for Prometheus Operator resources:

from cloudcoil.models.prometheus_operator.v1 import Prometheus, Alertmanager

# Create a Prometheus using the builder
prometheus = (
    Prometheus.builder()
    .metadata(lambda m: m
        .name("main")
    )
    .spec(lambda s: s
        .external_url("http://monitoring.my.systems/prometheus")
        .resources(lambda r: r
            .requests({
                "memory": "400Mi"
            })
        )
    )
    .build()
)

# Create an Alertmanager using the builder
alert_manager = (
    Alertmanager.builder()
    .metadata(lambda m: m
        .name("main")
    )
    .spec(lambda s: s
        .replicas(3)
        .external_url("http://monitoring.my.systems/alertmanager")
        .resources(lambda r: r
            .requests({
                "memory": "400Mi"
            })
        )
    )
    .build()
)

Using the Context Manager Builder API

For complex monitoring configurations, you can use the context manager-based builder:

from cloudcoil.models.prometheus_operator.v1 import Prometheus

# Create a Prometheus instance using context managers
with Prometheus.new() as prometheus:
    with prometheus.metadata() as metadata:
        metadata.name("main")
    
    with prometheus.spec() as spec:
        spec.external_url("http://monitoring.my.systems/prometheus")
        with spec.resources() as resources:
            resources.requests({
                "memory": "400Mi"
            })

final_prometheus = prometheus.build()

Mixing Builder Styles

You can mix different builder styles based on your needs:

from cloudcoil.models.prometheus_operator.v1 import Alertmanager
from cloudcoil import apimachinery

# Create an Alertmanager using mixed styles
with Alertmanager.new() as alert_manager:
    # Direct object initialization
    alert_manager.metadata(apimachinery.ObjectMeta(
        name="main"
    ))
    
    # Fluent style for spec
    alert_manager.spec(lambda s: s
        .replicas(3)
        .external_url("http://monitoring.my.systems/alertmanager")
        .resources(lambda r: r
            .requests({
                "memory": "400Mi"
            })
        )
    )

final_alert_manager = alert_manager.build()

📚 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_prometheus_operator-0.79.2.0.tar.gz (445.6 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file cloudcoil_models_prometheus_operator-0.79.2.0.tar.gz.

File metadata

File hashes

Hashes for cloudcoil_models_prometheus_operator-0.79.2.0.tar.gz
Algorithm Hash digest
SHA256 f0b495140b105875b3b8093f08ae453106ea90eea4f9115b8167b5fdf06ec294
MD5 21581bd151f5be9ba60729c469ff6431
BLAKE2b-256 c7a222123891dd71a7f2d49fa3e6189e28b1294d1e542faa4e395fa13fa72fc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcoil_models_prometheus_operator-0.79.2.0.tar.gz:

Publisher: pypi_publish.yml on cloudcoil/models-prometheus-operator

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_prometheus_operator-0.79.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudcoil_models_prometheus_operator-0.79.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a40cca1adad11e4a051227661247fc27b5c35b69b50b8b4d9766f213a7ff6b87
MD5 a25c8243073d57e29d543031fbd31b02
BLAKE2b-256 703be29d59c6fa047ceb48b8b186004e5a5272085a75e6a890537bc209559e5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcoil_models_prometheus_operator-0.79.2.0-py3-none-any.whl:

Publisher: pypi_publish.yml on cloudcoil/models-prometheus-operator

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