aws_sdk_sagemaker_runtime_http2 0.9.0__tar.gz → 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. aws_sdk_sagemaker_runtime_http2-0.10.0/.changes/0.10.0.json +8 -0
  2. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/CHANGELOG.md +5 -0
  3. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/PKG-INFO +2 -2
  4. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/pyproject.toml +2 -2
  5. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/scripts/docs/generate_doc_stubs.py +47 -9
  6. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/__init__.py +1 -1
  7. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/client.py +75 -20
  8. aws_sdk_sagemaker_runtime_http2-0.10.0/src/aws_sdk_sagemaker_runtime_http2/config.py +175 -0
  9. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/user_agent.py +2 -2
  10. aws_sdk_sagemaker_runtime_http2-0.9.0/src/aws_sdk_sagemaker_runtime_http2/config.py +0 -180
  11. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.1.0.json +0 -0
  12. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.3.0.json +0 -0
  13. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.4.0.json +0 -0
  14. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.5.0.json +0 -0
  15. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.6.0.json +0 -0
  16. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.7.0.json +0 -0
  17. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.8.0.json +0 -0
  18. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.changes/0.9.0.json +0 -0
  19. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/.gitignore +0 -0
  20. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/LICENSE +0 -0
  21. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/Makefile +0 -0
  22. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/NOTICE +0 -0
  23. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/README.md +0 -0
  24. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/docs/README.md +0 -0
  25. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/docs/index.md +0 -0
  26. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/docs/stylesheets/extra.css +0 -0
  27. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/_private/__init__.py +0 -0
  28. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/_private/schemas.py +0 -0
  29. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/auth.py +0 -0
  30. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/src/aws_sdk_sagemaker_runtime_http2/models.py +0 -0
  31. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/tests/__init__.py +0 -0
  32. /aws_sdk_sagemaker_runtime_http2-0.9.0/tests/test_protocol.py → /aws_sdk_sagemaker_runtime_http2-0.10.0/tests/test_restjson_protocol.py +0 -0
  33. {aws_sdk_sagemaker_runtime_http2-0.9.0 → aws_sdk_sagemaker_runtime_http2-0.10.0}/zensical.toml +0 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "changes": [
3
+ {
4
+ "type": "dependency",
5
+ "description": "Bump `smithy-aws-core` from `~=0.9.0` to `~=0.10.0`."
6
+ }
7
+ ]
8
+ }
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.10.0
4
+
5
+ ### Dependencies
6
+ * Bump `smithy-aws-core` from `~=0.9.0` to `~=0.10.0`.
7
+
3
8
  ## v0.9.0
4
9
 
5
10
  ### Dependencies
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: aws_sdk_sagemaker_runtime_http2
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: aws_sdk_sagemaker_runtime_http2 client
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Programming Language :: Python :: 3.14
20
20
  Requires-Python: >=3.12
21
- Requires-Dist: smithy-aws-core[eventstream,json]~=0.9.0
21
+ Requires-Dist: smithy-aws-core[eventstream,json]~=0.10.0
22
22
  Requires-Dist: smithy-core~=0.8.0
23
23
  Requires-Dist: smithy-http[awscrt]~=0.4.0
24
24
  Description-Content-Type: text/markdown
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "aws_sdk_sagemaker_runtime_http2"
5
- version = "0.9.0"
5
+ version = "0.10.0"
6
6
  description = "aws_sdk_sagemaker_runtime_http2 client"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.12"
@@ -23,7 +23,7 @@ classifiers = [
23
23
  ]
24
24
 
25
25
  dependencies = [
26
- "smithy_aws_core[eventstream, json]~=0.9.0",
26
+ "smithy_aws_core[eventstream, json]~=0.10.0",
27
27
  "smithy_core~=0.8.0",
28
28
  "smithy_http[awscrt]~=0.4.0"
29
29
  ]
@@ -8,6 +8,7 @@ for the client, operations, models (structures, unions, enums), and errors.
8
8
 
9
9
  import argparse
10
10
  import logging
11
+ import re
11
12
  import sys
12
13
  from collections.abc import Sequence
13
14
  from dataclasses import dataclass
@@ -115,19 +116,43 @@ class ClientInfo:
115
116
  class DocStubGenerator:
116
117
  """Generate markdown API Reference stubs for AWS SDK for Python clients."""
117
118
 
118
- def __init__(self, client_dir: Path, output_dir: Path) -> None:
119
+ def __init__(self, client_dir: Path, output_dir: Path, service_name: str | None = None) -> None:
119
120
  """
120
121
  Initialize the documentation generator.
121
122
 
122
123
  Args:
123
124
  client_dir: Path to the client source directory
124
125
  output_dir: Path to the output directory for generated doc stubs
126
+ service_name: Display name for the service (e.g. the Smithy sdkId
127
+ "SNS"). When omitted, falls back to a title-cased derivation of
128
+ the package name, which does not preserve acronym casing.
125
129
  """
126
130
  self.client_dir = client_dir
127
131
  self.output_dir = output_dir
128
- # Extract service name from package name
129
- # (e.g., "aws_sdk_bedrock_runtime" -> "Bedrock Runtime")
130
- self.service_name = client_dir.name.replace("aws_sdk_", "").replace("_", " ").title()
132
+ # Use the explicit override, then the sdkId from the package, then
133
+ # fall back to a title-cased package name (does not keep acronym
134
+ # casing, so "sns" becomes "Sns").
135
+ self.service_name = (
136
+ service_name
137
+ or self._sdk_id_from_package(client_dir)
138
+ or client_dir.name.replace("aws_sdk_", "").replace("_", " ").title()
139
+ )
140
+
141
+ @staticmethod
142
+ def _sdk_id_from_package(client_dir: Path) -> str | None:
143
+ """
144
+ Read the authoritative service name (Smithy sdkId) from the package.
145
+
146
+ The generated ``_private/schemas.py`` carries the ``aws.api#service``
147
+ trait's ``sdkId`` (e.g. "SNS"), the same field the sidebar navigation
148
+ uses, so it keeps acronym casing that the package name does not.
149
+ Returns None if the file or value is absent.
150
+ """
151
+ schemas = client_dir / "_private" / "schemas.py"
152
+ if not schemas.is_file():
153
+ return None
154
+ match = re.search(r'"sdkId":\s*"([^"]+)"', schemas.read_text())
155
+ return match.group(1) if match else None
131
156
 
132
157
  def generate(self) -> bool:
133
158
  """
@@ -166,10 +191,13 @@ class DocStubGenerator:
166
191
  if not client_class:
167
192
  raise ValueError(f"No class ending with 'Client' found in {package_name}.client")
168
193
 
169
- config_class = config_module.members.get("Config")
194
+ config_class = self._find_class_with_suffix(config_module, "Config")
195
+ if not config_class:
196
+ raise ValueError(f"No class ending with 'Config' found in {package_name}.config")
197
+
170
198
  plugin_alias = config_module.members.get("Plugin")
171
- if not config_class or not plugin_alias:
172
- raise ValueError(f"Missing Config or Plugin in {package_name}.config")
199
+ if not plugin_alias:
200
+ raise ValueError(f"Missing Plugin in {package_name}.config")
173
201
 
174
202
  config = TypeInfo(name=config_class.name, module_path=config_class.path)
175
203
  plugin = TypeInfo(name=plugin_alias.name, module_path=plugin_alias.path)
@@ -194,8 +222,12 @@ class DocStubGenerator:
194
222
  )
195
223
 
196
224
  def _find_class_with_suffix(self, module: Module, suffix: str) -> Class | None:
197
- """Find the class in the module with a matching suffix."""
225
+ """Find the class defined in the module with a matching suffix."""
198
226
  for cls in module.classes.values():
227
+ # Skip imported classes so a same-package import (e.g. a *Config
228
+ # class re-exported from config.py) can't shadow the defined one.
229
+ if cls.is_imported:
230
+ continue
199
231
  if cls.name.endswith(suffix):
200
232
  return cls
201
233
  return None
@@ -616,6 +648,12 @@ def main() -> int:
616
648
  required=True,
617
649
  help="Output directory for generated doc stubs",
618
650
  )
651
+ parser.add_argument(
652
+ "-s",
653
+ "--service-name",
654
+ default=None,
655
+ help="Display name for the service (Smithy sdkId, e.g. 'SNS')",
656
+ )
619
657
 
620
658
  args = parser.parse_args()
621
659
  client_dir = args.client_dir.resolve()
@@ -626,7 +664,7 @@ def main() -> int:
626
664
  return 1
627
665
 
628
666
  try:
629
- generator = DocStubGenerator(client_dir, output_dir)
667
+ generator = DocStubGenerator(client_dir, output_dir, args.service_name)
630
668
  success = generator.generate()
631
669
  return 0 if success else 1
632
670
  except Exception as e:
@@ -1,3 +1,3 @@
1
1
  # Code generated by smithy-python-codegen DO NOT EDIT.
2
2
 
3
- __version__: str = "0.9.0"
3
+ __version__: str = "0.10.0"
@@ -1,19 +1,24 @@
1
1
  # Code generated by smithy-python-codegen DO NOT EDIT.
2
2
 
3
+ import asyncio
3
4
  from copy import deepcopy
4
5
  import logging
5
- from typing import Any, TYPE_CHECKING
6
+ from typing import Any, TYPE_CHECKING, cast
6
7
  import warnings
7
8
 
9
+ from smithy_aws_core.config import ConfigSource
10
+ from smithy_aws_core.identity import AWSCredentialsIdentity
11
+ from smithy_aws_core.identity.chain import IdentityChain
8
12
  from smithy_core.aio.client import ClientCall, RequestPipeline
9
13
  from smithy_core.aio.eventstream import DuplexEventStream
10
14
  from smithy_core.aio.retries import RetryStrategyResolver
11
15
  from smithy_core.exceptions import ExpectationNotMetError
12
16
  from smithy_core.interceptors import InterceptorChain
13
17
  from smithy_core.types import TypedProperties
18
+ from smithy_http.aio.interfaces import HTTPClient
14
19
  from smithy_http.plugins import user_agent_plugin
15
20
 
16
- from .config import Config, Plugin
21
+ from .config import AsyncSageMakerRuntimeHTTP2Config, Plugin
17
22
  from .models import (
18
23
  INVOKE_ENDPOINT_WITH_BIDIRECTIONAL_STREAM,
19
24
  InvokeEndpointWithBidirectionalStreamInput,
@@ -32,7 +37,9 @@ class AsyncSageMakerRuntimeHTTP2Client:
32
37
  """The Amazon SageMaker AI runtime HTTP/2 API."""
33
38
 
34
39
  def __init__(
35
- self, config: Config | None = None, plugins: list[Plugin] | None = None
40
+ self,
41
+ config: AsyncSageMakerRuntimeHTTP2Config | None = None,
42
+ plugins: list[Plugin] | None = None,
36
43
  ):
37
44
  """
38
45
  Constructor for `AsyncSageMakerRuntimeHTTP2Client`.
@@ -42,19 +49,52 @@ class AsyncSageMakerRuntimeHTTP2Client:
42
49
  Optional configuration for the client. Here you can set things like
43
50
  the endpoint for HTTP services or auth credentials.
44
51
  plugins:
45
- A list of callables that modify the configuration dynamically. These
46
- can be used to set defaults, for example.
52
+ A list of callables applied once to the client's base configuration.
53
+ Their changes are inherited by every operation invocation.
47
54
  """
48
- self._config = config or Config()
49
-
50
- client_plugins: list[Plugin] = [aws_user_agent_plugin, user_agent_plugin]
51
- if plugins:
52
- client_plugins.extend(plugins)
53
-
54
- for plugin in client_plugins:
55
- plugin(self._config)
56
-
55
+ self._config = config
56
+ self._plugins = plugins
57
+ self._derive_lock = asyncio.Lock()
58
+ self._setup_done = False
57
59
  self._retry_strategy_resolver = RetryStrategyResolver()
60
+ self._client_plugins: list[Plugin] = [aws_user_agent_plugin, user_agent_plugin]
61
+
62
+ async def _ensure_setup(self) -> None:
63
+ if not self._setup_done:
64
+ async with self._derive_lock:
65
+ if not self._setup_done:
66
+ if self._config is None:
67
+ config = await AsyncSageMakerRuntimeHTTP2Config.resolve()
68
+ else:
69
+ # Copy so plugins don't mutate the caller's config.
70
+ config = deepcopy(self._config)
71
+ for plugin in self._client_plugins:
72
+ plugin(config)
73
+ if self._plugins:
74
+ for plugin in self._plugins:
75
+ plugin(config)
76
+ self._config = config
77
+
78
+ if self._config.aws_credentials_identity_resolver is None:
79
+ config_context = self._config.resolution_context()
80
+ config_file = None
81
+ profile_name = None
82
+ if config_context is not None:
83
+ config_file = await config_context.parsed_profiles()
84
+ if config_context.profile_source is ConfigSource.OVERRIDE:
85
+ profile_name = config_context.profile_name
86
+ self._config.aws_credentials_identity_resolver = (
87
+ await IdentityChain.create(
88
+ AWSCredentialsIdentity,
89
+ config_file=config_file,
90
+ profile_name=profile_name,
91
+ region_override=self._config.region,
92
+ http_client=cast(
93
+ HTTPClient | None, self._config.transport
94
+ ),
95
+ )
96
+ )
97
+ self._setup_done = True
58
98
 
59
99
  async def invoke_endpoint_with_bidirectional_stream(
60
100
  self,
@@ -117,16 +157,31 @@ class AsyncSageMakerRuntimeHTTP2Client:
117
157
  operation_plugins: list[Plugin] = []
118
158
  if plugins:
119
159
  operation_plugins.extend(plugins)
120
- config = deepcopy(self._config)
121
- for plugin in operation_plugins:
122
- plugin(config)
123
- if config.protocol is None or config.transport is None:
160
+ await self._ensure_setup()
161
+ assert self._config is not None
162
+ if operation_plugins:
163
+ # Keep operation-plugin mutations scoped to this call.
164
+ config = deepcopy(self._config)
165
+ for plugin in operation_plugins:
166
+ plugin(config)
167
+ else:
168
+ config = self._config
169
+ if (
170
+ config.protocol is None
171
+ or config.transport is None
172
+ or config.endpoint_resolver is None
173
+ or config.auth_scheme_resolver is None
174
+ or config.auth_schemes is None
175
+ ):
124
176
  raise ExpectationNotMetError(
125
- "protocol and transport MUST be set on the config to make calls."
177
+ "protocol, transport, endpoint_resolver, auth_scheme_resolver,"
178
+ " and auth_schemes MUST be set on the config to make calls."
126
179
  )
127
180
 
128
181
  retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy(
129
- retry_strategy=config.retry_strategy
182
+ retry_strategy=config.retry_strategy,
183
+ retry_mode=config.retry_mode,
184
+ max_attempts=config.max_attempts,
130
185
  )
131
186
 
132
187
  pipeline = RequestPipeline(protocol=config.protocol, transport=config.transport)
@@ -0,0 +1,175 @@
1
+ # Code generated by smithy-python-codegen DO NOT EDIT.
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import Any, Callable, ClassVar, Self, TypeAlias, Union, Unpack
5
+
6
+ from smithy_aws_core.aio.protocols import RestJsonClientProtocol
7
+ from smithy_aws_core.auth import SigV4AuthScheme
8
+ from smithy_aws_core.config import AwsConfigOverrides, FileSystem
9
+ from smithy_aws_core.config.aws_config import AsyncAwsConfig
10
+ from smithy_aws_core.config.resolvers import EndpointUriResolver
11
+ from smithy_aws_core.config.types import FieldSpec
12
+ from smithy_aws_core.endpoints.standard_regional import (
13
+ StandardRegionalEndpointsResolver,
14
+ )
15
+ from smithy_aws_core.identity import AWSCredentialsIdentity, AWSIdentityProperties
16
+ from smithy_core.aio.interfaces import ClientProtocol, EndpointResolver
17
+ from smithy_core.aio.interfaces.auth import AuthScheme
18
+ from smithy_core.aio.interfaces.identity import IdentityResolver
19
+ from smithy_core.interceptors import Interceptor
20
+ from smithy_core.shapes import ShapeID
21
+ from smithy_http.aio.crt import AWSCRTHTTPClient
22
+
23
+ from ._private.schemas import (
24
+ AMAZON_SAGE_MAKER_RUNTIME_HTTP2 as _SCHEMA_AMAZON_SAGE_MAKER_RUNTIME_HTTP2,
25
+ )
26
+ from .auth import HTTPAuthSchemeResolver
27
+ from .models import (
28
+ InvokeEndpointWithBidirectionalStreamInput,
29
+ InvokeEndpointWithBidirectionalStreamOutput,
30
+ )
31
+
32
+
33
+ _ServiceInterceptor = Union[
34
+ Interceptor[
35
+ InvokeEndpointWithBidirectionalStreamInput,
36
+ InvokeEndpointWithBidirectionalStreamOutput,
37
+ Any,
38
+ Any,
39
+ ]
40
+ ]
41
+
42
+
43
+ class _AsyncSageMakerRuntimeHTTP2ConfigOverrides(AwsConfigOverrides, total=False):
44
+ endpoint_resolver: EndpointResolver | None
45
+ protocol: ClientProtocol[Any, Any] | None
46
+ auth_schemes: dict[ShapeID, AuthScheme[Any, Any, Any, Any]] | None
47
+ auth_scheme_resolver: HTTPAuthSchemeResolver | None
48
+
49
+
50
+ @dataclass(kw_only=True, repr=False, init=False)
51
+ class AsyncSageMakerRuntimeHTTP2Config(AsyncAwsConfig):
52
+ """SageMaker Runtime HTTP2 configuration (async-resolved)."""
53
+
54
+ endpoint_resolver: EndpointResolver | None = None
55
+ """
56
+ The endpoint resolver used to resolve the final endpoint per-operation
57
+ based on the configuration.
58
+ """
59
+
60
+ protocol: ClientProtocol[Any, Any] | None = None
61
+ """The protocol to serialize and deserialize requests with."""
62
+
63
+ interceptors: list[_ServiceInterceptor] = field(default_factory=lambda: [])
64
+ """
65
+ The list of interceptors, which are hooks that are called during the
66
+ execution of a request.
67
+ """
68
+
69
+ auth_schemes: dict[ShapeID, AuthScheme[Any, Any, Any, Any]] | None = None
70
+ """A map of auth scheme ids to auth schemes."""
71
+
72
+ auth_scheme_resolver: HTTPAuthSchemeResolver | None = None
73
+ """
74
+ An auth scheme resolver that determines the auth scheme for each
75
+ operation.
76
+ """
77
+
78
+ aws_credentials_identity_resolver: (
79
+ IdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties] | None
80
+ ) = None
81
+ """Resolves AWS Credentials. Required for operations that use Sigv4 Auth."""
82
+
83
+ region: str | None = None
84
+ """
85
+ The AWS region to connect to. The configured region is used to determine
86
+ the service endpoint.
87
+ """
88
+
89
+ aws_access_key_id: str | None = None
90
+ """The identifier for a secret access key."""
91
+
92
+ aws_secret_access_key: str | None = None
93
+ """A secret access key that can be used to sign requests."""
94
+
95
+ aws_session_token: str | None = None
96
+ """The session token used with temporary AWS credentials."""
97
+
98
+ user_agent_extra: str | None = None
99
+ """Additional suffix to be added to the User-Agent header."""
100
+
101
+ sdk_ua_app_id: str | None = None
102
+ """
103
+ A unique and opaque application ID that is appended to the User-Agent
104
+ header.
105
+ """
106
+
107
+ _FIELDS: ClassVar[dict[str, FieldSpec]] = {
108
+ "aws_credentials_identity_resolver": FieldSpec(default=None),
109
+ "region": FieldSpec(default=None),
110
+ "aws_access_key_id": FieldSpec(default=None),
111
+ "aws_secret_access_key": FieldSpec(default=None),
112
+ "aws_session_token": FieldSpec(default=None),
113
+ "user_agent_extra": FieldSpec(default=None),
114
+ "sdk_ua_app_id": FieldSpec(default=None),
115
+ **AsyncAwsConfig._FIELDS,
116
+ "endpoint_uri": FieldSpec(
117
+ default=None, resolver=EndpointUriResolver("sagemaker_runtime_http2")
118
+ ),
119
+ "endpoint_resolver": FieldSpec(
120
+ default_factory=lambda: StandardRegionalEndpointsResolver(
121
+ endpoint_prefix="runtime.sagemaker"
122
+ )
123
+ ),
124
+ "protocol": FieldSpec(
125
+ default_factory=lambda: RestJsonClientProtocol(
126
+ _SCHEMA_AMAZON_SAGE_MAKER_RUNTIME_HTTP2
127
+ )
128
+ ),
129
+ "auth_schemes": FieldSpec(
130
+ default_factory=lambda: {
131
+ ShapeID("aws.auth#sigv4"): SigV4AuthScheme(service="sagemaker")
132
+ }
133
+ ),
134
+ "auth_scheme_resolver": FieldSpec(default_factory=HTTPAuthSchemeResolver),
135
+ "transport": FieldSpec(default_factory=lambda: AWSCRTHTTPClient()),
136
+ }
137
+
138
+ def set_auth_scheme(self, scheme: AuthScheme[Any, Any, Any, Any]) -> None:
139
+ """
140
+ Set an auth scheme implementation using its scheme ID. :param scheme:
141
+ The auth scheme to add or replace.
142
+ """
143
+ auth_schemes = dict(self.auth_schemes or {})
144
+ auth_schemes[scheme.scheme_id] = scheme
145
+ self.auth_schemes = auth_schemes
146
+
147
+ @classmethod
148
+ async def resolve( # pyright: ignore[reportIncompatibleMethodOverride]
149
+ cls,
150
+ *,
151
+ profile: str | None = None,
152
+ fs: FileSystem | None = None,
153
+ config_file_path: str | None = None,
154
+ credentials_file_path: str | None = None,
155
+ **overrides: Unpack[_AsyncSageMakerRuntimeHTTP2ConfigOverrides],
156
+ ) -> Self:
157
+ """
158
+ Resolve config from environment, config files, defaults, and explicit
159
+ overrides.
160
+ """
161
+ return await cls._resolve(
162
+ profile=profile,
163
+ fs=fs,
164
+ config_file_path=config_file_path,
165
+ credentials_file_path=credentials_file_path,
166
+ overrides=overrides,
167
+ )
168
+
169
+
170
+ Plugin: TypeAlias = Callable[[AsyncSageMakerRuntimeHTTP2Config], None]
171
+ """
172
+ A callable that customizes a client configuration. Service-level plugins
173
+ are applied once to the base configuration inherited by every operation.
174
+ Operation-level plugins apply only to a single operation invocation.
175
+ """
@@ -3,10 +3,10 @@
3
3
  from smithy_aws_core.interceptors.user_agent import UserAgentInterceptor
4
4
 
5
5
  from . import __version__
6
- from .config import Config
6
+ from .config import AsyncSageMakerRuntimeHTTP2Config
7
7
 
8
8
 
9
- def aws_user_agent_plugin(config: Config):
9
+ def aws_user_agent_plugin(config: AsyncSageMakerRuntimeHTTP2Config):
10
10
  config.interceptors.append(
11
11
  UserAgentInterceptor(
12
12
  ua_suffix=config.user_agent_extra,
@@ -1,180 +0,0 @@
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_aws_core.aio.protocols import RestJsonClientProtocol
7
- from smithy_aws_core.auth import SigV4AuthScheme
8
- from smithy_aws_core.endpoints.standard_regional import (
9
- StandardRegionalEndpointsResolver,
10
- )
11
- from smithy_aws_core.identity import AWSCredentialsIdentity, AWSIdentityProperties
12
- from smithy_core.aio.interfaces import ClientProtocol, ClientTransport, EndpointResolver
13
- from smithy_core.aio.interfaces.auth import AuthScheme
14
- from smithy_core.aio.interfaces.identity import IdentityResolver
15
- from smithy_core.aio.interfaces.retries import RetryStrategy
16
- from smithy_core.interceptors import Interceptor
17
- from smithy_core.interfaces import URI
18
- from smithy_core.retries import RetryStrategyOptions
19
- from smithy_core.shapes import ShapeID
20
- from smithy_http.aio.crt import AWSCRTHTTPClient
21
- from smithy_http.interfaces import HTTPRequestConfiguration
22
-
23
- from ._private.schemas import (
24
- AMAZON_SAGE_MAKER_RUNTIME_HTTP2 as _SCHEMA_AMAZON_SAGE_MAKER_RUNTIME_HTTP2,
25
- )
26
- from .auth import HTTPAuthSchemeResolver
27
- from .models import (
28
- InvokeEndpointWithBidirectionalStreamInput,
29
- InvokeEndpointWithBidirectionalStreamOutput,
30
- )
31
-
32
-
33
- _ServiceInterceptor = Union[
34
- Interceptor[
35
- InvokeEndpointWithBidirectionalStreamInput,
36
- InvokeEndpointWithBidirectionalStreamOutput,
37
- Any,
38
- Any,
39
- ]
40
- ]
41
-
42
-
43
- @dataclass(init=False)
44
- class Config:
45
- """Configuration for SageMaker Runtime HTTP2."""
46
-
47
- auth_scheme_resolver: HTTPAuthSchemeResolver
48
- """
49
- An auth scheme resolver that determines the auth scheme for each
50
- operation.
51
- """
52
-
53
- auth_schemes: dict[ShapeID, AuthScheme[Any, Any, Any, Any]]
54
- """A map of auth scheme ids to auth schemes."""
55
-
56
- aws_access_key_id: str | None
57
- """The identifier for a secret access key."""
58
-
59
- aws_credentials_identity_resolver: (
60
- IdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties] | None
61
- )
62
- """Resolves AWS Credentials. Required for operations that use Sigv4 Auth."""
63
-
64
- aws_secret_access_key: str | None
65
- """A secret access key that can be used to sign requests."""
66
-
67
- aws_session_token: str | None
68
- """An access key ID that identifies temporary security credentials."""
69
-
70
- endpoint_resolver: EndpointResolver
71
- """
72
- The endpoint resolver used to resolve the final endpoint per-operation
73
- based on the configuration.
74
- """
75
-
76
- endpoint_uri: str | URI | None
77
- """A static URI to route requests to."""
78
-
79
- http_request_config: HTTPRequestConfiguration | None
80
- """Configuration for individual HTTP requests."""
81
-
82
- interceptors: list[_ServiceInterceptor]
83
- """
84
- The list of interceptors, which are hooks that are called during the
85
- execution of a request.
86
- """
87
-
88
- protocol: ClientProtocol[Any, Any] | None
89
- """The protocol to serialize and deserialize requests with."""
90
-
91
- region: str | None
92
- """
93
- The AWS region to connect to. The configured region is used to determine
94
- the service endpoint.
95
- """
96
-
97
- retry_strategy: RetryStrategy | RetryStrategyOptions | None
98
- """
99
- The retry strategy or options for configuring retry behavior. Can be
100
- either a configured RetryStrategy or RetryStrategyOptions to create one.
101
- """
102
-
103
- sdk_ua_app_id: str | None
104
- """
105
- A unique and opaque application ID that is appended to the User-Agent
106
- header.
107
- """
108
-
109
- transport: ClientTransport[Any, Any] | None
110
- """
111
- The transport to use to send requests (e.g. an HTTP client). Operations
112
- with bidirectional event streams require a DuplexClientTransport, such
113
- as AWSCRTHTTPClient. Transports are assumed not to support duplex
114
- streaming unless they explicitly set SUPPORTS_DUPLEX_STREAMING to True.
115
- """
116
-
117
- user_agent_extra: str | None
118
- """Additional suffix to be added to the User-Agent header."""
119
-
120
- def __init__(
121
- self,
122
- *,
123
- auth_scheme_resolver: HTTPAuthSchemeResolver | None = None,
124
- auth_schemes: dict[ShapeID, AuthScheme[Any, Any, Any, Any]] | None = None,
125
- aws_access_key_id: str | None = None,
126
- aws_credentials_identity_resolver: IdentityResolver[
127
- AWSCredentialsIdentity, AWSIdentityProperties
128
- ]
129
- | None = None,
130
- aws_secret_access_key: str | None = None,
131
- aws_session_token: str | None = None,
132
- endpoint_resolver: EndpointResolver | None = None,
133
- endpoint_uri: str | URI | None = None,
134
- http_request_config: HTTPRequestConfiguration | None = None,
135
- interceptors: list[_ServiceInterceptor] | None = None,
136
- protocol: ClientProtocol[Any, Any] | None = None,
137
- region: str | None = None,
138
- retry_strategy: RetryStrategy | RetryStrategyOptions | None = None,
139
- sdk_ua_app_id: str | None = None,
140
- transport: ClientTransport[Any, Any] | None = None,
141
- user_agent_extra: str | None = None,
142
- ):
143
- self.auth_scheme_resolver = auth_scheme_resolver or HTTPAuthSchemeResolver()
144
- self.auth_schemes = auth_schemes or {
145
- ShapeID("aws.auth#sigv4"): SigV4AuthScheme(service="sagemaker")
146
- }
147
- self.aws_access_key_id = aws_access_key_id
148
- self.aws_credentials_identity_resolver = aws_credentials_identity_resolver
149
- self.aws_secret_access_key = aws_secret_access_key
150
- self.aws_session_token = aws_session_token
151
- self.endpoint_resolver = endpoint_resolver or StandardRegionalEndpointsResolver(
152
- endpoint_prefix="runtime.sagemaker"
153
- )
154
- self.endpoint_uri = endpoint_uri
155
- self.http_request_config = http_request_config
156
- self.interceptors = interceptors or []
157
- self.protocol = protocol or RestJsonClientProtocol(
158
- _SCHEMA_AMAZON_SAGE_MAKER_RUNTIME_HTTP2
159
- )
160
- self.region = region
161
- self.retry_strategy = retry_strategy
162
- self.sdk_ua_app_id = sdk_ua_app_id
163
- self.transport = transport or AWSCRTHTTPClient()
164
- self.user_agent_extra = user_agent_extra
165
-
166
- def set_auth_scheme(self, scheme: AuthScheme[Any, Any, Any, Any]) -> None:
167
- """
168
- Sets the implementation of an auth scheme.
169
-
170
- Using this method ensures the correct key is used.
171
-
172
- Args:
173
- scheme:
174
- The auth scheme to add.
175
- """
176
- self.auth_schemes[scheme.scheme_id] = scheme
177
-
178
-
179
- Plugin: TypeAlias = Callable[[Config], None]
180
- """A callable that allows customizing the config object on each request."""