diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa4929c..7c14324 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 diff --git a/yeti_switch_api/orm/__init__.py b/yeti_switch_api/orm/__init__.py index 816b0e7..8766eda 100644 --- a/yeti_switch_api/orm/__init__.py +++ b/yeti_switch_api/orm/__init__.py @@ -13,6 +13,7 @@ from .numberlist import Numberlist # noqa: F401 from .numberlist_item import NumberlistItem # noqa: F401 from .rateplan import Rateplan # noqa: F401 +from .routing_plan import RoutingPlan # noqa: F401 from .routing_tag import RoutingTag # noqa: F401 from .gateway import Gateway # noqa: F401 @@ -23,3 +24,4 @@ from .country import Country # noqa: F401 from .network import Network # noqa: F401 from .network_type import NetworkType # noqa: F401 +from .timezone import Timezone # noqa: F401 diff --git a/yeti_switch_api/orm/account.py b/yeti_switch_api/orm/account.py index ac2d58c..5af40dd 100644 --- a/yeti_switch_api/orm/account.py +++ b/yeti_switch_api/orm/account.py @@ -4,9 +4,10 @@ class Account(BaseModel): class Meta: path = "accounts" - type = "account" + type = "accounts" contractor = RelationField("contractor") + timezone = RelationField("timezone") name = AttributeField("name") balance = AttributeField("balance") @@ -14,4 +15,4 @@ class Meta: max_balance = AttributeField("max-balance") def creatable_fields(self): - return ["contractor", "min_balace", "max_balance"] + return ["name", "contractor", "timezone", "min-balance", "max-balance"] diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index d0c0a32..a8660d8 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -7,4 +7,34 @@ class Meta: type = "customers-auths" name = AttributeField("name") - src_numberlist = RelationField("src_numberlist") + enabled = AttributeField("enabled") + src_numberlist = RelationField("src-numberlist") + dst_numberlist = RelationField("dst-numberlist") + customer = RelationField("customer") + account = RelationField("account") + rateplan = RelationField("rateplan") + routing_plan = RelationField("routing-plan") + gateway = RelationField("gateway") + pop = RelationField("pop") + ip = AttributeField("ip") + src_prefix = AttributeField("src-prefix") + dst_prefix = AttributeField("dst-prefix") + x_yeti_auth = AttributeField("x-yeti-auth") + + def creatable_fields(self): + return [ + "name", + "enabled", + "src-numberlist", + "dst-numberlist", + "customer", + "account", + "rateplan", + "routing-plan", + "gateway", + "pop", + "ip", + "src-prefix", + "dst-prefix", + "x-yeti-auth", + ] diff --git a/yeti_switch_api/orm/orm_client.py b/yeti_switch_api/orm/orm_client.py index 9f3f91b..fddf2f6 100644 --- a/yeti_switch_api/orm/orm_client.py +++ b/yeti_switch_api/orm/orm_client.py @@ -16,6 +16,7 @@ from .numberlist import Numberlist from .numberlist_item import NumberlistItem from .rateplan import Rateplan +from .routing_plan import RoutingPlan from .routing_tag import RoutingTag from .gateway import Gateway @@ -26,6 +27,7 @@ from .country import Country from .network import Network from .network_type import NetworkType +from .timezone import Timezone class OrmClient: @@ -55,6 +57,7 @@ def __register_models(cls): cls.__register_model(Numberlist) cls.__register_model(NumberlistItem) cls.__register_model(Rateplan) + cls.__register_model(RoutingPlan) cls.__register_model(RoutingTag) cls.__register_model(Gateway) cls.__register_model(GatewayGroup) @@ -63,6 +66,7 @@ def __register_models(cls): cls.__register_model(Country) cls.__register_model(Network) cls.__register_model(NetworkType) + cls.__register_model(Timezone) @classmethod def __register_model(cls, model_class): diff --git a/yeti_switch_api/orm/routing_plan.py b/yeti_switch_api/orm/routing_plan.py new file mode 100644 index 0000000..406fc1e --- /dev/null +++ b/yeti_switch_api/orm/routing_plan.py @@ -0,0 +1,12 @@ +from .base_model import BaseModel, AttributeField + + +class RoutingPlan(BaseModel): + class Meta: + path = "routing-plans" + type = "routing-plans" + + name = AttributeField("name") + rate_delta_max = AttributeField("rate-delta-max") + use_lnp = AttributeField("use-lnp") + max_rerouting_attempts = AttributeField("max-rerouting-attempts") diff --git a/yeti_switch_api/orm/timezone.py b/yeti_switch_api/orm/timezone.py new file mode 100644 index 0000000..7d893d6 --- /dev/null +++ b/yeti_switch_api/orm/timezone.py @@ -0,0 +1,9 @@ +from .base_model import BaseModel, AttributeField + + +class Timezone(BaseModel): + class Meta: + path = "timezones" + type = "timezones" + + name = AttributeField("name")