From a073b1b3973c0cb39479c88fb199167f5e08b86e Mon Sep 17 00:00:00 2001 From: RAprogramm Date: Tue, 30 Jun 2026 08:19:19 +0700 Subject: [PATCH 1/4] fix: surface account login and keep ssh_keys via spec normalizer The upstream OpenAPI spec omits account-status fields the live API actually returns (login, registered_at, two_factor_method, is_password_set) and names the SSH-key list property 'ssh-keys' while the API sends 'ssh_keys'. Both were undocumented upstream defects; the latter had been hand-patched in the generated file and was lost on regeneration. Move both fixes into openapi/normalize_spec.py so every regeneration (manual and the spec-sync CI) re-applies them automatically: add the missing status fields (defensively, as Option) and rename the ssh-keys response property to ssh_keys. Regenerated src/models accordingly. --- Cargo.lock | 2 +- openapi/normalize_spec.py | 61 +++++++++++++++++++++++++++++++++++++++ src/models/status.rs | 21 ++++++++++++-- 3 files changed, 81 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1f320cd..510f4d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1564,7 +1564,7 @@ dependencies = [ [[package]] name = "timeweb-rs" -version = "0.1.3" +version = "0.1.4" dependencies = [ "chrono", "reqwest", diff --git a/openapi/normalize_spec.py b/openapi/normalize_spec.py index 671c819..12af969 100644 --- a/openapi/normalize_spec.py +++ b/openapi/normalize_spec.py @@ -169,11 +169,72 @@ def walk(node): walk(spec) +def add_undocumented_account_status_fields(spec): + """Add ``status`` fields the live API returns but the spec omits. + + ``GET /account/status`` returns ``login`` (the account identifier shown to + the user), ``registered_at``, ``two_factor_method`` and ``is_password_set``, + but the upstream ``status`` schema documents none of them — it stops at + ``ym_client_id``. Without ``login`` a client is left with only the + hoster's ``company_info`` (the same "ООО ТАЙМВЭБ.КЛАУД" for every account), + which is useless for identifying the account. + + The fields are added here, defensively (not marked required), so the + generator emits ``Option`` types and a missing field never breaks + deserialization. Run on every regeneration, so it survives upstream spec + syncs automatically. + """ + status = spec.get("components", {}).get("schemas", {}).get("status") + if not isinstance(status, dict): + return + props = status.setdefault("properties", {}) + additions = { + "login": {"type": "string"}, + "registered_at": {"type": "string"}, + "is_password_set": {"type": "boolean"}, + "two_factor_method": {"type": "string", "nullable": True}, + } + for name, schema in additions.items(): + props.setdefault(name, schema) + + +def fix_ssh_keys_property(spec): + """Rename the ``ssh-keys`` response property to ``ssh_keys``. + + The ``GET /api/v1/ssh-keys`` response schema names its collection property + ``ssh-keys`` (hyphen), but the live API returns ``ssh_keys`` (underscore). + Generated from the hyphen spelling, the client deserializes the real + payload to an empty list. Rename the property (and any ``required`` entry) + to the underscore spelling the API actually sends, everywhere it appears. + """ + + def walk(node): + if isinstance(node, dict): + props = node.get("properties") + if isinstance(props, dict) and "ssh-keys" in props: + props["ssh_keys"] = props.pop("ssh-keys") + required = node.get("required") + if isinstance(required, list): + node["required"] = [ + "ssh_keys" if name == "ssh-keys" else name + for name in required + ] + for value in node.values(): + walk(value) + elif isinstance(node, list): + for value in node: + walk(value) + + walk(spec) + + def normalize(spec): """Apply all normalization passes to ``spec`` in place and return it.""" fix_path_parameters(spec) localize_tags(spec) nullable_response_id(spec) + add_undocumented_account_status_fields(spec) + fix_ssh_keys_property(spec) return spec diff --git a/src/models/status.rs b/src/models/status.rs index 3c134a1..03fb5c9 100644 --- a/src/models/status.rs +++ b/src/models/status.rs @@ -34,7 +34,20 @@ pub struct Status { pub last_password_changed_at: String, /// ID аккаунта для яндекс метрики. #[serde(rename = "ym_client_id", deserialize_with = "Option::deserialize")] - pub ym_client_id: Option + pub ym_client_id: Option, + #[serde(rename = "login", skip_serializing_if = "Option::is_none")] + pub login: Option, + #[serde(rename = "registered_at", skip_serializing_if = "Option::is_none")] + pub registered_at: Option, + #[serde(rename = "is_password_set", skip_serializing_if = "Option::is_none")] + pub is_password_set: Option, + #[serde( + rename = "two_factor_method", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub two_factor_method: Option> } impl Status { @@ -53,7 +66,11 @@ impl Status { is_send_bill_letters, company_info: Box::new(company_info), last_password_changed_at, - ym_client_id + ym_client_id, + login: None, + registered_at: None, + is_password_set: None, + two_factor_method: None } } } From 6a4eb21b6d6246e337fc601ecc2d605a3be45fcc Mon Sep 17 00:00:00 2001 From: RAprogramm Date: Tue, 30 Jun 2026 08:36:48 +0700 Subject: [PATCH 2/4] fix: tolerate omitted app fields and new zones in spec normalizer Two more upstream-spec defects made GET /api/v1/apps deserialize to an empty list (dashboard showed 0 apps despite several existing): - The 'app' schema marks 'framework', 'branch_name', 'server_id' required, but the live API never sends them (it sends 'branch', no 'framework'). relax_overstrict_required() trims the schema's required list to the identifying fields the API reliably returns; the rest become Option. - 'location' is a closed enum (ru-1/pl-1/nl-1/...) but new zones like 'de-1' appear over time, failing enum deserialization for the whole collection. relax_location_enums() strips the enum from every location-like field (keeping type string) so any zone deserializes. Both live in normalize_spec.py, so they survive every regeneration and the spec-sync CI. Regenerated src/models accordingly. --- openapi/normalize_spec.py | 57 +++++++ src/models/app.rs | 221 ++++++++++++-------------- src/models/balancer.rs | 18 +-- src/models/create_vpc.rs | 22 +-- src/models/database_cluster.rs | 22 +-- src/models/db.rs | 20 +-- src/models/dedicated_server.rs | 30 +--- src/models/dedicated_server_preset.rs | 32 +--- src/models/image.rs | 24 +-- src/models/image_in_api.rs | 4 +- src/models/location.rs | 9 +- src/models/location_dto.rs | 5 +- src/models/mod.rs | 2 - src/models/network_drive.rs | 16 +- src/models/presets_balancer.rs | 20 +-- src/models/presets_dbs.rs | 18 +-- src/models/presets_storage.rs | 16 +- src/models/servers_configurator.rs | 20 +-- src/models/servers_preset.rs | 20 +-- src/models/vds.rs | 26 +-- src/models/vpc.rs | 22 +-- 21 files changed, 195 insertions(+), 429 deletions(-) diff --git a/openapi/normalize_spec.py b/openapi/normalize_spec.py index 12af969..b3801b8 100644 --- a/openapi/normalize_spec.py +++ b/openapi/normalize_spec.py @@ -228,6 +228,61 @@ def walk(node): walk(spec) +_MINIMAL_REQUIRED = { + "app": ["id", "name", "status"], +} + + +def relax_overstrict_required(spec): + """Trim ``required`` lists that demand fields the live API omits. + + Some list-item schemas mark many fields ``required`` that the live API + does not actually send. The ``app`` schema, for example, requires + ``framework``, ``branch_name`` and ``server_id`` — none of which appear in + a ``GET /api/v1/apps`` item (the API sends ``branch``, not ``branch_name``, + and no ``framework``). One missing required field fails deserialization of + the whole collection, so the dashboard shows zero apps despite the account + having several. + + Reduce each listed schema's ``required`` to the minimal identifying fields + the API reliably returns; the rest become ``Option`` and tolerate absence. + """ + schemas = spec.get("components", {}).get("schemas", {}) + for name, minimal in _MINIMAL_REQUIRED.items(): + sch = schemas.get(name) + if not isinstance(sch, dict) or not isinstance(sch.get("required"), list): + continue + props = sch.get("properties", {}) + sch["required"] = [field for field in minimal if field in props] + + +def relax_location_enums(spec): + """Drop the closed enum on availability-zone (location) fields. + + Zones (``ru-1``, ``pl-1``, ``nl-1``, ``de-1``, ...) are added over time, + but the spec pins them as a closed enum — both the shared ``Location`` / + ``location`` schemas and ~17 inline copies. A resource in a zone the spec + has not caught up to (e.g. an app in ``de-1``) then fails enum + deserialization, and the whole collection comes back empty. Strip the enum + constraint (keeping ``type: string``) wherever a location-like enum + appears, so any present or future zone deserializes as a plain string. + """ + + def walk(node): + if isinstance(node, dict): + enum = node.get("enum") + if isinstance(enum, list) and "ru-1" in enum: + node.pop("enum", None) + node.setdefault("type", "string") + for value in node.values(): + walk(value) + elif isinstance(node, list): + for value in node: + walk(value) + + walk(spec) + + def normalize(spec): """Apply all normalization passes to ``spec`` in place and return it.""" fix_path_parameters(spec) @@ -235,6 +290,8 @@ def normalize(spec): nullable_response_id(spec) add_undocumented_account_status_fields(spec) fix_ssh_keys_property(spec) + relax_overstrict_required(spec) + relax_location_enums(spec) return spec diff --git a/src/models/app.rs b/src/models/app.rs index 7663a36..d66c10b 100644 --- a/src/models/app.rs +++ b/src/models/app.rs @@ -20,144 +20,139 @@ pub struct App { #[serde(rename = "id")] pub id: f64, /// Тип приложения. - #[serde(rename = "type")] - pub r#type: Type, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, /// Удобочитаемое имя, установленное для приложения. #[serde(rename = "name")] pub name: String, /// Статус приложения. #[serde(rename = "status")] pub status: Status, - #[serde(rename = "provider")] - pub provider: Box, + #[serde(rename = "provider", skip_serializing_if = "Option::is_none")] + pub provider: Option>, /// IPv4-адрес приложения. - #[serde(rename = "ip")] - pub ip: String, - #[serde(rename = "domains")] - pub domains: Vec, - #[serde(rename = "framework")] - pub framework: Box, + #[serde(rename = "ip", skip_serializing_if = "Option::is_none")] + pub ip: Option, + #[serde(rename = "domains", skip_serializing_if = "Option::is_none")] + pub domains: Option>, + #[serde(rename = "framework", skip_serializing_if = "Option::is_none")] + pub framework: Option>, /// Локация сервера. - #[serde(rename = "location")] - pub location: Location, - #[serde(rename = "repository")] - pub repository: Box, + #[serde(rename = "location", skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] + pub repository: Option>, /// Версия окружения. - #[serde(rename = "env_version", deserialize_with = "Option::deserialize")] - pub env_version: Option, + #[serde( + rename = "env_version", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub env_version: Option>, /// Переменные окружения приложения. Объект с ключами и значениями типа /// string. - #[serde(rename = "envs")] - pub envs: serde_json::Value, + #[serde(rename = "envs", skip_serializing_if = "Option::is_none")] + pub envs: Option, /// Название ветки репозитория из которой собрано приложение. - #[serde(rename = "branch_name")] - pub branch_name: String, + #[serde(rename = "branch_name", skip_serializing_if = "Option::is_none")] + pub branch_name: Option, /// Включен ли автоматический деплой. - #[serde(rename = "is_auto_deploy")] - pub is_auto_deploy: bool, + #[serde(rename = "is_auto_deploy", skip_serializing_if = "Option::is_none")] + pub is_auto_deploy: Option, /// Хэш коммита из которого собрано приложеие. - #[serde(rename = "commit_sha")] - pub commit_sha: String, + #[serde(rename = "commit_sha", skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, /// Комментарий к приложению. - #[serde(rename = "comment")] - pub comment: String, + #[serde(rename = "comment", skip_serializing_if = "Option::is_none")] + pub comment: Option, /// ID тарифа. - #[serde(rename = "preset_id")] - pub preset_id: f64, + #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] + pub preset_id: Option, /// Путь к директории с индексным файлом. Определен для приложений `type: /// frontend`. Для приложений `type: backend` всегда null. - #[serde(rename = "index_dir", deserialize_with = "Option::deserialize")] - pub index_dir: Option, + #[serde( + rename = "index_dir", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub index_dir: Option>, /// Команда сборки приложения. - #[serde(rename = "build_cmd")] - pub build_cmd: String, + #[serde(rename = "build_cmd", skip_serializing_if = "Option::is_none")] + pub build_cmd: Option, /// Ссылка на аватар приложения. - #[serde(rename = "avatar_link", deserialize_with = "Option::deserialize")] - pub avatar_link: Option, + #[serde( + rename = "avatar_link", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub avatar_link: Option>, /// Команда для запуска приложения. Определена для приложений `type: /// backend`. Для приложений `type: frontend` всегда null. - #[serde(rename = "run_cmd", deserialize_with = "Option::deserialize")] - pub run_cmd: Option, - #[serde(rename = "configuration", deserialize_with = "Option::deserialize")] - pub configuration: Option>, - #[serde(rename = "disk_status", deserialize_with = "Option::deserialize")] - pub disk_status: Option>, + #[serde( + rename = "run_cmd", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub run_cmd: Option>, + #[serde( + rename = "configuration", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub configuration: Option>>, + #[serde( + rename = "disk_status", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub disk_status: Option>>, /// Включен ли агент QEMU. - #[serde(rename = "is_qemu_agent")] - pub is_qemu_agent: bool, + #[serde(rename = "is_qemu_agent", skip_serializing_if = "Option::is_none")] + pub is_qemu_agent: Option, /// Язык программирования приложения. - #[serde(rename = "language")] - pub language: String, + #[serde(rename = "language", skip_serializing_if = "Option::is_none")] + pub language: Option, /// Время запуска приложения. - #[serde(rename = "start_time")] - pub start_time: chrono::DateTime + #[serde(rename = "start_time", skip_serializing_if = "Option::is_none")] + pub start_time: Option> } impl App { /// Экземпляр приложения. - pub fn new( - id: f64, - r#type: Type, - name: String, - status: Status, - provider: models::AppProvider, - ip: String, - domains: Vec, - framework: models::Frameworks, - location: Location, - repository: models::Repository, - env_version: Option, - envs: serde_json::Value, - branch_name: String, - is_auto_deploy: bool, - commit_sha: String, - comment: String, - preset_id: f64, - index_dir: Option, - build_cmd: String, - avatar_link: Option, - run_cmd: Option, - configuration: Option, - disk_status: Option, - is_qemu_agent: bool, - language: String, - start_time: chrono::DateTime - ) -> App { + pub fn new(id: f64, name: String, status: Status) -> App { App { id, - r#type, + r#type: None, name, status, - provider: Box::new(provider), - ip, - domains, - framework: Box::new(framework), - location, - repository: Box::new(repository), - env_version, - envs, - branch_name, - is_auto_deploy, - commit_sha, - comment, - preset_id, - index_dir, - build_cmd, - avatar_link, - run_cmd, - configuration: if let Some(x) = configuration { - Some(Box::new(x)) - } else { - None - }, - disk_status: if let Some(x) = disk_status { - Some(Box::new(x)) - } else { - None - }, - is_qemu_agent, - language, - start_time + provider: None, + ip: None, + domains: None, + framework: None, + location: None, + repository: None, + env_version: None, + envs: None, + branch_name: None, + is_auto_deploy: None, + commit_sha: None, + comment: None, + preset_id: None, + index_dir: None, + build_cmd: None, + avatar_link: None, + run_cmd: None, + configuration: None, + disk_status: None, + is_qemu_agent: None, + language: None, + start_time: None } } } @@ -201,19 +196,3 @@ impl Default for Status { Self::Active } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "nl-1")] - Nl1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/balancer.rs b/src/models/balancer.rs index 0e56cd7..d6cdccb 100644 --- a/src/models/balancer.rs +++ b/src/models/balancer.rs @@ -105,7 +105,7 @@ pub struct Balancer { pub ips: Vec, /// Географическое расположение балансировщика #[serde(rename = "location")] - pub location: Location, + pub location: String, #[serde(rename = "availability_zone")] pub availability_zone: models::AvailabilityZone, /// ID проекта @@ -146,7 +146,7 @@ impl Balancer { is_use_proxy: bool, rules: Vec, ips: Vec, - location: Location, + location: String, availability_zone: models::AvailabilityZone, project_id: i32, networks: Vec @@ -237,17 +237,3 @@ impl Default for Status { Self::Started } } -/// Географическое расположение балансировщика -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/create_vpc.rs b/src/models/create_vpc.rs index 4efc80d..b9bbf98 100644 --- a/src/models/create_vpc.rs +++ b/src/models/create_vpc.rs @@ -22,7 +22,7 @@ pub struct CreateVpc { pub subnet_v4: String, /// Локация сети. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Описание. #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, @@ -31,7 +31,7 @@ pub struct CreateVpc { } impl CreateVpc { - pub fn new(name: String, subnet_v4: String, location: Location) -> CreateVpc { + pub fn new(name: String, subnet_v4: String, location: String) -> CreateVpc { CreateVpc { name, subnet_v4, @@ -41,21 +41,3 @@ impl CreateVpc { } } } -/// Локация сети. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-2")] - Ru2, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "nl-1")] - Nl1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/database_cluster.rs b/src/models/database_cluster.rs index d2e243d..7e4b058 100644 --- a/src/models/database_cluster.rs +++ b/src/models/database_cluster.rs @@ -25,7 +25,7 @@ pub struct DatabaseCluster { pub created_at: String, /// Локация сервера. #[serde(rename = "location", deserialize_with = "Option::deserialize")] - pub location: Option, + pub location: Option, /// Название кластера базы данных. #[serde(rename = "name")] pub name: String, @@ -68,7 +68,7 @@ impl DatabaseCluster { pub fn new( id: f64, created_at: String, - location: Option, + location: Option, name: String, networks: Vec, r#type: models::DbType, @@ -98,24 +98,6 @@ impl DatabaseCluster { } } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-3")] - Ru3, - #[serde(rename = "nl-1")] - Nl1, - #[serde(rename = "de-1")] - De1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Тип хеширования кластера базы данных (mysql5 | mysql | postgres). #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum HashType { diff --git a/src/models/db.rs b/src/models/db.rs index bfbb14a..035de3b 100644 --- a/src/models/db.rs +++ b/src/models/db.rs @@ -31,7 +31,7 @@ pub struct Db { pub login: String, /// Локация сервера. #[serde(rename = "location", skip_serializing_if = "Option::is_none")] - pub location: Option, + pub location: Option, /// Пароль для подключения к базе данных. #[serde(rename = "password")] pub password: String, @@ -122,24 +122,6 @@ impl Db { } } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-2")] - Ru2, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Тип хеширования базы данных (mysql5 | mysql | postgres). #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum HashType { diff --git a/src/models/dedicated_server.rs b/src/models/dedicated_server.rs index e8ded51..e3b8ea4 100644 --- a/src/models/dedicated_server.rs +++ b/src/models/dedicated_server.rs @@ -90,7 +90,7 @@ pub struct DedicatedServer { pub price: f64, /// Локация сервера. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Количество готовых к автоматической выдаче серверов. Если значение равно /// 0, сервер будет установлен через инженеров. #[serde(rename = "autoinstall_ready")] @@ -138,7 +138,7 @@ impl DedicatedServer { additional_ip_addr_id: Option>, plan_id: Option, price: f64, - location: Location, + location: String, autoinstall_ready: f64, password: Option, avatar_link: Option, @@ -198,29 +198,3 @@ impl Default for Status { Self::Installing } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1, - #[serde(rename = "nl-1")] - Nl1, - #[serde(rename = "tr-1")] - Tr1, - #[serde(rename = "us-2")] - Us2, - #[serde(rename = "de-1")] - De1, - #[serde(rename = "fi-1")] - Fi1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/dedicated_server_preset.rs b/src/models/dedicated_server_preset.rs index 92d60be..939ed0b 100644 --- a/src/models/dedicated_server_preset.rs +++ b/src/models/dedicated_server_preset.rs @@ -40,7 +40,7 @@ pub struct DedicatedServerPreset { pub memory: Box, /// Локация. #[serde(rename = "location")] - pub location: Location + pub location: String } impl DedicatedServerPreset { @@ -54,7 +54,7 @@ impl DedicatedServerPreset { disk: models::DedicatedServerPresetDisk, price: f64, memory: models::DedicatedServerPresetMemory, - location: Location + location: String ) -> DedicatedServerPreset { DedicatedServerPreset { id, @@ -69,31 +69,3 @@ impl DedicatedServerPreset { } } } -/// Локация. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-2")] - Ru2, - #[serde(rename = "kz-1")] - Kz1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "nl-1")] - Nl1, - #[serde(rename = "us-2")] - Us2, - #[serde(rename = "tr-1")] - Tr1, - #[serde(rename = "de-1")] - De1, - #[serde(rename = "fi-1")] - Fi1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/image.rs b/src/models/image.rs index 4fdde40..a0ed6e0 100644 --- a/src/models/image.rs +++ b/src/models/image.rs @@ -45,7 +45,7 @@ pub struct Image { pub disk_id: i32, /// Локация образа. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Операционная система образа. #[serde(rename = "os")] pub os: models::Os, @@ -71,7 +71,7 @@ impl Image { name: String, description: String, disk_id: i32, - location: Location, + location: String, os: models::Os, progress: i32, is_custom: bool, @@ -95,26 +95,6 @@ impl Image { } } } -/// Локация образа. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-2")] - Ru2, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1, - #[serde(rename = "nl-1")] - Nl1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Тип образа. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { diff --git a/src/models/image_in_api.rs b/src/models/image_in_api.rs index 575c303..e95689c 100644 --- a/src/models/image_in_api.rs +++ b/src/models/image_in_api.rs @@ -28,14 +28,14 @@ pub struct ImageInApi { pub upload_url: Option, /// Локация, в которой будет создан образ. #[serde(rename = "location")] - pub location: models::Location, + pub location: String, /// Операционная система образа. #[serde(rename = "os")] pub os: models::Os } impl ImageInApi { - pub fn new(location: models::Location, os: models::Os) -> ImageInApi { + pub fn new(location: String, os: models::Os) -> ImageInApi { ImageInApi { name: None, description: None, diff --git a/src/models/location.rs b/src/models/location.rs index 17f6f29..29880ce 100644 --- a/src/models/location.rs +++ b/src/models/location.rs @@ -8,9 +8,8 @@ * Generated by: https://openapi-generator.tech */ -use serde::{Deserialize, Serialize}; - use crate::models; +use serde::{Deserialize, Serialize}; /// Location : Локация. /// Локация. @@ -27,7 +26,8 @@ pub enum Location { #[serde(rename = "kz-1")] Kz1, #[serde(rename = "nl-1")] - Nl1 + Nl1, + } impl std::fmt::Display for Location { @@ -38,7 +38,7 @@ impl std::fmt::Display for Location { Self::Ru3 => write!(f, "ru-3"), Self::Pl1 => write!(f, "pl-1"), Self::Kz1 => write!(f, "kz-1"), - Self::Nl1 => write!(f, "nl-1") + Self::Nl1 => write!(f, "nl-1"), } } } @@ -48,3 +48,4 @@ impl Default for Location { Self::Ru1 } } + diff --git a/src/models/location_dto.rs b/src/models/location_dto.rs index e0ff37e..68c4618 100644 --- a/src/models/location_dto.rs +++ b/src/models/location_dto.rs @@ -15,8 +15,9 @@ use crate::models; /// LocationDto : Локация #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LocationDto { + /// Локация. #[serde(rename = "location")] - pub location: models::Location, + pub location: String, /// Код локации в формате `ISO 3166` #[serde(rename = "location_code")] pub location_code: String, @@ -28,7 +29,7 @@ pub struct LocationDto { impl LocationDto { /// Локация pub fn new( - location: models::Location, + location: String, location_code: String, availability_zones: Vec ) -> LocationDto { diff --git a/src/models/mod.rs b/src/models/mod.rs index fd63b06..295b98b 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -782,8 +782,6 @@ pub mod knowledgebase; pub use self::knowledgebase::Knowledgebase; pub mod knowledgebase_v2; pub use self::knowledgebase_v2::KnowledgebaseV2; -pub mod location; -pub use self::location::Location; pub mod location_dto; pub use self::location_dto::LocationDto; pub mod mailbox; diff --git a/src/models/network_drive.rs b/src/models/network_drive.rs index 1675efa..8f493cc 100644 --- a/src/models/network_drive.rs +++ b/src/models/network_drive.rs @@ -31,7 +31,7 @@ pub struct NetworkDrive { pub service_list: Vec, /// Локация сетевого диска. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Статус сетевого диска. #[serde(rename = "status")] pub status: Status, @@ -52,7 +52,7 @@ impl NetworkDrive { comment: Option, size: f64, service_list: Vec, - location: Location, + location: String, status: Status, availability_zone: models::AvailabilityZone, r#type: Type, @@ -72,18 +72,6 @@ impl NetworkDrive { } } } -/// Локация сетевого диска. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Статус сетевого диска. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { diff --git a/src/models/presets_balancer.rs b/src/models/presets_balancer.rs index b79d747..2bbcdaa 100644 --- a/src/models/presets_balancer.rs +++ b/src/models/presets_balancer.rs @@ -37,7 +37,7 @@ pub struct PresetsBalancer { pub price: f64, /// Географическое расположение тарифа. #[serde(rename = "location")] - pub location: Location + pub location: String } impl PresetsBalancer { @@ -49,7 +49,7 @@ impl PresetsBalancer { replica_count: f64, request_per_second: String, price: f64, - location: Location + location: String ) -> PresetsBalancer { PresetsBalancer { id, @@ -63,19 +63,3 @@ impl PresetsBalancer { } } } -/// Географическое расположение тарифа. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/presets_dbs.rs b/src/models/presets_dbs.rs index b145139..9318bb9 100644 --- a/src/models/presets_dbs.rs +++ b/src/models/presets_dbs.rs @@ -39,7 +39,7 @@ pub struct PresetsDbs { pub price: Option, /// Географическое расположение тарифа. #[serde(rename = "location", skip_serializing_if = "Option::is_none")] - pub location: Option + pub location: Option } impl PresetsDbs { @@ -57,19 +57,3 @@ impl PresetsDbs { } } } -/// Географическое расположение тарифа. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} diff --git a/src/models/presets_storage.rs b/src/models/presets_storage.rs index 5f84cfc..769fe44 100644 --- a/src/models/presets_storage.rs +++ b/src/models/presets_storage.rs @@ -32,7 +32,7 @@ pub struct PresetsStorage { pub price: f64, /// Географическое расположение тарифа. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Теги тарифа. #[serde(rename = "tags")] pub tags: Vec, @@ -49,7 +49,7 @@ impl PresetsStorage { description_short: String, disk: f64, price: f64, - location: Location, + location: String, tags: Vec, storage_class: StorageClass ) -> PresetsStorage { @@ -65,18 +65,6 @@ impl PresetsStorage { } } } -/// Географическое расположение тарифа. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Класс хранилища. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum StorageClass { diff --git a/src/models/servers_configurator.rs b/src/models/servers_configurator.rs index 614f3f8..843f292 100644 --- a/src/models/servers_configurator.rs +++ b/src/models/servers_configurator.rs @@ -19,7 +19,7 @@ pub struct ServersConfigurator { pub id: f64, /// Локация сервера. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Тип диска. #[serde(rename = "disk_type")] pub disk_type: DiskType, @@ -36,7 +36,7 @@ pub struct ServersConfigurator { impl ServersConfigurator { pub fn new( id: f64, - location: Location, + location: String, disk_type: DiskType, is_allowed_local_network: bool, cpu_frequency: String, @@ -52,22 +52,6 @@ impl ServersConfigurator { } } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Тип диска. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DiskType { diff --git a/src/models/servers_preset.rs b/src/models/servers_preset.rs index 51b76cb..d99a777 100644 --- a/src/models/servers_preset.rs +++ b/src/models/servers_preset.rs @@ -19,7 +19,7 @@ pub struct ServersPreset { pub id: f64, /// Локация сервера. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Стоимость в рублях. #[serde(rename = "price")] pub price: f64, @@ -58,7 +58,7 @@ pub struct ServersPreset { impl ServersPreset { pub fn new( id: f64, - location: Location, + location: String, price: f64, cpu: f64, cpu_frequency: String, @@ -88,22 +88,6 @@ impl ServersPreset { } } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Тип диска. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DiskType { diff --git a/src/models/vds.rs b/src/models/vds.rs index 17bdcaa..c20230d 100644 --- a/src/models/vds.rs +++ b/src/models/vds.rs @@ -37,7 +37,7 @@ pub struct Vds { pub preset_id: Option, /// Локация сервера. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// ID конфигуратора сервера. #[serde(rename = "configurator_id", deserialize_with = "Option::deserialize")] pub configurator_id: Option, @@ -115,7 +115,7 @@ impl Vds { os: models::VdsOs, software: Option, preset_id: Option, - location: Location, + location: String, configurator_id: Option, boot_mode: BootMode, status: Status, @@ -179,28 +179,6 @@ impl Vds { } } } -/// Локация сервера. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-2")] - Ru2, - #[serde(rename = "ru-3")] - Ru3, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "kz-1")] - Kz1, - #[serde(rename = "nl-1")] - Nl1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Режим загрузки ОС сервера. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum BootMode { diff --git a/src/models/vpc.rs b/src/models/vpc.rs index a02e2ce..e991549 100644 --- a/src/models/vpc.rs +++ b/src/models/vpc.rs @@ -25,7 +25,7 @@ pub struct Vpc { pub subnet_v4: String, /// Локация сети. #[serde(rename = "location")] - pub location: Location, + pub location: String, /// Дата создания сети. #[serde(rename = "created_at")] pub created_at: chrono::DateTime, @@ -50,7 +50,7 @@ impl Vpc { id: String, name: String, subnet_v4: String, - location: Location, + location: String, created_at: chrono::DateTime, description: String, availability_zone: models::AvailabilityZone, @@ -72,24 +72,6 @@ impl Vpc { } } } -/// Локация сети. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Location { - #[serde(rename = "ru-1")] - Ru1, - #[serde(rename = "ru-2")] - Ru2, - #[serde(rename = "pl-1")] - Pl1, - #[serde(rename = "nl-1")] - Nl1 -} - -impl Default for Location { - fn default() -> Location { - Self::Ru1 - } -} /// Тип сети. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { From bca926e7563fb89377d3f782b189b6f14a63cf75 Mon Sep 17 00:00:00 2001 From: RAprogramm Date: Tue, 30 Jun 2026 08:59:00 +0700 Subject: [PATCH 3/4] fix: tolerate open enums, null VPC fields, renamed list properties Four more tabs deserialized to empty because of upstream-spec drift; all fixed durably in normalize_spec.py so they survive regeneration: - relax_open_enums(): generalize the location-enum delisting to also cover the database-engine enum (postgres18 etc.) and floating-ip resource_type (the API returns 'dbaas', absent from the spec's server/balancer/database/network set). - nullable_vpc_optional_fields(): GET /api/v2/vpcs returns null for 'description' and 'public_ip'; mark them nullable. - rename_mismatched_properties(): generalize the ssh-keys rename to also map the knowledge-bases response property 'knowledgebases' -> the API's 'knowledge_bases'. Regenerated src/models accordingly. --- openapi/normalize_spec.py | 102 +++++++++++++----- src/models/bind_floating_ip.rs | 22 +--- src/models/create_cluster.rs | 5 +- src/models/create_db.rs | 10 +- src/models/database_cluster.rs | 5 +- src/models/db.rs | 5 +- src/models/db_type.rs | 9 +- src/models/floating_ip.rs | 22 +--- src/models/get_knowledgebases_200_response.rs | 12 +-- .../get_knowledgebases_v2_200_response.rs | 12 +-- src/models/mod.rs | 2 - src/models/presets_dbs.rs | 3 +- src/models/vpc.rs | 6 +- 13 files changed, 112 insertions(+), 103 deletions(-) diff --git a/openapi/normalize_spec.py b/openapi/normalize_spec.py index b3801b8..3bfebe4 100644 --- a/openapi/normalize_spec.py +++ b/openapi/normalize_spec.py @@ -198,27 +198,39 @@ def add_undocumented_account_status_fields(spec): props.setdefault(name, schema) -def fix_ssh_keys_property(spec): - """Rename the ``ssh-keys`` response property to ``ssh_keys``. - - The ``GET /api/v1/ssh-keys`` response schema names its collection property - ``ssh-keys`` (hyphen), but the live API returns ``ssh_keys`` (underscore). - Generated from the hyphen spelling, the client deserializes the real - payload to an empty list. Rename the property (and any ``required`` entry) - to the underscore spelling the API actually sends, everywhere it appears. +_RENAMED_PROPERTIES = { + "ssh-keys": "ssh_keys", + "knowledgebases": "knowledge_bases", +} + + +def rename_mismatched_properties(spec): + """Rename response properties whose spec name differs from the API's. + + Some list responses name their collection property differently from what + the live API sends, so the generated client deserializes an empty list (or + fails on a missing field): + + * ``GET /api/v1/ssh-keys`` — spec ``ssh-keys`` vs API ``ssh_keys``; + * ``GET /api/v1/cloud-ai/knowledge-bases`` — spec ``knowledgebases`` vs API + ``knowledge_bases``. + + Rename the property (and any matching ``required`` entry) to the spelling + the API actually sends, wherever it appears. """ def walk(node): if isinstance(node, dict): props = node.get("properties") - if isinstance(props, dict) and "ssh-keys" in props: - props["ssh_keys"] = props.pop("ssh-keys") - required = node.get("required") - if isinstance(required, list): - node["required"] = [ - "ssh_keys" if name == "ssh-keys" else name - for name in required - ] + if isinstance(props, dict): + for old, new in _RENAMED_PROPERTIES.items(): + if old in props: + props[new] = props.pop(old) + required = node.get("required") + if isinstance(required, list): + node["required"] = [ + new if name == old else name for name in required + ] for value in node.values(): walk(value) elif isinstance(node, list): @@ -256,22 +268,37 @@ def relax_overstrict_required(spec): sch["required"] = [field for field in minimal if field in props] -def relax_location_enums(spec): - """Drop the closed enum on availability-zone (location) fields. +def relax_open_enums(spec): + """Drop closed enums on fields the API extends with new values over time. + + Several string enums in the spec are effectively open-ended and lag the + live API, so a value the spec has not caught up to fails deserialization + and the whole collection comes back empty: - Zones (``ru-1``, ``pl-1``, ``nl-1``, ``de-1``, ...) are added over time, - but the spec pins them as a closed enum — both the shared ``Location`` / - ``location`` schemas and ~17 inline copies. A resource in a zone the spec - has not caught up to (e.g. an app in ``de-1``) then fails enum - deserialization, and the whole collection comes back empty. Strip the enum - constraint (keeping ``type: string``) wherever a location-like enum - appears, so any present or future zone deserializes as a plain string. + * availability zones (``ru-1``/``pl-1``/``nl-1``/``de-1``/...) — the shared + ``Location``/``location`` schemas plus ~17 inline copies; + * database engines (``mysql``/``postgres17``/``postgres18``/...); + * floating-ip ``resource_type`` (``server``/``balancer``/``database``/ + ``network`` — the API also returns ``dbaas``). + + Strip the enum (keeping ``type: string``) wherever one of these appears, so + any present or future value deserializes as a plain string. Detected by a + distinctive member so unrelated enums (statuses, etc.) are left intact. """ + resource_kinds = {"server", "balancer", "database", "network"} + + def is_open(values): + members = set(values) + return ( + "ru-1" in members + or "postgres14" in members + or members == resource_kinds + ) def walk(node): if isinstance(node, dict): enum = node.get("enum") - if isinstance(enum, list) and "ru-1" in enum: + if isinstance(enum, list) and is_open(enum): node.pop("enum", None) node.setdefault("type", "string") for value in node.values(): @@ -283,15 +310,34 @@ def walk(node): walk(spec) +def nullable_vpc_optional_fields(spec): + """Mark VPC string fields nullable that the live API returns as ``null``. + + The ``vpc`` schema types ``description`` and ``public_ip`` as required + strings, but ``GET /api/v2/vpcs`` returns ``null`` for them, failing with + "invalid type: null, expected a string". Mark them nullable so they map to + ``Option`` instead. + """ + vpc = spec.get("components", {}).get("schemas", {}).get("vpc") + if not isinstance(vpc, dict): + return + props = vpc.get("properties", {}) + for name in ("description", "public_ip"): + field = props.get(name) + if isinstance(field, dict) and "$ref" not in field: + field["nullable"] = True + + def normalize(spec): """Apply all normalization passes to ``spec`` in place and return it.""" fix_path_parameters(spec) localize_tags(spec) nullable_response_id(spec) add_undocumented_account_status_fields(spec) - fix_ssh_keys_property(spec) + rename_mismatched_properties(spec) relax_overstrict_required(spec) - relax_location_enums(spec) + relax_open_enums(spec) + nullable_vpc_optional_fields(spec) return spec diff --git a/src/models/bind_floating_ip.rs b/src/models/bind_floating_ip.rs index 91ed6d8..a056c52 100644 --- a/src/models/bind_floating_ip.rs +++ b/src/models/bind_floating_ip.rs @@ -16,14 +16,14 @@ use crate::models; pub struct BindFloatingIp { /// Тип ресурса. #[serde(rename = "resource_type")] - pub resource_type: ResourceType, + pub resource_type: String, #[serde(rename = "resource_id")] pub resource_id: Box } impl BindFloatingIp { pub fn new( - resource_type: ResourceType, + resource_type: String, resource_id: models::BindFloatingIpResourceId ) -> BindFloatingIp { BindFloatingIp { @@ -32,21 +32,3 @@ impl BindFloatingIp { } } } -/// Тип ресурса. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum ResourceType { - #[serde(rename = "server")] - Server, - #[serde(rename = "balancer")] - Balancer, - #[serde(rename = "database")] - Database, - #[serde(rename = "network")] - Network -} - -impl Default for ResourceType { - fn default() -> ResourceType { - Self::Server - } -} diff --git a/src/models/create_cluster.rs b/src/models/create_cluster.rs index 03960d8..9bd6413 100644 --- a/src/models/create_cluster.rs +++ b/src/models/create_cluster.rs @@ -17,8 +17,9 @@ pub struct CreateCluster { /// Название кластера базы данных. #[serde(rename = "name")] pub name: String, + /// Тип базы данных. #[serde(rename = "type")] - pub r#type: models::DbType, + pub r#type: String, #[serde(rename = "admin", skip_serializing_if = "Option::is_none")] pub admin: Option>, #[serde(rename = "instance", skip_serializing_if = "Option::is_none")] @@ -51,7 +52,7 @@ pub struct CreateCluster { } impl CreateCluster { - pub fn new(name: String, r#type: models::DbType) -> CreateCluster { + pub fn new(name: String, r#type: String) -> CreateCluster { CreateCluster { name, r#type, diff --git a/src/models/create_db.rs b/src/models/create_db.rs index af317f6..4e27a37 100644 --- a/src/models/create_db.rs +++ b/src/models/create_db.rs @@ -23,8 +23,9 @@ pub struct CreateDb { /// Название базы данных. #[serde(rename = "name")] pub name: String, + /// Тип базы данных. #[serde(rename = "type")] - pub r#type: models::DbType, + pub r#type: String, /// Тип хеширования базы данных (mysql5 | mysql | postgres). #[serde(rename = "hash_type", skip_serializing_if = "Option::is_none")] pub hash_type: Option, @@ -38,12 +39,7 @@ pub struct CreateDb { } impl CreateDb { - pub fn new( - password: String, - name: String, - r#type: models::DbType, - preset_id: i32 - ) -> CreateDb { + pub fn new(password: String, name: String, r#type: String, preset_id: i32) -> CreateDb { CreateDb { login: None, password, diff --git a/src/models/database_cluster.rs b/src/models/database_cluster.rs index 7e4b058..bb66fdc 100644 --- a/src/models/database_cluster.rs +++ b/src/models/database_cluster.rs @@ -32,8 +32,9 @@ pub struct DatabaseCluster { /// Список сетей кластера базы данных. #[serde(rename = "networks")] pub networks: Vec, + /// Тип базы данных. #[serde(rename = "type")] - pub r#type: models::DbType, + pub r#type: String, /// Тип хеширования кластера базы данных (mysql5 | mysql | postgres). #[serde(rename = "hash_type", deserialize_with = "Option::deserialize")] pub hash_type: Option, @@ -71,7 +72,7 @@ impl DatabaseCluster { location: Option, name: String, networks: Vec, - r#type: models::DbType, + r#type: String, hash_type: Option, avatar_link: Option, port: Option, diff --git a/src/models/db.rs b/src/models/db.rs index 035de3b..a6efdfc 100644 --- a/src/models/db.rs +++ b/src/models/db.rs @@ -41,8 +41,9 @@ pub struct Db { /// Хост. #[serde(rename = "host", deserialize_with = "Option::deserialize")] pub host: Option, + /// Тип базы данных. #[serde(rename = "type")] - pub r#type: models::DbType, + pub r#type: String, /// Тип хеширования базы данных (mysql5 | mysql | postgres). #[serde(rename = "hash_type", deserialize_with = "Option::deserialize")] pub hash_type: Option, @@ -83,7 +84,7 @@ impl Db { password: String, name: String, host: Option, - r#type: models::DbType, + r#type: String, hash_type: Option, port: i32, ip: Option, diff --git a/src/models/db_type.rs b/src/models/db_type.rs index cb1c506..9d0df38 100644 --- a/src/models/db_type.rs +++ b/src/models/db_type.rs @@ -8,9 +8,8 @@ * Generated by: https://openapi-generator.tech */ -use serde::{Deserialize, Serialize}; - use crate::models; +use serde::{Deserialize, Serialize}; /// DbType : Тип базы данных. /// Тип базы данных. @@ -49,7 +48,8 @@ pub enum DbType { #[serde(rename = "kafka")] Kafka, #[serde(rename = "rabbitmq4_0")] - Rabbitmq40 + Rabbitmq40, + } impl std::fmt::Display for DbType { @@ -71,7 +71,7 @@ impl std::fmt::Display for DbType { Self::Clickhouse24 => write!(f, "clickhouse24"), Self::Clickhouse25 => write!(f, "clickhouse25"), Self::Kafka => write!(f, "kafka"), - Self::Rabbitmq40 => write!(f, "rabbitmq4_0") + Self::Rabbitmq40 => write!(f, "rabbitmq4_0"), } } } @@ -81,3 +81,4 @@ impl Default for DbType { Self::Mysql } } + diff --git a/src/models/floating_ip.rs b/src/models/floating_ip.rs index ec530b4..dcc2d51 100644 --- a/src/models/floating_ip.rs +++ b/src/models/floating_ip.rs @@ -27,7 +27,7 @@ pub struct FloatingIp { pub availability_zone: models::AvailabilityZone, /// Тип ресурса. #[serde(rename = "resource_type", deserialize_with = "Option::deserialize")] - pub resource_type: Option, + pub resource_type: Option, #[serde(rename = "resource_id", deserialize_with = "Option::deserialize")] pub resource_id: Option>, /// Комментарий @@ -44,7 +44,7 @@ impl FloatingIp { ip: Option, is_ddos_guard: bool, availability_zone: models::AvailabilityZone, - resource_type: Option, + resource_type: Option, resource_id: Option, comment: Option, ptr: Option @@ -65,21 +65,3 @@ impl FloatingIp { } } } -/// Тип ресурса. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum ResourceType { - #[serde(rename = "server")] - Server, - #[serde(rename = "balancer")] - Balancer, - #[serde(rename = "database")] - Database, - #[serde(rename = "network")] - Network -} - -impl Default for ResourceType { - fn default() -> ResourceType { - Self::Server - } -} diff --git a/src/models/get_knowledgebases_200_response.rs b/src/models/get_knowledgebases_200_response.rs index 1ca3506..65a49ff 100644 --- a/src/models/get_knowledgebases_200_response.rs +++ b/src/models/get_knowledgebases_200_response.rs @@ -14,25 +14,25 @@ use crate::models; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GetKnowledgebases200Response { - #[serde(rename = "knowledgebases")] - pub knowledgebases: Vec, #[serde(rename = "meta")] - pub meta: Box, + pub meta: Box, + #[serde(rename = "knowledge_bases")] + pub knowledge_bases: Vec, /// ID запроса, который можно указывать при обращении в службу технической /// поддержки, чтобы помочь определить проблему. #[serde(rename = "response_id", deserialize_with = "Option::deserialize")] - pub response_id: Option + pub response_id: Option } impl GetKnowledgebases200Response { pub fn new( - knowledgebases: Vec, meta: models::GetKnowledgebasesV2200ResponseAllOfMeta, + knowledge_bases: Vec, response_id: Option ) -> GetKnowledgebases200Response { GetKnowledgebases200Response { - knowledgebases, meta: Box::new(meta), + knowledge_bases, response_id } } diff --git a/src/models/get_knowledgebases_v2_200_response.rs b/src/models/get_knowledgebases_v2_200_response.rs index 9ef3ff2..bf838c5 100644 --- a/src/models/get_knowledgebases_v2_200_response.rs +++ b/src/models/get_knowledgebases_v2_200_response.rs @@ -14,25 +14,25 @@ use crate::models; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GetKnowledgebasesV2200Response { - #[serde(rename = "knowledgebases")] - pub knowledgebases: Vec, #[serde(rename = "meta")] - pub meta: Box, + pub meta: Box, + #[serde(rename = "knowledge_bases")] + pub knowledge_bases: Vec, /// ID запроса, который можно указывать при обращении в службу технической /// поддержки, чтобы помочь определить проблему. #[serde(rename = "response_id", deserialize_with = "Option::deserialize")] - pub response_id: Option + pub response_id: Option } impl GetKnowledgebasesV2200Response { pub fn new( - knowledgebases: Vec, meta: models::GetKnowledgebasesV2200ResponseAllOfMeta, + knowledge_bases: Vec, response_id: Option ) -> GetKnowledgebasesV2200Response { GetKnowledgebasesV2200Response { - knowledgebases, meta: Box::new(meta), + knowledge_bases, response_id } } diff --git a/src/models/mod.rs b/src/models/mod.rs index 295b98b..2fb5fd0 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -350,8 +350,6 @@ pub mod db_disk_stats; pub use self::db_disk_stats::DbDiskStats; pub mod db_replication; pub use self::db_replication::DbReplication; -pub mod db_type; -pub use self::db_type::DbType; pub mod dedicated_server; pub use self::dedicated_server::DedicatedServer; pub mod dedicated_server_additional_service; diff --git a/src/models/presets_dbs.rs b/src/models/presets_dbs.rs index 9318bb9..6d05908 100644 --- a/src/models/presets_dbs.rs +++ b/src/models/presets_dbs.rs @@ -32,8 +32,9 @@ pub struct PresetsDbs { /// Описание диска тарифа. #[serde(rename = "disk", skip_serializing_if = "Option::is_none")] pub disk: Option, + /// Тип базы данных. #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, + pub r#type: Option, /// Стоимость тарифа базы данных #[serde(rename = "price", skip_serializing_if = "Option::is_none")] pub price: Option, diff --git a/src/models/vpc.rs b/src/models/vpc.rs index e991549..26c0305 100644 --- a/src/models/vpc.rs +++ b/src/models/vpc.rs @@ -30,8 +30,8 @@ pub struct Vpc { #[serde(rename = "created_at")] pub created_at: chrono::DateTime, /// Описание. - #[serde(rename = "description")] - pub description: String, + #[serde(rename = "description", deserialize_with = "Option::deserialize")] + pub description: Option, #[serde(rename = "availability_zone")] pub availability_zone: models::AvailabilityZone, /// Публичный IP-адрес сети. @@ -52,7 +52,7 @@ impl Vpc { subnet_v4: String, location: String, created_at: chrono::DateTime, - description: String, + description: Option, availability_zone: models::AvailabilityZone, public_ip: Option, r#type: Type, From 202f4e4ae0955ad0f6c1128eeca0c8d7f1f1cd9c Mon Sep 17 00:00:00 2001 From: RAprogramm Date: Tue, 30 Jun 2026 10:39:54 +0700 Subject: [PATCH 4/4] fix: type identifier fields as integers, not floats Numeric ids (id, *_id) were typed 'number' in the spec, so the generated Rust models used f64 and JSON serialized them as floats (1873345.0). Add an integer_id_fields() normalizer pass that retypes id-like number fields to integer/int64; genuine decimals (balance, *_cost) keep their type because their names do not match. Regenerated src/models accordingly. --- openapi/normalize_spec.py | 30 +++++++++++++++++++ src/models/a_______.rs | 2 +- src/models/add_balancer_to_project_request.rs | 4 +-- src/models/add_cluster_to_project_request.rs | 4 +-- src/models/add_database_to_project_request.rs | 4 +-- ...add_dedicated_server_to_project_request.rs | 4 +-- src/models/add_server_to_project_request.rs | 4 +-- src/models/add_storage_to_project_request.rs | 4 +-- src/models/agent.rs | 20 ++++++------- src/models/app.rs | 6 ++-- src/models/app_disk_status.rs | 2 +- src/models/balancer.rs | 8 ++--- src/models/bonus.rs | 6 ++-- src/models/bucket.rs | 20 ++++++------- src/models/bucket_user.rs | 4 +-- src/models/clusterk8s.rs | 8 ++--- src/models/create_admin.rs | 2 +- src/models/create_agent.rs | 10 +++---- src/models/create_app.rs | 6 ++-- src/models/create_balancer.rs | 4 +-- src/models/create_dedicated_server.rs | 18 +++++------ src/models/create_knowledgebase.rs | 10 +++---- src/models/create_server.rs | 8 ++--- src/models/create_server_configuration.rs | 4 +-- src/models/create_storage_request.rs | 4 +-- .../create_storage_request_configurator.rs | 2 +- src/models/database_admin.rs | 4 +-- src/models/database_admin_instances_inner.rs | 4 +-- src/models/database_cluster.rs | 4 +-- src/models/database_instance.rs | 4 +-- src/models/db.rs | 4 +-- src/models/dedicated_server.rs | 24 +++++++-------- .../dedicated_server_additional_service.rs | 4 +-- src/models/dedicated_server_preset.rs | 4 +-- src/models/dns_record.rs | 2 +- src/models/dns_record_v2.rs | 2 +- src/models/document.rs | 4 +-- src/models/domain.rs | 12 ++++---- src/models/domain_prolong.rs | 2 +- src/models/domain_register.rs | 4 +-- src/models/domain_request.rs | 12 ++++---- src/models/free.rs | 2 +- src/models/invoice.rs | 6 ++-- src/models/knowledgebase.rs | 12 ++++---- src/models/knowledgebase_v2.rs | 12 ++++---- src/models/model.rs | 8 ++--- src/models/model_use.rs | 2 +- src/models/mount_network_drive.rs | 4 +-- .../network_drive_available_resource.rs | 4 +-- src/models/network_drive_preset.rs | 4 +-- .../network_drive_service_list_inner.rs | 4 +-- src/models/presets_balancer.rs | 4 +-- src/models/presets_dbs.rs | 2 +- src/models/presets_storage.rs | 4 +-- src/models/project.rs | 4 +-- src/models/project_resource.rs | 8 ++--- src/models/resource_transfer.rs | 4 +-- src/models/rule.rs | 4 +-- src/models/s3_subdomain.rs | 4 +-- src/models/server_backup.rs | 4 +-- src/models/server_disk.rs | 4 +-- src/models/server_log.rs | 4 +-- src/models/servers_configurator.rs | 4 +-- src/models/servers_os.rs | 2 +- src/models/servers_preset.rs | 4 +-- src/models/servers_software.rs | 2 +- src/models/service_price.rs | 2 +- src/models/service_service_price.rs | 2 +- src/models/ssh_key.rs | 4 +-- src/models/ssh_key_used_by_inner.rs | 4 +-- src/models/status_company_info.rs | 4 +-- src/models/subdomain.rs | 4 +-- src/models/token_package.rs | 8 ++--- src/models/top_level_domain.rs | 4 +-- src/models/update_admin.rs | 2 +- src/models/update_agent.rs | 4 +-- src/models/update_server.rs | 6 ++-- src/models/update_server_configurator.rs | 2 +- src/models/update_settings.rs | 2 +- src/models/update_storage_request.rs | 2 +- .../update_storage_request_configurator.rs | 2 +- src/models/vds.rs | 12 ++++---- src/models/vds_disks_inner.rs | 4 +-- src/models/vds_os.rs | 4 +-- src/models/vds_software.rs | 2 +- src/models/vpc_service.rs | 4 +-- 86 files changed, 256 insertions(+), 226 deletions(-) diff --git a/openapi/normalize_spec.py b/openapi/normalize_spec.py index 3bfebe4..bc6268a 100644 --- a/openapi/normalize_spec.py +++ b/openapi/normalize_spec.py @@ -328,6 +328,35 @@ def nullable_vpc_optional_fields(spec): field["nullable"] = True +def integer_id_fields(spec): + """Type identifier fields as integers instead of floats. + + The upstream spec types numeric ids (``id`` and ``*_id``) as ``number``, + so the generated Rust model uses ``f64`` and JSON output renders them as + floats (e.g. ``1873345.0``). Retype id-like ``number`` fields to + ``integer`` (``int64``) so ids serialize and display as integers. Genuine + decimals (``balance``, ``*_cost``, ...) are left untouched because their + names do not match. + """ + + def walk(node): + if isinstance(node, dict): + props = node.get("properties") + if isinstance(props, dict): + for name, schema in props.items(): + is_id = name == "id" or name.endswith("_id") + if is_id and isinstance(schema, dict) and schema.get("type") == "number": + schema["type"] = "integer" + schema["format"] = "int64" + for value in node.values(): + walk(value) + elif isinstance(node, list): + for value in node: + walk(value) + + walk(spec) + + def normalize(spec): """Apply all normalization passes to ``spec`` in place and return it.""" fix_path_parameters(spec) @@ -338,6 +367,7 @@ def normalize(spec): relax_overstrict_required(spec) relax_open_enums(spec) nullable_vpc_optional_fields(spec) + integer_id_fields(spec) return spec diff --git a/src/models/a_______.rs b/src/models/a_______.rs index c9fcc1b..506ff0c 100644 --- a/src/models/a_______.rs +++ b/src/models/a_______.rs @@ -26,7 +26,7 @@ pub struct A { /// Идентификатор приложения в App Platform, к которому будет привязан домен /// или поддомен. #[serde(rename = "app_id", skip_serializing_if = "Option::is_none")] - pub app_id: Option + pub app_id: Option } impl A { diff --git a/src/models/add_balancer_to_project_request.rs b/src/models/add_balancer_to_project_request.rs index 23a0842..078082e 100644 --- a/src/models/add_balancer_to_project_request.rs +++ b/src/models/add_balancer_to_project_request.rs @@ -16,11 +16,11 @@ use crate::models; pub struct AddBalancerToProjectRequest { /// ID добавляемого балансировщика. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl AddBalancerToProjectRequest { - pub fn new(resource_id: f64) -> AddBalancerToProjectRequest { + pub fn new(resource_id: i64) -> AddBalancerToProjectRequest { AddBalancerToProjectRequest { resource_id } diff --git a/src/models/add_cluster_to_project_request.rs b/src/models/add_cluster_to_project_request.rs index fc076e4..80a07c7 100644 --- a/src/models/add_cluster_to_project_request.rs +++ b/src/models/add_cluster_to_project_request.rs @@ -16,11 +16,11 @@ use crate::models; pub struct AddClusterToProjectRequest { /// ID добавляемого кластера. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl AddClusterToProjectRequest { - pub fn new(resource_id: f64) -> AddClusterToProjectRequest { + pub fn new(resource_id: i64) -> AddClusterToProjectRequest { AddClusterToProjectRequest { resource_id } diff --git a/src/models/add_database_to_project_request.rs b/src/models/add_database_to_project_request.rs index d734d3e..a2c3b71 100644 --- a/src/models/add_database_to_project_request.rs +++ b/src/models/add_database_to_project_request.rs @@ -16,11 +16,11 @@ use crate::models; pub struct AddDatabaseToProjectRequest { /// ID добавляемой базы данных. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl AddDatabaseToProjectRequest { - pub fn new(resource_id: f64) -> AddDatabaseToProjectRequest { + pub fn new(resource_id: i64) -> AddDatabaseToProjectRequest { AddDatabaseToProjectRequest { resource_id } diff --git a/src/models/add_dedicated_server_to_project_request.rs b/src/models/add_dedicated_server_to_project_request.rs index d87c628..9cf12a4 100644 --- a/src/models/add_dedicated_server_to_project_request.rs +++ b/src/models/add_dedicated_server_to_project_request.rs @@ -16,11 +16,11 @@ use crate::models; pub struct AddDedicatedServerToProjectRequest { /// ID добавляемого выделенного сервера. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl AddDedicatedServerToProjectRequest { - pub fn new(resource_id: f64) -> AddDedicatedServerToProjectRequest { + pub fn new(resource_id: i64) -> AddDedicatedServerToProjectRequest { AddDedicatedServerToProjectRequest { resource_id } diff --git a/src/models/add_server_to_project_request.rs b/src/models/add_server_to_project_request.rs index 6aedf85..e0f4b69 100644 --- a/src/models/add_server_to_project_request.rs +++ b/src/models/add_server_to_project_request.rs @@ -16,11 +16,11 @@ use crate::models; pub struct AddServerToProjectRequest { /// ID добавляемого сервера. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl AddServerToProjectRequest { - pub fn new(resource_id: f64) -> AddServerToProjectRequest { + pub fn new(resource_id: i64) -> AddServerToProjectRequest { AddServerToProjectRequest { resource_id } diff --git a/src/models/add_storage_to_project_request.rs b/src/models/add_storage_to_project_request.rs index 3063877..ff96c92 100644 --- a/src/models/add_storage_to_project_request.rs +++ b/src/models/add_storage_to_project_request.rs @@ -16,11 +16,11 @@ use crate::models; pub struct AddStorageToProjectRequest { /// ID добавляемого хранилища. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl AddStorageToProjectRequest { - pub fn new(resource_id: f64) -> AddStorageToProjectRequest { + pub fn new(resource_id: i64) -> AddStorageToProjectRequest { AddStorageToProjectRequest { resource_id } diff --git a/src/models/agent.rs b/src/models/agent.rs index 10919f3..384a250 100644 --- a/src/models/agent.rs +++ b/src/models/agent.rs @@ -17,7 +17,7 @@ use crate::models; pub struct Agent { /// Уникальный идентификатор агента #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название агента #[serde(rename = "name")] pub name: String, @@ -26,10 +26,10 @@ pub struct Agent { pub description: String, /// ID модели #[serde(rename = "model_id")] - pub model_id: f64, + pub model_id: i64, /// ID провайдера #[serde(rename = "provider_id")] - pub provider_id: f64, + pub provider_id: i64, #[serde(rename = "settings")] pub settings: Box, /// Статус агента @@ -49,7 +49,7 @@ pub struct Agent { pub remaining_tokens: f64, /// ID пакета токенов #[serde(rename = "token_package_id")] - pub token_package_id: f64, + pub token_package_id: i64, /// Дата обновления подписки #[serde(rename = "subscription_renewal_date")] pub subscription_renewal_date: chrono::DateTime, @@ -58,7 +58,7 @@ pub struct Agent { pub knowledge_bases_ids: Vec, /// ID доступа #[serde(rename = "access_id")] - pub access_id: f64, + pub access_id: i64, /// Дата создания агента #[serde(rename = "created_at")] pub created_at: chrono::DateTime @@ -67,21 +67,21 @@ pub struct Agent { impl Agent { /// AI Agent pub fn new( - id: f64, + id: i64, name: String, description: String, - model_id: f64, - provider_id: f64, + model_id: i64, + provider_id: i64, settings: models::AgentSettings, status: Status, access_type: AccessType, total_tokens: f64, used_tokens: f64, remaining_tokens: f64, - token_package_id: f64, + token_package_id: i64, subscription_renewal_date: chrono::DateTime, knowledge_bases_ids: Vec, - access_id: f64, + access_id: i64, created_at: chrono::DateTime ) -> Agent { Agent { diff --git a/src/models/app.rs b/src/models/app.rs index d66c10b..4339bac 100644 --- a/src/models/app.rs +++ b/src/models/app.rs @@ -18,7 +18,7 @@ pub struct App { /// ID для каждого экземпляра приложения. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Тип приложения. #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, @@ -68,7 +68,7 @@ pub struct App { pub comment: Option, /// ID тарифа. #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] - pub preset_id: Option, + pub preset_id: Option, /// Путь к директории с индексным файлом. Определен для приложений `type: /// frontend`. Для приложений `type: backend` всегда null. #[serde( @@ -125,7 +125,7 @@ pub struct App { impl App { /// Экземпляр приложения. - pub fn new(id: f64, name: String, status: Status) -> App { + pub fn new(id: i64, name: String, status: Status) -> App { App { id, r#type: None, diff --git a/src/models/app_disk_status.rs b/src/models/app_disk_status.rs index 9fcba0e..be3929b 100644 --- a/src/models/app_disk_status.rs +++ b/src/models/app_disk_status.rs @@ -24,7 +24,7 @@ pub struct AppDiskStatus { pub size: Option, /// ID диска. #[serde(rename = "disk_id", skip_serializing_if = "Option::is_none")] - pub disk_id: Option + pub disk_id: Option } impl AppDiskStatus { diff --git a/src/models/balancer.rs b/src/models/balancer.rs index d6cdccb..c2c356c 100644 --- a/src/models/balancer.rs +++ b/src/models/balancer.rs @@ -18,7 +18,7 @@ pub struct Balancer { /// ID для каждого экземпляра балансировщика. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// ID пользователя. #[serde(rename = "account_id", skip_serializing_if = "Option::is_none")] pub account_id: Option, @@ -77,7 +77,7 @@ pub struct Balancer { pub httprequest_timeout: f64, /// ID тарифа. #[serde(rename = "preset_id")] - pub preset_id: f64, + pub preset_id: i64, /// Это логическое значение, которое показывает, требуется ли /// перенаправление на SSL. #[serde(rename = "is_ssl")] @@ -119,7 +119,7 @@ pub struct Balancer { impl Balancer { /// Балансировщик pub fn new( - id: f64, + id: i64, algo: Algo, created_at: chrono::DateTime, fall: f64, @@ -137,7 +137,7 @@ impl Balancer { client_timeout: f64, server_timeout: f64, httprequest_timeout: f64, - preset_id: f64, + preset_id: i64, is_ssl: bool, status: Status, is_sticky: bool, diff --git a/src/models/bonus.rs b/src/models/bonus.rs index f27aa49..b2f9879 100644 --- a/src/models/bonus.rs +++ b/src/models/bonus.rs @@ -20,15 +20,15 @@ pub struct Bonus { pub money_source: MoneySource, /// ID администратора, на которого зарегистрирован домен. #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")] - pub person_id: Option, + pub person_id: Option, /// ID бонуса. #[serde(rename = "bonus_id")] - pub bonus_id: f64 + pub bonus_id: i64 } impl Bonus { /// Оплата заявки на продление/регистрацию домена бонусом - pub fn new(money_source: MoneySource, bonus_id: f64) -> Bonus { + pub fn new(money_source: MoneySource, bonus_id: i64) -> Bonus { Bonus { money_source, person_id: None, diff --git a/src/models/bucket.rs b/src/models/bucket.rs index db02bc1..417e3d3 100644 --- a/src/models/bucket.rs +++ b/src/models/bucket.rs @@ -18,7 +18,7 @@ pub struct Bucket { /// ID для каждого экземпляра хранилища. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Удобочитаемое имя, установленное для хранилища. #[serde(rename = "name")] pub name: String, @@ -32,10 +32,10 @@ pub struct Bucket { pub r#type: Type, /// ID тарифа хранилища. #[serde(rename = "preset_id", deserialize_with = "Option::deserialize")] - pub preset_id: Option, + pub preset_id: Option, /// ID конфигуратора хранилища. #[serde(rename = "configurator_id", deserialize_with = "Option::deserialize")] - pub configurator_id: Option, + pub configurator_id: Option, /// Ссылка на аватар хранилища. #[serde(rename = "avatar_link", deserialize_with = "Option::deserialize")] pub avatar_link: Option, @@ -68,10 +68,10 @@ pub struct Bucket { pub storage_class: StorageClass, /// ID проекта. #[serde(rename = "project_id")] - pub project_id: f64, + pub project_id: i64, /// ID тарифа. #[serde(rename = "rate_id")] - pub rate_id: f64, + pub rate_id: i64, #[serde(rename = "website_config", deserialize_with = "Option::deserialize")] pub website_config: Option>, /// Разрешено ли автоматическое повышение тарифа. @@ -82,13 +82,13 @@ pub struct Bucket { impl Bucket { /// Хранилище S3 pub fn new( - id: f64, + id: i64, name: String, description: String, disk_stats: models::BucketDiskStats, r#type: Type, - preset_id: Option, - configurator_id: Option, + preset_id: Option, + configurator_id: Option, avatar_link: Option, status: Status, object_amount: f64, @@ -98,8 +98,8 @@ impl Bucket { secret_key: String, moved_in_quarantine_at: Option>, storage_class: StorageClass, - project_id: f64, - rate_id: f64, + project_id: i64, + rate_id: i64, website_config: Option, is_allow_auto_upgrade: bool ) -> Bucket { diff --git a/src/models/bucket_user.rs b/src/models/bucket_user.rs index 89c2bd3..4659835 100644 --- a/src/models/bucket_user.rs +++ b/src/models/bucket_user.rs @@ -17,7 +17,7 @@ use crate::models; pub struct BucketUser { /// ID пользователя. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Логин пользователя. #[serde(rename = "access_key")] pub access_key: String, @@ -28,7 +28,7 @@ pub struct BucketUser { impl BucketUser { /// Пользователь хранилища - pub fn new(id: f64, access_key: String, secret_key: String) -> BucketUser { + pub fn new(id: i64, access_key: String, secret_key: String) -> BucketUser { BucketUser { id, access_key, diff --git a/src/models/clusterk8s.rs b/src/models/clusterk8s.rs index be9c508..5f27648 100644 --- a/src/models/clusterk8s.rs +++ b/src/models/clusterk8s.rs @@ -18,7 +18,7 @@ pub struct Clusterk8s { /// ID для каждого экземпляра кластера. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Удобочитаемое имя, установленное для кластера. #[serde(rename = "name")] pub name: String, @@ -55,13 +55,13 @@ pub struct Clusterk8s { pub disk: f64, /// Тип сервиса кластера. #[serde(rename = "preset_id")] - pub preset_id: f64 + pub preset_id: i64 } impl Clusterk8s { /// Кластер pub fn new( - id: f64, + id: i64, name: String, created_at: chrono::DateTime, status: Status, @@ -73,7 +73,7 @@ impl Clusterk8s { cpu: f64, ram: f64, disk: f64, - preset_id: f64 + preset_id: i64 ) -> Clusterk8s { Clusterk8s { id, diff --git a/src/models/create_admin.rs b/src/models/create_admin.rs index 92c8ac6..dec2132 100644 --- a/src/models/create_admin.rs +++ b/src/models/create_admin.rs @@ -27,7 +27,7 @@ pub struct CreateAdmin { /// доступно только для кластеров MySQL. Если поле не передано, то /// привилегии будут применены ко всем инстансам #[serde(rename = "instance_id", skip_serializing_if = "Option::is_none")] - pub instance_id: Option, + pub instance_id: Option, /// Список привилегий пользователя базы данных #[serde(rename = "privileges")] pub privileges: Vec, diff --git a/src/models/create_agent.rs b/src/models/create_agent.rs index bbf4250..054b871 100644 --- a/src/models/create_agent.rs +++ b/src/models/create_agent.rs @@ -26,15 +26,15 @@ pub struct CreateAgent { pub access_type: AccessType, /// ID модели #[serde(rename = "model_id")] - pub model_id: f64, + pub model_id: i64, /// ID пакета токенов #[serde(rename = "token_package_id")] - pub token_package_id: f64, + pub token_package_id: i64, #[serde(rename = "settings")] pub settings: Box, /// ID проекта #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option + pub project_id: Option } impl CreateAgent { @@ -42,8 +42,8 @@ impl CreateAgent { pub fn new( name: String, access_type: AccessType, - model_id: f64, - token_package_id: f64, + model_id: i64, + token_package_id: i64, settings: models::AgentSettings ) -> CreateAgent { CreateAgent { diff --git a/src/models/create_app.rs b/src/models/create_app.rs index 47af094..70666e8 100644 --- a/src/models/create_app.rs +++ b/src/models/create_app.rs @@ -47,7 +47,7 @@ pub struct CreateApp { pub comment: String, /// ID тарифа. #[serde(rename = "preset_id")] - pub preset_id: f64, + pub preset_id: i64, /// Версия окружения. #[serde(rename = "env_version", skip_serializing_if = "Option::is_none")] pub env_version: Option, @@ -70,7 +70,7 @@ pub struct CreateApp { pub system_dependencies: Option>, /// ID проекта. #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option + pub project_id: Option } impl CreateApp { @@ -84,7 +84,7 @@ impl CreateApp { commit_sha: String, name: String, comment: String, - preset_id: f64, + preset_id: i64, framework: models::Frameworks ) -> CreateApp { CreateApp { diff --git a/src/models/create_balancer.rs b/src/models/create_balancer.rs index 1b6af0e..54d8b40 100644 --- a/src/models/create_balancer.rs +++ b/src/models/create_balancer.rs @@ -77,7 +77,7 @@ pub struct CreateBalancer { pub httprequest_timeout: Option, /// ID тарифа. #[serde(rename = "preset_id")] - pub preset_id: f64, + pub preset_id: i64, #[serde(rename = "network", skip_serializing_if = "Option::is_none")] pub network: Option>, #[serde(rename = "availability_zone", skip_serializing_if = "Option::is_none")] @@ -104,7 +104,7 @@ impl CreateBalancer { timeout: f64, fall: f64, rise: f64, - preset_id: f64 + preset_id: i64 ) -> CreateBalancer { CreateBalancer { name, diff --git a/src/models/create_dedicated_server.rs b/src/models/create_dedicated_server.rs index fe41256..1c6c67a 100644 --- a/src/models/create_dedicated_server.rs +++ b/src/models/create_dedicated_server.rs @@ -21,10 +21,10 @@ pub struct CreateDedicatedServer { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub plan_id: Option>, + pub plan_id: Option>, /// ID тарифа выделенного сервера. #[serde(rename = "preset_id")] - pub preset_id: f64, + pub preset_id: i64, /// ID операционной системы, которая будет установлена на выделенный сервер. #[serde( rename = "os_id", @@ -32,7 +32,7 @@ pub struct CreateDedicatedServer { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub os_id: Option>, + pub os_id: Option>, /// ID панели управления, которая будет установлена на выделенный сервер. #[serde( rename = "cp_id", @@ -40,7 +40,7 @@ pub struct CreateDedicatedServer { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub cp_id: Option>, + pub cp_id: Option>, /// ID интернет-канала, который будет установлен на выделенный сервер. #[serde( rename = "bandwidth_id", @@ -48,10 +48,10 @@ pub struct CreateDedicatedServer { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub bandwidth_id: Option>, + pub bandwidth_id: Option>, /// ID сетевого диска, который будет установлен на выделенный сервер. #[serde(rename = "network_drive_id", skip_serializing_if = "Option::is_none")] - pub network_drive_id: Option, + pub network_drive_id: Option, /// ID дополнительного IP-адреса, который будет установлен на выделенный /// сервер. #[serde( @@ -60,7 +60,7 @@ pub struct CreateDedicatedServer { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub additional_ip_addr_id: Option>, + pub additional_ip_addr_id: Option>, /// Период оплаты. #[serde(rename = "payment_period")] pub payment_period: PaymentPeriod, @@ -83,12 +83,12 @@ pub struct CreateDedicatedServer { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub project_id: Option> + pub project_id: Option> } impl CreateDedicatedServer { pub fn new( - preset_id: f64, + preset_id: i64, payment_period: PaymentPeriod, name: String ) -> CreateDedicatedServer { diff --git a/src/models/create_knowledgebase.rs b/src/models/create_knowledgebase.rs index b33a0ee..0d80a7d 100644 --- a/src/models/create_knowledgebase.rs +++ b/src/models/create_knowledgebase.rs @@ -23,25 +23,25 @@ pub struct CreateKnowledgebase { pub description: Option, /// ID пресета базы данных #[serde(rename = "dbaas_preset_id")] - pub dbaas_preset_id: f64, + pub dbaas_preset_id: i64, /// ID сети #[serde(rename = "network_id")] pub network_id: String, /// ID пакета токенов #[serde(rename = "token_package_id")] - pub token_package_id: f64, + pub token_package_id: i64, /// ID проекта #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option + pub project_id: Option } impl CreateKnowledgebase { /// Данные для создания базы знаний pub fn new( name: String, - dbaas_preset_id: f64, + dbaas_preset_id: i64, network_id: String, - token_package_id: f64 + token_package_id: i64 ) -> CreateKnowledgebase { CreateKnowledgebase { name, diff --git a/src/models/create_server.rs b/src/models/create_server.rs index eb90959..fa80823 100644 --- a/src/models/create_server.rs +++ b/src/models/create_server.rs @@ -24,17 +24,17 @@ pub struct CreateServer { /// ID операционной системы, которая будет установлена на облачный сервер. /// Нельзя передавать вместе с `image_id`. #[serde(rename = "os_id", skip_serializing_if = "Option::is_none")] - pub os_id: Option, + pub os_id: Option, /// ID образа, который будет установлен на облачный сервер. Нельзя /// передавать вместе с `os_id`. #[serde(rename = "image_id", skip_serializing_if = "Option::is_none")] pub image_id: Option, /// ID программного обеспечения сервера. #[serde(rename = "software_id", skip_serializing_if = "Option::is_none")] - pub software_id: Option, + pub software_id: Option, /// ID тарифа сервера. Нельзя передавать вместе с ключом `configurator`. #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] - pub preset_id: Option, + pub preset_id: Option, /// Пропускная способность тарифа. Доступные значения от 100 до 1000 с шагом /// 100. #[serde(rename = "bandwidth", skip_serializing_if = "Option::is_none")] @@ -63,7 +63,7 @@ pub struct CreateServer { pub availability_zone: Option, /// ID проекта. #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option, + pub project_id: Option, /// Сетевое имя сервера #[serde(rename = "hostname", skip_serializing_if = "Option::is_none")] pub hostname: Option diff --git a/src/models/create_server_configuration.rs b/src/models/create_server_configuration.rs index 6df4e2b..b6ebd07 100644 --- a/src/models/create_server_configuration.rs +++ b/src/models/create_server_configuration.rs @@ -18,7 +18,7 @@ use crate::models; pub struct CreateServerConfiguration { /// ID конфигуратора сервера. #[serde(rename = "configurator_id")] - pub configurator_id: f64, + pub configurator_id: i64, /// Размер диска в МБ. #[serde(rename = "disk")] pub disk: f64, @@ -35,7 +35,7 @@ pub struct CreateServerConfiguration { impl CreateServerConfiguration { /// Параметры конфигурации сервера. Нельзя передавать вместе с `preset_id`. - pub fn new(configurator_id: f64, disk: f64, cpu: f64, ram: f64) -> CreateServerConfiguration { + pub fn new(configurator_id: i64, disk: f64, cpu: f64, ram: f64) -> CreateServerConfiguration { CreateServerConfiguration { configurator_id, disk, diff --git a/src/models/create_storage_request.rs b/src/models/create_storage_request.rs index b64f455..4cf21b6 100644 --- a/src/models/create_storage_request.rs +++ b/src/models/create_storage_request.rs @@ -25,12 +25,12 @@ pub struct CreateStorageRequest { pub r#type: Type, /// ID тарифа. Нельзя передавать вместе с `configurator`. #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] - pub preset_id: Option, + pub preset_id: Option, #[serde(rename = "configurator", skip_serializing_if = "Option::is_none")] pub configurator: Option>, /// ID проекта. #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option + pub project_id: Option } impl CreateStorageRequest { diff --git a/src/models/create_storage_request_configurator.rs b/src/models/create_storage_request_configurator.rs index e211fbd..3da61c3 100644 --- a/src/models/create_storage_request_configurator.rs +++ b/src/models/create_storage_request_configurator.rs @@ -21,7 +21,7 @@ pub struct CreateStorageRequestConfigurator { pub disk: Option, /// ID конфигуратора хранилища. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option + pub id: Option } impl CreateStorageRequestConfigurator { diff --git a/src/models/database_admin.rs b/src/models/database_admin.rs index 1e56454..81b93cf 100644 --- a/src/models/database_admin.rs +++ b/src/models/database_admin.rs @@ -18,7 +18,7 @@ pub struct DatabaseAdmin { /// ID для каждого экземпляра пользователя базы данных. Автоматически /// генерируется при создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Значение времени, указанное в комбинированном формате даты и времени /// ISO8601, которое представляет, когда была создана база данных. #[serde(rename = "created_at")] @@ -42,7 +42,7 @@ pub struct DatabaseAdmin { impl DatabaseAdmin { /// Пользователь базы данных pub fn new( - id: f64, + id: i64, created_at: String, login: String, password: String, diff --git a/src/models/database_admin_instances_inner.rs b/src/models/database_admin_instances_inner.rs index e08393e..fed612c 100644 --- a/src/models/database_admin_instances_inner.rs +++ b/src/models/database_admin_instances_inner.rs @@ -16,14 +16,14 @@ use crate::models; pub struct DatabaseAdminInstancesInner { /// ID базы данных #[serde(rename = "instance_id")] - pub instance_id: f64, + pub instance_id: i64, /// Список привилегий пользователя базы данных #[serde(rename = "privileges")] pub privileges: Vec } impl DatabaseAdminInstancesInner { - pub fn new(instance_id: f64, privileges: Vec) -> DatabaseAdminInstancesInner { + pub fn new(instance_id: i64, privileges: Vec) -> DatabaseAdminInstancesInner { DatabaseAdminInstancesInner { instance_id, privileges diff --git a/src/models/database_cluster.rs b/src/models/database_cluster.rs index bb66fdc..1c5c0e4 100644 --- a/src/models/database_cluster.rs +++ b/src/models/database_cluster.rs @@ -18,7 +18,7 @@ pub struct DatabaseCluster { /// ID для каждого экземпляра базы данных. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Значение времени, указанное в комбинированном формате даты и времени /// ISO8601, которое представляет, когда была создана база данных. #[serde(rename = "created_at")] @@ -67,7 +67,7 @@ pub struct DatabaseCluster { impl DatabaseCluster { /// Кластер базы данных pub fn new( - id: f64, + id: i64, created_at: String, location: Option, name: String, diff --git a/src/models/database_instance.rs b/src/models/database_instance.rs index 26f12f0..8342a16 100644 --- a/src/models/database_instance.rs +++ b/src/models/database_instance.rs @@ -18,7 +18,7 @@ pub struct DatabaseInstance { /// ID для каждого экземпляра базы данных. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Значение времени, указанное в комбинированном формате даты и времени /// ISO8601, которое представляет, когда была создана база данных. #[serde(rename = "created_at")] @@ -34,7 +34,7 @@ pub struct DatabaseInstance { impl DatabaseInstance { /// База данных pub fn new( - id: f64, + id: i64, created_at: String, name: String, description: String diff --git a/src/models/db.rs b/src/models/db.rs index a6efdfc..5aa859a 100644 --- a/src/models/db.rs +++ b/src/models/db.rs @@ -18,7 +18,7 @@ pub struct Db { /// ID для каждого экземпляра базы данных. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Значение времени, указанное в комбинированном формате даты и времени /// ISO8601, которое представляет, когда была создана база данных. #[serde(rename = "created_at")] @@ -77,7 +77,7 @@ pub struct Db { impl Db { /// База данных pub fn new( - id: f64, + id: i64, created_at: String, account_id: String, login: String, diff --git a/src/models/dedicated_server.rs b/src/models/dedicated_server.rs index e3b8ea4..6a9f190 100644 --- a/src/models/dedicated_server.rs +++ b/src/models/dedicated_server.rs @@ -18,7 +18,7 @@ pub struct DedicatedServer { /// ID для каждого экземпляра выделенного сервера. Автоматически /// генерируется при создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Описание параметров процессора выделенного сервера. #[serde(rename = "cpu_description")] pub cpu_description: String, @@ -49,7 +49,7 @@ pub struct DedicatedServer { pub ipv6: Option, /// Внутренний дополнительный ID сервера. #[serde(rename = "node_id", deserialize_with = "Option::deserialize")] - pub node_id: Option, + pub node_id: Option, /// Удобочитаемое имя, установленное для выделенного сервера. #[serde(rename = "name")] pub name: String, @@ -65,13 +65,13 @@ pub struct DedicatedServer { pub status: Status, /// ID операционной системы, установленной на выделенный сервер. #[serde(rename = "os_id", deserialize_with = "Option::deserialize")] - pub os_id: Option, + pub os_id: Option, /// ID панели управления, установленной на выделенный сервер. #[serde(rename = "cp_id", deserialize_with = "Option::deserialize")] - pub cp_id: Option, + pub cp_id: Option, /// ID интернет-канала, установленного на выделенный сервер. #[serde(rename = "bandwidth_id", deserialize_with = "Option::deserialize")] - pub bandwidth_id: Option, + pub bandwidth_id: Option, /// Массив уникальных ID сетевых дисков, подключенных к выделенному серверу. #[serde(rename = "network_drive_id", deserialize_with = "Option::deserialize")] pub network_drive_id: Option>, @@ -84,7 +84,7 @@ pub struct DedicatedServer { pub additional_ip_addr_id: Option>, /// ID списка дополнительных услуг выделенного сервера. #[serde(rename = "plan_id", deserialize_with = "Option::deserialize")] - pub plan_id: Option, + pub plan_id: Option, /// Стоимость выделенного сервера. #[serde(rename = "price")] pub price: f64, @@ -116,7 +116,7 @@ pub struct DedicatedServer { impl DedicatedServer { /// Выделенный сервер pub fn new( - id: f64, + id: i64, cpu_description: String, hdd_description: String, ram_description: String, @@ -126,17 +126,17 @@ impl DedicatedServer { ipmi_login: Option, ipmi_password: Option, ipv6: Option, - node_id: Option, + node_id: Option, name: String, comment: String, vnc_pass: Option, status: Status, - os_id: Option, - cp_id: Option, - bandwidth_id: Option, + os_id: Option, + cp_id: Option, + bandwidth_id: Option, network_drive_id: Option>, additional_ip_addr_id: Option>, - plan_id: Option, + plan_id: Option, price: f64, location: String, autoinstall_ready: f64, diff --git a/src/models/dedicated_server_additional_service.rs b/src/models/dedicated_server_additional_service.rs index 0bdd427..8f66918 100644 --- a/src/models/dedicated_server_additional_service.rs +++ b/src/models/dedicated_server_additional_service.rs @@ -18,7 +18,7 @@ use crate::models; pub struct DedicatedServerAdditionalService { /// ID дополнительной услуги для выделенного сервера. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Стоимость (в рублях) дополнительной услуги для выделенного сервера. #[serde(rename = "price")] pub price: f64, @@ -39,7 +39,7 @@ pub struct DedicatedServerAdditionalService { impl DedicatedServerAdditionalService { /// Дополнительная услуга для выделенного сервера pub fn new( - id: f64, + id: i64, price: f64, period: Period, description: String, diff --git a/src/models/dedicated_server_preset.rs b/src/models/dedicated_server_preset.rs index 939ed0b..17ffcc6 100644 --- a/src/models/dedicated_server_preset.rs +++ b/src/models/dedicated_server_preset.rs @@ -17,7 +17,7 @@ use crate::models; pub struct DedicatedServerPreset { /// ID тарифа выделенного сервера. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Описание характеристик тарифа выделенного сервера. #[serde(rename = "description")] pub description: String, @@ -46,7 +46,7 @@ pub struct DedicatedServerPreset { impl DedicatedServerPreset { /// Выделенный сервер pub fn new( - id: f64, + id: i64, description: String, is_ipmi_enabled: bool, is_pre_installed: bool, diff --git a/src/models/dns_record.rs b/src/models/dns_record.rs index 14604b8..d86b30c 100644 --- a/src/models/dns_record.rs +++ b/src/models/dns_record.rs @@ -25,7 +25,7 @@ pub struct DnsRecord { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub id: Option>, + pub id: Option>, #[serde(rename = "data")] pub data: Box, /// Время жизни DNS-записи. diff --git a/src/models/dns_record_v2.rs b/src/models/dns_record_v2.rs index fc061e4..76a8786 100644 --- a/src/models/dns_record_v2.rs +++ b/src/models/dns_record_v2.rs @@ -25,7 +25,7 @@ pub struct DnsRecordV2 { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub id: Option>, + pub id: Option>, /// Полное имя основного домена. #[serde(rename = "fqdn", skip_serializing_if = "Option::is_none")] pub fqdn: Option, diff --git a/src/models/document.rs b/src/models/document.rs index 69c202f..57c8087 100644 --- a/src/models/document.rs +++ b/src/models/document.rs @@ -17,7 +17,7 @@ use crate::models; pub struct Document { /// Уникальный идентификатор документа #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название документа #[serde(rename = "name")] pub name: String, @@ -53,7 +53,7 @@ pub struct Document { impl Document { /// Документ в базе знаний pub fn new( - id: f64, + id: i64, name: String, size: f64, status: Status, diff --git a/src/models/domain.rs b/src/models/domain.rs index 4831838..1ab674e 100644 --- a/src/models/domain.rs +++ b/src/models/domain.rs @@ -33,7 +33,7 @@ pub struct Domain { pub fqdn: String, /// ID домена. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Ссылка на аватар домена. #[serde(rename = "avatar_link", deserialize_with = "Option::deserialize")] pub avatar_link: Option, @@ -72,7 +72,7 @@ pub struct Domain { pub paid_till: Option, /// ID администратора, на которого зарегистрирован домен. #[serde(rename = "person_id", deserialize_with = "Option::deserialize")] - pub person_id: Option, + pub person_id: Option, /// Стоимость премиального домена. #[serde( rename = "premium_prolong_cost", @@ -90,7 +90,7 @@ pub struct Domain { pub subdomains: Vec, /// ID доменной зоны. #[serde(rename = "tld_id", deserialize_with = "Option::deserialize")] - pub tld_id: Option + pub tld_id: Option } impl Domain { @@ -101,7 +101,7 @@ impl Domain { domain_status: DomainStatus, expiration: String, fqdn: String, - id: f64, + id: i64, avatar_link: Option, is_autoprolong_enabled: Option, is_premium: bool, @@ -110,12 +110,12 @@ impl Domain { is_whois_privacy_enabled: Option, linked_ip: Option, paid_till: Option, - person_id: Option, + person_id: Option, premium_prolong_cost: Option, provider: Option, request_status: Option, subdomains: Vec, - tld_id: Option + tld_id: Option ) -> Domain { Domain { allowed_buy_periods, diff --git a/src/models/domain_prolong.rs b/src/models/domain_prolong.rs index d175e3b..5d23334 100644 --- a/src/models/domain_prolong.rs +++ b/src/models/domain_prolong.rs @@ -47,7 +47,7 @@ pub struct DomainProlong { pub period: Option, /// ID администратора, на которого зарегистрирован домен. #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")] - pub person_id: Option, + pub person_id: Option, #[serde(rename = "prime", skip_serializing_if = "Option::is_none")] pub prime: Option } diff --git a/src/models/domain_register.rs b/src/models/domain_register.rs index 03e8f69..8dab3c8 100644 --- a/src/models/domain_register.rs +++ b/src/models/domain_register.rs @@ -40,12 +40,12 @@ pub struct DomainRegister { pub period: Option, /// ID администратора, на которого регистрируется домен. #[serde(rename = "person_id")] - pub person_id: f64 + pub person_id: i64 } impl DomainRegister { /// Заявка на регистрацию домена - pub fn new(action: Action, fqdn: String, person_id: f64) -> DomainRegister { + pub fn new(action: Action, fqdn: String, person_id: i64) -> DomainRegister { DomainRegister { action, fqdn, diff --git a/src/models/domain_request.rs b/src/models/domain_request.rs index 1fa4451..6b2c1b9 100644 --- a/src/models/domain_request.rs +++ b/src/models/domain_request.rs @@ -39,10 +39,10 @@ pub struct DomainRequest { pub fqdn: String, /// ID группы доменных зон. #[serde(rename = "group_id")] - pub group_id: f64, + pub group_id: i64, /// ID заявки. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Это логическое значение, которое показывает включена ли услуга /// \"Антиспам\" для домена #[serde(rename = "is_antispam_enabled")] @@ -66,7 +66,7 @@ pub struct DomainRequest { pub period: models::DomainPaymentPeriod, /// Идентификационный номер персоны для заявки на регистрацию. #[serde(rename = "person_id")] - pub person_id: f64, + pub person_id: i64, #[serde(rename = "prime", deserialize_with = "Option::deserialize")] pub prime: Option, /// Количество дней до конца регистрации домена, за которые мы уведомим о @@ -91,15 +91,15 @@ impl DomainRequest { domain_bundle_id: Option, error_code_transfer: Option, fqdn: String, - group_id: f64, - id: f64, + group_id: i64, + id: i64, is_antispam_enabled: bool, is_autoprolong_enabled: bool, is_whois_privacy_enabled: bool, message: Option, money_source: Option, period: models::DomainPaymentPeriod, - person_id: f64, + person_id: i64, prime: Option, soon_expire: f64, sort_order: f64, diff --git a/src/models/free.rs b/src/models/free.rs index fc6c837..4087bec 100644 --- a/src/models/free.rs +++ b/src/models/free.rs @@ -20,7 +20,7 @@ pub struct Free { pub money_source: MoneySource, /// ID администратора, на которого зарегистрирован домен. #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")] - pub person_id: Option, + pub person_id: Option, /// Код авторизации для переноса домена. #[serde(rename = "auth_code")] pub auth_code: String diff --git a/src/models/invoice.rs b/src/models/invoice.rs index a0c72ae..d87e032 100644 --- a/src/models/invoice.rs +++ b/src/models/invoice.rs @@ -21,19 +21,19 @@ pub struct Invoice { pub money_source: MoneySource, /// ID администратора, на которого зарегистрирован домен. #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")] - pub person_id: Option, + pub person_id: Option, /// Тип платежной системы. #[serde(rename = "payment_type")] pub payment_type: PaymentType, /// Идентификационный номер плательщика #[serde(rename = "payer_id")] - pub payer_id: f64 + pub payer_id: i64 } impl Invoice { /// Оплата заявки на продление/регистрацию домена при помощи платежной /// системы - pub fn new(money_source: MoneySource, payment_type: PaymentType, payer_id: f64) -> Invoice { + pub fn new(money_source: MoneySource, payment_type: PaymentType, payer_id: i64) -> Invoice { Invoice { money_source, person_id: None, diff --git a/src/models/knowledgebase.rs b/src/models/knowledgebase.rs index 3b1336b..6a5dd77 100644 --- a/src/models/knowledgebase.rs +++ b/src/models/knowledgebase.rs @@ -17,7 +17,7 @@ use crate::models; pub struct Knowledgebase { /// Уникальный идентификатор базы знаний #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название базы знаний #[serde(rename = "name")] pub name: String, @@ -31,7 +31,7 @@ pub struct Knowledgebase { pub description: Option>, /// ID базы данных opensearch #[serde(rename = "dbaas_id")] - pub dbaas_id: f64, + pub dbaas_id: i64, /// Статус базы знаний #[serde(rename = "status")] pub status: Status, @@ -54,7 +54,7 @@ pub struct Knowledgebase { pub remaining_tokens: f64, /// ID пакета токенов #[serde(rename = "token_package_id")] - pub token_package_id: f64, + pub token_package_id: i64, /// Дата обновления подписки #[serde(rename = "subscription_renewal_date")] pub subscription_renewal_date: chrono::DateTime, @@ -72,14 +72,14 @@ pub struct Knowledgebase { impl Knowledgebase { /// База знаний pub fn new( - id: f64, + id: i64, name: String, - dbaas_id: f64, + dbaas_id: i64, status: Status, total_tokens: f64, used_tokens: f64, remaining_tokens: f64, - token_package_id: f64, + token_package_id: i64, subscription_renewal_date: chrono::DateTime, documents: Vec, agents_ids: Vec, diff --git a/src/models/knowledgebase_v2.rs b/src/models/knowledgebase_v2.rs index c01c7bd..d7db964 100644 --- a/src/models/knowledgebase_v2.rs +++ b/src/models/knowledgebase_v2.rs @@ -17,7 +17,7 @@ use crate::models; pub struct KnowledgebaseV2 { /// Уникальный идентификатор базы знаний #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название базы знаний #[serde(rename = "name")] pub name: String, @@ -31,7 +31,7 @@ pub struct KnowledgebaseV2 { pub description: Option>, /// ID базы данных opensearch #[serde(rename = "dbaas_id")] - pub dbaas_id: f64, + pub dbaas_id: i64, /// Статус базы знаний #[serde(rename = "status")] pub status: Status, @@ -54,7 +54,7 @@ pub struct KnowledgebaseV2 { pub remaining_tokens: f64, /// ID пакета токенов #[serde(rename = "token_package_id")] - pub token_package_id: f64, + pub token_package_id: i64, /// Дата обновления подписки #[serde(rename = "subscription_renewal_date")] pub subscription_renewal_date: chrono::DateTime, @@ -72,14 +72,14 @@ pub struct KnowledgebaseV2 { impl KnowledgebaseV2 { /// База знаний (версия API v2) pub fn new( - id: f64, + id: i64, name: String, - dbaas_id: f64, + dbaas_id: i64, status: Status, total_tokens: f64, used_tokens: f64, remaining_tokens: f64, - token_package_id: f64, + token_package_id: i64, subscription_renewal_date: chrono::DateTime, documents_count: f64, agents_ids: Vec, diff --git a/src/models/model.rs b/src/models/model.rs index 4434c3a..5b580d3 100644 --- a/src/models/model.rs +++ b/src/models/model.rs @@ -17,10 +17,10 @@ use crate::models; pub struct Model { /// Уникальный идентификатор модели #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// ID провайдера, который предоставляет модель #[serde(rename = "provider_id")] - pub provider_id: f64, + pub provider_id: i64, /// Название модели #[serde(rename = "name")] pub name: String, @@ -51,8 +51,8 @@ pub struct Model { impl Model { /// Модель AI pub fn new( - id: f64, - provider_id: f64, + id: i64, + provider_id: i64, name: String, public_name: String, r#type: Type, diff --git a/src/models/model_use.rs b/src/models/model_use.rs index f1b9557..e3594b2 100644 --- a/src/models/model_use.rs +++ b/src/models/model_use.rs @@ -20,7 +20,7 @@ pub struct Use { pub money_source: MoneySource, /// ID администратора, на которого зарегистрирован домен. #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")] - pub person_id: Option + pub person_id: Option } impl Use { diff --git a/src/models/mount_network_drive.rs b/src/models/mount_network_drive.rs index a71ba04..873ca22 100644 --- a/src/models/mount_network_drive.rs +++ b/src/models/mount_network_drive.rs @@ -19,11 +19,11 @@ pub struct MountNetworkDrive { pub resource_type: ResourceType, /// Id ресурса. #[serde(rename = "resource_id")] - pub resource_id: f64 + pub resource_id: i64 } impl MountNetworkDrive { - pub fn new(resource_type: ResourceType, resource_id: f64) -> MountNetworkDrive { + pub fn new(resource_type: ResourceType, resource_id: i64) -> MountNetworkDrive { MountNetworkDrive { resource_type, resource_id diff --git a/src/models/network_drive_available_resource.rs b/src/models/network_drive_available_resource.rs index a010161..9b8d22c 100644 --- a/src/models/network_drive_available_resource.rs +++ b/src/models/network_drive_available_resource.rs @@ -16,7 +16,7 @@ use crate::models; pub struct NetworkDriveAvailableResource { /// ID сервиса. #[serde(rename = "resource_id")] - pub resource_id: f64, + pub resource_id: i64, /// Тип ресурса. #[serde(rename = "resource_type")] pub resource_type: ResourceType, @@ -34,7 +34,7 @@ pub struct NetworkDriveAvailableResource { impl NetworkDriveAvailableResource { pub fn new( - resource_id: f64, + resource_id: i64, resource_type: ResourceType, availability_zone: models::AvailabilityZone ) -> NetworkDriveAvailableResource { diff --git a/src/models/network_drive_preset.rs b/src/models/network_drive_preset.rs index 14a9a7f..cd9b18f 100644 --- a/src/models/network_drive_preset.rs +++ b/src/models/network_drive_preset.rs @@ -16,7 +16,7 @@ use crate::models; pub struct NetworkDrivePreset { /// ID тарифа. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Стоимость тарифа сетевого диска. #[serde(rename = "cost_per_gb")] pub cost_per_gb: f64, @@ -40,7 +40,7 @@ pub struct NetworkDrivePreset { impl NetworkDrivePreset { pub fn new( - id: f64, + id: i64, cost_per_gb: f64, min: f64, max: f64, diff --git a/src/models/network_drive_service_list_inner.rs b/src/models/network_drive_service_list_inner.rs index 933e7b2..39bcb2d 100644 --- a/src/models/network_drive_service_list_inner.rs +++ b/src/models/network_drive_service_list_inner.rs @@ -16,14 +16,14 @@ use crate::models; pub struct NetworkDriveServiceListInner { /// ID сервиса. #[serde(rename = "resource_id")] - pub resource_id: f64, + pub resource_id: i64, /// Тип ресурса. #[serde(rename = "resource_type")] pub resource_type: ResourceType } impl NetworkDriveServiceListInner { - pub fn new(resource_id: f64, resource_type: ResourceType) -> NetworkDriveServiceListInner { + pub fn new(resource_id: i64, resource_type: ResourceType) -> NetworkDriveServiceListInner { NetworkDriveServiceListInner { resource_id, resource_type diff --git a/src/models/presets_balancer.rs b/src/models/presets_balancer.rs index 2bbcdaa..425996c 100644 --- a/src/models/presets_balancer.rs +++ b/src/models/presets_balancer.rs @@ -16,7 +16,7 @@ use crate::models; pub struct PresetsBalancer { /// ID для каждого экземпляра тарифа базы данных. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Описание тарифа. #[serde(rename = "description")] pub description: String, @@ -42,7 +42,7 @@ pub struct PresetsBalancer { impl PresetsBalancer { pub fn new( - id: f64, + id: i64, description: String, description_short: String, bandwidth: f64, diff --git a/src/models/presets_dbs.rs b/src/models/presets_dbs.rs index 6d05908..ad4a564 100644 --- a/src/models/presets_dbs.rs +++ b/src/models/presets_dbs.rs @@ -16,7 +16,7 @@ use crate::models; pub struct PresetsDbs { /// ID для каждого экземпляра тарифа базы данных. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, + pub id: Option, /// Описание тарифа. #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, diff --git a/src/models/presets_storage.rs b/src/models/presets_storage.rs index 769fe44..db335ee 100644 --- a/src/models/presets_storage.rs +++ b/src/models/presets_storage.rs @@ -17,7 +17,7 @@ use crate::models; pub struct PresetsStorage { /// ID для каждого экземпляра тарифа хранилища. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Описание тарифа. #[serde(rename = "description")] pub description: String, @@ -44,7 +44,7 @@ pub struct PresetsStorage { impl PresetsStorage { /// Тариф pub fn new( - id: f64, + id: i64, description: String, description_short: String, disk: f64, diff --git a/src/models/project.rs b/src/models/project.rs index 0182632..aaa2e18 100644 --- a/src/models/project.rs +++ b/src/models/project.rs @@ -17,7 +17,7 @@ use crate::models; pub struct Project { /// ID для каждого проекта. Автоматически генерируется при создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// ID пользователя. #[serde(rename = "account_id")] pub account_id: String, @@ -40,7 +40,7 @@ pub struct Project { impl Project { /// Проект pub fn new( - id: f64, + id: i64, account_id: String, avatar_id: Option, description: String, diff --git a/src/models/project_resource.rs b/src/models/project_resource.rs index 52b3b33..a8514f3 100644 --- a/src/models/project_resource.rs +++ b/src/models/project_resource.rs @@ -17,7 +17,7 @@ use crate::models; pub struct ProjectResource { /// ID для каждого ресурса проекта. Автоматически генерируется при создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Значение времени, указанное в комбинированном формате даты и времени /// ISO8601, которое представляет, когда был создан ресурс. #[serde(rename = "created_at")] @@ -25,7 +25,7 @@ pub struct ProjectResource { /// ID ресурса проекта (сервера, хранилища, кластера, балансировщика, базы /// данных или выделенного сервера). #[serde(rename = "resource_id")] - pub resource_id: f64, + pub resource_id: i64, #[serde(rename = "project")] pub project: Box, /// Тип ресурса проекта @@ -36,9 +36,9 @@ pub struct ProjectResource { impl ProjectResource { /// Ресурс проекта pub fn new( - id: f64, + id: i64, created_at: String, - resource_id: f64, + resource_id: i64, project: models::Project, r#type: Type ) -> ProjectResource { diff --git a/src/models/resource_transfer.rs b/src/models/resource_transfer.rs index 50c5853..1fe31f4 100644 --- a/src/models/resource_transfer.rs +++ b/src/models/resource_transfer.rs @@ -20,7 +20,7 @@ pub struct ResourceTransfer { /// ID перемещаемого ресурса (сервера, хранилища, кластера, балансировщика, /// базы данных или выделенного сервера). #[serde(rename = "resource_id")] - pub resource_id: f64, + pub resource_id: i64, /// Тип перемещаемого ресурса. #[serde(rename = "resource_type")] pub resource_type: ResourceType @@ -29,7 +29,7 @@ pub struct ResourceTransfer { impl ResourceTransfer { pub fn new( to_project: f64, - resource_id: f64, + resource_id: i64, resource_type: ResourceType ) -> ResourceTransfer { ResourceTransfer { diff --git a/src/models/rule.rs b/src/models/rule.rs index c5c18cf..c32bcbb 100644 --- a/src/models/rule.rs +++ b/src/models/rule.rs @@ -18,7 +18,7 @@ pub struct Rule { /// ID для каждого экземпляра правила для балансировщика. Автоматически /// генерируется при создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Протокол балансировщика. #[serde(rename = "balancer_proto")] pub balancer_proto: BalancerProto, @@ -36,7 +36,7 @@ pub struct Rule { impl Rule { /// Правило для балансировщика pub fn new( - id: f64, + id: i64, balancer_proto: BalancerProto, balancer_port: f64, server_proto: ServerProto, diff --git a/src/models/s3_subdomain.rs b/src/models/s3_subdomain.rs index 5052bd5..b1ba802 100644 --- a/src/models/s3_subdomain.rs +++ b/src/models/s3_subdomain.rs @@ -17,7 +17,7 @@ use crate::models; pub struct S3Subdomain { /// ID поддомена. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Поддомен. #[serde(rename = "subdomain")] pub subdomain: String, @@ -36,7 +36,7 @@ pub struct S3Subdomain { impl S3Subdomain { /// Поддомен. pub fn new( - id: f64, + id: i64, subdomain: String, cert_released: chrono::DateTime, tries: f64, diff --git a/src/models/server_backup.rs b/src/models/server_backup.rs index 05d531f..389bf9b 100644 --- a/src/models/server_backup.rs +++ b/src/models/server_backup.rs @@ -16,7 +16,7 @@ use crate::models; pub struct ServerBackup { /// ID бэкапа сервера. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название бэкапа. #[serde(rename = "name")] pub name: String, @@ -43,7 +43,7 @@ pub struct ServerBackup { impl ServerBackup { pub fn new( - id: f64, + id: i64, name: String, comment: Option, created_at: String, diff --git a/src/models/server_disk.rs b/src/models/server_disk.rs index 530c518..1327aaa 100644 --- a/src/models/server_disk.rs +++ b/src/models/server_disk.rs @@ -17,7 +17,7 @@ use crate::models; pub struct ServerDisk { /// ID диска. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Размер диска (в Мб). #[serde(rename = "size")] pub size: f64, @@ -44,7 +44,7 @@ pub struct ServerDisk { impl ServerDisk { /// Диск сервера pub fn new( - id: f64, + id: i64, size: f64, used: f64, r#type: String, diff --git a/src/models/server_log.rs b/src/models/server_log.rs index 927409d..35d1d9d 100644 --- a/src/models/server_log.rs +++ b/src/models/server_log.rs @@ -17,7 +17,7 @@ use crate::models; pub struct ServerLog { /// ID диска. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Дата лога. #[serde(rename = "logged_at")] pub logged_at: chrono::DateTime, @@ -29,7 +29,7 @@ pub struct ServerLog { impl ServerLog { /// Лог сервера pub fn new( - id: f64, + id: i64, logged_at: chrono::DateTime, event: String ) -> ServerLog { diff --git a/src/models/servers_configurator.rs b/src/models/servers_configurator.rs index 843f292..b62d960 100644 --- a/src/models/servers_configurator.rs +++ b/src/models/servers_configurator.rs @@ -16,7 +16,7 @@ use crate::models; pub struct ServersConfigurator { /// ID конфигуратора сервера. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Локация сервера. #[serde(rename = "location")] pub location: String, @@ -35,7 +35,7 @@ pub struct ServersConfigurator { impl ServersConfigurator { pub fn new( - id: f64, + id: i64, location: String, disk_type: DiskType, is_allowed_local_network: bool, diff --git a/src/models/servers_os.rs b/src/models/servers_os.rs index cc4d23b..939c2b1 100644 --- a/src/models/servers_os.rs +++ b/src/models/servers_os.rs @@ -16,7 +16,7 @@ use crate::models; pub struct ServersOs { /// ID операционной системы. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, + pub id: Option, /// Семейство операционной системы. #[serde(rename = "family", skip_serializing_if = "Option::is_none")] pub family: Option, diff --git a/src/models/servers_preset.rs b/src/models/servers_preset.rs index d99a777..91c573b 100644 --- a/src/models/servers_preset.rs +++ b/src/models/servers_preset.rs @@ -16,7 +16,7 @@ use crate::models; pub struct ServersPreset { /// ID тарифа сервера. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Локация сервера. #[serde(rename = "location")] pub location: String, @@ -57,7 +57,7 @@ pub struct ServersPreset { impl ServersPreset { pub fn new( - id: f64, + id: i64, location: String, price: f64, cpu: f64, diff --git a/src/models/servers_software.rs b/src/models/servers_software.rs index 11a114e..fb3ba52 100644 --- a/src/models/servers_software.rs +++ b/src/models/servers_software.rs @@ -16,7 +16,7 @@ use crate::models; pub struct ServersSoftware { /// ID ПО из маркетплейса. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, + pub id: Option, /// Имя ПО из маркетплейса. #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, diff --git a/src/models/service_price.rs b/src/models/service_price.rs index 9a7b135..8aeb36e 100644 --- a/src/models/service_price.rs +++ b/src/models/service_price.rs @@ -32,7 +32,7 @@ pub struct ServicePrice { with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none" )] - pub project_id: Option>, + pub project_id: Option>, /// Список вложенных сервисов #[serde(rename = "services", skip_serializing_if = "Option::is_none")] pub services: Option>, diff --git a/src/models/service_service_price.rs b/src/models/service_service_price.rs index f82351d..1ecb158 100644 --- a/src/models/service_service_price.rs +++ b/src/models/service_service_price.rs @@ -17,7 +17,7 @@ use crate::models; pub struct ServiceServicePrice { /// Идентификатор сервиса #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, + pub id: Option, /// Стоимость сервиса #[serde(rename = "cost", skip_serializing_if = "Option::is_none")] pub cost: Option, diff --git a/src/models/ssh_key.rs b/src/models/ssh_key.rs index 80d1258..dc536ba 100644 --- a/src/models/ssh_key.rs +++ b/src/models/ssh_key.rs @@ -16,7 +16,7 @@ use crate::models; pub struct SshKey { /// ID SSH-ключа. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название SSH-ключа. #[serde(rename = "name")] pub name: String, @@ -38,7 +38,7 @@ pub struct SshKey { impl SshKey { pub fn new( - id: f64, + id: i64, name: String, body: String, created_at: chrono::DateTime, diff --git a/src/models/ssh_key_used_by_inner.rs b/src/models/ssh_key_used_by_inner.rs index d807847..114507a 100644 --- a/src/models/ssh_key_used_by_inner.rs +++ b/src/models/ssh_key_used_by_inner.rs @@ -16,14 +16,14 @@ use crate::models; pub struct SshKeyUsedByInner { /// ID сервер.а #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название сервера. #[serde(rename = "name")] pub name: String } impl SshKeyUsedByInner { - pub fn new(id: f64, name: String) -> SshKeyUsedByInner { + pub fn new(id: i64, name: String) -> SshKeyUsedByInner { SshKeyUsedByInner { id, name diff --git a/src/models/status_company_info.rs b/src/models/status_company_info.rs index 05b5433..a2d46fd 100644 --- a/src/models/status_company_info.rs +++ b/src/models/status_company_info.rs @@ -17,7 +17,7 @@ use crate::models; pub struct StatusCompanyInfo { /// ID компании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Название компании. #[serde(rename = "name")] pub name: String @@ -25,7 +25,7 @@ pub struct StatusCompanyInfo { impl StatusCompanyInfo { /// Информация о компании. - pub fn new(id: f64, name: String) -> StatusCompanyInfo { + pub fn new(id: i64, name: String) -> StatusCompanyInfo { StatusCompanyInfo { id, name diff --git a/src/models/subdomain.rs b/src/models/subdomain.rs index 5db9451..6bc612e 100644 --- a/src/models/subdomain.rs +++ b/src/models/subdomain.rs @@ -19,14 +19,14 @@ pub struct Subdomain { pub fqdn: String, /// ID поддомена. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Привязанный к поддомену IP-адрес. #[serde(rename = "linked_ip", deserialize_with = "Option::deserialize")] pub linked_ip: Option } impl Subdomain { - pub fn new(fqdn: String, id: f64, linked_ip: Option) -> Subdomain { + pub fn new(fqdn: String, id: i64, linked_ip: Option) -> Subdomain { Subdomain { fqdn, id, diff --git a/src/models/token_package.rs b/src/models/token_package.rs index c4890a7..5ac0aee 100644 --- a/src/models/token_package.rs +++ b/src/models/token_package.rs @@ -17,10 +17,10 @@ use crate::models; pub struct TokenPackage { /// Уникальный идентификатор пакета #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// ID модели, к которой применяется пакет токенов #[serde(rename = "model_id")] - pub model_id: f64, + pub model_id: i64, /// Название пакета токенов #[serde(rename = "name")] pub name: String, @@ -53,8 +53,8 @@ pub struct TokenPackage { impl TokenPackage { /// Пакет токенов pub fn new( - id: f64, - model_id: f64, + id: i64, + model_id: i64, name: String, package_type: PackageType, r#type: Type, diff --git a/src/models/top_level_domain.rs b/src/models/top_level_domain.rs index 2d300ab..99393ba 100644 --- a/src/models/top_level_domain.rs +++ b/src/models/top_level_domain.rs @@ -32,7 +32,7 @@ pub struct TopLevelDomain { pub grace_period: f64, /// ID доменной зоны. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Это логическое значение, которое показывает, опубликована ли доменная /// зона. #[serde(rename = "is_published")] @@ -75,7 +75,7 @@ impl TopLevelDomain { allowed_buy_periods: Vec, early_renew_period: Option, grace_period: f64, - id: f64, + id: i64, is_published: bool, is_registered: bool, is_whois_privacy_default_enabled: bool, diff --git a/src/models/update_admin.rs b/src/models/update_admin.rs index 8ca35a1..cc8f5f4 100644 --- a/src/models/update_admin.rs +++ b/src/models/update_admin.rs @@ -27,7 +27,7 @@ pub struct UpdateAdmin { /// доступно только для кластеров MySQL. Если поле не передано, то /// привилегии будут применены ко всем инстансам #[serde(rename = "instance_id", skip_serializing_if = "Option::is_none")] - pub instance_id: Option + pub instance_id: Option } impl UpdateAdmin { diff --git a/src/models/update_agent.rs b/src/models/update_agent.rs index 9c873eb..d289cdb 100644 --- a/src/models/update_agent.rs +++ b/src/models/update_agent.rs @@ -29,12 +29,12 @@ pub struct UpdateAgent { pub status: Option, /// ID пакета токенов #[serde(rename = "token_package_id", skip_serializing_if = "Option::is_none")] - pub token_package_id: Option, + pub token_package_id: Option, #[serde(rename = "settings", skip_serializing_if = "Option::is_none")] pub settings: Option>, /// ID проекта #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option + pub project_id: Option } impl UpdateAgent { diff --git a/src/models/update_server.rs b/src/models/update_server.rs index c987208..f812f3e 100644 --- a/src/models/update_server.rs +++ b/src/models/update_server.rs @@ -18,13 +18,13 @@ pub struct UpdateServer { pub configurator: Option>, /// ID операционной системы, которая будет установлена на облачный сервер. #[serde(rename = "os_id", skip_serializing_if = "Option::is_none")] - pub os_id: Option, + pub os_id: Option, /// ID программного обеспечения сервера. #[serde(rename = "software_id", skip_serializing_if = "Option::is_none")] - pub software_id: Option, + pub software_id: Option, /// ID тарифа сервера. Нельзя передавать вместе с ключом `configurator`. #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] - pub preset_id: Option, + pub preset_id: Option, /// Пропускная способность тарифа. Доступные значения от 100 до 1000 с шагом /// 100. #[serde(rename = "bandwidth", skip_serializing_if = "Option::is_none")] diff --git a/src/models/update_server_configurator.rs b/src/models/update_server_configurator.rs index fc9c796..a719552 100644 --- a/src/models/update_server_configurator.rs +++ b/src/models/update_server_configurator.rs @@ -18,7 +18,7 @@ use crate::models; pub struct UpdateServerConfigurator { /// ID конфигуратора сервера. #[serde(rename = "configurator_id", skip_serializing_if = "Option::is_none")] - pub configurator_id: Option, + pub configurator_id: Option, /// Размер диска в МБ. #[serde(rename = "disk", skip_serializing_if = "Option::is_none")] pub disk: Option, diff --git a/src/models/update_settings.rs b/src/models/update_settings.rs index 0994ad8..0e7f6ff 100644 --- a/src/models/update_settings.rs +++ b/src/models/update_settings.rs @@ -52,7 +52,7 @@ pub struct UpdateSettings { pub comment: Option, /// ID тарифа. #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] - pub preset_id: Option + pub preset_id: Option } impl UpdateSettings { diff --git a/src/models/update_storage_request.rs b/src/models/update_storage_request.rs index 82dfe33..7b63df4 100644 --- a/src/models/update_storage_request.rs +++ b/src/models/update_storage_request.rs @@ -16,7 +16,7 @@ use crate::models; pub struct UpdateStorageRequest { /// ID тарифа. #[serde(rename = "preset_id", skip_serializing_if = "Option::is_none")] - pub preset_id: Option, + pub preset_id: Option, #[serde(rename = "configurator", skip_serializing_if = "Option::is_none")] pub configurator: Option>, /// Тип хранилища. diff --git a/src/models/update_storage_request_configurator.rs b/src/models/update_storage_request_configurator.rs index e403046..9a277fb 100644 --- a/src/models/update_storage_request_configurator.rs +++ b/src/models/update_storage_request_configurator.rs @@ -20,7 +20,7 @@ pub struct UpdateStorageRequestConfigurator { pub disk: Option, /// ID конфигуратора хранилища. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option + pub id: Option } impl UpdateStorageRequestConfigurator { diff --git a/src/models/vds.rs b/src/models/vds.rs index c20230d..6f6ff55 100644 --- a/src/models/vds.rs +++ b/src/models/vds.rs @@ -18,7 +18,7 @@ pub struct Vds { /// ID для каждого экземпляра сервера. Автоматически генерируется при /// создании. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Удобочитаемое имя, установленное для сервера. #[serde(rename = "name")] pub name: String, @@ -34,13 +34,13 @@ pub struct Vds { pub software: Option>, /// ID тарифа сервера. #[serde(rename = "preset_id", deserialize_with = "Option::deserialize")] - pub preset_id: Option, + pub preset_id: Option, /// Локация сервера. #[serde(rename = "location")] pub location: String, /// ID конфигуратора сервера. #[serde(rename = "configurator_id", deserialize_with = "Option::deserialize")] - pub configurator_id: Option, + pub configurator_id: Option, /// Режим загрузки ОС сервера. #[serde(rename = "boot_mode")] pub boot_mode: BootMode, @@ -108,15 +108,15 @@ pub struct Vds { impl Vds { /// Сервер pub fn new( - id: f64, + id: i64, name: String, comment: String, created_at: String, os: models::VdsOs, software: Option, - preset_id: Option, + preset_id: Option, location: String, - configurator_id: Option, + configurator_id: Option, boot_mode: BootMode, status: Status, start_at: Option>, diff --git a/src/models/vds_disks_inner.rs b/src/models/vds_disks_inner.rs index c609b30..28dd8a8 100644 --- a/src/models/vds_disks_inner.rs +++ b/src/models/vds_disks_inner.rs @@ -16,7 +16,7 @@ use crate::models; pub struct VdsDisksInner { /// ID диска. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Размер диска (в Мб). #[serde(rename = "size")] pub size: f64, @@ -42,7 +42,7 @@ pub struct VdsDisksInner { impl VdsDisksInner { pub fn new( - id: f64, + id: i64, size: f64, used: f64, r#type: String, diff --git a/src/models/vds_os.rs b/src/models/vds_os.rs index f0b5ae9..1fda910 100644 --- a/src/models/vds_os.rs +++ b/src/models/vds_os.rs @@ -17,7 +17,7 @@ use crate::models; pub struct VdsOs { /// ID операционной системы. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Тип операционной системы. #[serde(rename = "name")] pub name: Name, @@ -28,7 +28,7 @@ pub struct VdsOs { impl VdsOs { /// Операционная система сервера. - pub fn new(id: f64, name: Name, version: Option) -> VdsOs { + pub fn new(id: i64, name: Name, version: Option) -> VdsOs { VdsOs { id, name, diff --git a/src/models/vds_software.rs b/src/models/vds_software.rs index 14a42fa..1de22a4 100644 --- a/src/models/vds_software.rs +++ b/src/models/vds_software.rs @@ -17,7 +17,7 @@ use crate::models; pub struct VdsSoftware { /// ID ПО из маркетплейса. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, + pub id: Option, /// Название ПО из маркетплейса. #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option diff --git a/src/models/vpc_service.rs b/src/models/vpc_service.rs index 68019d3..8a8654e 100644 --- a/src/models/vpc_service.rs +++ b/src/models/vpc_service.rs @@ -16,7 +16,7 @@ use crate::models; pub struct VpcService { /// ID сервисв. #[serde(rename = "id")] - pub id: f64, + pub id: i64, /// Имя сервиса. #[serde(rename = "name")] pub name: String, @@ -32,7 +32,7 @@ pub struct VpcService { } impl VpcService { - pub fn new(id: f64, name: String) -> VpcService { + pub fn new(id: i64, name: String) -> VpcService { VpcService { id, name,