Skip to content

Commit 61a404c

Browse files
committed
Updated: 2025-12-22
1 parent bf2fb43 commit 61a404c

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/CreateServer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Name | Type | Description | Notes
2020
**cloud_init** | **object** | Cloud-init скрипт | [optional]
2121
**availability_zone** | [**AvailabilityZone**](AvailabilityZone.md) | | [optional]
2222
**project_id** | **object** | ID проекта. | [optional]
23+
**hostname** | **object** | Сетевое имя сервера | [optional]
2324

2425
## Example
2526

docs/ImageInAPI.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Name | Type | Description | Notes
1010
**upload_url** | **object** | Ссылка для загрузки образа. | [optional]
1111
**location** | [**Location**](Location.md) | |
1212
**os** | [**OS**](OS.md) | |
13-
**hostname** | **object** | Сетевое имя сервера | [optional]
1413

1514
## Example
1615

test/test_create_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def make_instance(self, include_optional):
6464
network_drive_ids = [8d014355-ffb8-41e0-8283-0f58e606c4ff], ),
6565
cloud_init = #cloud-config,
6666
availability_zone = spb-1,
67-
project_id = 1
67+
project_id = 1,
68+
hostname = None
6869
)
6970
else :
7071
return CreateServer(

test/test_image_in_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def make_instance(self, include_optional):
4444
disk_id = None,
4545
upload_url = None,
4646
location = ru-1,
47-
os = centos,
48-
hostname = None
47+
os = centos
4948
)
5049
else :
5150
return ImageInAPI(

timeweb_cloud_api/models/create_server.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class CreateServer(BaseModel):
4545
cloud_init: Optional[Any] = Field(None, description="Cloud-init скрипт")
4646
availability_zone: Optional[AvailabilityZone] = None
4747
project_id: Optional[Any] = Field(None, description="ID проекта.")
48-
__properties = ["configuration", "is_ddos_guard", "os_id", "image_id", "software_id", "preset_id", "bandwidth", "name", "avatar_id", "comment", "ssh_keys_ids", "is_local_network", "network", "cloud_init", "availability_zone", "project_id"]
48+
hostname: Optional[Any] = Field(None, description="Сетевое имя сервера")
49+
__properties = ["configuration", "is_ddos_guard", "os_id", "image_id", "software_id", "preset_id", "bandwidth", "name", "avatar_id", "comment", "ssh_keys_ids", "is_local_network", "network", "cloud_init", "availability_zone", "project_id", "hostname"]
4950

5051
class Config:
5152
"""Pydantic configuration"""
@@ -142,6 +143,11 @@ def to_dict(self):
142143
if self.project_id is None and "project_id" in self.__fields_set__:
143144
_dict['project_id'] = None
144145

146+
# set to None if hostname (nullable) is None
147+
# and __fields_set__ contains the field
148+
if self.hostname is None and "hostname" in self.__fields_set__:
149+
_dict['hostname'] = None
150+
145151
return _dict
146152

147153
@classmethod
@@ -169,7 +175,8 @@ def from_dict(cls, obj: dict) -> CreateServer:
169175
"network": CreateServerNetwork.from_dict(obj.get("network")) if obj.get("network") is not None else None,
170176
"cloud_init": obj.get("cloud_init"),
171177
"availability_zone": obj.get("availability_zone"),
172-
"project_id": obj.get("project_id")
178+
"project_id": obj.get("project_id"),
179+
"hostname": obj.get("hostname")
173180
})
174181
return _obj
175182

timeweb_cloud_api/models/image_in_api.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class ImageInAPI(BaseModel):
3434
upload_url: Optional[Any] = Field(None, description="Ссылка для загрузки образа.")
3535
location: Location = Field(...)
3636
os: OS = Field(...)
37-
hostname: Optional[Any] = Field(None, description="Сетевое имя сервера")
38-
__properties = ["name", "description", "disk_id", "upload_url", "location", "os", "hostname"]
37+
__properties = ["name", "description", "disk_id", "upload_url", "location", "os"]
3938

4039
class Config:
4140
"""Pydantic configuration"""
@@ -81,11 +80,6 @@ def to_dict(self):
8180
if self.upload_url is None and "upload_url" in self.__fields_set__:
8281
_dict['upload_url'] = None
8382

84-
# set to None if hostname (nullable) is None
85-
# and __fields_set__ contains the field
86-
if self.hostname is None and "hostname" in self.__fields_set__:
87-
_dict['hostname'] = None
88-
8983
return _dict
9084

9185
@classmethod
@@ -103,8 +97,7 @@ def from_dict(cls, obj: dict) -> ImageInAPI:
10397
"disk_id": obj.get("disk_id"),
10498
"upload_url": obj.get("upload_url"),
10599
"location": obj.get("location"),
106-
"os": obj.get("os"),
107-
"hostname": obj.get("hostname")
100+
"os": obj.get("os")
108101
})
109102
return _obj
110103

0 commit comments

Comments
 (0)