js7-client-python 2.0.2__py3-none-any.whl → 2.0.9.0__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.
- js7/api/joc/http/v_2_8_2/agents/export.py +1 -2
- js7/client/action/agent/export_agents_action.py +6 -19
- js7/client/action/controller/register_controller_action.py +17 -25
- js7/client/action/controller/test_controller_instance_action.py +8 -7
- js7/client/action/daily_plan/generate_orders_action.py +2 -3
- js7/client/action/daily_plan/{create_projections_action.py → recreate_projections_action.py} +1 -1
- js7/client/action/iam/get_account_permissions_action.py +2 -2
- js7/client/action/iam/get_roles_action.py +7 -4
- js7/client/action/inventory/get_change_dependencies_action.py +13 -10
- js7/client/action/inventory/get_git_credentials_action.py +15 -10
- js7/client/action/inventory/import_configurations_action.py +16 -10
- js7/client/action/inventory/import_deploy_configurations_action.py +7 -5
- js7/client/action/inventory/recall_folder_action.py +6 -25
- js7/client/action/inventory/remove_configurations_from_trash_action.py +4 -6
- js7/client/action/inventory/remove_repository_configuration_action.py +8 -4
- js7/client/action/inventory/restore_configuration_from_trash_action.py +3 -3
- js7/client/action/joc/get_components_versions_action.py +1 -1
- js7/client/action/joc/run_service_action.py +3 -3
- js7/client/action/order/cancel_orders_action.py +7 -3
- js7/client/action/workflow/stop_job_instructions_action.py +8 -4
- js7/client/action/workflow/unstop_job_instructions_action.py +8 -4
- js7/client/feature/agent/manage.py +3 -9
- js7/client/feature/controller/manage.py +9 -26
- js7/client/feature/daily_plan/manage.py +4 -4
- js7/client/feature/inventory/manage.py +10 -21
- js7/client/feature/inventory/manage_repository.py +3 -3
- js7/client/feature/joc/operate.py +2 -6
- js7/client/feature/order/operate.py +6 -2
- js7/model/__init__.py +4 -2
- js7/model/private/http/joc/joc_v_2_8_2.py +38 -44
- js7/model/public/client/common/__init__.py +3 -1
- js7/model/public/client/common/controller.py +10 -0
- js7/model/public/client/common/git_credentials.py +4 -4
- js7/service/http_service.py +1 -1
- {js7_client_python-2.0.2.dist-info → js7_client_python-2.0.9.0.dist-info}/METADATA +4 -2
- {js7_client_python-2.0.2.dist-info → js7_client_python-2.0.9.0.dist-info}/RECORD +39 -38
- {js7_client_python-2.0.2.dist-info → js7_client_python-2.0.9.0.dist-info}/LICENSE +0 -0
- {js7_client_python-2.0.2.dist-info → js7_client_python-2.0.9.0.dist-info}/WHEEL +0 -0
- {js7_client_python-2.0.2.dist-info → js7_client_python-2.0.9.0.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import List, Literal,
|
|
2
|
+
from typing import List, Literal, Union
|
|
3
3
|
|
|
4
4
|
from ...context import Context
|
|
5
|
-
from ....model.public.client.common.audit_log import AuditLog
|
|
6
5
|
from ....model.private.api.endpoint import EndpointCall
|
|
7
6
|
from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
8
|
-
AuditParams as AuditParams_V_2_8_2,
|
|
9
7
|
AgentExportFilter as AgentExportFilter_V_2_8_2,
|
|
10
8
|
ExportFile as ExportFile_V_2_8_2,
|
|
11
9
|
ArchiveFormat as ArchiveFormat_V_2_8_2
|
|
@@ -20,8 +18,7 @@ def export_agents_action(
|
|
|
20
18
|
context: Context,
|
|
21
19
|
out_path: Union[Path, str],
|
|
22
20
|
archive_format: Literal["ZIP", "TAR_GZ"],
|
|
23
|
-
agent_ids: List[str]
|
|
24
|
-
audit_log: Optional[AuditLog]
|
|
21
|
+
agent_ids: List[str]
|
|
25
22
|
) -> bool:
|
|
26
23
|
|
|
27
24
|
# Normalize out_path
|
|
@@ -38,8 +35,7 @@ def export_agents_action(
|
|
|
38
35
|
request_data = _build_v_2_8_2_request(
|
|
39
36
|
out_path=out_path,
|
|
40
37
|
archive_format=archive_format,
|
|
41
|
-
agent_ids=agent_ids
|
|
42
|
-
audit_log=audit_log
|
|
38
|
+
agent_ids=agent_ids
|
|
43
39
|
)
|
|
44
40
|
else:
|
|
45
41
|
raise RuntimeError(f"Version {context.version} is not compatible with building the request.")
|
|
@@ -53,7 +49,7 @@ def export_agents_action(
|
|
|
53
49
|
))
|
|
54
50
|
|
|
55
51
|
if isinstance(result, bytes):
|
|
56
|
-
return bytes_to_file(data=result, out_path=
|
|
52
|
+
return bytes_to_file(data=result, out_path=out_path)
|
|
57
53
|
|
|
58
54
|
raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
|
|
59
55
|
|
|
@@ -64,8 +60,7 @@ def _build_v_2_8_2_request(
|
|
|
64
60
|
*,
|
|
65
61
|
out_path: Union[Path, str],
|
|
66
62
|
archive_format: Literal["ZIP", "TAR_GZ"],
|
|
67
|
-
agent_ids: List[str]
|
|
68
|
-
audit_log: Optional[AuditLog]
|
|
63
|
+
agent_ids: List[str]
|
|
69
64
|
) -> AgentExportFilter_V_2_8_2:
|
|
70
65
|
|
|
71
66
|
# Validate: out_path
|
|
@@ -85,17 +80,9 @@ def _build_v_2_8_2_request(
|
|
|
85
80
|
filename=Path(out_path).name,
|
|
86
81
|
format=(ArchiveFormat_V_2_8_2(archive_format)) # Raises ValueError() if invalid.
|
|
87
82
|
)
|
|
88
|
-
|
|
89
|
-
# Build: Audit Log
|
|
90
|
-
res_audit_log = AuditParams_V_2_8_2(
|
|
91
|
-
ticket_link=audit_log.ticket_link,
|
|
92
|
-
comment=audit_log.comment,
|
|
93
|
-
time_spent=audit_log.time_spent
|
|
94
|
-
) if audit_log else None
|
|
95
83
|
|
|
96
84
|
# Result
|
|
97
85
|
return AgentExportFilter_V_2_8_2(
|
|
98
86
|
agent_ids=agent_ids,
|
|
99
|
-
export_file=res_export_file
|
|
100
|
-
audit_log=res_audit_log
|
|
87
|
+
export_file=res_export_file
|
|
101
88
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import List, Optional
|
|
2
2
|
|
|
3
3
|
from ...context import Context
|
|
4
4
|
from ....model.public.client.common.audit_log import AuditLog
|
|
5
|
+
from ....model.public.client.common.controller import Controller
|
|
5
6
|
from ....model.private.api.endpoint import EndpointCall
|
|
6
7
|
from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
7
8
|
AuditParams as AuditParams_V_2_8_2,
|
|
@@ -16,22 +17,16 @@ from ....util.check_matching_version import check_matching_version
|
|
|
16
17
|
|
|
17
18
|
def register_controller_action(
|
|
18
19
|
*,
|
|
19
|
-
context: Context,
|
|
20
|
+
context: Context,
|
|
20
21
|
controller_id: Optional[str],
|
|
21
|
-
|
|
22
|
-
cluster_url: Optional[str],
|
|
23
|
-
role: Literal["STANDALONE", "PRIMARY", "BACKUP"],
|
|
24
|
-
title: Optional[str],
|
|
22
|
+
controllers: List[Controller],
|
|
25
23
|
audit_log: Optional[AuditLog]
|
|
26
24
|
) -> bool:
|
|
27
25
|
|
|
28
26
|
if check_matching_version(min="2.6.5", max="2.8.3", check=context.version):
|
|
29
27
|
request_data = _build_v_2_8_2_request(
|
|
30
28
|
controller_id=controller_id,
|
|
31
|
-
|
|
32
|
-
cluster_url=cluster_url,
|
|
33
|
-
role=role,
|
|
34
|
-
title=title,
|
|
29
|
+
controllers=controllers,
|
|
35
30
|
audit_log=audit_log
|
|
36
31
|
)
|
|
37
32
|
else:
|
|
@@ -56,20 +51,16 @@ def register_controller_action(
|
|
|
56
51
|
def _build_v_2_8_2_request(
|
|
57
52
|
*,
|
|
58
53
|
controller_id: Optional[str],
|
|
59
|
-
|
|
60
|
-
cluster_url: Optional[str],
|
|
61
|
-
role: Literal["STANDALONE", "PRIMARY", "BACKUP"],
|
|
62
|
-
title: Optional[str],
|
|
54
|
+
controllers: List[Controller],
|
|
63
55
|
audit_log: Optional[AuditLog]
|
|
64
56
|
) -> RegisterParameters_V_2_8_2:
|
|
65
57
|
|
|
66
|
-
# Validate:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
raise ValueError(f"Invalid 'role': {role}.")
|
|
58
|
+
# Validate: controllers
|
|
59
|
+
for c in controllers:
|
|
60
|
+
if not c.url:
|
|
61
|
+
raise ValueError("Each controller must define a 'url'.")
|
|
62
|
+
if c.role not in ["STANDALONE", "PRIMARY", "BACKUP"]:
|
|
63
|
+
raise ValueError(f"Invalid controller role '{c.role}'. Expected one of: STANDALONE, PRIMARY, BACKUP.")
|
|
73
64
|
|
|
74
65
|
# Build: Audit Log
|
|
75
66
|
res_audit_log = AuditParams_V_2_8_2(
|
|
@@ -83,11 +74,12 @@ def _build_v_2_8_2_request(
|
|
|
83
74
|
controller_id=controller_id,
|
|
84
75
|
controllers=[
|
|
85
76
|
RegisterParameter_V_2_8_2(
|
|
86
|
-
url=url,
|
|
87
|
-
cluster_url=cluster_url,
|
|
88
|
-
role=ControllerRole_V_2_8_2(role), # Raises ValueError() if invalid.
|
|
89
|
-
title=title,
|
|
77
|
+
url=c.url,
|
|
78
|
+
cluster_url=c.cluster_url,
|
|
79
|
+
role=ControllerRole_V_2_8_2(c.role), # Raises ValueError() if invalid.
|
|
80
|
+
title=c.title,
|
|
90
81
|
)
|
|
82
|
+
for c in controllers
|
|
91
83
|
],
|
|
92
84
|
audit_log=res_audit_log
|
|
93
85
|
)
|
|
@@ -4,7 +4,8 @@ from ...context import Context
|
|
|
4
4
|
from ....model.private.api.endpoint import EndpointCall
|
|
5
5
|
from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
6
6
|
TestConnect as TestConnect_V_2_8_2,
|
|
7
|
-
JobScheduler200 as JobScheduler200_V_2_8_2
|
|
7
|
+
JobScheduler200 as JobScheduler200_V_2_8_2,
|
|
8
|
+
ConnectionStateText as ConnectionStateText_V_2_8_2
|
|
8
9
|
)
|
|
9
10
|
|
|
10
11
|
from ....util.check_matching_version import check_matching_version
|
|
@@ -34,14 +35,14 @@ def test_controller_instance_action(
|
|
|
34
35
|
))
|
|
35
36
|
|
|
36
37
|
if isinstance(result, JobScheduler200_V_2_8_2):
|
|
37
|
-
if
|
|
38
|
+
if (
|
|
38
39
|
result.controller
|
|
39
|
-
and result.controller.connection_state
|
|
40
|
-
and result.controller.connection_state.
|
|
40
|
+
and result.controller.connection_state
|
|
41
|
+
and result.controller.connection_state.text == ConnectionStateText_V_2_8_2.ESTABLISHED
|
|
41
42
|
):
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
return
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
return False
|
|
45
46
|
|
|
46
47
|
raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
|
|
47
48
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import date
|
|
1
|
+
from datetime import date
|
|
2
2
|
from typing import List, Optional
|
|
3
3
|
|
|
4
4
|
from ...context import Context
|
|
@@ -97,8 +97,7 @@ def _build_v_2_8_2_request(
|
|
|
97
97
|
return GenerateRequest_V_2_8_2(
|
|
98
98
|
controller_id=controller_id,
|
|
99
99
|
daily_plan_dates=[
|
|
100
|
-
|
|
101
|
-
for d in daily_plan_dates
|
|
100
|
+
d for d in daily_plan_dates
|
|
102
101
|
],
|
|
103
102
|
schedule_paths=PathItem_V_2_8_2(
|
|
104
103
|
folders=[
|
|
@@ -5,8 +5,8 @@ from ....model.public.client.common.audit_log import AuditLog
|
|
|
5
5
|
from ....model.private.api.endpoint import EndpointCall
|
|
6
6
|
from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
7
7
|
AccountFilter as AccountFilter_V_2_8_2,
|
|
8
|
-
Accounts as Accounts_V_2_8_2,
|
|
9
8
|
AuditParams as AuditParams_V_2_8_2,
|
|
9
|
+
ConfigurationPermissions as ConfigurationPermissions_V_2_8_2
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
from ....util.check_matching_version import check_matching_version
|
|
@@ -37,7 +37,7 @@ def get_account_permissions_action(
|
|
|
37
37
|
options=None,
|
|
38
38
|
))
|
|
39
39
|
|
|
40
|
-
if isinstance(result,
|
|
40
|
+
if isinstance(result, ConfigurationPermissions_V_2_8_2):
|
|
41
41
|
return result.model_dump(mode="json")
|
|
42
42
|
|
|
43
43
|
raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
|
|
@@ -32,10 +32,13 @@ def get_roles_action(
|
|
|
32
32
|
))
|
|
33
33
|
|
|
34
34
|
if isinstance(result, Roles_V_2_8_2):
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
for r in result.roles
|
|
38
|
-
|
|
35
|
+
result_list: List[str] = []
|
|
36
|
+
if result.roles:
|
|
37
|
+
for r in result.roles:
|
|
38
|
+
if not r.role_name:
|
|
39
|
+
continue
|
|
40
|
+
result_list.append(r.role_name)
|
|
41
|
+
return result_list
|
|
39
42
|
|
|
40
43
|
raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
|
|
41
44
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List, Optional, Set
|
|
1
|
+
from typing import List, Optional, Set, Tuple
|
|
2
2
|
|
|
3
3
|
from ...context import Context
|
|
4
4
|
from ....model.public.client.common.changes import Change, ChangeDependencies, ChangeStatus
|
|
@@ -20,7 +20,7 @@ def get_change_dependencies_action(
|
|
|
20
20
|
*,
|
|
21
21
|
context: Context,
|
|
22
22
|
operation_type: OperationType,
|
|
23
|
-
changes: List[
|
|
23
|
+
changes: List[Tuple[str, ObjectType]],
|
|
24
24
|
filter_paths: Optional[List[str]],
|
|
25
25
|
filter_no_references: bool,
|
|
26
26
|
filter_no_referencing: bool
|
|
@@ -51,22 +51,25 @@ def get_change_dependencies_action(
|
|
|
51
51
|
#---------------------#
|
|
52
52
|
# Build 2.8.2 request #
|
|
53
53
|
#---------------------#
|
|
54
|
-
def _build_v_2_8_2_request(*, operation_type: OperationType, changes: List[
|
|
54
|
+
def _build_v_2_8_2_request(*, operation_type: OperationType, changes: List[Tuple[str, ObjectType]]) -> GetDependenciesRequest_V_2_8_2:
|
|
55
55
|
# Validate: changes
|
|
56
56
|
if not changes:
|
|
57
57
|
raise ValueError("At least one change in 'changes' is required.")
|
|
58
58
|
|
|
59
59
|
# Validate: changes
|
|
60
|
-
for
|
|
61
|
-
if not
|
|
60
|
+
for name, object_type in changes:
|
|
61
|
+
if not name or not object_type:
|
|
62
62
|
raise ValueError("'name' and 'object_type' are required in every change.")
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
# Validate: Object Types
|
|
65
|
+
if object_type in {"FOLDER", "JOBRESOURCE", "INCLUDESCRIPT", "REPORT", "DEPLOYMENTDESCRIPTOR", "DESCRIPTORFOLDER"}:
|
|
66
|
+
raise ValueError(f"Object type '{object_type.value}' is not supported for dependency resolution.")
|
|
67
|
+
|
|
64
68
|
return GetDependenciesRequest_V_2_8_2(
|
|
65
69
|
operation_type=OperationType_V_2_8_2(operation_type.value), # Raises ValueError() if invalid.
|
|
66
70
|
configurations=[
|
|
67
|
-
RequestItem_V_2_8_2(name=
|
|
68
|
-
for
|
|
69
|
-
if c.name and c.object_type # Process only valid changes
|
|
71
|
+
RequestItem_V_2_8_2(name=name, type=object_type.value)
|
|
72
|
+
for name, object_type in changes
|
|
70
73
|
]
|
|
71
74
|
)
|
|
72
75
|
|
|
@@ -137,7 +140,7 @@ def _build_v_2_8_2_response(
|
|
|
137
140
|
|
|
138
141
|
if skip:
|
|
139
142
|
continue
|
|
140
|
-
|
|
143
|
+
|
|
141
144
|
if in_references or in_referenced_by or in_enforced_references or in_enforced_referenced_by:
|
|
142
145
|
if not config.object_type:
|
|
143
146
|
raise RuntimeError("'object_type' is required in response.")
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
1
3
|
from ...context import Context
|
|
2
4
|
from ....model.public.client.common.git_credentials import GitCredentials
|
|
3
5
|
from ....model.private.api.endpoint import EndpointCall
|
|
@@ -6,7 +8,7 @@ from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
|
6
8
|
)
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
def get_git_credentials_action(*, context: Context) -> GitCredentials:
|
|
11
|
+
def get_git_credentials_action(*, context: Context) -> List[GitCredentials]:
|
|
10
12
|
# Calls the dispatcher for the matching JOC version
|
|
11
13
|
result = context.joc_api.dispatch(endpoint_id="inventory/repository/git/credentials", call=EndpointCall(
|
|
12
14
|
http_service=context.http_service,
|
|
@@ -16,14 +18,17 @@ def get_git_credentials_action(*, context: Context) -> GitCredentials:
|
|
|
16
18
|
))
|
|
17
19
|
|
|
18
20
|
if isinstance(result, GitCredentials_V_2_8_2):
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
return [
|
|
22
|
+
GitCredentials(
|
|
23
|
+
email=c.email,
|
|
24
|
+
git_account=c.git_account,
|
|
25
|
+
git_server=c.git_server,
|
|
26
|
+
keyfile_path=c.keyfile_path,
|
|
27
|
+
password=c.password,
|
|
28
|
+
personal_access_token=c.personal_access_token,
|
|
29
|
+
username=c.username
|
|
30
|
+
)
|
|
31
|
+
for c in result.credentials
|
|
32
|
+
] if result.credentials else []
|
|
28
33
|
|
|
29
34
|
raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
|
|
@@ -19,7 +19,7 @@ def import_configurations_action(
|
|
|
19
19
|
file_path: Union[Path, str],
|
|
20
20
|
archive_format: Literal["ZIP", "TAR_GZ"],
|
|
21
21
|
overwrite: bool,
|
|
22
|
-
|
|
22
|
+
inventory_target_folder: Optional[str],
|
|
23
23
|
suffix: Optional[str],
|
|
24
24
|
prefix: Optional[str],
|
|
25
25
|
overwrite_tags: bool,
|
|
@@ -31,7 +31,7 @@ def import_configurations_action(
|
|
|
31
31
|
file_path=Path(file_path),
|
|
32
32
|
archive_format=archive_format,
|
|
33
33
|
overwrite=overwrite,
|
|
34
|
-
|
|
34
|
+
inventory_target_folder=inventory_target_folder,
|
|
35
35
|
suffix=suffix,
|
|
36
36
|
prefix=prefix,
|
|
37
37
|
overwrite_tags=overwrite_tags,
|
|
@@ -62,7 +62,7 @@ def _build_v_2_8_2_request(
|
|
|
62
62
|
file_path: Path,
|
|
63
63
|
archive_format: Literal["ZIP", "TAR_GZ"],
|
|
64
64
|
overwrite: bool,
|
|
65
|
-
|
|
65
|
+
inventory_target_folder: Optional[str],
|
|
66
66
|
suffix: Optional[str],
|
|
67
67
|
prefix: Optional[str],
|
|
68
68
|
overwrite_tags: bool,
|
|
@@ -77,6 +77,10 @@ def _build_v_2_8_2_request(
|
|
|
77
77
|
if archive_format not in ("ZIP", "TAR_GZ"):
|
|
78
78
|
raise ValueError("'archive_format' must be 'ZIP' or 'TAR_GZ'.")
|
|
79
79
|
|
|
80
|
+
# Validate: inventory_target_folder
|
|
81
|
+
if inventory_target_folder and not inventory_target_folder.startswith("/"):
|
|
82
|
+
inventory_target_folder = "/" + inventory_target_folder
|
|
83
|
+
|
|
80
84
|
# Build: files_as_bytes
|
|
81
85
|
files_as_bytes = files_to_bytes(
|
|
82
86
|
file_path=file_path,
|
|
@@ -96,7 +100,9 @@ def _build_v_2_8_2_request(
|
|
|
96
100
|
# Skips invalid filenames
|
|
97
101
|
if path.rsplit("/", 1)[-1].startswith((".", "_", "-")):
|
|
98
102
|
continue
|
|
99
|
-
|
|
103
|
+
|
|
104
|
+
path = "/" + path
|
|
105
|
+
|
|
100
106
|
archive_type = detect_archive_type(file)
|
|
101
107
|
|
|
102
108
|
if not archive_type and path.endswith(".json"):
|
|
@@ -110,14 +116,14 @@ def _build_v_2_8_2_request(
|
|
|
110
116
|
if not arch_files:
|
|
111
117
|
continue
|
|
112
118
|
|
|
119
|
+
# Removes the archive name from path
|
|
120
|
+
path = "/".join(path.split("/")[:-1])
|
|
121
|
+
|
|
113
122
|
for arch_path, arch_file in arch_files:
|
|
114
123
|
# Skips invalid filenames
|
|
115
124
|
if arch_path.rsplit("/", 1)[-1].startswith((".", "_", "-")):
|
|
116
125
|
continue
|
|
117
126
|
|
|
118
|
-
# Removes archive suffix
|
|
119
|
-
path = path.split(".")[0]
|
|
120
|
-
|
|
121
127
|
new_path = path + "/" + arch_path
|
|
122
128
|
files.append((new_path, arch_file))
|
|
123
129
|
|
|
@@ -131,12 +137,12 @@ def _build_v_2_8_2_request(
|
|
|
131
137
|
"overwrite_tags": overwrite_tags
|
|
132
138
|
}
|
|
133
139
|
|
|
134
|
-
if
|
|
135
|
-
res_options["target_folder"] =
|
|
140
|
+
if inventory_target_folder:
|
|
141
|
+
res_options["target_folder"] = inventory_target_folder
|
|
136
142
|
|
|
137
143
|
if suffix:
|
|
138
144
|
res_options["suffix"] = suffix
|
|
139
|
-
|
|
145
|
+
|
|
140
146
|
if prefix:
|
|
141
147
|
res_options["prefix"] = prefix
|
|
142
148
|
|
|
@@ -127,28 +127,30 @@ def _build_v_2_8_2_request(
|
|
|
127
127
|
# Skips invalid filenames
|
|
128
128
|
if path.rsplit("/", 1)[-1].startswith((".", "_", "-")):
|
|
129
129
|
continue
|
|
130
|
-
|
|
130
|
+
|
|
131
|
+
path = "/" + path
|
|
132
|
+
|
|
131
133
|
archive_type = detect_archive_type(file)
|
|
132
134
|
|
|
133
135
|
if not archive_type and path.endswith(".json"):
|
|
134
136
|
files.append((path, file))
|
|
135
137
|
else:
|
|
136
138
|
arch_files = read_bytes_archive_files_to_bytes(
|
|
137
|
-
file=file,
|
|
139
|
+
file=file,
|
|
138
140
|
filter_suffixes=[".json"]
|
|
139
141
|
)
|
|
140
142
|
|
|
141
143
|
if not arch_files:
|
|
142
144
|
continue
|
|
143
145
|
|
|
146
|
+
# Removes the archive name from path
|
|
147
|
+
path = "/".join(path.split("/")[:-1])
|
|
148
|
+
|
|
144
149
|
for arch_path, arch_file in arch_files:
|
|
145
150
|
# Skips invalid filenames
|
|
146
151
|
if arch_path.rsplit("/", 1)[-1].startswith((".", "_", "-")):
|
|
147
152
|
continue
|
|
148
153
|
|
|
149
|
-
# Removes archive suffix
|
|
150
|
-
path = path.split(".")[0]
|
|
151
|
-
|
|
152
154
|
new_path = path + "/" + arch_path
|
|
153
155
|
files.append((new_path, arch_file))
|
|
154
156
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
from typing import List, Optional
|
|
2
2
|
|
|
3
|
-
from ....model.public.client.common.audit_log import AuditLog
|
|
4
3
|
from ....model.public.client.enum.object_types import ReleaseObjectType
|
|
5
4
|
from ...context import Context
|
|
6
5
|
from ....model.private.api.endpoint import EndpointCall
|
|
7
6
|
from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
8
7
|
CommonConfigurationType as ConfigurationType_V_2_8_2,
|
|
9
|
-
|
|
10
|
-
AuditParams as AuditParams_V_2_8_2,
|
|
8
|
+
CommonRequestFolder as CommonRequestFolder_V_2_8_2,
|
|
11
9
|
OK as OK_V_2_8_2,
|
|
12
10
|
)
|
|
13
11
|
|
|
@@ -19,18 +17,14 @@ def recall_folder_action(
|
|
|
19
17
|
context: Context,
|
|
20
18
|
folder_path: str,
|
|
21
19
|
filter_object_types: Optional[List[ReleaseObjectType]],
|
|
22
|
-
|
|
23
|
-
recursive: bool,
|
|
24
|
-
audit_log: Optional[AuditLog]
|
|
20
|
+
recursive: bool
|
|
25
21
|
) -> bool:
|
|
26
22
|
|
|
27
23
|
if check_matching_version(min="2.6.5", max="2.8.3", check=context.version):
|
|
28
24
|
request_data = _build_v_2_8_2_request(
|
|
29
25
|
folder_path=folder_path,
|
|
30
26
|
filter_object_types=filter_object_types,
|
|
31
|
-
|
|
32
|
-
recursive=recursive,
|
|
33
|
-
audit_log=audit_log,
|
|
27
|
+
recursive=recursive
|
|
34
28
|
)
|
|
35
29
|
else:
|
|
36
30
|
raise RuntimeError(f"Version {context.version} is not compatible with building the request.")
|
|
@@ -55,21 +49,12 @@ def _build_v_2_8_2_request(
|
|
|
55
49
|
*,
|
|
56
50
|
folder_path: str,
|
|
57
51
|
filter_object_types: Optional[List[ReleaseObjectType]],
|
|
58
|
-
filter_no_invalid_objects: bool,
|
|
59
52
|
recursive: bool,
|
|
60
|
-
|
|
61
|
-
) -> RequestFolder_V_2_8_2:
|
|
53
|
+
) -> CommonRequestFolder_V_2_8_2:
|
|
62
54
|
|
|
63
55
|
# Validate: folder_path
|
|
64
56
|
if not folder_path:
|
|
65
57
|
raise ValueError("'folder_path' must not be empty.")
|
|
66
|
-
|
|
67
|
-
# Build: res_audit_log
|
|
68
|
-
res_audit_log = AuditParams_V_2_8_2(
|
|
69
|
-
ticket_link=audit_log.ticket_link,
|
|
70
|
-
comment=audit_log.comment,
|
|
71
|
-
time_spent=audit_log.time_spent
|
|
72
|
-
) if audit_log else None
|
|
73
58
|
|
|
74
59
|
# Build: res_object_types
|
|
75
60
|
res_object_types = [
|
|
@@ -78,12 +63,8 @@ def _build_v_2_8_2_request(
|
|
|
78
63
|
] if filter_object_types else None
|
|
79
64
|
|
|
80
65
|
# Result
|
|
81
|
-
return
|
|
82
|
-
controller_id=None,
|
|
66
|
+
return CommonRequestFolder_V_2_8_2(
|
|
83
67
|
path=folder_path,
|
|
84
|
-
recursive=recursive,
|
|
85
68
|
object_types=res_object_types,
|
|
86
|
-
|
|
87
|
-
only_valid_objects=filter_no_invalid_objects,
|
|
88
|
-
cancel_orders_date_from=None,
|
|
69
|
+
recursive=recursive,
|
|
89
70
|
)
|
|
@@ -9,7 +9,7 @@ from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
|
9
9
|
CommonRequestFilter as CommonRequestFilter_V_2_8_2,
|
|
10
10
|
OK as OK_V_2_8_2,
|
|
11
11
|
CommonConfigurationType as ConfigurationType_V_2_8_2,
|
|
12
|
-
|
|
12
|
+
CommonRequestFilters as CommonRequestFilters_V_2_8_2
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
from ....util.check_matching_version import check_matching_version
|
|
@@ -49,7 +49,7 @@ def _build_v_2_8_2_request(
|
|
|
49
49
|
*,
|
|
50
50
|
configurations: List[Configuration],
|
|
51
51
|
audit_log: Optional[AuditLog]
|
|
52
|
-
) ->
|
|
52
|
+
) -> CommonRequestFilters_V_2_8_2:
|
|
53
53
|
|
|
54
54
|
# Validate: configurations
|
|
55
55
|
if not configurations:
|
|
@@ -72,9 +72,7 @@ def _build_v_2_8_2_request(
|
|
|
72
72
|
) if audit_log else None
|
|
73
73
|
|
|
74
74
|
# Result
|
|
75
|
-
return
|
|
75
|
+
return CommonRequestFilters_V_2_8_2(
|
|
76
76
|
objects=res_objects,
|
|
77
|
-
audit_log=res_audit_log
|
|
78
|
-
|
|
79
|
-
cancel_orders_date_from=None, # Wrong domain
|
|
77
|
+
audit_log=res_audit_log
|
|
80
78
|
)
|
|
@@ -10,7 +10,8 @@ from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
|
10
10
|
CommonConfigurationType as ConfigurationType_V_2_8_2,
|
|
11
11
|
DeleteFromFilter as DeleteFromFilter_V_2_8_2,
|
|
12
12
|
Category as Category_V_2_8_2,
|
|
13
|
-
PublishConfiguration as
|
|
13
|
+
PublishConfiguration as PublishConfiguration_V_2_8_2,
|
|
14
|
+
PublishConfig as PublishConfig_V_2_8_2
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
from ....util.check_matching_version import check_matching_version
|
|
@@ -61,8 +62,8 @@ def _build_v_2_8_2_request(
|
|
|
61
62
|
raise ValueError("'category' must be one of 'LOCAL' or 'ROLLOUT'.")
|
|
62
63
|
|
|
63
64
|
# Build: Configurations
|
|
64
|
-
res_configurations: List[
|
|
65
|
-
|
|
65
|
+
res_configurations: List[PublishConfiguration_V_2_8_2] = [
|
|
66
|
+
PublishConfiguration_V_2_8_2(
|
|
66
67
|
object_type=ConfigurationType_V_2_8_2(c.object_type.value), # Raises ValueError() if invalid.
|
|
67
68
|
path=c.path,
|
|
68
69
|
)
|
|
@@ -78,7 +79,10 @@ def _build_v_2_8_2_request(
|
|
|
78
79
|
|
|
79
80
|
# Result
|
|
80
81
|
return DeleteFromFilter_V_2_8_2(
|
|
81
|
-
configurations=
|
|
82
|
+
configurations=[
|
|
83
|
+
PublishConfig_V_2_8_2(configuration=c)
|
|
84
|
+
for c in res_configurations
|
|
85
|
+
],
|
|
82
86
|
category=Category_V_2_8_2(category), # Raises ValueError() if invalid.
|
|
83
87
|
audit_log=res_audit_log,
|
|
84
88
|
)
|
|
@@ -6,7 +6,7 @@ from ....model.private.api.endpoint import EndpointCall
|
|
|
6
6
|
from ....model.public.client.common.configurations import Configuration
|
|
7
7
|
from ....model.private.http.joc.joc_v_2_8_2 import (
|
|
8
8
|
AuditParams as AuditParams_V_2_8_2,
|
|
9
|
-
|
|
9
|
+
RestoreRequestFilter as RestoreRequestFilter_V_2_8_2,
|
|
10
10
|
CommonConfigurationType as ConfigurationType_V_2_8_2,
|
|
11
11
|
ResponseNewPath as ResponseNewPath_V_2_8_2
|
|
12
12
|
)
|
|
@@ -60,7 +60,7 @@ def _build_v_2_8_2_request(
|
|
|
60
60
|
add_prefix: Optional[str],
|
|
61
61
|
add_suffix: Optional[str],
|
|
62
62
|
audit_log: Optional[AuditLog]
|
|
63
|
-
) ->
|
|
63
|
+
) -> RestoreRequestFilter_V_2_8_2:
|
|
64
64
|
|
|
65
65
|
# Validate: new_path
|
|
66
66
|
if not new_path:
|
|
@@ -74,7 +74,7 @@ def _build_v_2_8_2_request(
|
|
|
74
74
|
) if audit_log else None
|
|
75
75
|
|
|
76
76
|
# Result
|
|
77
|
-
return
|
|
77
|
+
return RestoreRequestFilter_V_2_8_2(
|
|
78
78
|
path=configuration.path,
|
|
79
79
|
object_type=ConfigurationType_V_2_8_2(configuration.object_type.value), # Raises ValueError() if invalid.
|
|
80
80
|
new_path=new_path,
|
|
@@ -47,7 +47,7 @@ def _build_v_2_8_2_request(
|
|
|
47
47
|
) -> VersionsFilter_V_2_8_2:
|
|
48
48
|
|
|
49
49
|
# Validate: Any of controller_ids or agent_ids
|
|
50
|
-
if not (controller_ids
|
|
50
|
+
if not (controller_ids or agent_ids):
|
|
51
51
|
raise ValueError("At least one of 'controller_ids' or 'agent_ids' is required.")
|
|
52
52
|
|
|
53
53
|
# Result
|