Skip to content
Open
Show file tree
Hide file tree
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
23 changes: 7 additions & 16 deletions interfaces/cos_agent/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# See LICENSE file for licensing details.

"""This file defines the schemas for the provider and requirer sides of the cos_agent interface.
It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema

Examples:
ProviderSchema:
Provider:
app: <empty>
# The value of `config` key is a json-dumped data.
unit: {
Expand Down Expand Up @@ -49,7 +47,7 @@
"metrics_scrape_jobs": [{"job_name": "kafka_0", "path": "/metrics", "port": 9101}],
}
}
RequirerSchema:
Requirer:
unit: <empty>
app: <empty>
"""
Expand All @@ -59,12 +57,10 @@
import lzma
from typing import Annotated

from interface_tester.schema_base import DataBagSchema
from pydantic import (
AfterValidator,
BaseModel,
Field,
Json,
PlainSerializer,
WithJsonSchema,
)
Expand Down Expand Up @@ -114,16 +110,11 @@ class Config:
class ProviderUnitData(BaseModel):
"""Unit databag model for `cos-agent` relation."""

config: Json[NestedDataModel] = Field(
config: NestedDataModel = Field(
description='When dumped into a databag in JSON format, this configuration data will be nested under the key defaulted to "config".'
)


class ProviderSchema(DataBagSchema):
"""Provider schema for CosAgent."""

unit: ProviderUnitData


class RequirerSchema(DataBagSchema):
"""Requirer schema for CosAgent."""
ProviderAppData = None
RequirerAppData = None
RequirerUnitData = None
Empty file.
97 changes: 0 additions & 97 deletions interfaces/cos_agent/interface/v0/tests/test_provider.py

This file was deleted.

7 changes: 0 additions & 7 deletions interfaces/cos_agent/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@ quote-style = "preserve"
"D", # docs
"E501", # line too long
]
"./interface/v*/tests/*.py" = [
"CPY", # copyright
"D", # docs
"S", # security
"E501", # line too long
"F841", # assignment to unused variable
]
6 changes: 0 additions & 6 deletions interfaces/grafana_datasource/interface/v0/interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@ description: |
providers:
- name: tempo-coordinator-k8s
url: https://github.com/canonical/tempo-coordinator-k8s-operator
test_setup:
location: tests/interface/conftest.py
identifier: grafana_datasource_tester

requirers:
- name: grafana-k8s
url: https://github.com/canonical/grafana-k8s-operator
test_setup:
location: tests/interface/conftest.py
identifier: grafana_source_tester


maintainer: observability
29 changes: 9 additions & 20 deletions interfaces/grafana_datasource/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any

from interface_tester.schema_base import DataBagSchema
from pydantic import BaseModel, Field, Json
from pydantic import BaseModel, Field


class GrafanaSourceData(BaseModel):
Expand All @@ -19,46 +18,36 @@ class GrafanaSourceData(BaseModel):
type: str = Field(
description="Type of the datasource.", examples=['tempo', 'loki', 'prometheus']
)
extra_fields: Json[Any] | None = Field(
extra_fields: Any | None = Field(
description="Any datasource-type-specific additional configuration."
)
secure_extra_fields: Json[Any] | None = Field(
secure_extra_fields: Any | None = Field(
description="Any secure datasource-type-specific additional configuration."
)


class GrafanaSourceProviderAppData(BaseModel):
class ProviderAppData(BaseModel):
"""Application databag model for the requirer side of this interface."""

grafana_source_data: Json[GrafanaSourceData]
grafana_source_data: GrafanaSourceData


class GrafanaSourceProviderUnitData(BaseModel):
class ProviderUnitData(BaseModel):
"""Application databag model for the requirer side of this interface."""

grafana_source_host: str = Field(
description="Hostname of a source server.", examples=['localhost:80']
)


class ProviderSchema(DataBagSchema):
"""The schemas for the requirer side of this interface."""

app: GrafanaSourceProviderAppData
unit: GrafanaSourceProviderUnitData


class GrafanaSourceRequirerAppData(BaseModel):
class RequirerAppData(BaseModel):
"""Application databag model for the requirer side of this interface."""

datasource_uids: Json[dict[str, str]]
datasource_uids: dict[str, str]
grafana_uid: str = Field(
description="UID of the requirer application.",
examples=['foo-0000-0000-0000-0000-grafana-1'],
)


class RequirerSchema(DataBagSchema):
"""The schema for the provider side of this interface."""

app: GrafanaSourceRequirerAppData
RequirerUnitData = None
Empty file.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions interfaces/grafana_datasource/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,3 @@ quote-style = "preserve"
"D", # docs
"E501", # line too long
]
"./interface/v*/tests/*.py" = [
"CPY", # copyright
"D", # docs
"S", # security
"E501", # line too long
"F841", # assignment to unused variable
"RUF015", # single element slice
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@ description: |
providers:
- name: tempo-coordinator-k8s
url: https://github.com/canonical/tempo-coordinator-k8s-operator
test_setup:
location: tests/interface/conftest.py
identifier: grafana_datasource_exchange_tester

requirers:
- name: tempo-coordinator-k8s
url: https://github.com/canonical/tempo-coordinator-k8s-operator
test_setup:
location: tests/interface/conftest.py
identifier: grafana_datasource_exchange_tester


maintainer: observability
Loading
Loading