osi-dump 0.1.3.3.4.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. osi_dump/__main__.py +4 -4
  2. osi_dump/api/keystone.py +70 -70
  3. osi_dump/api/neutron.py +65 -65
  4. osi_dump/api/octavia.py +94 -94
  5. osi_dump/api/placement.py +41 -41
  6. osi_dump/batch_handler/__init__.py +6 -5
  7. osi_dump/batch_handler/external_port_batch_handler.py +55 -55
  8. osi_dump/batch_handler/flavor_batch_handler.py +51 -51
  9. osi_dump/batch_handler/floating_ip_batch_handler.py +57 -57
  10. osi_dump/batch_handler/hypervisor_batch_handler.py +55 -55
  11. osi_dump/batch_handler/image_batch_handler.py +51 -51
  12. osi_dump/batch_handler/instance_batch_handler.py +46 -54
  13. osi_dump/batch_handler/load_balancer_batch_handler.py +59 -59
  14. osi_dump/batch_handler/network_batch_handler.py +51 -51
  15. osi_dump/batch_handler/project_batch_handler.py +51 -51
  16. osi_dump/batch_handler/role_assignment_batch_handler.py +38 -61
  17. osi_dump/batch_handler/router_batch_handler.py +49 -49
  18. osi_dump/batch_handler/security_group_batch_handler.py +37 -0
  19. osi_dump/batch_handler/volume_batch_handler.py +45 -45
  20. osi_dump/cli.py +267 -257
  21. osi_dump/exporter/external_port/excel_external_port_exporter.py +34 -34
  22. osi_dump/exporter/external_port/external_port_exporter.py +7 -7
  23. osi_dump/exporter/flavor/excel_flavor_exporter.py +30 -30
  24. osi_dump/exporter/flavor/flavor_exporter.py +7 -7
  25. osi_dump/exporter/floating_ip/excel_floating_ip_exporter.py +30 -30
  26. osi_dump/exporter/floating_ip/floating_ip_exporter.py +7 -7
  27. osi_dump/exporter/hypervisor/excel_hypervisor_exporter.py +32 -32
  28. osi_dump/exporter/hypervisor/hypervisor_exporter.py +7 -7
  29. osi_dump/exporter/image/excel_image_exporter.py +28 -28
  30. osi_dump/exporter/image/image_exporter.py +7 -7
  31. osi_dump/exporter/instance/excel_instance_exporter.py +29 -29
  32. osi_dump/exporter/instance/instance_exporter.py +8 -7
  33. osi_dump/exporter/load_balancer/excel_load_balancer_exporter.py +36 -36
  34. osi_dump/exporter/load_balancer/load_balancer_exporter.py +7 -7
  35. osi_dump/exporter/network/excel_network_exporter.py +32 -32
  36. osi_dump/exporter/network/network_exporter.py +7 -7
  37. osi_dump/exporter/project/excel_project_exporter.py +30 -30
  38. osi_dump/exporter/project/project_exporter.py +7 -7
  39. osi_dump/exporter/role_assignment/excel_role_assignment_exporter.py +43 -35
  40. osi_dump/exporter/role_assignment/role_assignment_exporter.py +7 -7
  41. osi_dump/exporter/router/excel_router_exporter.py +30 -30
  42. osi_dump/exporter/router/router_exporter.py +7 -7
  43. osi_dump/exporter/security_group/excel_security_group_exporter.py +35 -0
  44. osi_dump/exporter/security_group/security_group_exporter.py +8 -0
  45. osi_dump/exporter/volume/excel_volume_exporter.py +29 -29
  46. osi_dump/exporter/volume/volume_exporter.py +7 -7
  47. osi_dump/importer/external_port/external_port_importer.py +9 -9
  48. osi_dump/importer/external_port/openstack_external_port_importer.py +177 -177
  49. osi_dump/importer/flavor/flavor_importer.py +9 -9
  50. osi_dump/importer/flavor/openstack_flavor_importer.py +64 -64
  51. osi_dump/importer/floating_ip/floating_ip_importer.py +9 -9
  52. osi_dump/importer/floating_ip/openstack_floating_ip_importer.py +68 -68
  53. osi_dump/importer/hypervisor/hypervisor_importer.py +9 -9
  54. osi_dump/importer/hypervisor/openstack_hypervisor_importer.py +137 -137
  55. osi_dump/importer/image/image_importer.py +9 -9
  56. osi_dump/importer/image/openstack_image_importer.py +81 -81
  57. osi_dump/importer/instance/instance_importer.py +8 -9
  58. osi_dump/importer/instance/openstack_instance_importer.py +136 -136
  59. osi_dump/importer/load_balancer/load_balancer_importer.py +9 -9
  60. osi_dump/importer/load_balancer/openstack_load_balancer_importer.py +113 -113
  61. osi_dump/importer/network/network_importer.py +9 -9
  62. osi_dump/importer/network/openstack_network_importer.py +93 -93
  63. osi_dump/importer/project/openstack_project_importer.py +141 -141
  64. osi_dump/importer/project/project_importer.py +9 -9
  65. osi_dump/importer/role_assignment/openstack_role_assignment_importer.py +117 -147
  66. osi_dump/importer/role_assignment/role_assignment_importer.py +16 -9
  67. osi_dump/importer/router/openstack_router_importer.py +87 -87
  68. osi_dump/importer/router/router_importer.py +9 -9
  69. osi_dump/importer/security_group/openstack_security_group_importer.py +54 -0
  70. osi_dump/importer/security_group/security_group_importer.py +8 -0
  71. osi_dump/importer/volume/openstack_volume_importer.py +81 -81
  72. osi_dump/importer/volume/volume_importer.py +9 -9
  73. osi_dump/model/authentication_info.py +15 -15
  74. osi_dump/model/external_port.py +30 -30
  75. osi_dump/model/flavor.py +20 -20
  76. osi_dump/model/floating_ip.py +24 -24
  77. osi_dump/model/hypervisor.py +24 -24
  78. osi_dump/model/image.py +27 -27
  79. osi_dump/model/instance.py +29 -29
  80. osi_dump/model/load_balancer.py +26 -26
  81. osi_dump/model/network.py +25 -25
  82. osi_dump/model/project.py +33 -33
  83. osi_dump/model/role_assignment.py +30 -23
  84. osi_dump/model/router.py +23 -23
  85. osi_dump/model/security_group.py +22 -0
  86. osi_dump/model/volume.py +25 -25
  87. osi_dump/os_connection/get_connections.py +67 -67
  88. osi_dump/util/__init__.py +7 -7
  89. osi_dump/util/create_file.py +11 -11
  90. osi_dump/util/excel_autosize_column.py +39 -39
  91. osi_dump/util/excel_sort_sheet.py +35 -35
  92. osi_dump/util/export_data_excel.py +36 -36
  93. osi_dump/util/extract_hostname.py +5 -5
  94. osi_dump/util/openstack_util.py +48 -48
  95. osi_dump/util/panda_excel.py +26 -26
  96. osi_dump/util/validate_dir_path.py +20 -20
  97. {osi_dump-0.1.3.3.4.3.dist-info → osi_dump-0.1.4.dist-info}/METADATA +40 -40
  98. osi_dump-0.1.4.dist-info/RECORD +130 -0
  99. osi_dump-0.1.3.3.4.3.dist-info/RECORD +0 -124
  100. {osi_dump-0.1.3.3.4.3.dist-info → osi_dump-0.1.4.dist-info}/WHEEL +0 -0
  101. {osi_dump-0.1.3.3.4.3.dist-info → osi_dump-0.1.4.dist-info}/entry_points.txt +0 -0
  102. {osi_dump-0.1.3.3.4.3.dist-info → osi_dump-0.1.4.dist-info}/top_level.txt +0 -0
osi_dump/model/image.py CHANGED
@@ -1,27 +1,27 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class Image(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- image_id: str
10
-
11
- disk_format: str
12
- min_disk: int
13
- min_ram: int
14
- image_name: Optional[str]
15
- owner: Optional[str]
16
-
17
- os_distro: Optional[str]
18
- properties: Optional[dict]
19
-
20
- protected: bool
21
- status: str
22
- size: Optional[int]
23
- virtual_size: Optional[int]
24
- visibility: str
25
-
26
- created_at: Optional[str]
27
- updated_at: Optional[str]
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, ConfigDict, ValidationError
4
+
5
+
6
+ class Image(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ image_id: str
10
+
11
+ disk_format: str
12
+ min_disk: int
13
+ min_ram: int
14
+ image_name: Optional[str]
15
+ owner: Optional[str]
16
+
17
+ os_distro: Optional[str]
18
+ properties: Optional[dict]
19
+
20
+ protected: bool
21
+ status: str
22
+ size: Optional[int]
23
+ virtual_size: Optional[int]
24
+ visibility: str
25
+
26
+ created_at: Optional[str]
27
+ updated_at: Optional[str]
@@ -1,29 +1,29 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class Instance(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- instance_id: str
10
- instance_name: Optional[str]
11
- project_id: Optional[str]
12
- project_name: Optional[str]
13
- domain_name: Optional[str]
14
- private_v4_ips: Optional[list[str]]
15
- floating_ip: Optional[str]
16
- status: str
17
- ram: int
18
- vcpus: int
19
- vgpus: Optional[int]
20
- vgpu_type: Optional[str]
21
- hypervisor: Optional[str]
22
-
23
- user_id: Optional[str]
24
-
25
- image_id: Optional[str]
26
- flavor_id: Optional[str]
27
-
28
- created_at: str
29
- updated_at: str
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, ConfigDict, ValidationError
4
+
5
+
6
+ class Instance(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ instance_id: str
10
+ instance_name: Optional[str]
11
+ project_id: Optional[str]
12
+ project_name: Optional[str]
13
+ domain_name: Optional[str]
14
+ private_v4_ips: Optional[list[str]]
15
+ floating_ip: Optional[str]
16
+ status: str
17
+ ram: int
18
+ vcpus: int
19
+ vgpus: Optional[int]
20
+ vgpu_type: Optional[str]
21
+ hypervisor: Optional[str]
22
+
23
+ user_id: Optional[str]
24
+
25
+ image_id: Optional[str]
26
+ flavor_id: Optional[str]
27
+
28
+ created_at: str
29
+ updated_at: str
@@ -1,26 +1,26 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class LoadBalancer(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- id: str
10
-
11
- load_balancer_name: Optional[str]
12
-
13
- provisioning_status: Optional[str]
14
-
15
- operating_status: Optional[str]
16
-
17
- flavor_name: Optional[str]
18
- flavor_description: Optional[str]
19
-
20
- amphoraes: list[dict] # compute_id, compute_flavor_id, flavor_name, flavor_description
21
- vip: Optional[str]
22
-
23
- project_id: Optional[str]
24
-
25
- created_at: Optional[str]
26
- updated_at: Optional[str]
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, ConfigDict, ValidationError
4
+
5
+
6
+ class LoadBalancer(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ id: str
10
+
11
+ load_balancer_name: Optional[str]
12
+
13
+ provisioning_status: Optional[str]
14
+
15
+ operating_status: Optional[str]
16
+
17
+ flavor_name: Optional[str]
18
+ flavor_description: Optional[str]
19
+
20
+ amphoraes: list[dict] # compute_id, compute_flavor_id, flavor_name, flavor_description
21
+ vip: Optional[str]
22
+
23
+ project_id: Optional[str]
24
+
25
+ created_at: Optional[str]
26
+ updated_at: Optional[str]
osi_dump/model/network.py CHANGED
@@ -1,26 +1,26 @@
1
- from typing import Optional
2
- from pydantic import BaseModel, ConfigDict
3
-
4
-
5
-
6
- class Network(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- network_id: str
10
- project_id: str
11
- name: Optional[str]
12
-
13
- subnets: Optional[list[dict]] # {"id": str, "cidr": "str"}
14
- mtu: int
15
-
16
- port_security_enabled: Optional[bool]
17
-
18
- network_type: str
19
- segmentation_id: Optional[int]
20
- physical_network: Optional[str]
21
-
22
- status: Optional[str]
23
- shared: Optional[bool]
24
-
25
- created_at: Optional[str]
1
+ from typing import Optional
2
+ from pydantic import BaseModel, ConfigDict
3
+
4
+
5
+
6
+ class Network(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ network_id: str
10
+ project_id: str
11
+ name: Optional[str]
12
+
13
+ subnets: Optional[list[dict]] # {"id": str, "cidr": "str"}
14
+ mtu: int
15
+
16
+ port_security_enabled: Optional[bool]
17
+
18
+ network_type: str
19
+ segmentation_id: Optional[int]
20
+ physical_network: Optional[str]
21
+
22
+ status: Optional[str]
23
+ shared: Optional[bool]
24
+
25
+ created_at: Optional[str]
26
26
  updated_at: Optional[str]
osi_dump/model/project.py CHANGED
@@ -1,34 +1,34 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class Project(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- project_id: str
10
- project_name: Optional[str]
11
- domain_id: Optional[str]
12
- domain_name: Optional[str]
13
- enabled: bool
14
- parent_id: Optional[str]
15
-
16
- usage_instance: Optional[int]
17
- quota_instance: Optional[int]
18
-
19
- usage_vcpu: Optional[int]
20
- quota_vcpu: Optional[int]
21
-
22
- usage_ram: Optional[int]
23
- quota_ram: Optional[int]
24
-
25
- usage_volume: Optional[int]
26
- quota_volume: Optional[int]
27
-
28
- usage_snapshot: Optional[int]
29
- quota_snapshot: Optional[int]
30
-
31
- usage_storage: Optional[int]
32
- quota_storage: Optional[int]
33
-
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, ConfigDict, ValidationError
4
+
5
+
6
+ class Project(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ project_id: str
10
+ project_name: Optional[str]
11
+ domain_id: Optional[str]
12
+ domain_name: Optional[str]
13
+ enabled: bool
14
+ parent_id: Optional[str]
15
+
16
+ usage_instance: Optional[int]
17
+ quota_instance: Optional[int]
18
+
19
+ usage_vcpu: Optional[int]
20
+ quota_vcpu: Optional[int]
21
+
22
+ usage_ram: Optional[int]
23
+ quota_ram: Optional[int]
24
+
25
+ usage_volume: Optional[int]
26
+ quota_volume: Optional[int]
27
+
28
+ usage_snapshot: Optional[int]
29
+ quota_snapshot: Optional[int]
30
+
31
+ usage_storage: Optional[int]
32
+ quota_storage: Optional[int]
33
+
34
34
  load_balancer_count: Optional[int]
@@ -1,23 +1,30 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class RoleAssignment(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- user_id: Optional[str]
10
-
11
- user_name: Optional[str]
12
-
13
- role_id: Optional[str]
14
-
15
- role_name: Optional[str]
16
-
17
- enabled: Optional[bool]
18
-
19
- options: Optional[dict]
20
-
21
- password_expires_at: Optional[str]
22
-
23
- scope: Optional[dict]
1
+ from typing import Optional
2
+ from pydantic import BaseModel, ConfigDict
3
+
4
+ class UserRoleAssignment(BaseModel):
5
+ model_config = ConfigDict(strict=True)
6
+ user_id: str
7
+ user_name: Optional[str]
8
+ role_id: str
9
+ role_name: Optional[str]
10
+ scope: dict
11
+ enabled: Optional[bool]
12
+ password_expires_at: Optional[str]
13
+ options: Optional[dict]
14
+
15
+ class GroupRoleAssignment(BaseModel):
16
+ model_config = ConfigDict(strict=True)
17
+ group_id: str
18
+ group_name: Optional[str]
19
+ role_id: str
20
+ role_name: Optional[str]
21
+ scope: dict
22
+
23
+ class EffectiveUserRole(BaseModel):
24
+ model_config = ConfigDict(strict=True)
25
+ user_id: str
26
+ user_name: Optional[str]
27
+ role_id: str
28
+ role_name: Optional[str]
29
+ scope: dict
30
+ inherited_from_group: Optional[str]
osi_dump/model/router.py CHANGED
@@ -1,23 +1,23 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class Router(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- project_id: Optional[str]
10
-
11
- router_id: str
12
-
13
- name: Optional[str]
14
-
15
- external_net_id: Optional[str]
16
- external_net_ip: Optional[str]
17
-
18
- admin_state: Optional[bool]
19
-
20
- status: str
21
-
22
- created_at: Optional[str]
23
- updated_at: Optional[str]
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, ConfigDict, ValidationError
4
+
5
+
6
+ class Router(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ project_id: Optional[str]
10
+
11
+ router_id: str
12
+
13
+ name: Optional[str]
14
+
15
+ external_net_id: Optional[str]
16
+ external_net_ip: Optional[str]
17
+
18
+ admin_state: Optional[bool]
19
+
20
+ status: str
21
+
22
+ created_at: Optional[str]
23
+ updated_at: Optional[str]
@@ -0,0 +1,22 @@
1
+ from typing import Optional, List
2
+ from pydantic import BaseModel, ConfigDict
3
+
4
+ class SecurityGroupRule(BaseModel):
5
+ """Represents a single rule within a security group."""
6
+ rule_id: str
7
+ direction: str
8
+ protocol: Optional[str]
9
+ ethertype: str
10
+ port_range: Optional[str]
11
+ remote_ip_prefix: Optional[str]
12
+ remote_group_id: Optional[str]
13
+
14
+ class SecurityGroup(BaseModel):
15
+ """Represents an OpenStack Security Group."""
16
+ model_config = ConfigDict(strict=True)
17
+
18
+ security_group_id: str
19
+ name: str
20
+ project_id: Optional[str]
21
+ description: Optional[str]
22
+ rules: List[SecurityGroupRule]
osi_dump/model/volume.py CHANGED
@@ -1,25 +1,25 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, ConfigDict, ValidationError
4
-
5
-
6
- class Volume(BaseModel):
7
- model_config = ConfigDict(strict=True)
8
-
9
- volume_id: str
10
-
11
- project_id: Optional[str]
12
-
13
- volume_name: Optional[str]
14
-
15
- attachments: Optional[list[str]]
16
-
17
- status: str
18
-
19
- type: str
20
- size: int
21
-
22
- snapshots: Optional[list[str]]
23
-
24
- updated_at: Optional[str]
25
- created_at: Optional[str]
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, ConfigDict, ValidationError
4
+
5
+
6
+ class Volume(BaseModel):
7
+ model_config = ConfigDict(strict=True)
8
+
9
+ volume_id: str
10
+
11
+ project_id: Optional[str]
12
+
13
+ volume_name: Optional[str]
14
+
15
+ attachments: Optional[list[str]]
16
+
17
+ status: str
18
+
19
+ type: str
20
+ size: int
21
+
22
+ snapshots: Optional[list[str]]
23
+
24
+ updated_at: Optional[str]
25
+ created_at: Optional[str]
@@ -1,67 +1,67 @@
1
- import json
2
- import logging
3
-
4
- from pydantic import ValidationError
5
-
6
- import typer
7
-
8
- import openstack
9
- from openstack.connection import Connection
10
-
11
- from osi_dump.model.authentication_info import AuthenticationInfo
12
-
13
-
14
- logger = logging.getLogger(__name__)
15
-
16
- TIMEOUT_SECOND = 30
17
-
18
-
19
- def get_connections(file_path) -> list[Connection]:
20
- auths = _parse_authentication_info(file_path=file_path)
21
-
22
- logger.info("Getting connections")
23
-
24
- connections = []
25
- auth_urls = []
26
-
27
- for auth in auths:
28
- try:
29
- connection = openstack.connect(
30
- auth_url=auth.auth_url,
31
- project_name=auth.project_name,
32
- username=auth.username,
33
- password=auth.password,
34
- project_domain_name=auth.project_domain_name,
35
- user_domain_name=auth.user_domain_name,
36
- interface=auth.interface,
37
- )
38
-
39
- connections.append(connection)
40
- auth_urls.append(auth.auth_url)
41
- except Exception as e:
42
- logger.warning(f"Skipping {auth.auth_url}... error: {e}")
43
- pass
44
-
45
- logger.info("Established connection success with: ")
46
- for auth_url in auth_urls:
47
- logger.info(f"{auth_url}")
48
-
49
- return connections
50
-
51
-
52
- def _parse_authentication_info(file_path: str) -> list[AuthenticationInfo]:
53
-
54
- with open(file_path, "r") as file:
55
- objects = json.load(file)
56
- if not isinstance(objects, list) or len(objects) == 0:
57
- raise ValueError(
58
- "The JSON file must contain a list with at least one object."
59
- )
60
-
61
- try:
62
- ret = [AuthenticationInfo.model_validate(obj) for obj in objects]
63
- except ValidationError as e:
64
- logger.error(e.errors())
65
- raise typer.Exit(1)
66
-
67
- return ret
1
+ import json
2
+ import logging
3
+
4
+ from pydantic import ValidationError
5
+
6
+ import typer
7
+
8
+ import openstack
9
+ from openstack.connection import Connection
10
+
11
+ from osi_dump.model.authentication_info import AuthenticationInfo
12
+
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+ TIMEOUT_SECOND = 30
17
+
18
+
19
+ def get_connections(file_path) -> list[Connection]:
20
+ auths = _parse_authentication_info(file_path=file_path)
21
+
22
+ logger.info("Getting connections")
23
+
24
+ connections = []
25
+ auth_urls = []
26
+
27
+ for auth in auths:
28
+ try:
29
+ connection = openstack.connect(
30
+ auth_url=auth.auth_url,
31
+ project_name=auth.project_name,
32
+ username=auth.username,
33
+ password=auth.password,
34
+ project_domain_name=auth.project_domain_name,
35
+ user_domain_name=auth.user_domain_name,
36
+ interface=auth.interface,
37
+ )
38
+
39
+ connections.append(connection)
40
+ auth_urls.append(auth.auth_url)
41
+ except Exception as e:
42
+ logger.warning(f"Skipping {auth.auth_url}... error: {e}")
43
+ pass
44
+
45
+ logger.info("Established connection success with: ")
46
+ for auth_url in auth_urls:
47
+ logger.info(f"{auth_url}")
48
+
49
+ return connections
50
+
51
+
52
+ def _parse_authentication_info(file_path: str) -> list[AuthenticationInfo]:
53
+
54
+ with open(file_path, "r") as file:
55
+ objects = json.load(file)
56
+ if not isinstance(objects, list) or len(objects) == 0:
57
+ raise ValueError(
58
+ "The JSON file must contain a list with at least one object."
59
+ )
60
+
61
+ try:
62
+ ret = [AuthenticationInfo.model_validate(obj) for obj in objects]
63
+ except ValidationError as e:
64
+ logger.error(e.errors())
65
+ raise typer.Exit(1)
66
+
67
+ return ret
osi_dump/util/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
- from .excel_autosize_column import excel_autosize_column
2
- from .extract_hostname import extract_hostname
3
- from .create_file import create_file
4
- from .export_data_excel import export_data_excel
5
- from .excel_sort_sheet import excel_sort_sheet
6
- from .validate_dir_path import validate_dir_path
7
- from .panda_excel import expand_list_column
1
+ from .excel_autosize_column import excel_autosize_column
2
+ from .extract_hostname import extract_hostname
3
+ from .create_file import create_file
4
+ from .export_data_excel import export_data_excel
5
+ from .excel_sort_sheet import excel_sort_sheet
6
+ from .validate_dir_path import validate_dir_path
7
+ from .panda_excel import expand_list_column
@@ -1,11 +1,11 @@
1
- import os
2
-
3
-
4
- def create_file(file_path: str):
5
- # Check if the file already exists
6
- if os.path.exists(file_path):
7
- # Delete the old file
8
- os.remove(file_path)
9
-
10
- # Create and write to the new file
11
- open(file_path, "x")
1
+ import os
2
+
3
+
4
+ def create_file(file_path: str):
5
+ # Check if the file already exists
6
+ if os.path.exists(file_path):
7
+ # Delete the old file
8
+ os.remove(file_path)
9
+
10
+ # Create and write to the new file
11
+ open(file_path, "x")