superposition-sdk 0.94.1__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.
@@ -0,0 +1,240 @@
1
+ # Code generated by smithy-python-codegen DO NOT EDIT.
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any, Callable, TypeAlias, Union
5
+
6
+ from smithy_core.aio.endpoints import StaticEndpointResolver
7
+ from smithy_core.aio.interfaces import EndpointResolver as _EndpointResolver
8
+ from smithy_core.interceptors import Interceptor
9
+ from smithy_core.interfaces import URI
10
+ from smithy_core.interfaces.retries import RetryStrategy
11
+ from smithy_core.retries import SimpleRetryStrategy
12
+ from smithy_http.aio.aiohttp import AIOHTTPClient
13
+ from smithy_http.aio.interfaces import HTTPClient
14
+ from smithy_http.aio.interfaces.auth import HTTPAuthScheme
15
+ from smithy_http.interfaces import HTTPRequestConfiguration
16
+
17
+ from .auth import HTTPAuthSchemeResolver
18
+ from .models import (
19
+ AddMembersToGroupInput,
20
+ AddMembersToGroupOutput,
21
+ ApplicableVariantsInput,
22
+ ApplicableVariantsOutput,
23
+ BulkOperationInput,
24
+ BulkOperationOutput,
25
+ ConcludeExperimentInput,
26
+ ConcludeExperimentOutput,
27
+ CreateContextInput,
28
+ CreateContextOutput,
29
+ CreateDefaultConfigInput,
30
+ CreateDefaultConfigOutput,
31
+ CreateDimensionInput,
32
+ CreateDimensionOutput,
33
+ CreateExperimentGroupInput,
34
+ CreateExperimentGroupOutput,
35
+ CreateExperimentInput,
36
+ CreateExperimentOutput,
37
+ CreateFunctionInput,
38
+ CreateFunctionOutput,
39
+ CreateOrganisationInput,
40
+ CreateOrganisationOutput,
41
+ CreateTypeTemplatesInput,
42
+ CreateTypeTemplatesOutput,
43
+ CreateWebhookInput,
44
+ CreateWebhookOutput,
45
+ CreateWorkspaceInput,
46
+ CreateWorkspaceOutput,
47
+ DeleteContextInput,
48
+ DeleteContextOutput,
49
+ DeleteDefaultConfigInput,
50
+ DeleteDefaultConfigOutput,
51
+ DeleteDimensionInput,
52
+ DeleteDimensionOutput,
53
+ DeleteExperimentGroupInput,
54
+ DeleteExperimentGroupOutput,
55
+ DeleteFunctionInput,
56
+ DeleteFunctionOutput,
57
+ DeleteTypeTemplatesInput,
58
+ DeleteTypeTemplatesOutput,
59
+ DeleteWebhookInput,
60
+ DeleteWebhookOutput,
61
+ DiscardExperimentInput,
62
+ DiscardExperimentOutput,
63
+ GetConfigFastInput,
64
+ GetConfigFastOutput,
65
+ GetConfigInput,
66
+ GetConfigOutput,
67
+ GetContextFromConditionInput,
68
+ GetContextFromConditionOutput,
69
+ GetContextInput,
70
+ GetContextOutput,
71
+ GetDefaultConfigInput,
72
+ GetDefaultConfigOutput,
73
+ GetDimensionInput,
74
+ GetDimensionOutput,
75
+ GetExperimentGroupInput,
76
+ GetExperimentGroupOutput,
77
+ GetExperimentInput,
78
+ GetExperimentOutput,
79
+ GetFunctionInput,
80
+ GetFunctionOutput,
81
+ GetOrganisationInput,
82
+ GetOrganisationOutput,
83
+ GetResolvedConfigInput,
84
+ GetResolvedConfigOutput,
85
+ GetTypeTemplateInput,
86
+ GetTypeTemplateOutput,
87
+ GetTypeTemplatesListInput,
88
+ GetTypeTemplatesListOutput,
89
+ GetVersionInput,
90
+ GetVersionOutput,
91
+ GetWebhookByEventInput,
92
+ GetWebhookByEventOutput,
93
+ GetWebhookInput,
94
+ GetWebhookOutput,
95
+ GetWorkspaceInput,
96
+ GetWorkspaceOutput,
97
+ ListAuditLogsInput,
98
+ ListAuditLogsOutput,
99
+ ListContextsInput,
100
+ ListContextsOutput,
101
+ ListDefaultConfigsInput,
102
+ ListDefaultConfigsOutput,
103
+ ListDimensionsInput,
104
+ ListDimensionsOutput,
105
+ ListExperimentGroupsInput,
106
+ ListExperimentGroupsOutput,
107
+ ListExperimentInput,
108
+ ListExperimentOutput,
109
+ ListFunctionInput,
110
+ ListFunctionOutput,
111
+ ListOrganisationInput,
112
+ ListOrganisationOutput,
113
+ ListVersionsInput,
114
+ ListVersionsOutput,
115
+ ListWebhookInput,
116
+ ListWebhookOutput,
117
+ ListWorkspaceInput,
118
+ ListWorkspaceOutput,
119
+ MigrateWorkspaceSchemaInput,
120
+ MigrateWorkspaceSchemaOutput,
121
+ MoveContextInput,
122
+ MoveContextOutput,
123
+ PauseExperimentInput,
124
+ PauseExperimentOutput,
125
+ PublishInput,
126
+ PublishOutput,
127
+ RampExperimentInput,
128
+ RampExperimentOutput,
129
+ RemoveMembersFromGroupInput,
130
+ RemoveMembersFromGroupOutput,
131
+ ResumeExperimentInput,
132
+ ResumeExperimentOutput,
133
+ TestInput,
134
+ TestOutput,
135
+ UpdateDefaultConfigInput,
136
+ UpdateDefaultConfigOutput,
137
+ UpdateDimensionInput,
138
+ UpdateDimensionOutput,
139
+ UpdateExperimentGroupInput,
140
+ UpdateExperimentGroupOutput,
141
+ UpdateFunctionInput,
142
+ UpdateFunctionOutput,
143
+ UpdateOrganisationInput,
144
+ UpdateOrganisationOutput,
145
+ UpdateOverrideInput,
146
+ UpdateOverrideOutput,
147
+ UpdateOverridesExperimentInput,
148
+ UpdateOverridesExperimentOutput,
149
+ UpdateTypeTemplatesInput,
150
+ UpdateTypeTemplatesOutput,
151
+ UpdateWebhookInput,
152
+ UpdateWebhookOutput,
153
+ UpdateWorkspaceInput,
154
+ UpdateWorkspaceOutput,
155
+ ValidateContextInput,
156
+ ValidateContextOutput,
157
+ WeightRecomputeInput,
158
+ WeightRecomputeOutput,
159
+ )
160
+
161
+
162
+ _ServiceInterceptor = Union[Interceptor[AddMembersToGroupInput, AddMembersToGroupOutput, Any, Any], Interceptor[ApplicableVariantsInput, ApplicableVariantsOutput, Any, Any], Interceptor[BulkOperationInput, BulkOperationOutput, Any, Any], Interceptor[ConcludeExperimentInput, ConcludeExperimentOutput, Any, Any], Interceptor[CreateContextInput, CreateContextOutput, Any, Any], Interceptor[CreateDefaultConfigInput, CreateDefaultConfigOutput, Any, Any], Interceptor[CreateDimensionInput, CreateDimensionOutput, Any, Any], Interceptor[CreateExperimentInput, CreateExperimentOutput, Any, Any], Interceptor[CreateExperimentGroupInput, CreateExperimentGroupOutput, Any, Any], Interceptor[CreateFunctionInput, CreateFunctionOutput, Any, Any], Interceptor[CreateOrganisationInput, CreateOrganisationOutput, Any, Any], Interceptor[CreateTypeTemplatesInput, CreateTypeTemplatesOutput, Any, Any], Interceptor[CreateWebhookInput, CreateWebhookOutput, Any, Any], Interceptor[CreateWorkspaceInput, CreateWorkspaceOutput, Any, Any], Interceptor[DeleteContextInput, DeleteContextOutput, Any, Any], Interceptor[DeleteDefaultConfigInput, DeleteDefaultConfigOutput, Any, Any], Interceptor[DeleteDimensionInput, DeleteDimensionOutput, Any, Any], Interceptor[DeleteExperimentGroupInput, DeleteExperimentGroupOutput, Any, Any], Interceptor[DeleteFunctionInput, DeleteFunctionOutput, Any, Any], Interceptor[DeleteTypeTemplatesInput, DeleteTypeTemplatesOutput, Any, Any], Interceptor[DeleteWebhookInput, DeleteWebhookOutput, Any, Any], Interceptor[DiscardExperimentInput, DiscardExperimentOutput, Any, Any], Interceptor[GetConfigInput, GetConfigOutput, Any, Any], Interceptor[GetConfigFastInput, GetConfigFastOutput, Any, Any], Interceptor[GetContextInput, GetContextOutput, Any, Any], Interceptor[GetContextFromConditionInput, GetContextFromConditionOutput, Any, Any], Interceptor[GetDefaultConfigInput, GetDefaultConfigOutput, Any, Any], Interceptor[GetDimensionInput, GetDimensionOutput, Any, Any], Interceptor[GetExperimentInput, GetExperimentOutput, Any, Any], Interceptor[GetExperimentGroupInput, GetExperimentGroupOutput, Any, Any], Interceptor[GetFunctionInput, GetFunctionOutput, Any, Any], Interceptor[GetOrganisationInput, GetOrganisationOutput, Any, Any], Interceptor[GetResolvedConfigInput, GetResolvedConfigOutput, Any, Any], Interceptor[GetTypeTemplateInput, GetTypeTemplateOutput, Any, Any], Interceptor[GetTypeTemplatesListInput, GetTypeTemplatesListOutput, Any, Any], Interceptor[GetVersionInput, GetVersionOutput, Any, Any], Interceptor[GetWebhookInput, GetWebhookOutput, Any, Any], Interceptor[GetWebhookByEventInput, GetWebhookByEventOutput, Any, Any], Interceptor[GetWorkspaceInput, GetWorkspaceOutput, Any, Any], Interceptor[ListAuditLogsInput, ListAuditLogsOutput, Any, Any], Interceptor[ListContextsInput, ListContextsOutput, Any, Any], Interceptor[ListDefaultConfigsInput, ListDefaultConfigsOutput, Any, Any], Interceptor[ListDimensionsInput, ListDimensionsOutput, Any, Any], Interceptor[ListExperimentInput, ListExperimentOutput, Any, Any], Interceptor[ListExperimentGroupsInput, ListExperimentGroupsOutput, Any, Any], Interceptor[ListFunctionInput, ListFunctionOutput, Any, Any], Interceptor[ListOrganisationInput, ListOrganisationOutput, Any, Any], Interceptor[ListVersionsInput, ListVersionsOutput, Any, Any], Interceptor[ListWebhookInput, ListWebhookOutput, Any, Any], Interceptor[ListWorkspaceInput, ListWorkspaceOutput, Any, Any], Interceptor[MigrateWorkspaceSchemaInput, MigrateWorkspaceSchemaOutput, Any, Any], Interceptor[MoveContextInput, MoveContextOutput, Any, Any], Interceptor[PauseExperimentInput, PauseExperimentOutput, Any, Any], Interceptor[PublishInput, PublishOutput, Any, Any], Interceptor[RampExperimentInput, RampExperimentOutput, Any, Any], Interceptor[RemoveMembersFromGroupInput, RemoveMembersFromGroupOutput, Any, Any], Interceptor[ResumeExperimentInput, ResumeExperimentOutput, Any, Any], Interceptor[TestInput, TestOutput, Any, Any], Interceptor[UpdateDefaultConfigInput, UpdateDefaultConfigOutput, Any, Any], Interceptor[UpdateDimensionInput, UpdateDimensionOutput, Any, Any], Interceptor[UpdateExperimentGroupInput, UpdateExperimentGroupOutput, Any, Any], Interceptor[UpdateFunctionInput, UpdateFunctionOutput, Any, Any], Interceptor[UpdateOrganisationInput, UpdateOrganisationOutput, Any, Any], Interceptor[UpdateOverrideInput, UpdateOverrideOutput, Any, Any], Interceptor[UpdateOverridesExperimentInput, UpdateOverridesExperimentOutput, Any, Any], Interceptor[UpdateTypeTemplatesInput, UpdateTypeTemplatesOutput, Any, Any], Interceptor[UpdateWebhookInput, UpdateWebhookOutput, Any, Any], Interceptor[UpdateWorkspaceInput, UpdateWorkspaceOutput, Any, Any], Interceptor[ValidateContextInput, ValidateContextOutput, Any, Any], Interceptor[WeightRecomputeInput, WeightRecomputeOutput, Any, Any]]
163
+ @dataclass(init=False)
164
+ class Config:
165
+ """Configuration for Superposition."""
166
+
167
+ endpoint_resolver: _EndpointResolver
168
+ endpoint_uri: str | URI | None
169
+ http_auth_scheme_resolver: HTTPAuthSchemeResolver
170
+ http_auth_schemes: dict[str, HTTPAuthScheme[Any, Any, Any, Any]]
171
+ http_client: HTTPClient
172
+ http_request_config: HTTPRequestConfiguration | None
173
+ interceptors: list[_ServiceInterceptor]
174
+ retry_strategy: RetryStrategy
175
+
176
+ def __init__(
177
+ self,
178
+ *,
179
+ endpoint_resolver: _EndpointResolver | None = None,
180
+ endpoint_uri: str | URI | None = None,
181
+ http_auth_scheme_resolver: HTTPAuthSchemeResolver | None = None,
182
+ http_auth_schemes: dict[str, HTTPAuthScheme[Any, Any, Any, Any]] | None = None,
183
+ http_client: HTTPClient | None = None,
184
+ http_request_config: HTTPRequestConfiguration | None = None,
185
+ interceptors: list[_ServiceInterceptor] | None = None,
186
+ retry_strategy: RetryStrategy | None = None,
187
+ ):
188
+ """Constructor.
189
+
190
+ :param endpoint_resolver:
191
+ The endpoint resolver used to resolve the final endpoint per-operation based on
192
+ the configuration.
193
+
194
+ :param endpoint_uri:
195
+ A static URI to route requests to.
196
+
197
+ :param http_auth_scheme_resolver:
198
+ An http auth scheme resolver that determines the auth scheme for each operation.
199
+
200
+ :param http_auth_schemes:
201
+ A map of http auth scheme ids to http auth schemes.
202
+
203
+ :param http_client:
204
+ The HTTP client used to make requests.
205
+
206
+ :param http_request_config:
207
+ Configuration for individual HTTP requests.
208
+
209
+ :param interceptors:
210
+ The list of interceptors, which are hooks that are called during the execution
211
+ of a request.
212
+
213
+ :param retry_strategy:
214
+ The retry strategy for issuing retry tokens and computing retry delays.
215
+
216
+ """
217
+ self.endpoint_resolver = endpoint_resolver or StaticEndpointResolver()
218
+ self.endpoint_uri = endpoint_uri
219
+ self.http_auth_scheme_resolver = http_auth_scheme_resolver or HTTPAuthSchemeResolver()
220
+ self.http_auth_schemes = http_auth_schemes or {
221
+ }
222
+
223
+ self.http_client = http_client or AIOHTTPClient()
224
+ self.http_request_config = http_request_config
225
+ self.interceptors = interceptors or []
226
+ self.retry_strategy = retry_strategy or SimpleRetryStrategy()
227
+
228
+ def set_http_auth_scheme(self, scheme: HTTPAuthScheme[Any, Any, Any, Any]) -> None:
229
+ """Sets the implementation of an auth scheme.
230
+
231
+ Using this method ensures the correct key is used.
232
+
233
+ :param scheme: The auth scheme to add.
234
+ """
235
+ self.http_auth_schemes[scheme.scheme_id] = scheme
236
+
237
+ #
238
+ # A callable that allows customizing the config object on each request.
239
+ #
240
+ Plugin: TypeAlias = Callable[[Config], None]