codecraftai-restclient-pychestrate 1.2.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.
Files changed (84) hide show
  1. ccai/pychestrate/py.typed +0 -0
  2. ccai/pychestrate/rest/client/__init__.py +0 -0
  3. ccai/pychestrate/rest/client/generation/__init__.py +0 -0
  4. ccai/pychestrate/rest/client/generation/pychestraterestclientgenerator.py +98 -0
  5. ccai/pychestrate/rest/client/generation/specs/pychestrate.yaml +3757 -0
  6. ccai/pychestrate/rest/client/groups/__init__.py +0 -0
  7. ccai/pychestrate/rest/client/groups/agents.py +171 -0
  8. ccai/pychestrate/rest/client/groups/artifacts.py +103 -0
  9. ccai/pychestrate/rest/client/groups/audit.py +99 -0
  10. ccai/pychestrate/rest/client/groups/auth.py +55 -0
  11. ccai/pychestrate/rest/client/groups/clients.py +287 -0
  12. ccai/pychestrate/rest/client/groups/dispatch.py +118 -0
  13. ccai/pychestrate/rest/client/groups/enrollment.py +212 -0
  14. ccai/pychestrate/rest/client/groups/flags.py +332 -0
  15. ccai/pychestrate/rest/client/groups/me.py +55 -0
  16. ccai/pychestrate/rest/client/groups/notifications.py +128 -0
  17. ccai/pychestrate/rest/client/groups/pluginapi.py +128 -0
  18. ccai/pychestrate/rest/client/groups/pods.py +558 -0
  19. ccai/pychestrate/rest/client/groups/progress.py +64 -0
  20. ccai/pychestrate/rest/client/groups/projects.py +420 -0
  21. ccai/pychestrate/rest/client/groups/projecttemplates.py +91 -0
  22. ccai/pychestrate/rest/client/groups/rbac.py +243 -0
  23. ccai/pychestrate/rest/client/groups/results.py +193 -0
  24. ccai/pychestrate/rest/client/groups/retention.py +169 -0
  25. ccai/pychestrate/rest/client/groups/runs.py +152 -0
  26. ccai/pychestrate/rest/client/groups/secrets.py +91 -0
  27. ccai/pychestrate/rest/client/groups/tagging.py +216 -0
  28. ccai/pychestrate/rest/client/groups/testcatalog.py +152 -0
  29. ccai/pychestrate/rest/client/groups/testruns.py +58 -0
  30. ccai/pychestrate/rest/client/groups/users.py +91 -0
  31. ccai/pychestrate/rest/client/groups/variables.py +228 -0
  32. ccai/pychestrate/rest/client/models/__init__.py +0 -0
  33. ccai/pychestrate/rest/client/models/agents.py +34 -0
  34. ccai/pychestrate/rest/client/models/artifactlocaluploadresult.py +18 -0
  35. ccai/pychestrate/rest/client/models/artifacts.py +24 -0
  36. ccai/pychestrate/rest/client/models/artifactuploadtarget.py +20 -0
  37. ccai/pychestrate/rest/client/models/audit.py +18 -0
  38. ccai/pychestrate/rest/client/models/auth.py +15 -0
  39. ccai/pychestrate/rest/client/models/capabilityentry.py +15 -0
  40. ccai/pychestrate/rest/client/models/client.py +19 -0
  41. ccai/pychestrate/rest/client/models/clients.py +40 -0
  42. ccai/pychestrate/rest/client/models/dispatch.py +26 -0
  43. ccai/pychestrate/rest/client/models/enrollment.py +39 -0
  44. ccai/pychestrate/rest/client/models/flags.py +55 -0
  45. ccai/pychestrate/rest/client/models/jobdeadline.py +11 -0
  46. ccai/pychestrate/rest/client/models/jobenvelope.py +38 -0
  47. ccai/pychestrate/rest/client/models/jobforwardinginfo.py +12 -0
  48. ccai/pychestrate/rest/client/models/jobpipelineref.py +11 -0
  49. ccai/pychestrate/rest/client/models/jobrefs.py +14 -0
  50. ccai/pychestrate/rest/client/models/jobresultslocator.py +11 -0
  51. ccai/pychestrate/rest/client/models/me.py +14 -0
  52. ccai/pychestrate/rest/client/models/notifications.py +24 -0
  53. ccai/pychestrate/rest/client/models/pagemeta.py +18 -0
  54. ccai/pychestrate/rest/client/models/pluginapi.py +21 -0
  55. ccai/pychestrate/rest/client/models/podmember.py +14 -0
  56. ccai/pychestrate/rest/client/models/pods.py +75 -0
  57. ccai/pychestrate/rest/client/models/podtopologylink.py +15 -0
  58. ccai/pychestrate/rest/client/models/problem.py +19 -0
  59. ccai/pychestrate/rest/client/models/progress.py +18 -0
  60. ccai/pychestrate/rest/client/models/progressrecord.py +26 -0
  61. ccai/pychestrate/rest/client/models/progresssummary.py +29 -0
  62. ccai/pychestrate/rest/client/models/projects.py +49 -0
  63. ccai/pychestrate/rest/client/models/projecttemplates.py +14 -0
  64. ccai/pychestrate/rest/client/models/rbac.py +46 -0
  65. ccai/pychestrate/rest/client/models/results.py +56 -0
  66. ccai/pychestrate/rest/client/models/retention.py +26 -0
  67. ccai/pychestrate/rest/client/models/runevent.py +25 -0
  68. ccai/pychestrate/rest/client/models/runs.py +32 -0
  69. ccai/pychestrate/rest/client/models/scopedsecret.py +13 -0
  70. ccai/pychestrate/rest/client/models/secrets.py +16 -0
  71. ccai/pychestrate/rest/client/models/signingkey.py +19 -0
  72. ccai/pychestrate/rest/client/models/tagging.py +24 -0
  73. ccai/pychestrate/rest/client/models/testcatalog.py +50 -0
  74. ccai/pychestrate/rest/client/models/testcatalogimportsummary.py +16 -0
  75. ccai/pychestrate/rest/client/models/testruns.py +25 -0
  76. ccai/pychestrate/rest/client/models/users.py +23 -0
  77. ccai/pychestrate/rest/client/models/variableeffectiveentry.py +13 -0
  78. ccai/pychestrate/rest/client/models/variables.py +30 -0
  79. ccai/pychestrate/rest/client/pychestraterestclient.py +166 -0
  80. ccai/pychestrate/rest/client/pychestraterestclientbase.py +147 -0
  81. codecraftai_restclient_pychestrate-1.2.0.dist-info/METADATA +96 -0
  82. codecraftai_restclient_pychestrate-1.2.0.dist-info/RECORD +84 -0
  83. codecraftai_restclient_pychestrate-1.2.0.dist-info/WHEEL +4 -0
  84. codecraftai_restclient_pychestrate-1.2.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,243 @@
1
+ # Auto-generated by RestClientGenerator. DO NOT EDIT.
2
+
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ from ccai.pychestrate.rest.client.models.rbac import Rbaccheckrequest
6
+ from ccai.pychestrate.rest.client.models.rbac import Rbaccheckresponse
7
+ from ccai.pychestrate.rest.client.models.rbac import Rbacrolebindingcreaterequest
8
+ from ccai.restclient.base.aspectsrest import AspectsRest
9
+ from ccai.restclient.base.restapigroup import RestApiGroup
10
+
11
+
12
+ class RbacApiGroup(RestApiGroup):
13
+ """
14
+ Roles, permissions, role bindings, and permission checks.
15
+ """
16
+
17
+ def rbac_check_permission(self, body: Rbaccheckrequest, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Rbaccheckresponse:
18
+ """
19
+ Check whether the actor has a permission in a scope.
20
+ """
21
+ client = self.client
22
+ if aspects is None:
23
+ aspects = client.aspects
24
+
25
+ header_params = client.headers
26
+ if headers is not None:
27
+ header_params = headers
28
+
29
+ call_leaf = "/rbac/check"
30
+
31
+ query_params = None
32
+
33
+
34
+ if exp_status is None:
35
+ exp_status = [200]
36
+
37
+ resp = client.perform_call(
38
+ leaf=call_leaf,
39
+ method="POST",
40
+ params=query_params if query_params else None,
41
+ body=body,
42
+ exp_status=exp_status,
43
+ headers=header_params if header_params else None,
44
+ context_msg=None,
45
+ aspects=aspects,
46
+ )
47
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
48
+ rtnobj = None
49
+ else:
50
+ raw_data = resp.json()
51
+ rtnobj = Rbaccheckresponse.from_dict(raw_data)
52
+ return rtnobj
53
+
54
+ def rbac_create_binding(self, body: Rbacrolebindingcreaterequest, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Any:
55
+ """
56
+ Create a role binding.
57
+ """
58
+ client = self.client
59
+ if aspects is None:
60
+ aspects = client.aspects
61
+
62
+ header_params = client.headers
63
+ if headers is not None:
64
+ header_params = headers
65
+
66
+ call_leaf = "/rbac/bindings"
67
+
68
+ query_params = None
69
+
70
+
71
+ if exp_status is None:
72
+ exp_status = [201]
73
+
74
+ resp = client.perform_call(
75
+ leaf=call_leaf,
76
+ method="POST",
77
+ params=query_params if query_params else None,
78
+ body=body,
79
+ exp_status=exp_status,
80
+ headers=header_params if header_params else None,
81
+ context_msg=None,
82
+ aspects=aspects,
83
+ )
84
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
85
+ rtnval = None
86
+ else:
87
+ rtnval = resp.json()
88
+ return rtnval
89
+
90
+ def rbac_delete_binding(self, binding_id: str, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Any:
91
+ """
92
+ Delete a role binding.
93
+ """
94
+ client = self.client
95
+ if aspects is None:
96
+ aspects = client.aspects
97
+
98
+ header_params = client.headers
99
+ if headers is not None:
100
+ header_params = headers
101
+
102
+ leaf_template = "/rbac/bindings/{binding_id}"
103
+ path_params = {
104
+ 'binding_id': binding_id,
105
+ }
106
+ call_leaf = leaf_template.format(**path_params)
107
+
108
+ query_params = None
109
+
110
+
111
+ if exp_status is None:
112
+ exp_status = [204]
113
+
114
+ resp = client.perform_call(
115
+ leaf=call_leaf,
116
+ method="DELETE",
117
+ params=query_params if query_params else None,
118
+ body=None,
119
+ exp_status=exp_status,
120
+ headers=header_params if header_params else None,
121
+ context_msg=None,
122
+ aspects=aspects,
123
+ )
124
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
125
+ rtnval = None
126
+ else:
127
+ rtnval = resp.json()
128
+ return rtnval
129
+
130
+ def rbac_list_bindings(self, *, user_id: Optional[str] = None, project_id: Optional[str] = None, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Dict[str, Any]:
131
+ """
132
+ List role bindings.
133
+ """
134
+ client = self.client
135
+ if aspects is None:
136
+ aspects = client.aspects
137
+
138
+ header_params = client.headers
139
+ if headers is not None:
140
+ header_params = headers
141
+
142
+ call_leaf = "/rbac/bindings"
143
+
144
+ query_params = {}
145
+ if user_id is not None:
146
+ query_params['user_id'] = user_id
147
+ if project_id is not None:
148
+ query_params['project_id'] = project_id
149
+
150
+
151
+ if exp_status is None:
152
+ exp_status = [200]
153
+
154
+ resp = client.perform_call(
155
+ leaf=call_leaf,
156
+ method="GET",
157
+ params=query_params if query_params else None,
158
+ body=None,
159
+ exp_status=exp_status,
160
+ headers=header_params if header_params else None,
161
+ context_msg=None,
162
+ aspects=aspects,
163
+ )
164
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
165
+ rtnval = None
166
+ else:
167
+ raw_data = resp.json()
168
+ rtnval = self._parse_item(raw_data, Dict[str, Any])
169
+ return rtnval
170
+
171
+ def rbac_list_permissions(self, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Dict[str, Any]:
172
+ """
173
+ List declared RBAC permission keys.
174
+ """
175
+ client = self.client
176
+ if aspects is None:
177
+ aspects = client.aspects
178
+
179
+ header_params = client.headers
180
+ if headers is not None:
181
+ header_params = headers
182
+
183
+ call_leaf = "/rbac/permissions"
184
+
185
+ query_params = None
186
+
187
+
188
+ if exp_status is None:
189
+ exp_status = [200]
190
+
191
+ resp = client.perform_call(
192
+ leaf=call_leaf,
193
+ method="GET",
194
+ params=query_params if query_params else None,
195
+ body=None,
196
+ exp_status=exp_status,
197
+ headers=header_params if header_params else None,
198
+ context_msg=None,
199
+ aspects=aspects,
200
+ )
201
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
202
+ rtnval = None
203
+ else:
204
+ raw_data = resp.json()
205
+ rtnval = self._parse_item(raw_data, Dict[str, Any])
206
+ return rtnval
207
+
208
+ def rbac_list_roles(self, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Dict[str, Any]:
209
+ """
210
+ List declared roles.
211
+ """
212
+ client = self.client
213
+ if aspects is None:
214
+ aspects = client.aspects
215
+
216
+ header_params = client.headers
217
+ if headers is not None:
218
+ header_params = headers
219
+
220
+ call_leaf = "/rbac/roles"
221
+
222
+ query_params = None
223
+
224
+
225
+ if exp_status is None:
226
+ exp_status = [200]
227
+
228
+ resp = client.perform_call(
229
+ leaf=call_leaf,
230
+ method="GET",
231
+ params=query_params if query_params else None,
232
+ body=None,
233
+ exp_status=exp_status,
234
+ headers=header_params if header_params else None,
235
+ context_msg=None,
236
+ aspects=aspects,
237
+ )
238
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
239
+ rtnval = None
240
+ else:
241
+ raw_data = resp.json()
242
+ rtnval = self._parse_item(raw_data, Dict[str, Any])
243
+ return rtnval
@@ -0,0 +1,193 @@
1
+ # Auto-generated by RestClientGenerator. DO NOT EDIT.
2
+
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ from ccai.pychestrate.rest.client.models.results import Artifactpresignrequest
6
+ from ccai.pychestrate.rest.client.models.results import Artifactpresignresponse
7
+ from ccai.pychestrate.rest.client.models.results import Resultmanifest
8
+ from ccai.restclient.base.aspectsrest import AspectsRest
9
+ from ccai.restclient.base.restapigroup import RestApiGroup
10
+
11
+
12
+ class ResultsApiGroup(RestApiGroup):
13
+ """
14
+ Pod-client → server final-result manifests.
15
+ """
16
+
17
+ def artifacts_local_upload(self, run_id: str, path: str, expires: int, signature: str, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Any:
18
+ """
19
+ Upload sink for the local-filesystem presign fallback.
20
+
21
+ The upload sink the `:presign` operation's local-filesystem
22
+ fallback URLs point at. Used only when the deploy has no
23
+ S3-compatible object store.
24
+
25
+ The request body is the raw artifact bytes. The handler
26
+ re-verifies the `signature` query parameter against the
27
+ server-held HMAC secret before writing the bytes under the
28
+ run's allocated `backend_key_prefix`. A forged or expired
29
+ signature is rejected with 403; the signature -- not a
30
+ permission check -- is this endpoint's auth contract, so no
31
+ object-store credential is involved.
32
+
33
+ """
34
+ client = self.client
35
+ if aspects is None:
36
+ aspects = client.aspects
37
+
38
+ header_params = client.headers
39
+ if headers is not None:
40
+ header_params = headers
41
+
42
+ leaf_template = "/runs/{run_id}/artifacts/_local-upload"
43
+ path_params = {
44
+ 'run_id': run_id,
45
+ }
46
+ call_leaf = leaf_template.format(**path_params)
47
+
48
+ query_params = {}
49
+ if path is not None:
50
+ query_params['path'] = path
51
+ if expires is not None:
52
+ query_params['expires'] = expires
53
+ if signature is not None:
54
+ query_params['signature'] = signature
55
+
56
+
57
+ if exp_status is None:
58
+ exp_status = [201]
59
+
60
+ resp = client.perform_call(
61
+ leaf=call_leaf,
62
+ method="PUT",
63
+ params=query_params if query_params else None,
64
+ body=None,
65
+ exp_status=exp_status,
66
+ headers=header_params if header_params else None,
67
+ context_msg=None,
68
+ aspects=aspects,
69
+ )
70
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
71
+ rtnval = None
72
+ else:
73
+ rtnval = resp.json()
74
+ return rtnval
75
+
76
+ def artifacts_presign_upload(self, run_id: str, body: Artifactpresignrequest, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Artifactpresignresponse:
77
+ """
78
+ Mint presigned PUT URLs for a run's result-tree upload.
79
+
80
+ Posted by the pod client agent over mTLS to obtain
81
+ short-lived presigned PUT URLs for the relative artifact
82
+ paths it discovered while walking its testbase result tree.
83
+
84
+ The agent PUTs each artifact's bytes directly to the
85
+ returned `put_url`, then calls
86
+ `POST /runs/{run_id}/results/complete`. Object-store
87
+ credentials never leave the server -- the credentialed
88
+ transfer is encoded entirely in the presigned URL.
89
+
90
+ On the dev / alpha deploy there is no S3-compatible object
91
+ store, so the server mints **local-filesystem fallback**
92
+ URLs that point back at
93
+ `PUT /runs/{run_id}/artifacts/_local-upload`. The URL
94
+ carries an HMAC signature over `run_id` + path + expiry, so
95
+ the fallback needs no object-store credential while staying
96
+ tamper-proof. The agent's code path is identical either way.
97
+
98
+ Auth: the verified mTLS client common-name must match the
99
+ `client_id` that owns the run's current dispatch receipt --
100
+ only the client running the job may upload its results. A
101
+ run that has already reached a terminal state no longer
102
+ accepts uploads (409).
103
+
104
+ """
105
+ client = self.client
106
+ if aspects is None:
107
+ aspects = client.aspects
108
+
109
+ header_params = client.headers
110
+ if headers is not None:
111
+ header_params = headers
112
+
113
+ leaf_template = "/runs/{run_id}/artifacts:presign"
114
+ path_params = {
115
+ 'run_id': run_id,
116
+ }
117
+ call_leaf = leaf_template.format(**path_params)
118
+
119
+ query_params = None
120
+
121
+
122
+ if exp_status is None:
123
+ exp_status = [200]
124
+
125
+ resp = client.perform_call(
126
+ leaf=call_leaf,
127
+ method="POST",
128
+ params=query_params if query_params else None,
129
+ body=body,
130
+ exp_status=exp_status,
131
+ headers=header_params if header_params else None,
132
+ context_msg=None,
133
+ aspects=aspects,
134
+ )
135
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
136
+ rtnobj = None
137
+ else:
138
+ raw_data = resp.json()
139
+ rtnobj = Artifactpresignresponse.from_dict(raw_data)
140
+ return rtnobj
141
+
142
+ def results_post_complete(self, run_id: str, body: Resultmanifest, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Any:
143
+ """
144
+ Signal that the result tree for a run is fully uploaded.
145
+
146
+ Posted by the pod client agent over mTLS once it has finished
147
+ writing the testbase result tree (`testrun_summary.json`,
148
+ `testrun_results_stream.jsos`, `testrun_results.json`,
149
+ `testsummary.html`, plus the `artifacts/`, `taskings/`,
150
+ `tc-by-products/`, `diagnostics/` subtrees) to the shared
151
+ results backend.
152
+
153
+ The server transitions the run to a terminal state
154
+ (`COMPLETED` / `FAILED`) based on the manifest's
155
+ `terminal_outcome` field and kicks off the
156
+ `result_tree_parser` extension chain.
157
+
158
+ """
159
+ client = self.client
160
+ if aspects is None:
161
+ aspects = client.aspects
162
+
163
+ header_params = client.headers
164
+ if headers is not None:
165
+ header_params = headers
166
+
167
+ leaf_template = "/runs/{run_id}/results/complete"
168
+ path_params = {
169
+ 'run_id': run_id,
170
+ }
171
+ call_leaf = leaf_template.format(**path_params)
172
+
173
+ query_params = None
174
+
175
+
176
+ if exp_status is None:
177
+ exp_status = [202]
178
+
179
+ resp = client.perform_call(
180
+ leaf=call_leaf,
181
+ method="POST",
182
+ params=query_params if query_params else None,
183
+ body=body,
184
+ exp_status=exp_status,
185
+ headers=header_params if header_params else None,
186
+ context_msg=None,
187
+ aspects=aspects,
188
+ )
189
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
190
+ rtnval = None
191
+ else:
192
+ rtnval = resp.json()
193
+ return rtnval
@@ -0,0 +1,169 @@
1
+ # Auto-generated by RestClientGenerator. DO NOT EDIT.
2
+
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ from ccai.pychestrate.rest.client.models.retention import Retentionpolicy
6
+ from ccai.pychestrate.rest.client.models.retention import Retentionpolicycreaterequest
7
+ from ccai.restclient.base.aspectsrest import AspectsRest
8
+ from ccai.restclient.base.restapigroup import RestApiGroup
9
+
10
+
11
+ class RetentionApiGroup(RestApiGroup):
12
+ """
13
+ Per-data-class retention policies.
14
+ """
15
+
16
+ def retention_create(self, body: Retentionpolicycreaterequest, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Any:
17
+ """
18
+ Create a retention policy.
19
+ """
20
+ client = self.client
21
+ if aspects is None:
22
+ aspects = client.aspects
23
+
24
+ header_params = client.headers
25
+ if headers is not None:
26
+ header_params = headers
27
+
28
+ call_leaf = "/retention/policies"
29
+
30
+ query_params = None
31
+
32
+
33
+ if exp_status is None:
34
+ exp_status = [201]
35
+
36
+ resp = client.perform_call(
37
+ leaf=call_leaf,
38
+ method="POST",
39
+ params=query_params if query_params else None,
40
+ body=body,
41
+ exp_status=exp_status,
42
+ headers=header_params if header_params else None,
43
+ context_msg=None,
44
+ aspects=aspects,
45
+ )
46
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
47
+ rtnval = None
48
+ else:
49
+ rtnval = resp.json()
50
+ return rtnval
51
+
52
+ def retention_get_by_id(self, policy_id: str, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Retentionpolicy:
53
+ """
54
+ Read a retention policy.
55
+ """
56
+ client = self.client
57
+ if aspects is None:
58
+ aspects = client.aspects
59
+
60
+ header_params = client.headers
61
+ if headers is not None:
62
+ header_params = headers
63
+
64
+ leaf_template = "/retention/policies/{policy_id}"
65
+ path_params = {
66
+ 'policy_id': policy_id,
67
+ }
68
+ call_leaf = leaf_template.format(**path_params)
69
+
70
+ query_params = None
71
+
72
+
73
+ if exp_status is None:
74
+ exp_status = [200]
75
+
76
+ resp = client.perform_call(
77
+ leaf=call_leaf,
78
+ method="GET",
79
+ params=query_params if query_params else None,
80
+ body=None,
81
+ exp_status=exp_status,
82
+ headers=header_params if header_params else None,
83
+ context_msg=None,
84
+ aspects=aspects,
85
+ )
86
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
87
+ rtnobj = None
88
+ else:
89
+ raw_data = resp.json()
90
+ rtnobj = Retentionpolicy.from_dict(raw_data)
91
+ return rtnobj
92
+
93
+ def retention_list(self, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Dict[str, Any]:
94
+ """
95
+ List retention policies.
96
+ """
97
+ client = self.client
98
+ if aspects is None:
99
+ aspects = client.aspects
100
+
101
+ header_params = client.headers
102
+ if headers is not None:
103
+ header_params = headers
104
+
105
+ call_leaf = "/retention/policies"
106
+
107
+ query_params = None
108
+
109
+
110
+ if exp_status is None:
111
+ exp_status = [200]
112
+
113
+ resp = client.perform_call(
114
+ leaf=call_leaf,
115
+ method="GET",
116
+ params=query_params if query_params else None,
117
+ body=None,
118
+ exp_status=exp_status,
119
+ headers=header_params if header_params else None,
120
+ context_msg=None,
121
+ aspects=aspects,
122
+ )
123
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
124
+ rtnval = None
125
+ else:
126
+ raw_data = resp.json()
127
+ rtnval = self._parse_item(raw_data, Dict[str, Any])
128
+ return rtnval
129
+
130
+ def retention_publish(self, policy_id: str, *, exp_status: Optional[List[int]] = None, headers: Optional[Dict[str, str]] = None, aspects: Optional[AspectsRest] = None) -> Retentionpolicy:
131
+ """
132
+ Publish (activate) a retention policy.
133
+ """
134
+ client = self.client
135
+ if aspects is None:
136
+ aspects = client.aspects
137
+
138
+ header_params = client.headers
139
+ if headers is not None:
140
+ header_params = headers
141
+
142
+ leaf_template = "/retention/policies/{policy_id}/publish"
143
+ path_params = {
144
+ 'policy_id': policy_id,
145
+ }
146
+ call_leaf = leaf_template.format(**path_params)
147
+
148
+ query_params = None
149
+
150
+
151
+ if exp_status is None:
152
+ exp_status = [200]
153
+
154
+ resp = client.perform_call(
155
+ leaf=call_leaf,
156
+ method="POST",
157
+ params=query_params if query_params else None,
158
+ body=None,
159
+ exp_status=exp_status,
160
+ headers=header_params if header_params else None,
161
+ context_msg=None,
162
+ aspects=aspects,
163
+ )
164
+ if resp.status_code in (204, 205) or (resp.status_code == 202 and len(resp.content) == 0):
165
+ rtnobj = None
166
+ else:
167
+ raw_data = resp.json()
168
+ rtnobj = Retentionpolicy.from_dict(raw_data)
169
+ return rtnobj