superposition-sdk 0.85.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.

Potentially problematic release.


This version of superposition-sdk might be problematic. Click here for more details.

@@ -0,0 +1,2424 @@
1
+ # Code generated by smithy-python-codegen DO NOT EDIT.
2
+
3
+ import asyncio
4
+ from asyncio import Future, iscoroutine, sleep
5
+ from copy import copy, deepcopy
6
+ from dataclasses import replace
7
+ import logging
8
+ import re
9
+ from typing import Any, Awaitable, Callable, cast
10
+
11
+ from smithy_core import URI
12
+ from smithy_core.deserializers import DeserializeableShape
13
+ from smithy_core.endpoints import EndpointResolverParams
14
+ from smithy_core.exceptions import SmithyRetryException
15
+ from smithy_core.interceptors import (
16
+ InputContext,
17
+ Interceptor,
18
+ InterceptorChain,
19
+ OutputContext,
20
+ RequestContext,
21
+ ResponseContext,
22
+ )
23
+ from smithy_core.interfaces.exceptions import HasFault
24
+ from smithy_core.interfaces.identity import Identity
25
+ from smithy_core.interfaces.retries import RetryErrorInfo, RetryErrorType
26
+ from smithy_core.schemas import APIOperation
27
+ from smithy_core.serializers import SerializeableShape
28
+ from smithy_core.types import PropertyKey, TypedProperties
29
+ from smithy_http.aio.interfaces import HTTPRequest, HTTPResponse
30
+ from smithy_http.aio.interfaces.auth import HTTPAuthOption, HTTPSigner
31
+ from smithy_http.interfaces import HTTPRequestConfiguration
32
+ from smithy_http.plugins import user_agent_plugin
33
+
34
+ from .auth import HTTPAuthParams
35
+ from .config import Config, Plugin
36
+ from .deserialize import (
37
+ _deserialize_add_members_to_group,
38
+ _deserialize_applicable_variants,
39
+ _deserialize_bulk_operation,
40
+ _deserialize_conclude_experiment,
41
+ _deserialize_create_context,
42
+ _deserialize_create_default_config,
43
+ _deserialize_create_dimension,
44
+ _deserialize_create_experiment,
45
+ _deserialize_create_experiment_group,
46
+ _deserialize_create_function,
47
+ _deserialize_create_organisation,
48
+ _deserialize_create_type_templates,
49
+ _deserialize_create_webhook,
50
+ _deserialize_create_workspace,
51
+ _deserialize_delete_context,
52
+ _deserialize_delete_default_config,
53
+ _deserialize_delete_dimension,
54
+ _deserialize_delete_experiment_group,
55
+ _deserialize_delete_function,
56
+ _deserialize_delete_type_templates,
57
+ _deserialize_discard_experiment,
58
+ _deserialize_get_config,
59
+ _deserialize_get_config_fast,
60
+ _deserialize_get_context,
61
+ _deserialize_get_context_from_condition,
62
+ _deserialize_get_dimension,
63
+ _deserialize_get_experiment,
64
+ _deserialize_get_experiment_group,
65
+ _deserialize_get_function,
66
+ _deserialize_get_organisation,
67
+ _deserialize_get_resolved_config,
68
+ _deserialize_get_type_templates_list,
69
+ _deserialize_get_webhook,
70
+ _deserialize_list_audit_logs,
71
+ _deserialize_list_contexts,
72
+ _deserialize_list_default_configs,
73
+ _deserialize_list_dimensions,
74
+ _deserialize_list_experiment,
75
+ _deserialize_list_experiment_groups,
76
+ _deserialize_list_function,
77
+ _deserialize_list_organisation,
78
+ _deserialize_list_versions,
79
+ _deserialize_list_webhook,
80
+ _deserialize_list_workspace,
81
+ _deserialize_move_context,
82
+ _deserialize_pause_experiment,
83
+ _deserialize_publish,
84
+ _deserialize_ramp_experiment,
85
+ _deserialize_remove_members_from_group,
86
+ _deserialize_resume_experiment,
87
+ _deserialize_test,
88
+ _deserialize_update_default_config,
89
+ _deserialize_update_dimension,
90
+ _deserialize_update_experiment_group,
91
+ _deserialize_update_function,
92
+ _deserialize_update_organisation,
93
+ _deserialize_update_override,
94
+ _deserialize_update_overrides_experiment,
95
+ _deserialize_update_type_templates,
96
+ _deserialize_update_webhook,
97
+ _deserialize_update_workspace,
98
+ _deserialize_weight_recompute,
99
+ )
100
+ from .models import (
101
+ ADD_MEMBERS_TO_GROUP,
102
+ APPLICABLE_VARIANTS,
103
+ AddMembersToGroupInput,
104
+ AddMembersToGroupOutput,
105
+ ApplicableVariantsInput,
106
+ ApplicableVariantsOutput,
107
+ BULK_OPERATION,
108
+ BulkOperationInput,
109
+ BulkOperationOutput,
110
+ CONCLUDE_EXPERIMENT,
111
+ CREATE_CONTEXT,
112
+ CREATE_DEFAULT_CONFIG,
113
+ CREATE_DIMENSION,
114
+ CREATE_EXPERIMENT,
115
+ CREATE_EXPERIMENT_GROUP,
116
+ CREATE_FUNCTION,
117
+ CREATE_ORGANISATION,
118
+ CREATE_TYPE_TEMPLATES,
119
+ CREATE_WEBHOOK,
120
+ CREATE_WORKSPACE,
121
+ ConcludeExperimentInput,
122
+ ConcludeExperimentOutput,
123
+ CreateContextInput,
124
+ CreateContextOutput,
125
+ CreateDefaultConfigInput,
126
+ CreateDefaultConfigOutput,
127
+ CreateDimensionInput,
128
+ CreateDimensionOutput,
129
+ CreateExperimentGroupInput,
130
+ CreateExperimentGroupOutput,
131
+ CreateExperimentInput,
132
+ CreateExperimentOutput,
133
+ CreateFunctionInput,
134
+ CreateFunctionOutput,
135
+ CreateOrganisationInput,
136
+ CreateOrganisationOutput,
137
+ CreateTypeTemplatesInput,
138
+ CreateTypeTemplatesOutput,
139
+ CreateWebhookInput,
140
+ CreateWebhookOutput,
141
+ CreateWorkspaceInput,
142
+ CreateWorkspaceOutput,
143
+ DELETE_CONTEXT,
144
+ DELETE_DEFAULT_CONFIG,
145
+ DELETE_DIMENSION,
146
+ DELETE_EXPERIMENT_GROUP,
147
+ DELETE_FUNCTION,
148
+ DELETE_TYPE_TEMPLATES,
149
+ DISCARD_EXPERIMENT,
150
+ DeleteContextInput,
151
+ DeleteContextOutput,
152
+ DeleteDefaultConfigInput,
153
+ DeleteDefaultConfigOutput,
154
+ DeleteDimensionInput,
155
+ DeleteDimensionOutput,
156
+ DeleteExperimentGroupInput,
157
+ DeleteExperimentGroupOutput,
158
+ DeleteFunctionInput,
159
+ DeleteFunctionOutput,
160
+ DeleteTypeTemplatesInput,
161
+ DeleteTypeTemplatesOutput,
162
+ DiscardExperimentInput,
163
+ DiscardExperimentOutput,
164
+ GET_CONFIG,
165
+ GET_CONFIG_FAST,
166
+ GET_CONTEXT,
167
+ GET_CONTEXT_FROM_CONDITION,
168
+ GET_DIMENSION,
169
+ GET_EXPERIMENT,
170
+ GET_EXPERIMENT_GROUP,
171
+ GET_FUNCTION,
172
+ GET_ORGANISATION,
173
+ GET_RESOLVED_CONFIG,
174
+ GET_TYPE_TEMPLATES_LIST,
175
+ GET_WEBHOOK,
176
+ GetConfigFastInput,
177
+ GetConfigFastOutput,
178
+ GetConfigInput,
179
+ GetConfigOutput,
180
+ GetContextFromConditionInput,
181
+ GetContextFromConditionOutput,
182
+ GetContextInput,
183
+ GetContextOutput,
184
+ GetDimensionInput,
185
+ GetDimensionOutput,
186
+ GetExperimentGroupInput,
187
+ GetExperimentGroupOutput,
188
+ GetExperimentInput,
189
+ GetExperimentOutput,
190
+ GetFunctionInput,
191
+ GetFunctionOutput,
192
+ GetOrganisationInput,
193
+ GetOrganisationOutput,
194
+ GetResolvedConfigInput,
195
+ GetResolvedConfigOutput,
196
+ GetTypeTemplatesListInput,
197
+ GetTypeTemplatesListOutput,
198
+ GetWebhookInput,
199
+ GetWebhookOutput,
200
+ LIST_AUDIT_LOGS,
201
+ LIST_CONTEXTS,
202
+ LIST_DEFAULT_CONFIGS,
203
+ LIST_DIMENSIONS,
204
+ LIST_EXPERIMENT,
205
+ LIST_EXPERIMENT_GROUPS,
206
+ LIST_FUNCTION,
207
+ LIST_ORGANISATION,
208
+ LIST_VERSIONS,
209
+ LIST_WEBHOOK,
210
+ LIST_WORKSPACE,
211
+ ListAuditLogsInput,
212
+ ListAuditLogsOutput,
213
+ ListContextsInput,
214
+ ListContextsOutput,
215
+ ListDefaultConfigsInput,
216
+ ListDefaultConfigsOutput,
217
+ ListDimensionsInput,
218
+ ListDimensionsOutput,
219
+ ListExperimentGroupsInput,
220
+ ListExperimentGroupsOutput,
221
+ ListExperimentInput,
222
+ ListExperimentOutput,
223
+ ListFunctionInput,
224
+ ListFunctionOutput,
225
+ ListOrganisationInput,
226
+ ListOrganisationOutput,
227
+ ListVersionsInput,
228
+ ListVersionsOutput,
229
+ ListWebhookInput,
230
+ ListWebhookOutput,
231
+ ListWorkspaceInput,
232
+ ListWorkspaceOutput,
233
+ MOVE_CONTEXT,
234
+ MoveContextInput,
235
+ MoveContextOutput,
236
+ PAUSE_EXPERIMENT,
237
+ PUBLISH,
238
+ PauseExperimentInput,
239
+ PauseExperimentOutput,
240
+ PublishInput,
241
+ PublishOutput,
242
+ RAMP_EXPERIMENT,
243
+ REMOVE_MEMBERS_FROM_GROUP,
244
+ RESUME_EXPERIMENT,
245
+ RampExperimentInput,
246
+ RampExperimentOutput,
247
+ RemoveMembersFromGroupInput,
248
+ RemoveMembersFromGroupOutput,
249
+ ResumeExperimentInput,
250
+ ResumeExperimentOutput,
251
+ ServiceError,
252
+ TEST,
253
+ TestInput,
254
+ TestOutput,
255
+ UPDATE_DEFAULT_CONFIG,
256
+ UPDATE_DIMENSION,
257
+ UPDATE_EXPERIMENT_GROUP,
258
+ UPDATE_FUNCTION,
259
+ UPDATE_ORGANISATION,
260
+ UPDATE_OVERRIDE,
261
+ UPDATE_OVERRIDES_EXPERIMENT,
262
+ UPDATE_TYPE_TEMPLATES,
263
+ UPDATE_WEBHOOK,
264
+ UPDATE_WORKSPACE,
265
+ UpdateDefaultConfigInput,
266
+ UpdateDefaultConfigOutput,
267
+ UpdateDimensionInput,
268
+ UpdateDimensionOutput,
269
+ UpdateExperimentGroupInput,
270
+ UpdateExperimentGroupOutput,
271
+ UpdateFunctionInput,
272
+ UpdateFunctionOutput,
273
+ UpdateOrganisationInput,
274
+ UpdateOrganisationOutput,
275
+ UpdateOverrideInput,
276
+ UpdateOverrideOutput,
277
+ UpdateOverridesExperimentInput,
278
+ UpdateOverridesExperimentOutput,
279
+ UpdateTypeTemplatesInput,
280
+ UpdateTypeTemplatesOutput,
281
+ UpdateWebhookInput,
282
+ UpdateWebhookOutput,
283
+ UpdateWorkspaceInput,
284
+ UpdateWorkspaceOutput,
285
+ WEIGHT_RECOMPUTE,
286
+ WeightRecomputeInput,
287
+ WeightRecomputeOutput,
288
+ )
289
+ from .serialize import (
290
+ _serialize_add_members_to_group,
291
+ _serialize_applicable_variants,
292
+ _serialize_bulk_operation,
293
+ _serialize_conclude_experiment,
294
+ _serialize_create_context,
295
+ _serialize_create_default_config,
296
+ _serialize_create_dimension,
297
+ _serialize_create_experiment,
298
+ _serialize_create_experiment_group,
299
+ _serialize_create_function,
300
+ _serialize_create_organisation,
301
+ _serialize_create_type_templates,
302
+ _serialize_create_webhook,
303
+ _serialize_create_workspace,
304
+ _serialize_delete_context,
305
+ _serialize_delete_default_config,
306
+ _serialize_delete_dimension,
307
+ _serialize_delete_experiment_group,
308
+ _serialize_delete_function,
309
+ _serialize_delete_type_templates,
310
+ _serialize_discard_experiment,
311
+ _serialize_get_config,
312
+ _serialize_get_config_fast,
313
+ _serialize_get_context,
314
+ _serialize_get_context_from_condition,
315
+ _serialize_get_dimension,
316
+ _serialize_get_experiment,
317
+ _serialize_get_experiment_group,
318
+ _serialize_get_function,
319
+ _serialize_get_organisation,
320
+ _serialize_get_resolved_config,
321
+ _serialize_get_type_templates_list,
322
+ _serialize_get_webhook,
323
+ _serialize_list_audit_logs,
324
+ _serialize_list_contexts,
325
+ _serialize_list_default_configs,
326
+ _serialize_list_dimensions,
327
+ _serialize_list_experiment,
328
+ _serialize_list_experiment_groups,
329
+ _serialize_list_function,
330
+ _serialize_list_organisation,
331
+ _serialize_list_versions,
332
+ _serialize_list_webhook,
333
+ _serialize_list_workspace,
334
+ _serialize_move_context,
335
+ _serialize_pause_experiment,
336
+ _serialize_publish,
337
+ _serialize_ramp_experiment,
338
+ _serialize_remove_members_from_group,
339
+ _serialize_resume_experiment,
340
+ _serialize_test,
341
+ _serialize_update_default_config,
342
+ _serialize_update_dimension,
343
+ _serialize_update_experiment_group,
344
+ _serialize_update_function,
345
+ _serialize_update_organisation,
346
+ _serialize_update_override,
347
+ _serialize_update_overrides_experiment,
348
+ _serialize_update_type_templates,
349
+ _serialize_update_webhook,
350
+ _serialize_update_workspace,
351
+ _serialize_weight_recompute,
352
+ )
353
+
354
+
355
+
356
+ logger = logging.getLogger(__name__)
357
+
358
+ class Superposition:
359
+ """
360
+ Client for Superposition
361
+
362
+ :param config: Optional configuration for the client. Here you can set things like the
363
+ endpoint for HTTP services or auth credentials.
364
+
365
+ :param plugins: A list of callables that modify the configuration dynamically. These
366
+ can be used to set defaults, for example.
367
+ """
368
+ def __init__(self, config: Config | None = None, plugins: list[Plugin] | None = None):
369
+ self._config = config or Config()
370
+
371
+ client_plugins: list[Plugin] = [
372
+ user_agent_plugin,
373
+ ]
374
+ if plugins:
375
+ client_plugins.extend(plugins)
376
+
377
+ for plugin in client_plugins:
378
+ plugin(self._config)
379
+
380
+ async def add_members_to_group(self, input: AddMembersToGroupInput, plugins: list[Plugin] | None = None) -> AddMembersToGroupOutput:
381
+ """
382
+ Adds members to an existing experiment group.
383
+
384
+ :param input: Input structure for adding members to an experiment group.
385
+
386
+ :param plugins: A list of callables that modify the configuration dynamically.
387
+ Changes made by these plugins only apply for the duration of the operation
388
+ execution and will not affect any other operation invocations.
389
+
390
+ """
391
+ operation_plugins: list[Plugin] = [
392
+
393
+ ]
394
+ if plugins:
395
+ operation_plugins.extend(plugins)
396
+
397
+ return await self._execute_operation(
398
+ input=input,
399
+ plugins=operation_plugins,
400
+ serialize=_serialize_add_members_to_group,
401
+ deserialize=_deserialize_add_members_to_group,
402
+ config=self._config,
403
+ operation=ADD_MEMBERS_TO_GROUP,
404
+ )
405
+
406
+ async def applicable_variants(self, input: ApplicableVariantsInput, plugins: list[Plugin] | None = None) -> ApplicableVariantsOutput:
407
+ """
408
+ Invokes the ApplicableVariants operation.
409
+
410
+ :param input: The operation's input.
411
+
412
+ :param plugins: A list of callables that modify the configuration dynamically.
413
+ Changes made by these plugins only apply for the duration of the operation
414
+ execution and will not affect any other operation invocations.
415
+
416
+ """
417
+ operation_plugins: list[Plugin] = [
418
+
419
+ ]
420
+ if plugins:
421
+ operation_plugins.extend(plugins)
422
+
423
+ return await self._execute_operation(
424
+ input=input,
425
+ plugins=operation_plugins,
426
+ serialize=_serialize_applicable_variants,
427
+ deserialize=_deserialize_applicable_variants,
428
+ config=self._config,
429
+ operation=APPLICABLE_VARIANTS,
430
+ )
431
+
432
+ async def bulk_operation(self, input: BulkOperationInput, plugins: list[Plugin] | None = None) -> BulkOperationOutput:
433
+ """
434
+ Invokes the BulkOperation operation.
435
+
436
+ :param input: The operation's input.
437
+
438
+ :param plugins: A list of callables that modify the configuration dynamically.
439
+ Changes made by these plugins only apply for the duration of the operation
440
+ execution and will not affect any other operation invocations.
441
+
442
+ """
443
+ operation_plugins: list[Plugin] = [
444
+
445
+ ]
446
+ if plugins:
447
+ operation_plugins.extend(plugins)
448
+
449
+ return await self._execute_operation(
450
+ input=input,
451
+ plugins=operation_plugins,
452
+ serialize=_serialize_bulk_operation,
453
+ deserialize=_deserialize_bulk_operation,
454
+ config=self._config,
455
+ operation=BULK_OPERATION,
456
+ )
457
+
458
+ async def conclude_experiment(self, input: ConcludeExperimentInput, plugins: list[Plugin] | None = None) -> ConcludeExperimentOutput:
459
+ """
460
+ Invokes the ConcludeExperiment operation.
461
+
462
+ :param input: The operation's input.
463
+
464
+ :param plugins: A list of callables that modify the configuration dynamically.
465
+ Changes made by these plugins only apply for the duration of the operation
466
+ execution and will not affect any other operation invocations.
467
+
468
+ """
469
+ operation_plugins: list[Plugin] = [
470
+
471
+ ]
472
+ if plugins:
473
+ operation_plugins.extend(plugins)
474
+
475
+ return await self._execute_operation(
476
+ input=input,
477
+ plugins=operation_plugins,
478
+ serialize=_serialize_conclude_experiment,
479
+ deserialize=_deserialize_conclude_experiment,
480
+ config=self._config,
481
+ operation=CONCLUDE_EXPERIMENT,
482
+ )
483
+
484
+ async def create_context(self, input: CreateContextInput, plugins: list[Plugin] | None = None) -> CreateContextOutput:
485
+ """
486
+ Invokes the CreateContext operation.
487
+
488
+ :param input: The operation's input.
489
+
490
+ :param plugins: A list of callables that modify the configuration dynamically.
491
+ Changes made by these plugins only apply for the duration of the operation
492
+ execution and will not affect any other operation invocations.
493
+
494
+ """
495
+ operation_plugins: list[Plugin] = [
496
+
497
+ ]
498
+ if plugins:
499
+ operation_plugins.extend(plugins)
500
+
501
+ return await self._execute_operation(
502
+ input=input,
503
+ plugins=operation_plugins,
504
+ serialize=_serialize_create_context,
505
+ deserialize=_deserialize_create_context,
506
+ config=self._config,
507
+ operation=CREATE_CONTEXT,
508
+ )
509
+
510
+ async def create_default_config(self, input: CreateDefaultConfigInput, plugins: list[Plugin] | None = None) -> CreateDefaultConfigOutput:
511
+ """
512
+ Invokes the CreateDefaultConfig operation.
513
+
514
+ :param input: The operation's input.
515
+
516
+ :param plugins: A list of callables that modify the configuration dynamically.
517
+ Changes made by these plugins only apply for the duration of the operation
518
+ execution and will not affect any other operation invocations.
519
+
520
+ """
521
+ operation_plugins: list[Plugin] = [
522
+
523
+ ]
524
+ if plugins:
525
+ operation_plugins.extend(plugins)
526
+
527
+ return await self._execute_operation(
528
+ input=input,
529
+ plugins=operation_plugins,
530
+ serialize=_serialize_create_default_config,
531
+ deserialize=_deserialize_create_default_config,
532
+ config=self._config,
533
+ operation=CREATE_DEFAULT_CONFIG,
534
+ )
535
+
536
+ async def create_dimension(self, input: CreateDimensionInput, plugins: list[Plugin] | None = None) -> CreateDimensionOutput:
537
+ """
538
+ Invokes the CreateDimension operation.
539
+
540
+ :param input: The operation's input.
541
+
542
+ :param plugins: A list of callables that modify the configuration dynamically.
543
+ Changes made by these plugins only apply for the duration of the operation
544
+ execution and will not affect any other operation invocations.
545
+
546
+ """
547
+ operation_plugins: list[Plugin] = [
548
+
549
+ ]
550
+ if plugins:
551
+ operation_plugins.extend(plugins)
552
+
553
+ return await self._execute_operation(
554
+ input=input,
555
+ plugins=operation_plugins,
556
+ serialize=_serialize_create_dimension,
557
+ deserialize=_deserialize_create_dimension,
558
+ config=self._config,
559
+ operation=CREATE_DIMENSION,
560
+ )
561
+
562
+ async def create_experiment(self, input: CreateExperimentInput, plugins: list[Plugin] | None = None) -> CreateExperimentOutput:
563
+ """
564
+ Invokes the CreateExperiment operation.
565
+
566
+ :param input: The operation's input.
567
+
568
+ :param plugins: A list of callables that modify the configuration dynamically.
569
+ Changes made by these plugins only apply for the duration of the operation
570
+ execution and will not affect any other operation invocations.
571
+
572
+ """
573
+ operation_plugins: list[Plugin] = [
574
+
575
+ ]
576
+ if plugins:
577
+ operation_plugins.extend(plugins)
578
+
579
+ return await self._execute_operation(
580
+ input=input,
581
+ plugins=operation_plugins,
582
+ serialize=_serialize_create_experiment,
583
+ deserialize=_deserialize_create_experiment,
584
+ config=self._config,
585
+ operation=CREATE_EXPERIMENT,
586
+ )
587
+
588
+ async def create_experiment_group(self, input: CreateExperimentGroupInput, plugins: list[Plugin] | None = None) -> CreateExperimentGroupOutput:
589
+ """
590
+ Creates a new experiment group.
591
+
592
+ :param input: Input structure for creating a new experiment group.
593
+
594
+ :param plugins: A list of callables that modify the configuration dynamically.
595
+ Changes made by these plugins only apply for the duration of the operation
596
+ execution and will not affect any other operation invocations.
597
+
598
+ """
599
+ operation_plugins: list[Plugin] = [
600
+
601
+ ]
602
+ if plugins:
603
+ operation_plugins.extend(plugins)
604
+
605
+ return await self._execute_operation(
606
+ input=input,
607
+ plugins=operation_plugins,
608
+ serialize=_serialize_create_experiment_group,
609
+ deserialize=_deserialize_create_experiment_group,
610
+ config=self._config,
611
+ operation=CREATE_EXPERIMENT_GROUP,
612
+ )
613
+
614
+ async def create_function(self, input: CreateFunctionInput, plugins: list[Plugin] | None = None) -> CreateFunctionOutput:
615
+ """
616
+ Invokes the CreateFunction operation.
617
+
618
+ :param input: The operation's input.
619
+
620
+ :param plugins: A list of callables that modify the configuration dynamically.
621
+ Changes made by these plugins only apply for the duration of the operation
622
+ execution and will not affect any other operation invocations.
623
+
624
+ """
625
+ operation_plugins: list[Plugin] = [
626
+
627
+ ]
628
+ if plugins:
629
+ operation_plugins.extend(plugins)
630
+
631
+ return await self._execute_operation(
632
+ input=input,
633
+ plugins=operation_plugins,
634
+ serialize=_serialize_create_function,
635
+ deserialize=_deserialize_create_function,
636
+ config=self._config,
637
+ operation=CREATE_FUNCTION,
638
+ )
639
+
640
+ async def create_organisation(self, input: CreateOrganisationInput, plugins: list[Plugin] | None = None) -> CreateOrganisationOutput:
641
+ """
642
+ Invokes the CreateOrganisation operation.
643
+
644
+ :param input: The operation's input.
645
+
646
+ :param plugins: A list of callables that modify the configuration dynamically.
647
+ Changes made by these plugins only apply for the duration of the operation
648
+ execution and will not affect any other operation invocations.
649
+
650
+ """
651
+ operation_plugins: list[Plugin] = [
652
+
653
+ ]
654
+ if plugins:
655
+ operation_plugins.extend(plugins)
656
+
657
+ return await self._execute_operation(
658
+ input=input,
659
+ plugins=operation_plugins,
660
+ serialize=_serialize_create_organisation,
661
+ deserialize=_deserialize_create_organisation,
662
+ config=self._config,
663
+ operation=CREATE_ORGANISATION,
664
+ )
665
+
666
+ async def create_type_templates(self, input: CreateTypeTemplatesInput, plugins: list[Plugin] | None = None) -> CreateTypeTemplatesOutput:
667
+ """
668
+ Invokes the CreateTypeTemplates operation.
669
+
670
+ :param input: The operation's input.
671
+
672
+ :param plugins: A list of callables that modify the configuration dynamically.
673
+ Changes made by these plugins only apply for the duration of the operation
674
+ execution and will not affect any other operation invocations.
675
+
676
+ """
677
+ operation_plugins: list[Plugin] = [
678
+
679
+ ]
680
+ if plugins:
681
+ operation_plugins.extend(plugins)
682
+
683
+ return await self._execute_operation(
684
+ input=input,
685
+ plugins=operation_plugins,
686
+ serialize=_serialize_create_type_templates,
687
+ deserialize=_deserialize_create_type_templates,
688
+ config=self._config,
689
+ operation=CREATE_TYPE_TEMPLATES,
690
+ )
691
+
692
+ async def create_webhook(self, input: CreateWebhookInput, plugins: list[Plugin] | None = None) -> CreateWebhookOutput:
693
+ """
694
+ Invokes the CreateWebhook operation.
695
+
696
+ :param input: The operation's input.
697
+
698
+ :param plugins: A list of callables that modify the configuration dynamically.
699
+ Changes made by these plugins only apply for the duration of the operation
700
+ execution and will not affect any other operation invocations.
701
+
702
+ """
703
+ operation_plugins: list[Plugin] = [
704
+
705
+ ]
706
+ if plugins:
707
+ operation_plugins.extend(plugins)
708
+
709
+ return await self._execute_operation(
710
+ input=input,
711
+ plugins=operation_plugins,
712
+ serialize=_serialize_create_webhook,
713
+ deserialize=_deserialize_create_webhook,
714
+ config=self._config,
715
+ operation=CREATE_WEBHOOK,
716
+ )
717
+
718
+ async def create_workspace(self, input: CreateWorkspaceInput, plugins: list[Plugin] | None = None) -> CreateWorkspaceOutput:
719
+ """
720
+ Invokes the CreateWorkspace operation.
721
+
722
+ :param input: The operation's input.
723
+
724
+ :param plugins: A list of callables that modify the configuration dynamically.
725
+ Changes made by these plugins only apply for the duration of the operation
726
+ execution and will not affect any other operation invocations.
727
+
728
+ """
729
+ operation_plugins: list[Plugin] = [
730
+
731
+ ]
732
+ if plugins:
733
+ operation_plugins.extend(plugins)
734
+
735
+ return await self._execute_operation(
736
+ input=input,
737
+ plugins=operation_plugins,
738
+ serialize=_serialize_create_workspace,
739
+ deserialize=_deserialize_create_workspace,
740
+ config=self._config,
741
+ operation=CREATE_WORKSPACE,
742
+ )
743
+
744
+ async def delete_context(self, input: DeleteContextInput, plugins: list[Plugin] | None = None) -> DeleteContextOutput:
745
+ """
746
+ Invokes the DeleteContext operation.
747
+
748
+ :param input: The operation's input.
749
+
750
+ :param plugins: A list of callables that modify the configuration dynamically.
751
+ Changes made by these plugins only apply for the duration of the operation
752
+ execution and will not affect any other operation invocations.
753
+
754
+ """
755
+ operation_plugins: list[Plugin] = [
756
+
757
+ ]
758
+ if plugins:
759
+ operation_plugins.extend(plugins)
760
+
761
+ return await self._execute_operation(
762
+ input=input,
763
+ plugins=operation_plugins,
764
+ serialize=_serialize_delete_context,
765
+ deserialize=_deserialize_delete_context,
766
+ config=self._config,
767
+ operation=DELETE_CONTEXT,
768
+ )
769
+
770
+ async def delete_default_config(self, input: DeleteDefaultConfigInput, plugins: list[Plugin] | None = None) -> DeleteDefaultConfigOutput:
771
+ """
772
+ Invokes the DeleteDefaultConfig operation.
773
+
774
+ :param input: The operation's input.
775
+
776
+ :param plugins: A list of callables that modify the configuration dynamically.
777
+ Changes made by these plugins only apply for the duration of the operation
778
+ execution and will not affect any other operation invocations.
779
+
780
+ """
781
+ operation_plugins: list[Plugin] = [
782
+
783
+ ]
784
+ if plugins:
785
+ operation_plugins.extend(plugins)
786
+
787
+ return await self._execute_operation(
788
+ input=input,
789
+ plugins=operation_plugins,
790
+ serialize=_serialize_delete_default_config,
791
+ deserialize=_deserialize_delete_default_config,
792
+ config=self._config,
793
+ operation=DELETE_DEFAULT_CONFIG,
794
+ )
795
+
796
+ async def delete_dimension(self, input: DeleteDimensionInput, plugins: list[Plugin] | None = None) -> DeleteDimensionOutput:
797
+ """
798
+ Invokes the DeleteDimension operation.
799
+
800
+ :param input: The operation's input.
801
+
802
+ :param plugins: A list of callables that modify the configuration dynamically.
803
+ Changes made by these plugins only apply for the duration of the operation
804
+ execution and will not affect any other operation invocations.
805
+
806
+ """
807
+ operation_plugins: list[Plugin] = [
808
+
809
+ ]
810
+ if plugins:
811
+ operation_plugins.extend(plugins)
812
+
813
+ return await self._execute_operation(
814
+ input=input,
815
+ plugins=operation_plugins,
816
+ serialize=_serialize_delete_dimension,
817
+ deserialize=_deserialize_delete_dimension,
818
+ config=self._config,
819
+ operation=DELETE_DIMENSION,
820
+ )
821
+
822
+ async def delete_experiment_group(self, input: DeleteExperimentGroupInput, plugins: list[Plugin] | None = None) -> DeleteExperimentGroupOutput:
823
+ """
824
+ Deletes an experiment group.
825
+
826
+ :param input: The operation's input.
827
+
828
+ :param plugins: A list of callables that modify the configuration dynamically.
829
+ Changes made by these plugins only apply for the duration of the operation
830
+ execution and will not affect any other operation invocations.
831
+
832
+ """
833
+ operation_plugins: list[Plugin] = [
834
+
835
+ ]
836
+ if plugins:
837
+ operation_plugins.extend(plugins)
838
+
839
+ return await self._execute_operation(
840
+ input=input,
841
+ plugins=operation_plugins,
842
+ serialize=_serialize_delete_experiment_group,
843
+ deserialize=_deserialize_delete_experiment_group,
844
+ config=self._config,
845
+ operation=DELETE_EXPERIMENT_GROUP,
846
+ )
847
+
848
+ async def delete_function(self, input: DeleteFunctionInput, plugins: list[Plugin] | None = None) -> DeleteFunctionOutput:
849
+ """
850
+ Invokes the DeleteFunction operation.
851
+
852
+ :param input: The operation's input.
853
+
854
+ :param plugins: A list of callables that modify the configuration dynamically.
855
+ Changes made by these plugins only apply for the duration of the operation
856
+ execution and will not affect any other operation invocations.
857
+
858
+ """
859
+ operation_plugins: list[Plugin] = [
860
+
861
+ ]
862
+ if plugins:
863
+ operation_plugins.extend(plugins)
864
+
865
+ return await self._execute_operation(
866
+ input=input,
867
+ plugins=operation_plugins,
868
+ serialize=_serialize_delete_function,
869
+ deserialize=_deserialize_delete_function,
870
+ config=self._config,
871
+ operation=DELETE_FUNCTION,
872
+ )
873
+
874
+ async def delete_type_templates(self, input: DeleteTypeTemplatesInput, plugins: list[Plugin] | None = None) -> DeleteTypeTemplatesOutput:
875
+ """
876
+ Invokes the DeleteTypeTemplates operation.
877
+
878
+ :param input: The operation's input.
879
+
880
+ :param plugins: A list of callables that modify the configuration dynamically.
881
+ Changes made by these plugins only apply for the duration of the operation
882
+ execution and will not affect any other operation invocations.
883
+
884
+ """
885
+ operation_plugins: list[Plugin] = [
886
+
887
+ ]
888
+ if plugins:
889
+ operation_plugins.extend(plugins)
890
+
891
+ return await self._execute_operation(
892
+ input=input,
893
+ plugins=operation_plugins,
894
+ serialize=_serialize_delete_type_templates,
895
+ deserialize=_deserialize_delete_type_templates,
896
+ config=self._config,
897
+ operation=DELETE_TYPE_TEMPLATES,
898
+ )
899
+
900
+ async def discard_experiment(self, input: DiscardExperimentInput, plugins: list[Plugin] | None = None) -> DiscardExperimentOutput:
901
+ """
902
+ Invokes the DiscardExperiment operation.
903
+
904
+ :param input: The operation's input.
905
+
906
+ :param plugins: A list of callables that modify the configuration dynamically.
907
+ Changes made by these plugins only apply for the duration of the operation
908
+ execution and will not affect any other operation invocations.
909
+
910
+ """
911
+ operation_plugins: list[Plugin] = [
912
+
913
+ ]
914
+ if plugins:
915
+ operation_plugins.extend(plugins)
916
+
917
+ return await self._execute_operation(
918
+ input=input,
919
+ plugins=operation_plugins,
920
+ serialize=_serialize_discard_experiment,
921
+ deserialize=_deserialize_discard_experiment,
922
+ config=self._config,
923
+ operation=DISCARD_EXPERIMENT,
924
+ )
925
+
926
+ async def get_config(self, input: GetConfigInput, plugins: list[Plugin] | None = None) -> GetConfigOutput:
927
+ """
928
+ Invokes the GetConfig operation.
929
+
930
+ :param input: The operation's input.
931
+
932
+ :param plugins: A list of callables that modify the configuration dynamically.
933
+ Changes made by these plugins only apply for the duration of the operation
934
+ execution and will not affect any other operation invocations.
935
+
936
+ """
937
+ operation_plugins: list[Plugin] = [
938
+
939
+ ]
940
+ if plugins:
941
+ operation_plugins.extend(plugins)
942
+
943
+ return await self._execute_operation(
944
+ input=input,
945
+ plugins=operation_plugins,
946
+ serialize=_serialize_get_config,
947
+ deserialize=_deserialize_get_config,
948
+ config=self._config,
949
+ operation=GET_CONFIG,
950
+ )
951
+
952
+ async def get_config_fast(self, input: GetConfigFastInput, plugins: list[Plugin] | None = None) -> GetConfigFastOutput:
953
+ """
954
+ Invokes the GetConfigFast operation.
955
+
956
+ :param input: The operation's input.
957
+
958
+ :param plugins: A list of callables that modify the configuration dynamically.
959
+ Changes made by these plugins only apply for the duration of the operation
960
+ execution and will not affect any other operation invocations.
961
+
962
+ """
963
+ operation_plugins: list[Plugin] = [
964
+
965
+ ]
966
+ if plugins:
967
+ operation_plugins.extend(plugins)
968
+
969
+ return await self._execute_operation(
970
+ input=input,
971
+ plugins=operation_plugins,
972
+ serialize=_serialize_get_config_fast,
973
+ deserialize=_deserialize_get_config_fast,
974
+ config=self._config,
975
+ operation=GET_CONFIG_FAST,
976
+ )
977
+
978
+ async def get_context(self, input: GetContextInput, plugins: list[Plugin] | None = None) -> GetContextOutput:
979
+ """
980
+ Invokes the GetContext operation.
981
+
982
+ :param input: The operation's input.
983
+
984
+ :param plugins: A list of callables that modify the configuration dynamically.
985
+ Changes made by these plugins only apply for the duration of the operation
986
+ execution and will not affect any other operation invocations.
987
+
988
+ """
989
+ operation_plugins: list[Plugin] = [
990
+
991
+ ]
992
+ if plugins:
993
+ operation_plugins.extend(plugins)
994
+
995
+ return await self._execute_operation(
996
+ input=input,
997
+ plugins=operation_plugins,
998
+ serialize=_serialize_get_context,
999
+ deserialize=_deserialize_get_context,
1000
+ config=self._config,
1001
+ operation=GET_CONTEXT,
1002
+ )
1003
+
1004
+ async def get_context_from_condition(self, input: GetContextFromConditionInput, plugins: list[Plugin] | None = None) -> GetContextFromConditionOutput:
1005
+ """
1006
+ Invokes the GetContextFromCondition operation.
1007
+
1008
+ :param input: The operation's input.
1009
+
1010
+ :param plugins: A list of callables that modify the configuration dynamically.
1011
+ Changes made by these plugins only apply for the duration of the operation
1012
+ execution and will not affect any other operation invocations.
1013
+
1014
+ """
1015
+ operation_plugins: list[Plugin] = [
1016
+
1017
+ ]
1018
+ if plugins:
1019
+ operation_plugins.extend(plugins)
1020
+
1021
+ return await self._execute_operation(
1022
+ input=input,
1023
+ plugins=operation_plugins,
1024
+ serialize=_serialize_get_context_from_condition,
1025
+ deserialize=_deserialize_get_context_from_condition,
1026
+ config=self._config,
1027
+ operation=GET_CONTEXT_FROM_CONDITION,
1028
+ )
1029
+
1030
+ async def get_dimension(self, input: GetDimensionInput, plugins: list[Plugin] | None = None) -> GetDimensionOutput:
1031
+ """
1032
+ Invokes the GetDimension operation.
1033
+
1034
+ :param input: The operation's input.
1035
+
1036
+ :param plugins: A list of callables that modify the configuration dynamically.
1037
+ Changes made by these plugins only apply for the duration of the operation
1038
+ execution and will not affect any other operation invocations.
1039
+
1040
+ """
1041
+ operation_plugins: list[Plugin] = [
1042
+
1043
+ ]
1044
+ if plugins:
1045
+ operation_plugins.extend(plugins)
1046
+
1047
+ return await self._execute_operation(
1048
+ input=input,
1049
+ plugins=operation_plugins,
1050
+ serialize=_serialize_get_dimension,
1051
+ deserialize=_deserialize_get_dimension,
1052
+ config=self._config,
1053
+ operation=GET_DIMENSION,
1054
+ )
1055
+
1056
+ async def get_experiment(self, input: GetExperimentInput, plugins: list[Plugin] | None = None) -> GetExperimentOutput:
1057
+ """
1058
+ Invokes the GetExperiment operation.
1059
+
1060
+ :param input: The operation's input.
1061
+
1062
+ :param plugins: A list of callables that modify the configuration dynamically.
1063
+ Changes made by these plugins only apply for the duration of the operation
1064
+ execution and will not affect any other operation invocations.
1065
+
1066
+ """
1067
+ operation_plugins: list[Plugin] = [
1068
+
1069
+ ]
1070
+ if plugins:
1071
+ operation_plugins.extend(plugins)
1072
+
1073
+ return await self._execute_operation(
1074
+ input=input,
1075
+ plugins=operation_plugins,
1076
+ serialize=_serialize_get_experiment,
1077
+ deserialize=_deserialize_get_experiment,
1078
+ config=self._config,
1079
+ operation=GET_EXPERIMENT,
1080
+ )
1081
+
1082
+ async def get_experiment_group(self, input: GetExperimentGroupInput, plugins: list[Plugin] | None = None) -> GetExperimentGroupOutput:
1083
+ """
1084
+ Retrieves an existing experiment group by its ID.
1085
+
1086
+ :param input: The operation's input.
1087
+
1088
+ :param plugins: A list of callables that modify the configuration dynamically.
1089
+ Changes made by these plugins only apply for the duration of the operation
1090
+ execution and will not affect any other operation invocations.
1091
+
1092
+ """
1093
+ operation_plugins: list[Plugin] = [
1094
+
1095
+ ]
1096
+ if plugins:
1097
+ operation_plugins.extend(plugins)
1098
+
1099
+ return await self._execute_operation(
1100
+ input=input,
1101
+ plugins=operation_plugins,
1102
+ serialize=_serialize_get_experiment_group,
1103
+ deserialize=_deserialize_get_experiment_group,
1104
+ config=self._config,
1105
+ operation=GET_EXPERIMENT_GROUP,
1106
+ )
1107
+
1108
+ async def get_function(self, input: GetFunctionInput, plugins: list[Plugin] | None = None) -> GetFunctionOutput:
1109
+ """
1110
+ Invokes the GetFunction operation.
1111
+
1112
+ :param input: The operation's input.
1113
+
1114
+ :param plugins: A list of callables that modify the configuration dynamically.
1115
+ Changes made by these plugins only apply for the duration of the operation
1116
+ execution and will not affect any other operation invocations.
1117
+
1118
+ """
1119
+ operation_plugins: list[Plugin] = [
1120
+
1121
+ ]
1122
+ if plugins:
1123
+ operation_plugins.extend(plugins)
1124
+
1125
+ return await self._execute_operation(
1126
+ input=input,
1127
+ plugins=operation_plugins,
1128
+ serialize=_serialize_get_function,
1129
+ deserialize=_deserialize_get_function,
1130
+ config=self._config,
1131
+ operation=GET_FUNCTION,
1132
+ )
1133
+
1134
+ async def get_organisation(self, input: GetOrganisationInput, plugins: list[Plugin] | None = None) -> GetOrganisationOutput:
1135
+ """
1136
+ Invokes the GetOrganisation operation.
1137
+
1138
+ :param input: The operation's input.
1139
+
1140
+ :param plugins: A list of callables that modify the configuration dynamically.
1141
+ Changes made by these plugins only apply for the duration of the operation
1142
+ execution and will not affect any other operation invocations.
1143
+
1144
+ """
1145
+ operation_plugins: list[Plugin] = [
1146
+
1147
+ ]
1148
+ if plugins:
1149
+ operation_plugins.extend(plugins)
1150
+
1151
+ return await self._execute_operation(
1152
+ input=input,
1153
+ plugins=operation_plugins,
1154
+ serialize=_serialize_get_organisation,
1155
+ deserialize=_deserialize_get_organisation,
1156
+ config=self._config,
1157
+ operation=GET_ORGANISATION,
1158
+ )
1159
+
1160
+ async def get_resolved_config(self, input: GetResolvedConfigInput, plugins: list[Plugin] | None = None) -> GetResolvedConfigOutput:
1161
+ """
1162
+ Invokes the GetResolvedConfig operation.
1163
+
1164
+ :param input: The operation's input.
1165
+
1166
+ :param plugins: A list of callables that modify the configuration dynamically.
1167
+ Changes made by these plugins only apply for the duration of the operation
1168
+ execution and will not affect any other operation invocations.
1169
+
1170
+ """
1171
+ operation_plugins: list[Plugin] = [
1172
+
1173
+ ]
1174
+ if plugins:
1175
+ operation_plugins.extend(plugins)
1176
+
1177
+ return await self._execute_operation(
1178
+ input=input,
1179
+ plugins=operation_plugins,
1180
+ serialize=_serialize_get_resolved_config,
1181
+ deserialize=_deserialize_get_resolved_config,
1182
+ config=self._config,
1183
+ operation=GET_RESOLVED_CONFIG,
1184
+ )
1185
+
1186
+ async def get_type_templates_list(self, input: GetTypeTemplatesListInput, plugins: list[Plugin] | None = None) -> GetTypeTemplatesListOutput:
1187
+ """
1188
+ Invokes the GetTypeTemplatesList operation.
1189
+
1190
+ :param input: The operation's input.
1191
+
1192
+ :param plugins: A list of callables that modify the configuration dynamically.
1193
+ Changes made by these plugins only apply for the duration of the operation
1194
+ execution and will not affect any other operation invocations.
1195
+
1196
+ """
1197
+ operation_plugins: list[Plugin] = [
1198
+
1199
+ ]
1200
+ if plugins:
1201
+ operation_plugins.extend(plugins)
1202
+
1203
+ return await self._execute_operation(
1204
+ input=input,
1205
+ plugins=operation_plugins,
1206
+ serialize=_serialize_get_type_templates_list,
1207
+ deserialize=_deserialize_get_type_templates_list,
1208
+ config=self._config,
1209
+ operation=GET_TYPE_TEMPLATES_LIST,
1210
+ )
1211
+
1212
+ async def get_webhook(self, input: GetWebhookInput, plugins: list[Plugin] | None = None) -> GetWebhookOutput:
1213
+ """
1214
+ Invokes the GetWebhook operation.
1215
+
1216
+ :param input: The operation's input.
1217
+
1218
+ :param plugins: A list of callables that modify the configuration dynamically.
1219
+ Changes made by these plugins only apply for the duration of the operation
1220
+ execution and will not affect any other operation invocations.
1221
+
1222
+ """
1223
+ operation_plugins: list[Plugin] = [
1224
+
1225
+ ]
1226
+ if plugins:
1227
+ operation_plugins.extend(plugins)
1228
+
1229
+ return await self._execute_operation(
1230
+ input=input,
1231
+ plugins=operation_plugins,
1232
+ serialize=_serialize_get_webhook,
1233
+ deserialize=_deserialize_get_webhook,
1234
+ config=self._config,
1235
+ operation=GET_WEBHOOK,
1236
+ )
1237
+
1238
+ async def list_audit_logs(self, input: ListAuditLogsInput, plugins: list[Plugin] | None = None) -> ListAuditLogsOutput:
1239
+ """
1240
+ Invokes the ListAuditLogs operation.
1241
+
1242
+ :param input: The operation's input.
1243
+
1244
+ :param plugins: A list of callables that modify the configuration dynamically.
1245
+ Changes made by these plugins only apply for the duration of the operation
1246
+ execution and will not affect any other operation invocations.
1247
+
1248
+ """
1249
+ operation_plugins: list[Plugin] = [
1250
+
1251
+ ]
1252
+ if plugins:
1253
+ operation_plugins.extend(plugins)
1254
+
1255
+ return await self._execute_operation(
1256
+ input=input,
1257
+ plugins=operation_plugins,
1258
+ serialize=_serialize_list_audit_logs,
1259
+ deserialize=_deserialize_list_audit_logs,
1260
+ config=self._config,
1261
+ operation=LIST_AUDIT_LOGS,
1262
+ )
1263
+
1264
+ async def list_contexts(self, input: ListContextsInput, plugins: list[Plugin] | None = None) -> ListContextsOutput:
1265
+ """
1266
+ Invokes the ListContexts operation.
1267
+
1268
+ :param input: The operation's input.
1269
+
1270
+ :param plugins: A list of callables that modify the configuration dynamically.
1271
+ Changes made by these plugins only apply for the duration of the operation
1272
+ execution and will not affect any other operation invocations.
1273
+
1274
+ """
1275
+ operation_plugins: list[Plugin] = [
1276
+
1277
+ ]
1278
+ if plugins:
1279
+ operation_plugins.extend(plugins)
1280
+
1281
+ return await self._execute_operation(
1282
+ input=input,
1283
+ plugins=operation_plugins,
1284
+ serialize=_serialize_list_contexts,
1285
+ deserialize=_deserialize_list_contexts,
1286
+ config=self._config,
1287
+ operation=LIST_CONTEXTS,
1288
+ )
1289
+
1290
+ async def list_default_configs(self, input: ListDefaultConfigsInput, plugins: list[Plugin] | None = None) -> ListDefaultConfigsOutput:
1291
+ """
1292
+ Invokes the ListDefaultConfigs operation.
1293
+
1294
+ :param input: The operation's input.
1295
+
1296
+ :param plugins: A list of callables that modify the configuration dynamically.
1297
+ Changes made by these plugins only apply for the duration of the operation
1298
+ execution and will not affect any other operation invocations.
1299
+
1300
+ """
1301
+ operation_plugins: list[Plugin] = [
1302
+
1303
+ ]
1304
+ if plugins:
1305
+ operation_plugins.extend(plugins)
1306
+
1307
+ return await self._execute_operation(
1308
+ input=input,
1309
+ plugins=operation_plugins,
1310
+ serialize=_serialize_list_default_configs,
1311
+ deserialize=_deserialize_list_default_configs,
1312
+ config=self._config,
1313
+ operation=LIST_DEFAULT_CONFIGS,
1314
+ )
1315
+
1316
+ async def list_dimensions(self, input: ListDimensionsInput, plugins: list[Plugin] | None = None) -> ListDimensionsOutput:
1317
+ """
1318
+ Invokes the ListDimensions operation.
1319
+
1320
+ :param input: The operation's input.
1321
+
1322
+ :param plugins: A list of callables that modify the configuration dynamically.
1323
+ Changes made by these plugins only apply for the duration of the operation
1324
+ execution and will not affect any other operation invocations.
1325
+
1326
+ """
1327
+ operation_plugins: list[Plugin] = [
1328
+
1329
+ ]
1330
+ if plugins:
1331
+ operation_plugins.extend(plugins)
1332
+
1333
+ return await self._execute_operation(
1334
+ input=input,
1335
+ plugins=operation_plugins,
1336
+ serialize=_serialize_list_dimensions,
1337
+ deserialize=_deserialize_list_dimensions,
1338
+ config=self._config,
1339
+ operation=LIST_DIMENSIONS,
1340
+ )
1341
+
1342
+ async def list_experiment(self, input: ListExperimentInput, plugins: list[Plugin] | None = None) -> ListExperimentOutput:
1343
+ """
1344
+ Invokes the ListExperiment operation.
1345
+
1346
+ :param input: The operation's input.
1347
+
1348
+ :param plugins: A list of callables that modify the configuration dynamically.
1349
+ Changes made by these plugins only apply for the duration of the operation
1350
+ execution and will not affect any other operation invocations.
1351
+
1352
+ """
1353
+ operation_plugins: list[Plugin] = [
1354
+
1355
+ ]
1356
+ if plugins:
1357
+ operation_plugins.extend(plugins)
1358
+
1359
+ return await self._execute_operation(
1360
+ input=input,
1361
+ plugins=operation_plugins,
1362
+ serialize=_serialize_list_experiment,
1363
+ deserialize=_deserialize_list_experiment,
1364
+ config=self._config,
1365
+ operation=LIST_EXPERIMENT,
1366
+ )
1367
+
1368
+ async def list_experiment_groups(self, input: ListExperimentGroupsInput, plugins: list[Plugin] | None = None) -> ListExperimentGroupsOutput:
1369
+ """
1370
+ Lists experiment groups, with support for filtering and pagination.
1371
+
1372
+ :param input: The operation's input.
1373
+
1374
+ :param plugins: A list of callables that modify the configuration dynamically.
1375
+ Changes made by these plugins only apply for the duration of the operation
1376
+ execution and will not affect any other operation invocations.
1377
+
1378
+ """
1379
+ operation_plugins: list[Plugin] = [
1380
+
1381
+ ]
1382
+ if plugins:
1383
+ operation_plugins.extend(plugins)
1384
+
1385
+ return await self._execute_operation(
1386
+ input=input,
1387
+ plugins=operation_plugins,
1388
+ serialize=_serialize_list_experiment_groups,
1389
+ deserialize=_deserialize_list_experiment_groups,
1390
+ config=self._config,
1391
+ operation=LIST_EXPERIMENT_GROUPS,
1392
+ )
1393
+
1394
+ async def list_function(self, input: ListFunctionInput, plugins: list[Plugin] | None = None) -> ListFunctionOutput:
1395
+ """
1396
+ Invokes the ListFunction operation.
1397
+
1398
+ :param input: The operation's input.
1399
+
1400
+ :param plugins: A list of callables that modify the configuration dynamically.
1401
+ Changes made by these plugins only apply for the duration of the operation
1402
+ execution and will not affect any other operation invocations.
1403
+
1404
+ """
1405
+ operation_plugins: list[Plugin] = [
1406
+
1407
+ ]
1408
+ if plugins:
1409
+ operation_plugins.extend(plugins)
1410
+
1411
+ return await self._execute_operation(
1412
+ input=input,
1413
+ plugins=operation_plugins,
1414
+ serialize=_serialize_list_function,
1415
+ deserialize=_deserialize_list_function,
1416
+ config=self._config,
1417
+ operation=LIST_FUNCTION,
1418
+ )
1419
+
1420
+ async def list_organisation(self, input: ListOrganisationInput, plugins: list[Plugin] | None = None) -> ListOrganisationOutput:
1421
+ """
1422
+ Invokes the ListOrganisation operation.
1423
+
1424
+ :param input: The operation's input.
1425
+
1426
+ :param plugins: A list of callables that modify the configuration dynamically.
1427
+ Changes made by these plugins only apply for the duration of the operation
1428
+ execution and will not affect any other operation invocations.
1429
+
1430
+ """
1431
+ operation_plugins: list[Plugin] = [
1432
+
1433
+ ]
1434
+ if plugins:
1435
+ operation_plugins.extend(plugins)
1436
+
1437
+ return await self._execute_operation(
1438
+ input=input,
1439
+ plugins=operation_plugins,
1440
+ serialize=_serialize_list_organisation,
1441
+ deserialize=_deserialize_list_organisation,
1442
+ config=self._config,
1443
+ operation=LIST_ORGANISATION,
1444
+ )
1445
+
1446
+ async def list_versions(self, input: ListVersionsInput, plugins: list[Plugin] | None = None) -> ListVersionsOutput:
1447
+ """
1448
+ Invokes the ListVersions operation.
1449
+
1450
+ :param input: The operation's input.
1451
+
1452
+ :param plugins: A list of callables that modify the configuration dynamically.
1453
+ Changes made by these plugins only apply for the duration of the operation
1454
+ execution and will not affect any other operation invocations.
1455
+
1456
+ """
1457
+ operation_plugins: list[Plugin] = [
1458
+
1459
+ ]
1460
+ if plugins:
1461
+ operation_plugins.extend(plugins)
1462
+
1463
+ return await self._execute_operation(
1464
+ input=input,
1465
+ plugins=operation_plugins,
1466
+ serialize=_serialize_list_versions,
1467
+ deserialize=_deserialize_list_versions,
1468
+ config=self._config,
1469
+ operation=LIST_VERSIONS,
1470
+ )
1471
+
1472
+ async def list_webhook(self, input: ListWebhookInput, plugins: list[Plugin] | None = None) -> ListWebhookOutput:
1473
+ """
1474
+ Invokes the ListWebhook operation.
1475
+
1476
+ :param input: The operation's input.
1477
+
1478
+ :param plugins: A list of callables that modify the configuration dynamically.
1479
+ Changes made by these plugins only apply for the duration of the operation
1480
+ execution and will not affect any other operation invocations.
1481
+
1482
+ """
1483
+ operation_plugins: list[Plugin] = [
1484
+
1485
+ ]
1486
+ if plugins:
1487
+ operation_plugins.extend(plugins)
1488
+
1489
+ return await self._execute_operation(
1490
+ input=input,
1491
+ plugins=operation_plugins,
1492
+ serialize=_serialize_list_webhook,
1493
+ deserialize=_deserialize_list_webhook,
1494
+ config=self._config,
1495
+ operation=LIST_WEBHOOK,
1496
+ )
1497
+
1498
+ async def list_workspace(self, input: ListWorkspaceInput, plugins: list[Plugin] | None = None) -> ListWorkspaceOutput:
1499
+ """
1500
+ Invokes the ListWorkspace operation.
1501
+
1502
+ :param input: The operation's input.
1503
+
1504
+ :param plugins: A list of callables that modify the configuration dynamically.
1505
+ Changes made by these plugins only apply for the duration of the operation
1506
+ execution and will not affect any other operation invocations.
1507
+
1508
+ """
1509
+ operation_plugins: list[Plugin] = [
1510
+
1511
+ ]
1512
+ if plugins:
1513
+ operation_plugins.extend(plugins)
1514
+
1515
+ return await self._execute_operation(
1516
+ input=input,
1517
+ plugins=operation_plugins,
1518
+ serialize=_serialize_list_workspace,
1519
+ deserialize=_deserialize_list_workspace,
1520
+ config=self._config,
1521
+ operation=LIST_WORKSPACE,
1522
+ )
1523
+
1524
+ async def move_context(self, input: MoveContextInput, plugins: list[Plugin] | None = None) -> MoveContextOutput:
1525
+ """
1526
+ Invokes the MoveContext operation.
1527
+
1528
+ :param input: The operation's input.
1529
+
1530
+ :param plugins: A list of callables that modify the configuration dynamically.
1531
+ Changes made by these plugins only apply for the duration of the operation
1532
+ execution and will not affect any other operation invocations.
1533
+
1534
+ """
1535
+ operation_plugins: list[Plugin] = [
1536
+
1537
+ ]
1538
+ if plugins:
1539
+ operation_plugins.extend(plugins)
1540
+
1541
+ return await self._execute_operation(
1542
+ input=input,
1543
+ plugins=operation_plugins,
1544
+ serialize=_serialize_move_context,
1545
+ deserialize=_deserialize_move_context,
1546
+ config=self._config,
1547
+ operation=MOVE_CONTEXT,
1548
+ )
1549
+
1550
+ async def pause_experiment(self, input: PauseExperimentInput, plugins: list[Plugin] | None = None) -> PauseExperimentOutput:
1551
+ """
1552
+ Invokes the PauseExperiment operation.
1553
+
1554
+ :param input: The operation's input.
1555
+
1556
+ :param plugins: A list of callables that modify the configuration dynamically.
1557
+ Changes made by these plugins only apply for the duration of the operation
1558
+ execution and will not affect any other operation invocations.
1559
+
1560
+ """
1561
+ operation_plugins: list[Plugin] = [
1562
+
1563
+ ]
1564
+ if plugins:
1565
+ operation_plugins.extend(plugins)
1566
+
1567
+ return await self._execute_operation(
1568
+ input=input,
1569
+ plugins=operation_plugins,
1570
+ serialize=_serialize_pause_experiment,
1571
+ deserialize=_deserialize_pause_experiment,
1572
+ config=self._config,
1573
+ operation=PAUSE_EXPERIMENT,
1574
+ )
1575
+
1576
+ async def publish(self, input: PublishInput, plugins: list[Plugin] | None = None) -> PublishOutput:
1577
+ """
1578
+ Invokes the Publish operation.
1579
+
1580
+ :param input: The operation's input.
1581
+
1582
+ :param plugins: A list of callables that modify the configuration dynamically.
1583
+ Changes made by these plugins only apply for the duration of the operation
1584
+ execution and will not affect any other operation invocations.
1585
+
1586
+ """
1587
+ operation_plugins: list[Plugin] = [
1588
+
1589
+ ]
1590
+ if plugins:
1591
+ operation_plugins.extend(plugins)
1592
+
1593
+ return await self._execute_operation(
1594
+ input=input,
1595
+ plugins=operation_plugins,
1596
+ serialize=_serialize_publish,
1597
+ deserialize=_deserialize_publish,
1598
+ config=self._config,
1599
+ operation=PUBLISH,
1600
+ )
1601
+
1602
+ async def ramp_experiment(self, input: RampExperimentInput, plugins: list[Plugin] | None = None) -> RampExperimentOutput:
1603
+ """
1604
+ Invokes the RampExperiment operation.
1605
+
1606
+ :param input: The operation's input.
1607
+
1608
+ :param plugins: A list of callables that modify the configuration dynamically.
1609
+ Changes made by these plugins only apply for the duration of the operation
1610
+ execution and will not affect any other operation invocations.
1611
+
1612
+ """
1613
+ operation_plugins: list[Plugin] = [
1614
+
1615
+ ]
1616
+ if plugins:
1617
+ operation_plugins.extend(plugins)
1618
+
1619
+ return await self._execute_operation(
1620
+ input=input,
1621
+ plugins=operation_plugins,
1622
+ serialize=_serialize_ramp_experiment,
1623
+ deserialize=_deserialize_ramp_experiment,
1624
+ config=self._config,
1625
+ operation=RAMP_EXPERIMENT,
1626
+ )
1627
+
1628
+ async def remove_members_from_group(self, input: RemoveMembersFromGroupInput, plugins: list[Plugin] | None = None) -> RemoveMembersFromGroupOutput:
1629
+ """
1630
+ Removes members from an existing experiment group.
1631
+
1632
+ :param input: Input structure for adding members to an experiment group.
1633
+
1634
+ :param plugins: A list of callables that modify the configuration dynamically.
1635
+ Changes made by these plugins only apply for the duration of the operation
1636
+ execution and will not affect any other operation invocations.
1637
+
1638
+ """
1639
+ operation_plugins: list[Plugin] = [
1640
+
1641
+ ]
1642
+ if plugins:
1643
+ operation_plugins.extend(plugins)
1644
+
1645
+ return await self._execute_operation(
1646
+ input=input,
1647
+ plugins=operation_plugins,
1648
+ serialize=_serialize_remove_members_from_group,
1649
+ deserialize=_deserialize_remove_members_from_group,
1650
+ config=self._config,
1651
+ operation=REMOVE_MEMBERS_FROM_GROUP,
1652
+ )
1653
+
1654
+ async def resume_experiment(self, input: ResumeExperimentInput, plugins: list[Plugin] | None = None) -> ResumeExperimentOutput:
1655
+ """
1656
+ Invokes the ResumeExperiment operation.
1657
+
1658
+ :param input: The operation's input.
1659
+
1660
+ :param plugins: A list of callables that modify the configuration dynamically.
1661
+ Changes made by these plugins only apply for the duration of the operation
1662
+ execution and will not affect any other operation invocations.
1663
+
1664
+ """
1665
+ operation_plugins: list[Plugin] = [
1666
+
1667
+ ]
1668
+ if plugins:
1669
+ operation_plugins.extend(plugins)
1670
+
1671
+ return await self._execute_operation(
1672
+ input=input,
1673
+ plugins=operation_plugins,
1674
+ serialize=_serialize_resume_experiment,
1675
+ deserialize=_deserialize_resume_experiment,
1676
+ config=self._config,
1677
+ operation=RESUME_EXPERIMENT,
1678
+ )
1679
+
1680
+ async def test(self, input: TestInput, plugins: list[Plugin] | None = None) -> TestOutput:
1681
+ """
1682
+ Invokes the Test operation.
1683
+
1684
+ :param input: The operation's input.
1685
+
1686
+ :param plugins: A list of callables that modify the configuration dynamically.
1687
+ Changes made by these plugins only apply for the duration of the operation
1688
+ execution and will not affect any other operation invocations.
1689
+
1690
+ """
1691
+ operation_plugins: list[Plugin] = [
1692
+
1693
+ ]
1694
+ if plugins:
1695
+ operation_plugins.extend(plugins)
1696
+
1697
+ return await self._execute_operation(
1698
+ input=input,
1699
+ plugins=operation_plugins,
1700
+ serialize=_serialize_test,
1701
+ deserialize=_deserialize_test,
1702
+ config=self._config,
1703
+ operation=TEST,
1704
+ )
1705
+
1706
+ async def update_default_config(self, input: UpdateDefaultConfigInput, plugins: list[Plugin] | None = None) -> UpdateDefaultConfigOutput:
1707
+ """
1708
+ Invokes the UpdateDefaultConfig operation.
1709
+
1710
+ :param input: The operation's input.
1711
+
1712
+ :param plugins: A list of callables that modify the configuration dynamically.
1713
+ Changes made by these plugins only apply for the duration of the operation
1714
+ execution and will not affect any other operation invocations.
1715
+
1716
+ """
1717
+ operation_plugins: list[Plugin] = [
1718
+
1719
+ ]
1720
+ if plugins:
1721
+ operation_plugins.extend(plugins)
1722
+
1723
+ return await self._execute_operation(
1724
+ input=input,
1725
+ plugins=operation_plugins,
1726
+ serialize=_serialize_update_default_config,
1727
+ deserialize=_deserialize_update_default_config,
1728
+ config=self._config,
1729
+ operation=UPDATE_DEFAULT_CONFIG,
1730
+ )
1731
+
1732
+ async def update_dimension(self, input: UpdateDimensionInput, plugins: list[Plugin] | None = None) -> UpdateDimensionOutput:
1733
+ """
1734
+ Invokes the UpdateDimension operation.
1735
+
1736
+ :param input: The operation's input.
1737
+
1738
+ :param plugins: A list of callables that modify the configuration dynamically.
1739
+ Changes made by these plugins only apply for the duration of the operation
1740
+ execution and will not affect any other operation invocations.
1741
+
1742
+ """
1743
+ operation_plugins: list[Plugin] = [
1744
+
1745
+ ]
1746
+ if plugins:
1747
+ operation_plugins.extend(plugins)
1748
+
1749
+ return await self._execute_operation(
1750
+ input=input,
1751
+ plugins=operation_plugins,
1752
+ serialize=_serialize_update_dimension,
1753
+ deserialize=_deserialize_update_dimension,
1754
+ config=self._config,
1755
+ operation=UPDATE_DIMENSION,
1756
+ )
1757
+
1758
+ async def update_experiment_group(self, input: UpdateExperimentGroupInput, plugins: list[Plugin] | None = None) -> UpdateExperimentGroupOutput:
1759
+ """
1760
+ Updates an existing experiment group. Allows partial updates to specified
1761
+ fields.
1762
+
1763
+ :param input: Input structure for updating an existing experiment group.
1764
+
1765
+ :param plugins: A list of callables that modify the configuration dynamically.
1766
+ Changes made by these plugins only apply for the duration of the operation
1767
+ execution and will not affect any other operation invocations.
1768
+
1769
+ """
1770
+ operation_plugins: list[Plugin] = [
1771
+
1772
+ ]
1773
+ if plugins:
1774
+ operation_plugins.extend(plugins)
1775
+
1776
+ return await self._execute_operation(
1777
+ input=input,
1778
+ plugins=operation_plugins,
1779
+ serialize=_serialize_update_experiment_group,
1780
+ deserialize=_deserialize_update_experiment_group,
1781
+ config=self._config,
1782
+ operation=UPDATE_EXPERIMENT_GROUP,
1783
+ )
1784
+
1785
+ async def update_function(self, input: UpdateFunctionInput, plugins: list[Plugin] | None = None) -> UpdateFunctionOutput:
1786
+ """
1787
+ Invokes the UpdateFunction operation.
1788
+
1789
+ :param input: The operation's input.
1790
+
1791
+ :param plugins: A list of callables that modify the configuration dynamically.
1792
+ Changes made by these plugins only apply for the duration of the operation
1793
+ execution and will not affect any other operation invocations.
1794
+
1795
+ """
1796
+ operation_plugins: list[Plugin] = [
1797
+
1798
+ ]
1799
+ if plugins:
1800
+ operation_plugins.extend(plugins)
1801
+
1802
+ return await self._execute_operation(
1803
+ input=input,
1804
+ plugins=operation_plugins,
1805
+ serialize=_serialize_update_function,
1806
+ deserialize=_deserialize_update_function,
1807
+ config=self._config,
1808
+ operation=UPDATE_FUNCTION,
1809
+ )
1810
+
1811
+ async def update_organisation(self, input: UpdateOrganisationInput, plugins: list[Plugin] | None = None) -> UpdateOrganisationOutput:
1812
+ """
1813
+ Invokes the UpdateOrganisation operation.
1814
+
1815
+ :param input: The operation's input.
1816
+
1817
+ :param plugins: A list of callables that modify the configuration dynamically.
1818
+ Changes made by these plugins only apply for the duration of the operation
1819
+ execution and will not affect any other operation invocations.
1820
+
1821
+ """
1822
+ operation_plugins: list[Plugin] = [
1823
+
1824
+ ]
1825
+ if plugins:
1826
+ operation_plugins.extend(plugins)
1827
+
1828
+ return await self._execute_operation(
1829
+ input=input,
1830
+ plugins=operation_plugins,
1831
+ serialize=_serialize_update_organisation,
1832
+ deserialize=_deserialize_update_organisation,
1833
+ config=self._config,
1834
+ operation=UPDATE_ORGANISATION,
1835
+ )
1836
+
1837
+ async def update_override(self, input: UpdateOverrideInput, plugins: list[Plugin] | None = None) -> UpdateOverrideOutput:
1838
+ """
1839
+ Invokes the UpdateOverride operation.
1840
+
1841
+ :param input: The operation's input.
1842
+
1843
+ :param plugins: A list of callables that modify the configuration dynamically.
1844
+ Changes made by these plugins only apply for the duration of the operation
1845
+ execution and will not affect any other operation invocations.
1846
+
1847
+ """
1848
+ operation_plugins: list[Plugin] = [
1849
+
1850
+ ]
1851
+ if plugins:
1852
+ operation_plugins.extend(plugins)
1853
+
1854
+ return await self._execute_operation(
1855
+ input=input,
1856
+ plugins=operation_plugins,
1857
+ serialize=_serialize_update_override,
1858
+ deserialize=_deserialize_update_override,
1859
+ config=self._config,
1860
+ operation=UPDATE_OVERRIDE,
1861
+ )
1862
+
1863
+ async def update_overrides_experiment(self, input: UpdateOverridesExperimentInput, plugins: list[Plugin] | None = None) -> UpdateOverridesExperimentOutput:
1864
+ """
1865
+ Invokes the UpdateOverridesExperiment operation.
1866
+
1867
+ :param input: The operation's input.
1868
+
1869
+ :param plugins: A list of callables that modify the configuration dynamically.
1870
+ Changes made by these plugins only apply for the duration of the operation
1871
+ execution and will not affect any other operation invocations.
1872
+
1873
+ """
1874
+ operation_plugins: list[Plugin] = [
1875
+
1876
+ ]
1877
+ if plugins:
1878
+ operation_plugins.extend(plugins)
1879
+
1880
+ return await self._execute_operation(
1881
+ input=input,
1882
+ plugins=operation_plugins,
1883
+ serialize=_serialize_update_overrides_experiment,
1884
+ deserialize=_deserialize_update_overrides_experiment,
1885
+ config=self._config,
1886
+ operation=UPDATE_OVERRIDES_EXPERIMENT,
1887
+ )
1888
+
1889
+ async def update_type_templates(self, input: UpdateTypeTemplatesInput, plugins: list[Plugin] | None = None) -> UpdateTypeTemplatesOutput:
1890
+ """
1891
+ Invokes the UpdateTypeTemplates operation.
1892
+
1893
+ :param input: The operation's input.
1894
+
1895
+ :param plugins: A list of callables that modify the configuration dynamically.
1896
+ Changes made by these plugins only apply for the duration of the operation
1897
+ execution and will not affect any other operation invocations.
1898
+
1899
+ """
1900
+ operation_plugins: list[Plugin] = [
1901
+
1902
+ ]
1903
+ if plugins:
1904
+ operation_plugins.extend(plugins)
1905
+
1906
+ return await self._execute_operation(
1907
+ input=input,
1908
+ plugins=operation_plugins,
1909
+ serialize=_serialize_update_type_templates,
1910
+ deserialize=_deserialize_update_type_templates,
1911
+ config=self._config,
1912
+ operation=UPDATE_TYPE_TEMPLATES,
1913
+ )
1914
+
1915
+ async def update_webhook(self, input: UpdateWebhookInput, plugins: list[Plugin] | None = None) -> UpdateWebhookOutput:
1916
+ """
1917
+ Invokes the UpdateWebhook operation.
1918
+
1919
+ :param input: The operation's input.
1920
+
1921
+ :param plugins: A list of callables that modify the configuration dynamically.
1922
+ Changes made by these plugins only apply for the duration of the operation
1923
+ execution and will not affect any other operation invocations.
1924
+
1925
+ """
1926
+ operation_plugins: list[Plugin] = [
1927
+
1928
+ ]
1929
+ if plugins:
1930
+ operation_plugins.extend(plugins)
1931
+
1932
+ return await self._execute_operation(
1933
+ input=input,
1934
+ plugins=operation_plugins,
1935
+ serialize=_serialize_update_webhook,
1936
+ deserialize=_deserialize_update_webhook,
1937
+ config=self._config,
1938
+ operation=UPDATE_WEBHOOK,
1939
+ )
1940
+
1941
+ async def update_workspace(self, input: UpdateWorkspaceInput, plugins: list[Plugin] | None = None) -> UpdateWorkspaceOutput:
1942
+ """
1943
+ Invokes the UpdateWorkspace operation.
1944
+
1945
+ :param input: The operation's input.
1946
+
1947
+ :param plugins: A list of callables that modify the configuration dynamically.
1948
+ Changes made by these plugins only apply for the duration of the operation
1949
+ execution and will not affect any other operation invocations.
1950
+
1951
+ """
1952
+ operation_plugins: list[Plugin] = [
1953
+
1954
+ ]
1955
+ if plugins:
1956
+ operation_plugins.extend(plugins)
1957
+
1958
+ return await self._execute_operation(
1959
+ input=input,
1960
+ plugins=operation_plugins,
1961
+ serialize=_serialize_update_workspace,
1962
+ deserialize=_deserialize_update_workspace,
1963
+ config=self._config,
1964
+ operation=UPDATE_WORKSPACE,
1965
+ )
1966
+
1967
+ async def weight_recompute(self, input: WeightRecomputeInput, plugins: list[Plugin] | None = None) -> WeightRecomputeOutput:
1968
+ """
1969
+ Invokes the WeightRecompute operation.
1970
+
1971
+ :param input: The operation's input.
1972
+
1973
+ :param plugins: A list of callables that modify the configuration dynamically.
1974
+ Changes made by these plugins only apply for the duration of the operation
1975
+ execution and will not affect any other operation invocations.
1976
+
1977
+ """
1978
+ operation_plugins: list[Plugin] = [
1979
+
1980
+ ]
1981
+ if plugins:
1982
+ operation_plugins.extend(plugins)
1983
+
1984
+ return await self._execute_operation(
1985
+ input=input,
1986
+ plugins=operation_plugins,
1987
+ serialize=_serialize_weight_recompute,
1988
+ deserialize=_deserialize_weight_recompute,
1989
+ config=self._config,
1990
+ operation=WEIGHT_RECOMPUTE,
1991
+ )
1992
+
1993
+ def _classify_error(
1994
+ self,
1995
+ *,
1996
+ error: Exception,
1997
+ context: ResponseContext[Any, HTTPRequest, HTTPResponse | None]
1998
+ ) -> RetryErrorInfo:
1999
+ logger.debug("Classifying error: %s", error)
2000
+
2001
+ if not isinstance(error, HasFault) and not context.transport_response:
2002
+ return RetryErrorInfo(error_type=RetryErrorType.TRANSIENT)
2003
+
2004
+ if context.transport_response:
2005
+ if context.transport_response.status in [429, 503]:
2006
+ retry_after = None
2007
+ retry_header = context.transport_response.fields["retry-after"]
2008
+ if retry_header and retry_header.values:
2009
+ retry_after = float(retry_header.values[0])
2010
+ return RetryErrorInfo(error_type=RetryErrorType.THROTTLING, retry_after_hint=retry_after)
2011
+
2012
+ if context.transport_response.status >= 500:
2013
+ return RetryErrorInfo(error_type=RetryErrorType.SERVER_ERROR)
2014
+
2015
+ error_type = RetryErrorType.CLIENT_ERROR
2016
+ if isinstance(error, HasFault) and error.fault == "server":
2017
+ error_type = RetryErrorType.SERVER_ERROR
2018
+
2019
+ return RetryErrorInfo(error_type=error_type)
2020
+
2021
+ async def _execute_operation[Input: SerializeableShape, Output: DeserializeableShape](
2022
+ self,
2023
+ input: Input,
2024
+ plugins: list[Plugin],
2025
+ serialize: Callable[[Input, Config], Awaitable[HTTPRequest]],
2026
+ deserialize: Callable[[HTTPResponse, Config], Awaitable[Output]],
2027
+ config: Config,
2028
+ operation: APIOperation[Input, Output],
2029
+ request_future: Future[RequestContext[Any, HTTPRequest]] | None = None,
2030
+ response_future: Future[HTTPResponse] | None = None,
2031
+ ) -> Output:
2032
+ try:
2033
+ return await self._handle_execution(
2034
+ input, plugins, serialize, deserialize, config, operation,
2035
+ request_future, response_future,
2036
+ )
2037
+ except Exception as e:
2038
+ if request_future is not None and not request_future.done():
2039
+ request_future.set_exception(ServiceError(e))
2040
+ if response_future is not None and not response_future.done():
2041
+ response_future.set_exception(ServiceError(e))
2042
+
2043
+ # Make sure every exception that we throw is an instance of ServiceError so
2044
+ # customers can reliably catch everything we throw.
2045
+ if not isinstance(e, ServiceError):
2046
+ raise ServiceError(e) from e
2047
+ raise
2048
+
2049
+ async def _handle_execution[Input: SerializeableShape, Output: DeserializeableShape](
2050
+ self,
2051
+ input: Input,
2052
+ plugins: list[Plugin],
2053
+ serialize: Callable[[Input, Config], Awaitable[HTTPRequest]],
2054
+ deserialize: Callable[[HTTPResponse, Config], Awaitable[Output]],
2055
+ config: Config,
2056
+ operation: APIOperation[Input, Output],
2057
+ request_future: Future[RequestContext[Any, HTTPRequest]] | None,
2058
+ response_future: Future[HTTPResponse] | None,
2059
+ ) -> Output:
2060
+ operation_name = operation.schema.id.name
2061
+ logger.debug('Making request for operation "%s" with parameters: %s', operation_name, input)
2062
+ config = deepcopy(config)
2063
+ for plugin in plugins:
2064
+ plugin(config)
2065
+
2066
+ input_context = InputContext(request=input, properties=TypedProperties({"config": config}))
2067
+ transport_request: HTTPRequest | None = None
2068
+ output_context: OutputContext[Input, Output, HTTPRequest | None, HTTPResponse | None] | None = None
2069
+
2070
+ client_interceptors = cast(
2071
+ list[Interceptor[Input, Output, HTTPRequest, HTTPResponse]], list(config.interceptors)
2072
+ )
2073
+ interceptor_chain = InterceptorChain(client_interceptors)
2074
+
2075
+ try:
2076
+ # Step 1: Invoke read_before_execution
2077
+ interceptor_chain.read_before_execution(input_context)
2078
+
2079
+ # Step 2: Invoke the modify_before_serialization hooks
2080
+ input_context = replace(
2081
+ input_context,
2082
+ request=interceptor_chain.modify_before_serialization(input_context)
2083
+ )
2084
+
2085
+ # Step 3: Invoke the read_before_serialization hooks
2086
+ interceptor_chain.read_before_serialization(input_context)
2087
+
2088
+ # Step 4: Serialize the request
2089
+ logger.debug("Serializing request for: %s", input_context.request)
2090
+ transport_request = await serialize(input_context.request, config)
2091
+ request_context = RequestContext(
2092
+ request=input_context.request,
2093
+ transport_request=transport_request,
2094
+ properties=input_context.properties,
2095
+ )
2096
+ logger.debug("Serialization complete. Transport request: %s", request_context.transport_request)
2097
+
2098
+ # Step 5: Invoke read_after_serialization
2099
+ interceptor_chain.read_after_serialization(request_context)
2100
+
2101
+ # Step 6: Invoke modify_before_retry_loop
2102
+ request_context = replace(
2103
+ request_context,
2104
+ transport_request=interceptor_chain.modify_before_retry_loop(request_context)
2105
+ )
2106
+
2107
+ # Step 7: Acquire the retry token.
2108
+ retry_strategy = config.retry_strategy
2109
+ retry_token = retry_strategy.acquire_initial_retry_token()
2110
+
2111
+ while True:
2112
+ # Make an attempt
2113
+ output_context = await self._handle_attempt(
2114
+ deserialize,
2115
+ interceptor_chain,
2116
+ replace(
2117
+ request_context,
2118
+ transport_request = copy(request_context.transport_request)
2119
+ ),
2120
+ config,
2121
+ operation,
2122
+ request_future,
2123
+ )
2124
+
2125
+ if isinstance(output_context.response, Exception):
2126
+ # Step 7u: Reacquire retry token if the attempt failed
2127
+ try:
2128
+ retry_token = retry_strategy.refresh_retry_token_for_retry(
2129
+ token_to_renew=retry_token,
2130
+ error_info=self._classify_error(
2131
+ error=output_context.response,
2132
+ context=output_context,
2133
+ )
2134
+ )
2135
+ except SmithyRetryException:
2136
+ raise output_context.response
2137
+ logger.debug(
2138
+ "Retry needed. Attempting request #%s in %.4f seconds.",
2139
+ retry_token.retry_count + 1,
2140
+ retry_token.retry_delay
2141
+ )
2142
+ await sleep(retry_token.retry_delay)
2143
+ current_body = output_context.transport_request.body
2144
+ if (seek := getattr(current_body, "seek", None)) is not None:
2145
+ if iscoroutine((result := seek(0))):
2146
+ await result
2147
+ else:
2148
+ # Step 8: Invoke record_success
2149
+ retry_strategy.record_success(token=retry_token)
2150
+ if response_future is not None:
2151
+ response_future.set_result(
2152
+ output_context.transport_response # type: ignore
2153
+ )
2154
+ break
2155
+ except Exception as e:
2156
+ if output_context is not None:
2157
+ logger.exception("Exception occurred while handling: %s", output_context.response)
2158
+ output_context = replace(output_context, response=e)
2159
+ else:
2160
+ output_context = OutputContext(
2161
+ request=input_context.request,
2162
+ response=e,
2163
+ transport_request=transport_request,
2164
+ transport_response=None,
2165
+ properties=input_context.properties
2166
+ )
2167
+
2168
+ return await self._finalize_execution(interceptor_chain, output_context)
2169
+
2170
+ async def _handle_attempt[Input: SerializeableShape, Output: DeserializeableShape](
2171
+ self,
2172
+ deserialize: Callable[[HTTPResponse, Config], Awaitable[Output]],
2173
+ interceptor: Interceptor[Input, Output, HTTPRequest, HTTPResponse],
2174
+ context: RequestContext[Input, HTTPRequest],
2175
+ config: Config,
2176
+ operation: APIOperation[Input, Output],
2177
+ request_future: Future[RequestContext[Input, HTTPRequest]] | None,
2178
+ ) -> OutputContext[Input, Output, HTTPRequest, HTTPResponse | None]:
2179
+ transport_response: HTTPResponse | None = None
2180
+ try:
2181
+ # Step 7a: Invoke read_before_attempt
2182
+ interceptor.read_before_attempt(context)
2183
+
2184
+ # Step 7b: Invoke service_auth_scheme_resolver.resolve_auth_scheme
2185
+ auth_parameters: HTTPAuthParams = HTTPAuthParams(
2186
+ operation=operation.schema.id.name,
2187
+
2188
+ )
2189
+
2190
+ auth_options = config.http_auth_scheme_resolver.resolve_auth_scheme(
2191
+ auth_parameters=auth_parameters
2192
+ )
2193
+ auth_option: HTTPAuthOption | None = None
2194
+ for option in auth_options:
2195
+ if option.scheme_id in config.http_auth_schemes:
2196
+ auth_option = option
2197
+ break
2198
+
2199
+ signer: HTTPSigner[Any, Any] | None = None
2200
+ identity: Identity | None = None
2201
+
2202
+ if auth_option:
2203
+ auth_scheme = config.http_auth_schemes[auth_option.scheme_id]
2204
+
2205
+ # Step 7c: Invoke auth_scheme.identity_resolver
2206
+ identity_resolver = auth_scheme.identity_resolver(config=config)
2207
+
2208
+ # Step 7d: Invoke auth_scheme.signer
2209
+ signer = auth_scheme.signer
2210
+
2211
+ # Step 7e: Invoke identity_resolver.get_identity
2212
+ identity = await identity_resolver.get_identity(
2213
+ identity_properties=auth_option.identity_properties
2214
+ )
2215
+
2216
+ # Step 7f: Invoke endpoint_resolver.resolve_endpoint
2217
+ endpoint_resolver_parameters = EndpointResolverParams(
2218
+ operation=operation,
2219
+ input=context.request,
2220
+ context=context.properties
2221
+ )
2222
+ logger.debug("Calling endpoint resolver with parameters: %s", endpoint_resolver_parameters)
2223
+ endpoint = await config.endpoint_resolver.resolve_endpoint(
2224
+ endpoint_resolver_parameters
2225
+ )
2226
+ logger.debug("Endpoint resolver result: %s", endpoint)
2227
+ if not endpoint.uri.path:
2228
+ path = ""
2229
+ elif endpoint.uri.path.endswith("/"):
2230
+ path = endpoint.uri.path[:-1]
2231
+ else:
2232
+ path = endpoint.uri.path
2233
+ if context.transport_request.destination.path:
2234
+ path += context.transport_request.destination.path
2235
+ context.transport_request.destination = URI(
2236
+ scheme=endpoint.uri.scheme,
2237
+ host=context.transport_request.destination.host + endpoint.uri.host,
2238
+ path=path,
2239
+ port=endpoint.uri.port,
2240
+ query=context.transport_request.destination.query,
2241
+ )
2242
+
2243
+ if (headers := endpoint.properties.get("headers")) is not None:
2244
+ context.transport_request.fields.extend(headers)
2245
+
2246
+ # Step 7g: Invoke modify_before_signing
2247
+ context = replace(
2248
+ context,
2249
+ transport_request=interceptor.modify_before_signing(context)
2250
+ )
2251
+
2252
+ # Step 7h: Invoke read_before_signing
2253
+ interceptor.read_before_signing(context)
2254
+
2255
+ # Step 7i: sign the request
2256
+ if auth_option and signer:
2257
+ logger.debug("HTTP request to sign: %s", context.transport_request)
2258
+ logger.debug(
2259
+ "Signer properties: %s",
2260
+ auth_option.signer_properties
2261
+ )
2262
+ context = replace(
2263
+ context,
2264
+ transport_request= await signer.sign(
2265
+ http_request=context.transport_request,
2266
+ identity=identity,
2267
+ signing_properties=auth_option.signer_properties,
2268
+ )
2269
+ )
2270
+ logger.debug("Signed HTTP request: %s", context.transport_request)
2271
+
2272
+ # TODO - Move this to separate resolution/population function
2273
+ fields = context.transport_request.fields
2274
+ auth_value = fields["Authorization"].as_string() # type: ignore
2275
+ signature = re.split("Signature=", auth_value)[-1] # type: ignore
2276
+ context.properties["signature"] = signature.encode('utf-8')
2277
+
2278
+ identity_key: PropertyKey[Identity | None] = PropertyKey(
2279
+ key="identity",
2280
+ value_type=Identity | None # type: ignore
2281
+ )
2282
+ sp_key: PropertyKey[dict[str, Any]] = PropertyKey(
2283
+ key="signer_properties",
2284
+ value_type=dict[str, Any] # type: ignore
2285
+ )
2286
+ context.properties[identity_key] = identity
2287
+ context.properties[sp_key] = auth_option.signer_properties
2288
+
2289
+ # Step 7j: Invoke read_after_signing
2290
+ interceptor.read_after_signing(context)
2291
+
2292
+ # Step 7k: Invoke modify_before_transmit
2293
+ context = replace(
2294
+ context,
2295
+ transport_request=interceptor.modify_before_transmit(context)
2296
+ )
2297
+
2298
+ # Step 7l: Invoke read_before_transmit
2299
+ interceptor.read_before_transmit(context)
2300
+
2301
+ # Step 7m: Invoke http_client.send
2302
+ request_config = config.http_request_config or HTTPRequestConfiguration()
2303
+ logger.debug("HTTP request config: %s", request_config)
2304
+ logger.debug("Sending HTTP request: %s", context.transport_request)
2305
+
2306
+ if request_future is not None:
2307
+ response_task = asyncio.create_task(config.http_client.send(
2308
+ request=context.transport_request,
2309
+ request_config=request_config,
2310
+ ))
2311
+ request_future.set_result(context)
2312
+ transport_response = await response_task
2313
+ else:
2314
+ transport_response = await config.http_client.send(
2315
+ request=context.transport_request,
2316
+ request_config=request_config,
2317
+ )
2318
+
2319
+ response_context = ResponseContext(
2320
+ request=context.request,
2321
+ transport_request=context.transport_request,
2322
+ transport_response=transport_response,
2323
+ properties=context.properties
2324
+ )
2325
+ logger.debug("Received HTTP response: %s", response_context.transport_response)
2326
+
2327
+ # Step 7n: Invoke read_after_transmit
2328
+ interceptor.read_after_transmit(response_context)
2329
+
2330
+ # Step 7o: Invoke modify_before_deserialization
2331
+ response_context = replace(
2332
+ response_context,
2333
+ transport_response=interceptor.modify_before_deserialization(response_context)
2334
+ )
2335
+
2336
+ # Step 7p: Invoke read_before_deserialization
2337
+ interceptor.read_before_deserialization(response_context)
2338
+
2339
+ # Step 7q: deserialize
2340
+ logger.debug("Deserializing transport response: %s", response_context.transport_response)
2341
+ output = await deserialize(
2342
+ response_context.transport_response, config
2343
+ )
2344
+ output_context = OutputContext(
2345
+ request=response_context.request,
2346
+ response=output,
2347
+ transport_request=response_context.transport_request,
2348
+ transport_response=response_context.transport_response,
2349
+ properties=response_context.properties
2350
+ )
2351
+ logger.debug("Deserialization complete. Response: %s", output_context.response)
2352
+
2353
+ # Step 7r: Invoke read_after_deserialization
2354
+ interceptor.read_after_deserialization(output_context)
2355
+ except Exception as e:
2356
+ output_context: OutputContext[Input, Output, HTTPRequest, HTTPResponse] = OutputContext(
2357
+ request=context.request,
2358
+ response=e, # type: ignore
2359
+ transport_request=context.transport_request,
2360
+ transport_response=transport_response,
2361
+ properties=context.properties
2362
+ )
2363
+
2364
+ return await self._finalize_attempt(interceptor, output_context)
2365
+
2366
+ async def _finalize_attempt[Input: SerializeableShape, Output: DeserializeableShape](
2367
+ self,
2368
+ interceptor: Interceptor[Input, Output, HTTPRequest, HTTPResponse],
2369
+ context: OutputContext[Input, Output, HTTPRequest, HTTPResponse | None],
2370
+ ) -> OutputContext[Input, Output, HTTPRequest, HTTPResponse | None]:
2371
+ # Step 7s: Invoke modify_before_attempt_completion
2372
+ try:
2373
+ context = replace(
2374
+ context,
2375
+ response=interceptor.modify_before_attempt_completion(context)
2376
+ )
2377
+ except Exception as e:
2378
+ logger.exception("Exception occurred while handling: %s", context.response)
2379
+ context = replace(context, response=e)
2380
+
2381
+ # Step 7t: Invoke read_after_attempt
2382
+ try:
2383
+ interceptor.read_after_attempt(context)
2384
+ except Exception as e:
2385
+ context = replace(context, response=e)
2386
+
2387
+ return context
2388
+
2389
+ async def _finalize_execution[Input: SerializeableShape, Output: DeserializeableShape](
2390
+ self,
2391
+ interceptor: Interceptor[Input, Output, HTTPRequest, HTTPResponse],
2392
+ context: OutputContext[Input, Output, HTTPRequest | None, HTTPResponse | None],
2393
+ ) -> Output:
2394
+ try:
2395
+ # Step 9: Invoke modify_before_completion
2396
+ context = replace(
2397
+ context,
2398
+ response=interceptor.modify_before_completion(context)
2399
+ )
2400
+
2401
+ # Step 10: Invoke trace_probe.dispatch_events
2402
+ try:
2403
+ pass
2404
+ except Exception as e:
2405
+ # log and ignore exceptions
2406
+ logger.exception("Exception occurred while dispatching trace events: %s", e)
2407
+ pass
2408
+ except Exception as e:
2409
+ logger.exception("Exception occurred while handling: %s", context.response)
2410
+ context = replace(context, response=e)
2411
+
2412
+ # Step 11: Invoke read_after_execution
2413
+ try:
2414
+ interceptor.read_after_execution(context)
2415
+ except Exception as e:
2416
+ context = replace(context, response=e)
2417
+
2418
+ # Step 12: Return / throw
2419
+ if isinstance(context.response, Exception):
2420
+ raise context.response
2421
+
2422
+ # We may want to add some aspects of this context to the output types so we can
2423
+ # return it to the end-users.
2424
+ return context.response