cribl-control-plane 0.0.26a1__py3-none-any.whl → 0.0.28__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.

Potentially problematic release.


This version of cribl-control-plane might be problematic. Click here for more details.

Files changed (132) hide show
  1. cribl_control_plane/_hooks/clientcredentials.py +22 -7
  2. cribl_control_plane/_version.py +4 -4
  3. cribl_control_plane/acl.py +203 -0
  4. cribl_control_plane/auth_sdk.py +9 -176
  5. cribl_control_plane/branches.py +335 -0
  6. cribl_control_plane/commits.py +1141 -0
  7. cribl_control_plane/commits_files.py +371 -0
  8. cribl_control_plane/configs_versions.py +189 -0
  9. cribl_control_plane/destinations.py +18 -729
  10. cribl_control_plane/destinations_pq.py +359 -0
  11. cribl_control_plane/errors/__init__.py +3 -2
  12. cribl_control_plane/errors/healthstatus_error.py +1 -1
  13. cribl_control_plane/groups_configs.py +17 -0
  14. cribl_control_plane/groups_sdk.py +18 -551
  15. cribl_control_plane/{healthinfo.py → health.py} +3 -1
  16. cribl_control_plane/hectokens.py +479 -0
  17. cribl_control_plane/models/__init__.py +6 -37
  18. cribl_control_plane/models/healthstatus.py +3 -3
  19. cribl_control_plane/models/inputappscope.py +5 -5
  20. cribl_control_plane/models/inputcollection.py +2 -2
  21. cribl_control_plane/models/inputconfluentcloud.py +3 -3
  22. cribl_control_plane/models/inputcribl.py +5 -5
  23. cribl_control_plane/models/inputcriblhttp.py +3 -3
  24. cribl_control_plane/models/inputcribllakehttp.py +3 -3
  25. cribl_control_plane/models/inputcriblmetrics.py +5 -5
  26. cribl_control_plane/models/inputcribltcp.py +3 -3
  27. cribl_control_plane/models/inputdatadogagent.py +3 -3
  28. cribl_control_plane/models/inputedgeprometheus.py +3 -3
  29. cribl_control_plane/models/inputelastic.py +3 -3
  30. cribl_control_plane/models/inputeventhub.py +3 -3
  31. cribl_control_plane/models/inputfile.py +5 -5
  32. cribl_control_plane/models/inputfirehose.py +3 -3
  33. cribl_control_plane/models/inputgooglepubsub.py +3 -3
  34. cribl_control_plane/models/inputgrafana.py +6 -6
  35. cribl_control_plane/models/inputhttp.py +3 -3
  36. cribl_control_plane/models/inputhttpraw.py +3 -3
  37. cribl_control_plane/models/inputjournalfiles.py +3 -3
  38. cribl_control_plane/models/inputkafka.py +3 -3
  39. cribl_control_plane/models/inputkinesis.py +3 -3
  40. cribl_control_plane/models/inputkubeevents.py +5 -5
  41. cribl_control_plane/models/inputkubelogs.py +5 -5
  42. cribl_control_plane/models/inputkubemetrics.py +5 -5
  43. cribl_control_plane/models/inputloki.py +3 -3
  44. cribl_control_plane/models/inputmodeldriventelemetry.py +3 -3
  45. cribl_control_plane/models/inputmsk.py +3 -3
  46. cribl_control_plane/models/inputnetflow.py +3 -3
  47. cribl_control_plane/models/inputoffice365mgmt.py +3 -3
  48. cribl_control_plane/models/inputoffice365msgtrace.py +3 -3
  49. cribl_control_plane/models/inputoffice365service.py +3 -3
  50. cribl_control_plane/models/inputopentelemetry.py +3 -3
  51. cribl_control_plane/models/inputprometheus.py +3 -3
  52. cribl_control_plane/models/inputprometheusrw.py +3 -3
  53. cribl_control_plane/models/inputrawudp.py +3 -3
  54. cribl_control_plane/models/inputsnmp.py +3 -3
  55. cribl_control_plane/models/inputsplunk.py +3 -3
  56. cribl_control_plane/models/inputsplunkhec.py +3 -3
  57. cribl_control_plane/models/inputsplunksearch.py +3 -3
  58. cribl_control_plane/models/inputsqs.py +3 -3
  59. cribl_control_plane/models/inputsystemmetrics.py +5 -5
  60. cribl_control_plane/models/inputsystemstate.py +5 -5
  61. cribl_control_plane/models/inputtcp.py +3 -3
  62. cribl_control_plane/models/inputtcpjson.py +3 -3
  63. cribl_control_plane/models/inputwef.py +3 -3
  64. cribl_control_plane/models/inputwindowsmetrics.py +5 -5
  65. cribl_control_plane/models/inputwiz.py +3 -3
  66. cribl_control_plane/models/inputzscalerhec.py +3 -3
  67. cribl_control_plane/models/outputazureblob.py +3 -3
  68. cribl_control_plane/models/outputazuredataexplorer.py +3 -3
  69. cribl_control_plane/models/outputazureeventhub.py +3 -3
  70. cribl_control_plane/models/outputclickhouse.py +3 -3
  71. cribl_control_plane/models/outputcloudwatch.py +3 -3
  72. cribl_control_plane/models/outputconfluentcloud.py +3 -3
  73. cribl_control_plane/models/outputcriblhttp.py +5 -5
  74. cribl_control_plane/models/outputcribllake.py +5 -5
  75. cribl_control_plane/models/outputcribltcp.py +5 -5
  76. cribl_control_plane/models/outputcrowdstrikenextgensiem.py +3 -3
  77. cribl_control_plane/models/outputdatadog.py +5 -5
  78. cribl_control_plane/models/outputdataset.py +5 -5
  79. cribl_control_plane/models/outputdevnull.py +5 -5
  80. cribl_control_plane/models/outputdiskspool.py +5 -5
  81. cribl_control_plane/models/outputdls3.py +3 -3
  82. cribl_control_plane/models/outputdynatracehttp.py +3 -3
  83. cribl_control_plane/models/outputdynatraceotlp.py +3 -3
  84. cribl_control_plane/models/outputelasticcloud.py +3 -3
  85. cribl_control_plane/models/outputexabeam.py +3 -3
  86. cribl_control_plane/models/outputgooglecloudlogging.py +3 -3
  87. cribl_control_plane/models/outputgooglecloudstorage.py +3 -3
  88. cribl_control_plane/models/outputgrafanacloud.py +10 -10
  89. cribl_control_plane/models/outputgraphite.py +3 -3
  90. cribl_control_plane/models/outputhumiohec.py +3 -3
  91. cribl_control_plane/models/outputkafka.py +3 -3
  92. cribl_control_plane/models/outputkinesis.py +3 -3
  93. cribl_control_plane/models/outputminio.py +3 -3
  94. cribl_control_plane/models/outputmsk.py +3 -3
  95. cribl_control_plane/models/outputnewrelic.py +5 -5
  96. cribl_control_plane/models/outputnewrelicevents.py +3 -3
  97. cribl_control_plane/models/outputring.py +5 -5
  98. cribl_control_plane/models/outputs3.py +3 -3
  99. cribl_control_plane/models/outputsecuritylake.py +3 -3
  100. cribl_control_plane/models/outputsentinel.py +3 -3
  101. cribl_control_plane/models/outputsentineloneaisiem.py +3 -3
  102. cribl_control_plane/models/outputservicenow.py +3 -3
  103. cribl_control_plane/models/outputsns.py +3 -3
  104. cribl_control_plane/models/outputsplunk.py +3 -3
  105. cribl_control_plane/models/outputsplunkhec.py +5 -5
  106. cribl_control_plane/models/outputsqs.py +3 -3
  107. cribl_control_plane/models/outputstatsd.py +3 -3
  108. cribl_control_plane/models/outputstatsdext.py +3 -3
  109. cribl_control_plane/models/outputsyslog.py +5 -5
  110. cribl_control_plane/models/outputtcpjson.py +5 -5
  111. cribl_control_plane/models/outputwebhook.py +5 -5
  112. cribl_control_plane/models/outputxsiam.py +5 -5
  113. cribl_control_plane/models/schemeclientoauth.py +5 -0
  114. cribl_control_plane/nodes.py +90 -68
  115. cribl_control_plane/samples.py +391 -0
  116. cribl_control_plane/sdk.py +11 -17
  117. cribl_control_plane/sources.py +15 -469
  118. cribl_control_plane/{workers_sdk.py → statuses.py} +23 -25
  119. cribl_control_plane/{deployments.py → summaries.py} +3 -3
  120. cribl_control_plane/teams.py +201 -0
  121. cribl_control_plane/tokens.py +182 -0
  122. cribl_control_plane/utils/__init__.py +3 -2
  123. cribl_control_plane/utils/security.py +5 -0
  124. cribl_control_plane/versions.py +26 -0
  125. cribl_control_plane/versions_configs.py +171 -0
  126. {cribl_control_plane-0.0.26a1.dist-info → cribl_control_plane-0.0.28.dist-info}/METADATA +77 -38
  127. {cribl_control_plane-0.0.26a1.dist-info → cribl_control_plane-0.0.28.dist-info}/RECORD +128 -119
  128. cribl_control_plane/models/createversionsyncop.py +0 -23
  129. cribl_control_plane/models/restartresponse.py +0 -26
  130. cribl_control_plane/models/updateworkersrestartop.py +0 -24
  131. cribl_control_plane/versioning.py +0 -2309
  132. {cribl_control_plane-0.0.26a1.dist-info → cribl_control_plane-0.0.28.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1141 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from .sdkconfiguration import SDKConfiguration
5
+ from cribl_control_plane import errors, models, utils
6
+ from cribl_control_plane._hooks import HookContext
7
+ from cribl_control_plane.commits_files import CommitsFiles
8
+ from cribl_control_plane.types import OptionalNullable, UNSET
9
+ from cribl_control_plane.utils import get_security_from_env
10
+ from cribl_control_plane.utils.unmarshal_json_response import unmarshal_json_response
11
+ from typing import Any, List, Mapping, Optional
12
+
13
+
14
+ class Commits(BaseSDK):
15
+ files: CommitsFiles
16
+
17
+ def __init__(self, sdk_config: SDKConfiguration) -> None:
18
+ BaseSDK.__init__(self, sdk_config)
19
+ self.sdk_configuration = sdk_config
20
+ self._init_sdks()
21
+
22
+ def _init_sdks(self):
23
+ self.files = CommitsFiles(self.sdk_configuration)
24
+
25
+ def create(
26
+ self,
27
+ *,
28
+ message: str,
29
+ effective: Optional[bool] = None,
30
+ files: Optional[List[str]] = None,
31
+ group: Optional[str] = None,
32
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
33
+ server_url: Optional[str] = None,
34
+ timeout_ms: Optional[int] = None,
35
+ http_headers: Optional[Mapping[str, str]] = None,
36
+ ) -> models.CreateVersionCommitResponse:
37
+ r"""Create a new commit for pending changes to the Cribl configuration
38
+
39
+ create a new commit containing the current configs the given log message describing the changes.
40
+
41
+ :param message:
42
+ :param effective:
43
+ :param files:
44
+ :param group:
45
+ :param retries: Override the default retry configuration for this method
46
+ :param server_url: Override the default server URL for this method
47
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
48
+ :param http_headers: Additional headers to set or replace on requests.
49
+ """
50
+ base_url = None
51
+ url_variables = None
52
+ if timeout_ms is None:
53
+ timeout_ms = self.sdk_configuration.timeout_ms
54
+
55
+ if server_url is not None:
56
+ base_url = server_url
57
+ else:
58
+ base_url = self._get_url(base_url, url_variables)
59
+
60
+ request = models.GitCommitParams(
61
+ effective=effective,
62
+ files=files,
63
+ group=group,
64
+ message=message,
65
+ )
66
+
67
+ req = self._build_request(
68
+ method="POST",
69
+ path="/version/commit",
70
+ base_url=base_url,
71
+ url_variables=url_variables,
72
+ request=request,
73
+ request_body_required=True,
74
+ request_has_path_params=False,
75
+ request_has_query_params=True,
76
+ user_agent_header="user-agent",
77
+ accept_header_value="application/json",
78
+ http_headers=http_headers,
79
+ security=self.sdk_configuration.security,
80
+ get_serialized_body=lambda: utils.serialize_request_body(
81
+ request, False, False, "json", models.GitCommitParams
82
+ ),
83
+ timeout_ms=timeout_ms,
84
+ )
85
+
86
+ if retries == UNSET:
87
+ if self.sdk_configuration.retry_config is not UNSET:
88
+ retries = self.sdk_configuration.retry_config
89
+
90
+ retry_config = None
91
+ if isinstance(retries, utils.RetryConfig):
92
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
93
+
94
+ http_res = self.do_request(
95
+ hook_ctx=HookContext(
96
+ config=self.sdk_configuration,
97
+ base_url=base_url or "",
98
+ operation_id="createVersionCommit",
99
+ oauth2_scopes=[],
100
+ security_source=get_security_from_env(
101
+ self.sdk_configuration.security, models.Security
102
+ ),
103
+ ),
104
+ request=req,
105
+ error_status_codes=["401", "4XX", "500", "5XX"],
106
+ retry_config=retry_config,
107
+ )
108
+
109
+ response_data: Any = None
110
+ if utils.match_response(http_res, "200", "application/json"):
111
+ return unmarshal_json_response(models.CreateVersionCommitResponse, http_res)
112
+ if utils.match_response(http_res, "500", "application/json"):
113
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
114
+ raise errors.Error(response_data, http_res)
115
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
116
+ http_res_text = utils.stream_to_text(http_res)
117
+ raise errors.APIError("API error occurred", http_res, http_res_text)
118
+ if utils.match_response(http_res, "5XX", "*"):
119
+ http_res_text = utils.stream_to_text(http_res)
120
+ raise errors.APIError("API error occurred", http_res, http_res_text)
121
+
122
+ raise errors.APIError("Unexpected response received", http_res)
123
+
124
+ async def create_async(
125
+ self,
126
+ *,
127
+ message: str,
128
+ effective: Optional[bool] = None,
129
+ files: Optional[List[str]] = None,
130
+ group: Optional[str] = None,
131
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
132
+ server_url: Optional[str] = None,
133
+ timeout_ms: Optional[int] = None,
134
+ http_headers: Optional[Mapping[str, str]] = None,
135
+ ) -> models.CreateVersionCommitResponse:
136
+ r"""Create a new commit for pending changes to the Cribl configuration
137
+
138
+ create a new commit containing the current configs the given log message describing the changes.
139
+
140
+ :param message:
141
+ :param effective:
142
+ :param files:
143
+ :param group:
144
+ :param retries: Override the default retry configuration for this method
145
+ :param server_url: Override the default server URL for this method
146
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
147
+ :param http_headers: Additional headers to set or replace on requests.
148
+ """
149
+ base_url = None
150
+ url_variables = None
151
+ if timeout_ms is None:
152
+ timeout_ms = self.sdk_configuration.timeout_ms
153
+
154
+ if server_url is not None:
155
+ base_url = server_url
156
+ else:
157
+ base_url = self._get_url(base_url, url_variables)
158
+
159
+ request = models.GitCommitParams(
160
+ effective=effective,
161
+ files=files,
162
+ group=group,
163
+ message=message,
164
+ )
165
+
166
+ req = self._build_request_async(
167
+ method="POST",
168
+ path="/version/commit",
169
+ base_url=base_url,
170
+ url_variables=url_variables,
171
+ request=request,
172
+ request_body_required=True,
173
+ request_has_path_params=False,
174
+ request_has_query_params=True,
175
+ user_agent_header="user-agent",
176
+ accept_header_value="application/json",
177
+ http_headers=http_headers,
178
+ security=self.sdk_configuration.security,
179
+ get_serialized_body=lambda: utils.serialize_request_body(
180
+ request, False, False, "json", models.GitCommitParams
181
+ ),
182
+ timeout_ms=timeout_ms,
183
+ )
184
+
185
+ if retries == UNSET:
186
+ if self.sdk_configuration.retry_config is not UNSET:
187
+ retries = self.sdk_configuration.retry_config
188
+
189
+ retry_config = None
190
+ if isinstance(retries, utils.RetryConfig):
191
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
192
+
193
+ http_res = await self.do_request_async(
194
+ hook_ctx=HookContext(
195
+ config=self.sdk_configuration,
196
+ base_url=base_url or "",
197
+ operation_id="createVersionCommit",
198
+ oauth2_scopes=[],
199
+ security_source=get_security_from_env(
200
+ self.sdk_configuration.security, models.Security
201
+ ),
202
+ ),
203
+ request=req,
204
+ error_status_codes=["401", "4XX", "500", "5XX"],
205
+ retry_config=retry_config,
206
+ )
207
+
208
+ response_data: Any = None
209
+ if utils.match_response(http_res, "200", "application/json"):
210
+ return unmarshal_json_response(models.CreateVersionCommitResponse, http_res)
211
+ if utils.match_response(http_res, "500", "application/json"):
212
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
213
+ raise errors.Error(response_data, http_res)
214
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
215
+ http_res_text = await utils.stream_to_text_async(http_res)
216
+ raise errors.APIError("API error occurred", http_res, http_res_text)
217
+ if utils.match_response(http_res, "5XX", "*"):
218
+ http_res_text = await utils.stream_to_text_async(http_res)
219
+ raise errors.APIError("API error occurred", http_res, http_res_text)
220
+
221
+ raise errors.APIError("Unexpected response received", http_res)
222
+
223
+ def diff(
224
+ self,
225
+ *,
226
+ commit: Optional[str] = None,
227
+ group: Optional[str] = None,
228
+ filename: Optional[str] = None,
229
+ diff_line_limit: Optional[float] = None,
230
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
231
+ server_url: Optional[str] = None,
232
+ timeout_ms: Optional[int] = None,
233
+ http_headers: Optional[Mapping[str, str]] = None,
234
+ ) -> models.GetVersionDiffResponse:
235
+ r"""Retrieve the diff for a commit
236
+
237
+ get the textual diff for given commit
238
+
239
+ :param commit: Commit hash (default is HEAD)
240
+ :param group: Group ID
241
+ :param filename: Filename
242
+ :param diff_line_limit: Limit maximum lines in the diff
243
+ :param retries: Override the default retry configuration for this method
244
+ :param server_url: Override the default server URL for this method
245
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
246
+ :param http_headers: Additional headers to set or replace on requests.
247
+ """
248
+ base_url = None
249
+ url_variables = None
250
+ if timeout_ms is None:
251
+ timeout_ms = self.sdk_configuration.timeout_ms
252
+
253
+ if server_url is not None:
254
+ base_url = server_url
255
+ else:
256
+ base_url = self._get_url(base_url, url_variables)
257
+
258
+ request = models.GetVersionDiffRequest(
259
+ commit=commit,
260
+ group=group,
261
+ filename=filename,
262
+ diff_line_limit=diff_line_limit,
263
+ )
264
+
265
+ req = self._build_request(
266
+ method="GET",
267
+ path="/version/diff",
268
+ base_url=base_url,
269
+ url_variables=url_variables,
270
+ request=request,
271
+ request_body_required=False,
272
+ request_has_path_params=False,
273
+ request_has_query_params=True,
274
+ user_agent_header="user-agent",
275
+ accept_header_value="application/json",
276
+ http_headers=http_headers,
277
+ security=self.sdk_configuration.security,
278
+ timeout_ms=timeout_ms,
279
+ )
280
+
281
+ if retries == UNSET:
282
+ if self.sdk_configuration.retry_config is not UNSET:
283
+ retries = self.sdk_configuration.retry_config
284
+
285
+ retry_config = None
286
+ if isinstance(retries, utils.RetryConfig):
287
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
288
+
289
+ http_res = self.do_request(
290
+ hook_ctx=HookContext(
291
+ config=self.sdk_configuration,
292
+ base_url=base_url or "",
293
+ operation_id="getVersionDiff",
294
+ oauth2_scopes=[],
295
+ security_source=get_security_from_env(
296
+ self.sdk_configuration.security, models.Security
297
+ ),
298
+ ),
299
+ request=req,
300
+ error_status_codes=["401", "4XX", "500", "5XX"],
301
+ retry_config=retry_config,
302
+ )
303
+
304
+ response_data: Any = None
305
+ if utils.match_response(http_res, "200", "application/json"):
306
+ return unmarshal_json_response(models.GetVersionDiffResponse, http_res)
307
+ if utils.match_response(http_res, "500", "application/json"):
308
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
309
+ raise errors.Error(response_data, http_res)
310
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
311
+ http_res_text = utils.stream_to_text(http_res)
312
+ raise errors.APIError("API error occurred", http_res, http_res_text)
313
+ if utils.match_response(http_res, "5XX", "*"):
314
+ http_res_text = utils.stream_to_text(http_res)
315
+ raise errors.APIError("API error occurred", http_res, http_res_text)
316
+
317
+ raise errors.APIError("Unexpected response received", http_res)
318
+
319
+ async def diff_async(
320
+ self,
321
+ *,
322
+ commit: Optional[str] = None,
323
+ group: Optional[str] = None,
324
+ filename: Optional[str] = None,
325
+ diff_line_limit: Optional[float] = None,
326
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
327
+ server_url: Optional[str] = None,
328
+ timeout_ms: Optional[int] = None,
329
+ http_headers: Optional[Mapping[str, str]] = None,
330
+ ) -> models.GetVersionDiffResponse:
331
+ r"""Retrieve the diff for a commit
332
+
333
+ get the textual diff for given commit
334
+
335
+ :param commit: Commit hash (default is HEAD)
336
+ :param group: Group ID
337
+ :param filename: Filename
338
+ :param diff_line_limit: Limit maximum lines in the diff
339
+ :param retries: Override the default retry configuration for this method
340
+ :param server_url: Override the default server URL for this method
341
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
342
+ :param http_headers: Additional headers to set or replace on requests.
343
+ """
344
+ base_url = None
345
+ url_variables = None
346
+ if timeout_ms is None:
347
+ timeout_ms = self.sdk_configuration.timeout_ms
348
+
349
+ if server_url is not None:
350
+ base_url = server_url
351
+ else:
352
+ base_url = self._get_url(base_url, url_variables)
353
+
354
+ request = models.GetVersionDiffRequest(
355
+ commit=commit,
356
+ group=group,
357
+ filename=filename,
358
+ diff_line_limit=diff_line_limit,
359
+ )
360
+
361
+ req = self._build_request_async(
362
+ method="GET",
363
+ path="/version/diff",
364
+ base_url=base_url,
365
+ url_variables=url_variables,
366
+ request=request,
367
+ request_body_required=False,
368
+ request_has_path_params=False,
369
+ request_has_query_params=True,
370
+ user_agent_header="user-agent",
371
+ accept_header_value="application/json",
372
+ http_headers=http_headers,
373
+ security=self.sdk_configuration.security,
374
+ timeout_ms=timeout_ms,
375
+ )
376
+
377
+ if retries == UNSET:
378
+ if self.sdk_configuration.retry_config is not UNSET:
379
+ retries = self.sdk_configuration.retry_config
380
+
381
+ retry_config = None
382
+ if isinstance(retries, utils.RetryConfig):
383
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
384
+
385
+ http_res = await self.do_request_async(
386
+ hook_ctx=HookContext(
387
+ config=self.sdk_configuration,
388
+ base_url=base_url or "",
389
+ operation_id="getVersionDiff",
390
+ oauth2_scopes=[],
391
+ security_source=get_security_from_env(
392
+ self.sdk_configuration.security, models.Security
393
+ ),
394
+ ),
395
+ request=req,
396
+ error_status_codes=["401", "4XX", "500", "5XX"],
397
+ retry_config=retry_config,
398
+ )
399
+
400
+ response_data: Any = None
401
+ if utils.match_response(http_res, "200", "application/json"):
402
+ return unmarshal_json_response(models.GetVersionDiffResponse, http_res)
403
+ if utils.match_response(http_res, "500", "application/json"):
404
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
405
+ raise errors.Error(response_data, http_res)
406
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
407
+ http_res_text = await utils.stream_to_text_async(http_res)
408
+ raise errors.APIError("API error occurred", http_res, http_res_text)
409
+ if utils.match_response(http_res, "5XX", "*"):
410
+ http_res_text = await utils.stream_to_text_async(http_res)
411
+ raise errors.APIError("API error occurred", http_res, http_res_text)
412
+
413
+ raise errors.APIError("Unexpected response received", http_res)
414
+
415
+ def push(
416
+ self,
417
+ *,
418
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
419
+ server_url: Optional[str] = None,
420
+ timeout_ms: Optional[int] = None,
421
+ http_headers: Optional[Mapping[str, str]] = None,
422
+ ) -> models.CreateVersionPushResponse:
423
+ r"""Push a commit from the local repository to the remote repository
424
+
425
+ push the current configs to the remote repository.
426
+
427
+ :param retries: Override the default retry configuration for this method
428
+ :param server_url: Override the default server URL for this method
429
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
430
+ :param http_headers: Additional headers to set or replace on requests.
431
+ """
432
+ base_url = None
433
+ url_variables = None
434
+ if timeout_ms is None:
435
+ timeout_ms = self.sdk_configuration.timeout_ms
436
+
437
+ if server_url is not None:
438
+ base_url = server_url
439
+ else:
440
+ base_url = self._get_url(base_url, url_variables)
441
+ req = self._build_request(
442
+ method="POST",
443
+ path="/version/push",
444
+ base_url=base_url,
445
+ url_variables=url_variables,
446
+ request=None,
447
+ request_body_required=False,
448
+ request_has_path_params=False,
449
+ request_has_query_params=True,
450
+ user_agent_header="user-agent",
451
+ accept_header_value="application/json",
452
+ http_headers=http_headers,
453
+ security=self.sdk_configuration.security,
454
+ timeout_ms=timeout_ms,
455
+ )
456
+
457
+ if retries == UNSET:
458
+ if self.sdk_configuration.retry_config is not UNSET:
459
+ retries = self.sdk_configuration.retry_config
460
+
461
+ retry_config = None
462
+ if isinstance(retries, utils.RetryConfig):
463
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
464
+
465
+ http_res = self.do_request(
466
+ hook_ctx=HookContext(
467
+ config=self.sdk_configuration,
468
+ base_url=base_url or "",
469
+ operation_id="createVersionPush",
470
+ oauth2_scopes=[],
471
+ security_source=get_security_from_env(
472
+ self.sdk_configuration.security, models.Security
473
+ ),
474
+ ),
475
+ request=req,
476
+ error_status_codes=["401", "4XX", "500", "5XX"],
477
+ retry_config=retry_config,
478
+ )
479
+
480
+ response_data: Any = None
481
+ if utils.match_response(http_res, "200", "application/json"):
482
+ return unmarshal_json_response(models.CreateVersionPushResponse, http_res)
483
+ if utils.match_response(http_res, "500", "application/json"):
484
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
485
+ raise errors.Error(response_data, http_res)
486
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
487
+ http_res_text = utils.stream_to_text(http_res)
488
+ raise errors.APIError("API error occurred", http_res, http_res_text)
489
+ if utils.match_response(http_res, "5XX", "*"):
490
+ http_res_text = utils.stream_to_text(http_res)
491
+ raise errors.APIError("API error occurred", http_res, http_res_text)
492
+
493
+ raise errors.APIError("Unexpected response received", http_res)
494
+
495
+ async def push_async(
496
+ self,
497
+ *,
498
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
499
+ server_url: Optional[str] = None,
500
+ timeout_ms: Optional[int] = None,
501
+ http_headers: Optional[Mapping[str, str]] = None,
502
+ ) -> models.CreateVersionPushResponse:
503
+ r"""Push a commit from the local repository to the remote repository
504
+
505
+ push the current configs to the remote repository.
506
+
507
+ :param retries: Override the default retry configuration for this method
508
+ :param server_url: Override the default server URL for this method
509
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
510
+ :param http_headers: Additional headers to set or replace on requests.
511
+ """
512
+ base_url = None
513
+ url_variables = None
514
+ if timeout_ms is None:
515
+ timeout_ms = self.sdk_configuration.timeout_ms
516
+
517
+ if server_url is not None:
518
+ base_url = server_url
519
+ else:
520
+ base_url = self._get_url(base_url, url_variables)
521
+ req = self._build_request_async(
522
+ method="POST",
523
+ path="/version/push",
524
+ base_url=base_url,
525
+ url_variables=url_variables,
526
+ request=None,
527
+ request_body_required=False,
528
+ request_has_path_params=False,
529
+ request_has_query_params=True,
530
+ user_agent_header="user-agent",
531
+ accept_header_value="application/json",
532
+ http_headers=http_headers,
533
+ security=self.sdk_configuration.security,
534
+ timeout_ms=timeout_ms,
535
+ )
536
+
537
+ if retries == UNSET:
538
+ if self.sdk_configuration.retry_config is not UNSET:
539
+ retries = self.sdk_configuration.retry_config
540
+
541
+ retry_config = None
542
+ if isinstance(retries, utils.RetryConfig):
543
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
544
+
545
+ http_res = await self.do_request_async(
546
+ hook_ctx=HookContext(
547
+ config=self.sdk_configuration,
548
+ base_url=base_url or "",
549
+ operation_id="createVersionPush",
550
+ oauth2_scopes=[],
551
+ security_source=get_security_from_env(
552
+ self.sdk_configuration.security, models.Security
553
+ ),
554
+ ),
555
+ request=req,
556
+ error_status_codes=["401", "4XX", "500", "5XX"],
557
+ retry_config=retry_config,
558
+ )
559
+
560
+ response_data: Any = None
561
+ if utils.match_response(http_res, "200", "application/json"):
562
+ return unmarshal_json_response(models.CreateVersionPushResponse, http_res)
563
+ if utils.match_response(http_res, "500", "application/json"):
564
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
565
+ raise errors.Error(response_data, http_res)
566
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
567
+ http_res_text = await utils.stream_to_text_async(http_res)
568
+ raise errors.APIError("API error occurred", http_res, http_res_text)
569
+ if utils.match_response(http_res, "5XX", "*"):
570
+ http_res_text = await utils.stream_to_text_async(http_res)
571
+ raise errors.APIError("API error occurred", http_res, http_res_text)
572
+
573
+ raise errors.APIError("Unexpected response received", http_res)
574
+
575
+ def revert(
576
+ self,
577
+ *,
578
+ commit: str,
579
+ message: str,
580
+ group: Optional[str] = None,
581
+ force: Optional[bool] = None,
582
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
583
+ server_url: Optional[str] = None,
584
+ timeout_ms: Optional[int] = None,
585
+ http_headers: Optional[Mapping[str, str]] = None,
586
+ ) -> models.CreateVersionRevertResponse:
587
+ r"""Revert a commit in the local repository
588
+
589
+ revert a commit
590
+
591
+ :param commit:
592
+ :param message:
593
+ :param group: Group ID
594
+ :param force:
595
+ :param retries: Override the default retry configuration for this method
596
+ :param server_url: Override the default server URL for this method
597
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
598
+ :param http_headers: Additional headers to set or replace on requests.
599
+ """
600
+ base_url = None
601
+ url_variables = None
602
+ if timeout_ms is None:
603
+ timeout_ms = self.sdk_configuration.timeout_ms
604
+
605
+ if server_url is not None:
606
+ base_url = server_url
607
+ else:
608
+ base_url = self._get_url(base_url, url_variables)
609
+
610
+ request = models.CreateVersionRevertRequest(
611
+ group=group,
612
+ git_revert_params=models.GitRevertParams(
613
+ commit=commit,
614
+ force=force,
615
+ message=message,
616
+ ),
617
+ )
618
+
619
+ req = self._build_request(
620
+ method="POST",
621
+ path="/version/revert",
622
+ base_url=base_url,
623
+ url_variables=url_variables,
624
+ request=request,
625
+ request_body_required=True,
626
+ request_has_path_params=False,
627
+ request_has_query_params=True,
628
+ user_agent_header="user-agent",
629
+ accept_header_value="application/json",
630
+ http_headers=http_headers,
631
+ security=self.sdk_configuration.security,
632
+ get_serialized_body=lambda: utils.serialize_request_body(
633
+ request.git_revert_params, False, False, "json", models.GitRevertParams
634
+ ),
635
+ timeout_ms=timeout_ms,
636
+ )
637
+
638
+ if retries == UNSET:
639
+ if self.sdk_configuration.retry_config is not UNSET:
640
+ retries = self.sdk_configuration.retry_config
641
+
642
+ retry_config = None
643
+ if isinstance(retries, utils.RetryConfig):
644
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
645
+
646
+ http_res = self.do_request(
647
+ hook_ctx=HookContext(
648
+ config=self.sdk_configuration,
649
+ base_url=base_url or "",
650
+ operation_id="createVersionRevert",
651
+ oauth2_scopes=[],
652
+ security_source=get_security_from_env(
653
+ self.sdk_configuration.security, models.Security
654
+ ),
655
+ ),
656
+ request=req,
657
+ error_status_codes=["401", "4XX", "500", "5XX"],
658
+ retry_config=retry_config,
659
+ )
660
+
661
+ response_data: Any = None
662
+ if utils.match_response(http_res, "200", "application/json"):
663
+ return unmarshal_json_response(models.CreateVersionRevertResponse, http_res)
664
+ if utils.match_response(http_res, "500", "application/json"):
665
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
666
+ raise errors.Error(response_data, http_res)
667
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
668
+ http_res_text = utils.stream_to_text(http_res)
669
+ raise errors.APIError("API error occurred", http_res, http_res_text)
670
+ if utils.match_response(http_res, "5XX", "*"):
671
+ http_res_text = utils.stream_to_text(http_res)
672
+ raise errors.APIError("API error occurred", http_res, http_res_text)
673
+
674
+ raise errors.APIError("Unexpected response received", http_res)
675
+
676
+ async def revert_async(
677
+ self,
678
+ *,
679
+ commit: str,
680
+ message: str,
681
+ group: Optional[str] = None,
682
+ force: Optional[bool] = None,
683
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
684
+ server_url: Optional[str] = None,
685
+ timeout_ms: Optional[int] = None,
686
+ http_headers: Optional[Mapping[str, str]] = None,
687
+ ) -> models.CreateVersionRevertResponse:
688
+ r"""Revert a commit in the local repository
689
+
690
+ revert a commit
691
+
692
+ :param commit:
693
+ :param message:
694
+ :param group: Group ID
695
+ :param force:
696
+ :param retries: Override the default retry configuration for this method
697
+ :param server_url: Override the default server URL for this method
698
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
699
+ :param http_headers: Additional headers to set or replace on requests.
700
+ """
701
+ base_url = None
702
+ url_variables = None
703
+ if timeout_ms is None:
704
+ timeout_ms = self.sdk_configuration.timeout_ms
705
+
706
+ if server_url is not None:
707
+ base_url = server_url
708
+ else:
709
+ base_url = self._get_url(base_url, url_variables)
710
+
711
+ request = models.CreateVersionRevertRequest(
712
+ group=group,
713
+ git_revert_params=models.GitRevertParams(
714
+ commit=commit,
715
+ force=force,
716
+ message=message,
717
+ ),
718
+ )
719
+
720
+ req = self._build_request_async(
721
+ method="POST",
722
+ path="/version/revert",
723
+ base_url=base_url,
724
+ url_variables=url_variables,
725
+ request=request,
726
+ request_body_required=True,
727
+ request_has_path_params=False,
728
+ request_has_query_params=True,
729
+ user_agent_header="user-agent",
730
+ accept_header_value="application/json",
731
+ http_headers=http_headers,
732
+ security=self.sdk_configuration.security,
733
+ get_serialized_body=lambda: utils.serialize_request_body(
734
+ request.git_revert_params, False, False, "json", models.GitRevertParams
735
+ ),
736
+ timeout_ms=timeout_ms,
737
+ )
738
+
739
+ if retries == UNSET:
740
+ if self.sdk_configuration.retry_config is not UNSET:
741
+ retries = self.sdk_configuration.retry_config
742
+
743
+ retry_config = None
744
+ if isinstance(retries, utils.RetryConfig):
745
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
746
+
747
+ http_res = await self.do_request_async(
748
+ hook_ctx=HookContext(
749
+ config=self.sdk_configuration,
750
+ base_url=base_url or "",
751
+ operation_id="createVersionRevert",
752
+ oauth2_scopes=[],
753
+ security_source=get_security_from_env(
754
+ self.sdk_configuration.security, models.Security
755
+ ),
756
+ ),
757
+ request=req,
758
+ error_status_codes=["401", "4XX", "500", "5XX"],
759
+ retry_config=retry_config,
760
+ )
761
+
762
+ response_data: Any = None
763
+ if utils.match_response(http_res, "200", "application/json"):
764
+ return unmarshal_json_response(models.CreateVersionRevertResponse, http_res)
765
+ if utils.match_response(http_res, "500", "application/json"):
766
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
767
+ raise errors.Error(response_data, http_res)
768
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
769
+ http_res_text = await utils.stream_to_text_async(http_res)
770
+ raise errors.APIError("API error occurred", http_res, http_res_text)
771
+ if utils.match_response(http_res, "5XX", "*"):
772
+ http_res_text = await utils.stream_to_text_async(http_res)
773
+ raise errors.APIError("API error occurred", http_res, http_res_text)
774
+
775
+ raise errors.APIError("Unexpected response received", http_res)
776
+
777
+ def get(
778
+ self,
779
+ *,
780
+ commit: Optional[str] = None,
781
+ group: Optional[str] = None,
782
+ filename: Optional[str] = None,
783
+ diff_line_limit: Optional[float] = None,
784
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
785
+ server_url: Optional[str] = None,
786
+ timeout_ms: Optional[int] = None,
787
+ http_headers: Optional[Mapping[str, str]] = None,
788
+ ) -> models.GetVersionShowResponse:
789
+ r"""Retrieve the diff and log message for a commit
790
+
791
+ get the log message and textual diff for given commit
792
+
793
+ :param commit: Commit hash (default is HEAD)
794
+ :param group: Group ID
795
+ :param filename: Filename
796
+ :param diff_line_limit: Limit maximum lines in the diff
797
+ :param retries: Override the default retry configuration for this method
798
+ :param server_url: Override the default server URL for this method
799
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
800
+ :param http_headers: Additional headers to set or replace on requests.
801
+ """
802
+ base_url = None
803
+ url_variables = None
804
+ if timeout_ms is None:
805
+ timeout_ms = self.sdk_configuration.timeout_ms
806
+
807
+ if server_url is not None:
808
+ base_url = server_url
809
+ else:
810
+ base_url = self._get_url(base_url, url_variables)
811
+
812
+ request = models.GetVersionShowRequest(
813
+ commit=commit,
814
+ group=group,
815
+ filename=filename,
816
+ diff_line_limit=diff_line_limit,
817
+ )
818
+
819
+ req = self._build_request(
820
+ method="GET",
821
+ path="/version/show",
822
+ base_url=base_url,
823
+ url_variables=url_variables,
824
+ request=request,
825
+ request_body_required=False,
826
+ request_has_path_params=False,
827
+ request_has_query_params=True,
828
+ user_agent_header="user-agent",
829
+ accept_header_value="application/json",
830
+ http_headers=http_headers,
831
+ security=self.sdk_configuration.security,
832
+ timeout_ms=timeout_ms,
833
+ )
834
+
835
+ if retries == UNSET:
836
+ if self.sdk_configuration.retry_config is not UNSET:
837
+ retries = self.sdk_configuration.retry_config
838
+
839
+ retry_config = None
840
+ if isinstance(retries, utils.RetryConfig):
841
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
842
+
843
+ http_res = self.do_request(
844
+ hook_ctx=HookContext(
845
+ config=self.sdk_configuration,
846
+ base_url=base_url or "",
847
+ operation_id="getVersionShow",
848
+ oauth2_scopes=[],
849
+ security_source=get_security_from_env(
850
+ self.sdk_configuration.security, models.Security
851
+ ),
852
+ ),
853
+ request=req,
854
+ error_status_codes=["401", "4XX", "500", "5XX"],
855
+ retry_config=retry_config,
856
+ )
857
+
858
+ response_data: Any = None
859
+ if utils.match_response(http_res, "200", "application/json"):
860
+ return unmarshal_json_response(models.GetVersionShowResponse, http_res)
861
+ if utils.match_response(http_res, "500", "application/json"):
862
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
863
+ raise errors.Error(response_data, http_res)
864
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
865
+ http_res_text = utils.stream_to_text(http_res)
866
+ raise errors.APIError("API error occurred", http_res, http_res_text)
867
+ if utils.match_response(http_res, "5XX", "*"):
868
+ http_res_text = utils.stream_to_text(http_res)
869
+ raise errors.APIError("API error occurred", http_res, http_res_text)
870
+
871
+ raise errors.APIError("Unexpected response received", http_res)
872
+
873
+ async def get_async(
874
+ self,
875
+ *,
876
+ commit: Optional[str] = None,
877
+ group: Optional[str] = None,
878
+ filename: Optional[str] = None,
879
+ diff_line_limit: Optional[float] = None,
880
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
881
+ server_url: Optional[str] = None,
882
+ timeout_ms: Optional[int] = None,
883
+ http_headers: Optional[Mapping[str, str]] = None,
884
+ ) -> models.GetVersionShowResponse:
885
+ r"""Retrieve the diff and log message for a commit
886
+
887
+ get the log message and textual diff for given commit
888
+
889
+ :param commit: Commit hash (default is HEAD)
890
+ :param group: Group ID
891
+ :param filename: Filename
892
+ :param diff_line_limit: Limit maximum lines in the diff
893
+ :param retries: Override the default retry configuration for this method
894
+ :param server_url: Override the default server URL for this method
895
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
896
+ :param http_headers: Additional headers to set or replace on requests.
897
+ """
898
+ base_url = None
899
+ url_variables = None
900
+ if timeout_ms is None:
901
+ timeout_ms = self.sdk_configuration.timeout_ms
902
+
903
+ if server_url is not None:
904
+ base_url = server_url
905
+ else:
906
+ base_url = self._get_url(base_url, url_variables)
907
+
908
+ request = models.GetVersionShowRequest(
909
+ commit=commit,
910
+ group=group,
911
+ filename=filename,
912
+ diff_line_limit=diff_line_limit,
913
+ )
914
+
915
+ req = self._build_request_async(
916
+ method="GET",
917
+ path="/version/show",
918
+ base_url=base_url,
919
+ url_variables=url_variables,
920
+ request=request,
921
+ request_body_required=False,
922
+ request_has_path_params=False,
923
+ request_has_query_params=True,
924
+ user_agent_header="user-agent",
925
+ accept_header_value="application/json",
926
+ http_headers=http_headers,
927
+ security=self.sdk_configuration.security,
928
+ timeout_ms=timeout_ms,
929
+ )
930
+
931
+ if retries == UNSET:
932
+ if self.sdk_configuration.retry_config is not UNSET:
933
+ retries = self.sdk_configuration.retry_config
934
+
935
+ retry_config = None
936
+ if isinstance(retries, utils.RetryConfig):
937
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
938
+
939
+ http_res = await self.do_request_async(
940
+ hook_ctx=HookContext(
941
+ config=self.sdk_configuration,
942
+ base_url=base_url or "",
943
+ operation_id="getVersionShow",
944
+ oauth2_scopes=[],
945
+ security_source=get_security_from_env(
946
+ self.sdk_configuration.security, models.Security
947
+ ),
948
+ ),
949
+ request=req,
950
+ error_status_codes=["401", "4XX", "500", "5XX"],
951
+ retry_config=retry_config,
952
+ )
953
+
954
+ response_data: Any = None
955
+ if utils.match_response(http_res, "200", "application/json"):
956
+ return unmarshal_json_response(models.GetVersionShowResponse, http_res)
957
+ if utils.match_response(http_res, "500", "application/json"):
958
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
959
+ raise errors.Error(response_data, http_res)
960
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
961
+ http_res_text = await utils.stream_to_text_async(http_res)
962
+ raise errors.APIError("API error occurred", http_res, http_res_text)
963
+ if utils.match_response(http_res, "5XX", "*"):
964
+ http_res_text = await utils.stream_to_text_async(http_res)
965
+ raise errors.APIError("API error occurred", http_res, http_res_text)
966
+
967
+ raise errors.APIError("Unexpected response received", http_res)
968
+
969
+ def undo(
970
+ self,
971
+ *,
972
+ group: Optional[str] = None,
973
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
974
+ server_url: Optional[str] = None,
975
+ timeout_ms: Optional[int] = None,
976
+ http_headers: Optional[Mapping[str, str]] = None,
977
+ ) -> models.CreateVersionUndoResponse:
978
+ r"""Discard uncommitted (staged) changes
979
+
980
+ Discards all uncommitted (staged) configuration changes, resetting the working directory to the last committed state.
981
+
982
+ :param group: Group ID
983
+ :param retries: Override the default retry configuration for this method
984
+ :param server_url: Override the default server URL for this method
985
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
986
+ :param http_headers: Additional headers to set or replace on requests.
987
+ """
988
+ base_url = None
989
+ url_variables = None
990
+ if timeout_ms is None:
991
+ timeout_ms = self.sdk_configuration.timeout_ms
992
+
993
+ if server_url is not None:
994
+ base_url = server_url
995
+ else:
996
+ base_url = self._get_url(base_url, url_variables)
997
+
998
+ request = models.CreateVersionUndoRequest(
999
+ group=group,
1000
+ )
1001
+
1002
+ req = self._build_request(
1003
+ method="POST",
1004
+ path="/version/undo",
1005
+ base_url=base_url,
1006
+ url_variables=url_variables,
1007
+ request=request,
1008
+ request_body_required=False,
1009
+ request_has_path_params=False,
1010
+ request_has_query_params=True,
1011
+ user_agent_header="user-agent",
1012
+ accept_header_value="application/json",
1013
+ http_headers=http_headers,
1014
+ security=self.sdk_configuration.security,
1015
+ timeout_ms=timeout_ms,
1016
+ )
1017
+
1018
+ if retries == UNSET:
1019
+ if self.sdk_configuration.retry_config is not UNSET:
1020
+ retries = self.sdk_configuration.retry_config
1021
+
1022
+ retry_config = None
1023
+ if isinstance(retries, utils.RetryConfig):
1024
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1025
+
1026
+ http_res = self.do_request(
1027
+ hook_ctx=HookContext(
1028
+ config=self.sdk_configuration,
1029
+ base_url=base_url or "",
1030
+ operation_id="createVersionUndo",
1031
+ oauth2_scopes=[],
1032
+ security_source=get_security_from_env(
1033
+ self.sdk_configuration.security, models.Security
1034
+ ),
1035
+ ),
1036
+ request=req,
1037
+ error_status_codes=["401", "4XX", "500", "5XX"],
1038
+ retry_config=retry_config,
1039
+ )
1040
+
1041
+ response_data: Any = None
1042
+ if utils.match_response(http_res, "200", "application/json"):
1043
+ return unmarshal_json_response(models.CreateVersionUndoResponse, http_res)
1044
+ if utils.match_response(http_res, "500", "application/json"):
1045
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
1046
+ raise errors.Error(response_data, http_res)
1047
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
1048
+ http_res_text = utils.stream_to_text(http_res)
1049
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1050
+ if utils.match_response(http_res, "5XX", "*"):
1051
+ http_res_text = utils.stream_to_text(http_res)
1052
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1053
+
1054
+ raise errors.APIError("Unexpected response received", http_res)
1055
+
1056
+ async def undo_async(
1057
+ self,
1058
+ *,
1059
+ group: Optional[str] = None,
1060
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1061
+ server_url: Optional[str] = None,
1062
+ timeout_ms: Optional[int] = None,
1063
+ http_headers: Optional[Mapping[str, str]] = None,
1064
+ ) -> models.CreateVersionUndoResponse:
1065
+ r"""Discard uncommitted (staged) changes
1066
+
1067
+ Discards all uncommitted (staged) configuration changes, resetting the working directory to the last committed state.
1068
+
1069
+ :param group: Group ID
1070
+ :param retries: Override the default retry configuration for this method
1071
+ :param server_url: Override the default server URL for this method
1072
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1073
+ :param http_headers: Additional headers to set or replace on requests.
1074
+ """
1075
+ base_url = None
1076
+ url_variables = None
1077
+ if timeout_ms is None:
1078
+ timeout_ms = self.sdk_configuration.timeout_ms
1079
+
1080
+ if server_url is not None:
1081
+ base_url = server_url
1082
+ else:
1083
+ base_url = self._get_url(base_url, url_variables)
1084
+
1085
+ request = models.CreateVersionUndoRequest(
1086
+ group=group,
1087
+ )
1088
+
1089
+ req = self._build_request_async(
1090
+ method="POST",
1091
+ path="/version/undo",
1092
+ base_url=base_url,
1093
+ url_variables=url_variables,
1094
+ request=request,
1095
+ request_body_required=False,
1096
+ request_has_path_params=False,
1097
+ request_has_query_params=True,
1098
+ user_agent_header="user-agent",
1099
+ accept_header_value="application/json",
1100
+ http_headers=http_headers,
1101
+ security=self.sdk_configuration.security,
1102
+ timeout_ms=timeout_ms,
1103
+ )
1104
+
1105
+ if retries == UNSET:
1106
+ if self.sdk_configuration.retry_config is not UNSET:
1107
+ retries = self.sdk_configuration.retry_config
1108
+
1109
+ retry_config = None
1110
+ if isinstance(retries, utils.RetryConfig):
1111
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1112
+
1113
+ http_res = await self.do_request_async(
1114
+ hook_ctx=HookContext(
1115
+ config=self.sdk_configuration,
1116
+ base_url=base_url or "",
1117
+ operation_id="createVersionUndo",
1118
+ oauth2_scopes=[],
1119
+ security_source=get_security_from_env(
1120
+ self.sdk_configuration.security, models.Security
1121
+ ),
1122
+ ),
1123
+ request=req,
1124
+ error_status_codes=["401", "4XX", "500", "5XX"],
1125
+ retry_config=retry_config,
1126
+ )
1127
+
1128
+ response_data: Any = None
1129
+ if utils.match_response(http_res, "200", "application/json"):
1130
+ return unmarshal_json_response(models.CreateVersionUndoResponse, http_res)
1131
+ if utils.match_response(http_res, "500", "application/json"):
1132
+ response_data = unmarshal_json_response(errors.ErrorData, http_res)
1133
+ raise errors.Error(response_data, http_res)
1134
+ if utils.match_response(http_res, ["401", "4XX"], "*"):
1135
+ http_res_text = await utils.stream_to_text_async(http_res)
1136
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1137
+ if utils.match_response(http_res, "5XX", "*"):
1138
+ http_res_text = await utils.stream_to_text_async(http_res)
1139
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1140
+
1141
+ raise errors.APIError("Unexpected response received", http_res)