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
14 changes: 5 additions & 9 deletions interfaces/cloudflared_route/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
# Copyright 2024 Canonical
# See LICENSE file for licensing details.
"""This file defines the schemas for the provider sides of the cloudflared_route interface.
It exposes the interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {
"tunnel_token_secret_id": "secret:csn5caau557j9bojn7rg",
"nameserver": "1.1.1.1"
}
"""

from interface_tester.schema_base import DataBagSchema
from pydantic import BaseModel, IPvAnyAddress


class CloudflaredRouteProvider(BaseModel):
class ProviderAppData(BaseModel):
"""Provider application databag schema for cloudflared_route integration."""

tunnel_token_secret_id: str
nameserver: IPvAnyAddress | None = None


class ProviderSchema(DataBagSchema):
"""Provider schema for cloudflared_route integration."""

app: CloudflaredRouteProvider
ProviderUnitData = None
RequirerAppData = None
RequirerUnitData = None
24 changes: 6 additions & 18 deletions interfaces/dns_record/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Copyright 2024 Canonical
# See LICENSE file for licensing details.
"""This file defines the schemas for the provider and requirer sides of the dns_record interface.
It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema

Examples:
RequirerSchema:
Requirer:
unit: <empty>
app: {
"dns_entries": [
Expand All @@ -28,7 +25,7 @@
]
}

ProviderSchema:
Provider:
unit: <empty>
app: {
"dns_entries": [
Expand All @@ -49,7 +46,6 @@
from enum import Enum
from uuid import UUID

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


Expand Down Expand Up @@ -111,7 +107,7 @@ class DnsProviderData(BaseModel):
)


class DNSRecordProvider(BaseModel):
class ProviderAppData(BaseModel):
"""List statuses for the DNS records informed by the requirer."""

dns_entries: list[DnsProviderData] = Field(
Expand Down Expand Up @@ -160,21 +156,13 @@ class RequirerEntries(BaseModel):
)


class DNSRecordRequirer(BaseModel):
class RequirerAppData(BaseModel):
"""List of domains for the provider to manage."""

dns_entries: list[RequirerEntries] = Field(
name="DNS entries", description="List of DNS records for the provider to manage."
)


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

app: DNSRecordProvider


class RequirerSchema(DataBagSchema):
"""Requirer schema for dns_record."""

app: DNSRecordRequirer
ProviderUnitData = None
RequirerUnitData = None
19 changes: 5 additions & 14 deletions interfaces/milter/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
# See LICENSE file for licensing details.
"""This file defines the schema for the provider side of the milter interface.

It exposes one interfaces.schema_base.DataBagSchema subclass called:
- ProviderSchema

Examples:
ProviderSchema:
Provider:
app: <empty>
unit:
port: 8892
"""

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


class MilterProviderData(BaseModel):
class ProviderUnitData(BaseModel):
port: int = Field(
ge=1,
le=65536,
Expand All @@ -26,11 +22,6 @@ class MilterProviderData(BaseModel):
)


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

unit: MilterProviderData


class RequirerSchema(DataBagSchema):
"""Requirer schema for Milter."""
ProviderAppData = None
RequirerAppData = None
RequirerUnitData = None
14 changes: 4 additions & 10 deletions interfaces/nginx-route/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from typing import Optional

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


class NginxRouteRequirerSchema(BaseModel):
class RequirerAppData(BaseModel):
service_hostname: str = Field(
alias="service-hostname",
description="The hostname of the service to create an ingress for.",
Expand Down Expand Up @@ -140,11 +139,6 @@ class NginxRouteRequirerSchema(BaseModel):
)


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


class RequirerSchema(DataBagSchema):
"""Requirer schema for nginx_route."""

app: NginxRouteRequirerSchema
ProviderAppData = None
ProviderUnitData = None
RequirerUnitData = None
21 changes: 4 additions & 17 deletions interfaces/opencti_connector/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@
# See LICENSE file for licensing details.
"""This file defines the schemas for the provider and requirer sides of the opencti-connector interface.

It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {
"connector_charm_name": "connector-charm-name",
"connector_type": "connector-type",
}

RequirerSchema:
Requirer:
unit: <empty>
app: {
"opencti_url": "http://opencti-endpoints.stg-opencti.svc:8080",
"opencti_token": "secret:secret-id",
}
"""

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


Expand All @@ -45,12 +40,6 @@ class ProviderAppData(BaseModel):
)


class ProviderSchema(DataBagSchema):
"""Provider schema for the opencti-connector interface."""

app: ProviderAppData


class RequirerAppData(BaseModel):
opencti_url: AnyHttpUrl = Field(
description="URL to the OpenCTI instance.",
Expand All @@ -64,7 +53,5 @@ class RequirerAppData(BaseModel):
)


class RequirerSchema(DataBagSchema):
"""Requirer schema for the opencti-connector interface."""

app: RequirerAppData
ProviderUnitData = None
RequirerUnitData = None
19 changes: 5 additions & 14 deletions interfaces/saml/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
# See LICENSE file for licensing details.
"""This file defines the schema for the provider side of the saml interface.

It exposes one interfaces.schema_base.DataBagSchema subclass called:
- ProviderSchema

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {"saml":
{
Expand Down Expand Up @@ -38,11 +35,10 @@
}
"""

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


class SamlProviderData(BaseModel):
class ProviderAppData(BaseModel):
metadata_url: AnyHttpUrl | None = Field(
description="URL to the IdP's metadata.",
title="Metadata URL",
Expand Down Expand Up @@ -124,11 +120,6 @@ class SamlProviderData(BaseModel):
)


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

app: SamlProviderData


class RequirerSchema(DataBagSchema):
"""Requirer schema for SAML."""
ProviderUnitData = None
RequirerAppData = None
RequirerUnitData = None
Empty file.
19 changes: 0 additions & 19 deletions interfaces/saml/interface/v0/tests/test_provider.py

This file was deleted.

7 changes: 0 additions & 7 deletions interfaces/saml/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
]
19 changes: 6 additions & 13 deletions interfaces/smtp/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# See LICENSE file for licensing details.
"""This file defines the schema for the provider side of the smtp interface.

It exposes one interfaces.schema_base.DataBagSchema subclass called:
- ProviderSchema
It defines one model, `ProviderAppData`.

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {"smtp":
{
Expand All @@ -23,7 +22,6 @@

from enum import Enum

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


Expand All @@ -43,7 +41,7 @@ class AuthType(str, Enum):
PLAIN = "plain"


class SmtpProviderData(BaseModel):
class ProviderAppData(BaseModel):
host: str = Field(
min_length=1,
description="SMTP host.",
Expand Down Expand Up @@ -89,11 +87,6 @@ class SmtpProviderData(BaseModel):
)


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

app: SmtpProviderData


class RequirerSchema(DataBagSchema):
"""Requirer schema for SMTP."""
ProviderUnitData = None
RequirerAppData = None
RequirerUnitData = None
Empty file.
19 changes: 0 additions & 19 deletions interfaces/smtp/interface/v0/tests/test_provider.py

This file was deleted.

7 changes: 0 additions & 7 deletions interfaces/smtp/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
]
Loading
Loading