Skip to content

Commit 1ff4850

Browse files
Add from_trait to sigv4
1 parent 2c989e2 commit 1ff4850

File tree

1 file changed

+5
-1
lines changed
  • packages/smithy-aws-core/src/smithy_aws_core/auth

1 file changed

+5
-1
lines changed

packages/smithy-aws-core/src/smithy_aws_core/auth/sigv4.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import re
4-
from typing import TYPE_CHECKING, Protocol
4+
from typing import TYPE_CHECKING, Protocol, Self
55

66
from aws_sdk_signers import AsyncEventSigner, AsyncSigV4Signer, SigV4SigningProperties
77
from smithy_core.aio.interfaces.auth import AuthScheme, EventSigner, Signer
@@ -117,3 +117,7 @@ def event_signer(
117117
initial_signature=signature.encode("utf-8"),
118118
event_encoder_cls=EventHeaderEncoder,
119119
)
120+
121+
@classmethod
122+
def from_trait(cls, trait: SigV4Trait, /) -> Self:
123+
return cls(service=trait.name)

0 commit comments

Comments
 (0)