Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions codegen-output/aws-json-1-0/src/awsjson10/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import logging
from typing import Any, cast

from smithy_aws_core.aio.identity.chain import AsyncIdentityChain
from smithy_aws_core.config import ConfigSource
from smithy_aws_core.identity import AWSCredentialsIdentity
from smithy_aws_core.identity.chain import IdentityChain
from smithy_core.aio.client import AsyncClient, ClientCall, RequestPipeline
from smithy_core.aio.client import AsyncClient, AsyncClientCall, AsyncRequestPipeline
from smithy_core.deserializers import DeserializeableShape
from smithy_core.exceptions import ExpectationNotMetError
from smithy_core.schemas import APIOperation
from smithy_core.serializers import SerializeableShape
from smithy_http.aio.interfaces import HTTPClient
from smithy_http.aio.interfaces import AsyncHTTPClient
from smithy_http.plugins import user_agent_plugin

from .config import AsyncJSONRPC10Config, Plugin
Expand Down Expand Up @@ -141,12 +141,12 @@ async def _post_setup(self, config: AsyncJSONRPC10Config) -> None:
config_file = await config_context.parsed_profiles()
if config_context.profile_source is ConfigSource.OVERRIDE:
profile_name = config_context.profile_name
config.aws_credentials_identity_resolver = await IdentityChain.create(
config.aws_credentials_identity_resolver = await AsyncIdentityChain.create(
AWSCredentialsIdentity,
config_file=config_file,
profile_name=profile_name,
region_override=config.region,
http_client=cast(HTTPClient | None, config.transport),
http_client=cast(AsyncHTTPClient | None, config.transport),
)

async def _prepare_call[I: SerializeableShape, O: DeserializeableShape](
Expand All @@ -155,7 +155,7 @@ async def _prepare_call[I: SerializeableShape, O: DeserializeableShape](
operation: APIOperation[I, O],
default_plugins: list[Plugin],
plugins: list[Plugin] | None,
) -> tuple[RequestPipeline[Any, Any], ClientCall[I, O]]:
) -> tuple[AsyncRequestPipeline[Any, Any], AsyncClientCall[I, O]]:
if self._closed:
raise RuntimeError(
"Cannot invoke an operation on a client that has been closed."
Expand Down
58 changes: 28 additions & 30 deletions codegen-output/aws-json-1-0/src/awsjson10/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,20 @@
Unpack,
)

from smithy_aws_core.aio.protocols import AwsJson10ClientProtocol
from smithy_aws_core.auth import SigV4AuthScheme
from smithy_aws_core.config import AwsConfigOverrides, FileSystem
from smithy_aws_core.config.aws_config import AsyncAwsConfig
from smithy_aws_core.config.resolvers import EndpointUriResolver
from smithy_aws_core.config.types import FieldSpec
from smithy_aws_core.endpoints.standard_regional import (
StandardRegionalEndpointsResolver,
from smithy_aws_core.aio.auth.sigv4 import AsyncSigV4AuthScheme
from smithy_aws_core.aio.config import AsyncFileSystem
from smithy_aws_core.aio.config.aws_config import AsyncAwsConfig, AwsConfigOverrides
from smithy_aws_core.aio.config.resolvers import EndpointUriResolver
from smithy_aws_core.aio.endpoints.standard_regional import (
AsyncStandardRegionalEndpointsResolver,
)
from smithy_aws_core.aio.protocols import AsyncAwsJson10ClientProtocol
from smithy_aws_core.config.types import FieldSpec
from smithy_aws_core.identity import AWSCredentialsIdentity, AWSIdentityProperties
from smithy_core.aio.interfaces import (
ClientProtocol,
EndpointResolver,
ProtocolConstructor,
ProtocolSettings,
)
from smithy_core.aio.interfaces.auth import AuthScheme
from smithy_core.aio.interfaces.identity import IdentityResolver
from smithy_core.aio.interfaces import AsyncClientProtocol, AsyncEndpointResolver
from smithy_core.aio.interfaces.auth import AsyncAuthScheme
from smithy_core.aio.interfaces.identity import AsyncIdentityResolver
from smithy_core.interfaces import ProtocolConstructor, ProtocolSettings
from smithy_core.interfaces.auth import AuthSchemeResolver
from smithy_core.shapes import ShapeID
from smithy_http.aio.aiohttp import AIOHTTPClient
Expand Down Expand Up @@ -132,29 +128,31 @@


class _AsyncJSONRPC10ConfigOverrides(AwsConfigOverrides, total=False):
endpoint_resolver: EndpointResolver | None
endpoint_resolver: AsyncEndpointResolver | None
protocol: (
ClientProtocol[Any, Any] | ProtocolConstructor[ClientProtocol[Any, Any]] | None
AsyncClientProtocol[Any, Any]
| ProtocolConstructor[AsyncClientProtocol[Any, Any]]
| None
)
auth_schemes: dict[ShapeID, AuthScheme[Any, Any, Any, Any]] | None
auth_schemes: dict[ShapeID, AsyncAuthScheme[Any, Any, Any, Any]] | None
auth_scheme_resolver: AuthSchemeResolver | None


@dataclass(kw_only=True, repr=False, init=False)
class AsyncJSONRPC10Config(AsyncAwsConfig):
"""JSON RPC 10 configuration (async-resolved)."""

endpoint_resolver: EndpointResolver | None = None
endpoint_resolver: AsyncEndpointResolver | None = None
"""
The endpoint resolver used to resolve the final endpoint per-operation
based on the configuration.
"""

protocol: ClientProtocol[Any, Any] | None = None
protocol: AsyncClientProtocol[Any, Any] | None = None
"""
Pass a protocol class reference from smithy_aws_core.aio.protocols to
select the protocol, e.g. protocol=AwsJson10ClientProtocol. For custom
protocols a protocol instance may also be passed.
select the protocol, e.g. protocol=AsyncAwsJson10ClientProtocol. For
custom protocols a protocol instance may also be passed.
"""

interceptors: list[_ServiceInterceptor] = field(default_factory=lambda: [])
Expand All @@ -163,7 +161,7 @@ class AsyncJSONRPC10Config(AsyncAwsConfig):
execution of a request.
"""

auth_schemes: dict[ShapeID, AuthScheme[Any, Any, Any, Any]] | None = None
auth_schemes: dict[ShapeID, AsyncAuthScheme[Any, Any, Any, Any]] | None = None
"""A map of auth scheme ids to auth schemes."""

auth_scheme_resolver: AuthSchemeResolver | None = None
Expand All @@ -173,7 +171,7 @@ class AsyncJSONRPC10Config(AsyncAwsConfig):
"""

aws_credentials_identity_resolver: (
IdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties] | None
AsyncIdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties] | None
) = None
"""Resolves AWS Credentials. Required for operations that use Sigv4 Auth."""

Expand Down Expand Up @@ -214,24 +212,24 @@ class AsyncJSONRPC10Config(AsyncAwsConfig):
default=None, resolver=EndpointUriResolver("json_rpc_10")
),
"endpoint_resolver": FieldSpec(
default_factory=lambda: StandardRegionalEndpointsResolver(
default_factory=lambda: AsyncStandardRegionalEndpointsResolver(
endpoint_prefix="jsonrpc10"
)
),
"protocol": FieldSpec(
default_factory=lambda: AwsJson10ClientProtocol(_PROTOCOL_SETTINGS),
default_factory=lambda: AsyncAwsJson10ClientProtocol(_PROTOCOL_SETTINGS),
converter=lambda p: p(_PROTOCOL_SETTINGS) if isinstance(p, type) else p,
),
"auth_schemes": FieldSpec(
default_factory=lambda: {
ShapeID("aws.auth#sigv4"): SigV4AuthScheme(service="jsonrpc10")
ShapeID("aws.auth#sigv4"): AsyncSigV4AuthScheme(service="jsonrpc10")
}
),
"auth_scheme_resolver": FieldSpec(default_factory=HTTPAuthSchemeResolver),
"transport": FieldSpec(default_factory=lambda: AIOHTTPClient()),
}

def set_auth_scheme(self, scheme: AuthScheme[Any, Any, Any, Any]) -> None:
def set_auth_scheme(self, scheme: AsyncAuthScheme[Any, Any, Any, Any]) -> None:
"""
Set an auth scheme implementation using its scheme ID. :param scheme:
The auth scheme to add or replace.
Expand All @@ -245,7 +243,7 @@ async def resolve( # pyright: ignore[reportIncompatibleMethodOverride]
cls,
*,
profile: str | None = None,
fs: FileSystem | None = None,
fs: AsyncFileSystem | None = None,
config_file_path: str | None = None,
credentials_file_path: str | None = None,
**overrides: Unpack[_AsyncJSONRPC10ConfigOverrides],
Expand Down
Loading
Loading