boto3-refresh-session 2.0.8__tar.gz → 2.0.10__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.
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/PKG-INFO +1 -1
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/__init__.py +1 -1
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/custom.py +19 -9
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/ecs.py +3 -3
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/iot/certificate.typed +2 -2
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/iot/cognito.typed +2 -2
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/sts.py +3 -2
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/utils.py +17 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/pyproject.toml +1 -1
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/LICENSE +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/NOTICE +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/README.md +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/exceptions.py +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/__init__.py +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/iot/__init__.typed +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/iot/core.typed +0 -0
- {boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/session.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: boto3-refresh-session
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.10
|
4
4
|
Summary: A simple Python package for refreshing the temporary security credentials in a boto3.session.Session object automatically.
|
5
5
|
License: MIT
|
6
6
|
Keywords: boto3,botocore,aws,sts,ecs,credentials,token,refresh
|
{boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/__init__.py
RENAMED
@@ -4,7 +4,7 @@ from .methods.sts import STSRefreshableSession
|
|
4
4
|
from .session import RefreshableSession
|
5
5
|
|
6
6
|
__all__ = ["RefreshableSession"]
|
7
|
-
__version__ = "2.0.
|
7
|
+
__version__ = "2.0.10"
|
8
8
|
__title__ = "boto3-refresh-session"
|
9
9
|
__author__ = "Mike Letts"
|
10
10
|
__maintainer__ = "Mike Letts"
|
{boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/custom.py
RENAMED
@@ -6,7 +6,13 @@ from typing import Any, Callable
|
|
6
6
|
|
7
7
|
from ..exceptions import BRSError, BRSWarning
|
8
8
|
from ..session import BaseRefreshableSession
|
9
|
-
from ..utils import
|
9
|
+
from ..utils import (
|
10
|
+
CustomCredentialsMethod,
|
11
|
+
CustomCredentialsMethodArgs,
|
12
|
+
Identity,
|
13
|
+
TemporaryCredentials,
|
14
|
+
refreshable_session,
|
15
|
+
)
|
10
16
|
|
11
17
|
|
12
18
|
@refreshable_session
|
@@ -18,11 +24,11 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
|
|
18
24
|
|
19
25
|
Parameters
|
20
26
|
----------
|
21
|
-
custom_credentials_method:
|
27
|
+
custom_credentials_method: CustomCredentialsMethod
|
22
28
|
Required. Accepts a callable object that returns temporary AWS
|
23
29
|
security credentials. That object must return a dictionary containing
|
24
30
|
'access_key', 'secret_key', 'token', and 'expiry_time' when called.
|
25
|
-
custom_credentials_method_args :
|
31
|
+
custom_credentials_method_args : CustomCredentialsMethodArgs, optional
|
26
32
|
Optional keyword arguments for the function passed to the
|
27
33
|
``custom_credentials_method`` parameter.
|
28
34
|
defer_refresh : bool, optional
|
@@ -62,8 +68,10 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
|
|
62
68
|
|
63
69
|
def __init__(
|
64
70
|
self,
|
65
|
-
custom_credentials_method:
|
66
|
-
custom_credentials_method_args:
|
71
|
+
custom_credentials_method: CustomCredentialsMethod,
|
72
|
+
custom_credentials_method_args: (
|
73
|
+
CustomCredentialsMethodArgs | None
|
74
|
+
) = None,
|
67
75
|
**kwargs,
|
68
76
|
):
|
69
77
|
if "refresh_method" in kwargs:
|
@@ -75,8 +83,10 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
|
|
75
83
|
|
76
84
|
# initializing BRSSession
|
77
85
|
super().__init__(refresh_method="custom", **kwargs)
|
78
|
-
self._custom_get_credentials =
|
79
|
-
|
86
|
+
self._custom_get_credentials: CustomCredentialsMethod = (
|
87
|
+
custom_credentials_method
|
88
|
+
)
|
89
|
+
self._custom_get_credentials_args: CustomCredentialsMethodArgs = (
|
80
90
|
custom_credentials_method_args
|
81
91
|
if custom_credentials_method_args is not None
|
82
92
|
else {}
|
@@ -97,12 +107,12 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
|
|
97
107
|
|
98
108
|
return credentials
|
99
109
|
|
100
|
-
def get_identity(self) ->
|
110
|
+
def get_identity(self) -> Identity:
|
101
111
|
"""Returns metadata about the custom credential getter.
|
102
112
|
|
103
113
|
Returns
|
104
114
|
-------
|
105
|
-
|
115
|
+
Identity
|
106
116
|
Dict containing information about the custom credential getter.
|
107
117
|
"""
|
108
118
|
|
{boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/ecs.py
RENAMED
@@ -8,7 +8,7 @@ import requests
|
|
8
8
|
|
9
9
|
from ..exceptions import BRSError, BRSWarning
|
10
10
|
from ..session import BaseRefreshableSession
|
11
|
-
from ..utils import TemporaryCredentials, refreshable_session
|
11
|
+
from ..utils import Identity, TemporaryCredentials, refreshable_session
|
12
12
|
|
13
13
|
_ECS_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"
|
14
14
|
_ECS_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"
|
@@ -101,12 +101,12 @@ class ECSRefreshableSession(BaseRefreshableSession, registry_key="ecs"):
|
|
101
101
|
"expiry_time": credentials.get("Expiration"), # already ISO8601
|
102
102
|
}
|
103
103
|
|
104
|
-
def get_identity(self) ->
|
104
|
+
def get_identity(self) -> Identity:
|
105
105
|
"""Returns metadata about ECS.
|
106
106
|
|
107
107
|
Returns
|
108
108
|
-------
|
109
|
-
|
109
|
+
Identity
|
110
110
|
Dict containing metadata about ECS.
|
111
111
|
"""
|
112
112
|
|
@@ -4,7 +4,7 @@ from pathlib import Path
|
|
4
4
|
from typing import Any
|
5
5
|
|
6
6
|
from ...exceptions import BRSError
|
7
|
-
from ...utils import PKCS11, TemporaryCredentials, refreshable_session
|
7
|
+
from ...utils import Identity, PKCS11, TemporaryCredentials, refreshable_session
|
8
8
|
from .core import BaseIoTRefreshableSession
|
9
9
|
|
10
10
|
|
@@ -52,4 +52,4 @@ class IoTCertificateRefreshableSession(
|
|
52
52
|
|
53
53
|
def _get_credentials(self) -> TemporaryCredentials: ...
|
54
54
|
|
55
|
-
def get_identity(self) ->
|
55
|
+
def get_identity(self) -> Identity: ...
|
@@ -2,7 +2,7 @@ __all__ = ["IoTCognitoRefreshableSession"]
|
|
2
2
|
|
3
3
|
from typing import Any
|
4
4
|
|
5
|
-
from ...utils import TemporaryCredentials, refreshable_session
|
5
|
+
from ...utils import Identity, TemporaryCredentials, refreshable_session
|
6
6
|
from .core import BaseIoTRefreshableSession
|
7
7
|
|
8
8
|
|
@@ -14,4 +14,4 @@ class IoTCognitoRefreshableSession(
|
|
14
14
|
|
15
15
|
def _get_credentials(self) -> TemporaryCredentials: ...
|
16
16
|
|
17
|
-
def get_identity(self) ->
|
17
|
+
def get_identity(self) -> Identity: ...
|
{boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/methods/sts.py
RENAMED
@@ -8,6 +8,7 @@ from ..exceptions import BRSWarning
|
|
8
8
|
from ..session import BaseRefreshableSession
|
9
9
|
from ..utils import (
|
10
10
|
AssumeRoleParams,
|
11
|
+
Identity,
|
11
12
|
STSClientParams,
|
12
13
|
TemporaryCredentials,
|
13
14
|
refreshable_session,
|
@@ -85,12 +86,12 @@ class STSRefreshableSession(BaseRefreshableSession, registry_key="sts"):
|
|
85
86
|
"expiry_time": temporary_credentials.get("Expiration").isoformat(),
|
86
87
|
}
|
87
88
|
|
88
|
-
def get_identity(self) ->
|
89
|
+
def get_identity(self) -> Identity:
|
89
90
|
"""Returns metadata about the identity assumed.
|
90
91
|
|
91
92
|
Returns
|
92
93
|
-------
|
93
|
-
|
94
|
+
Identity
|
94
95
|
Dict containing caller identity according to AWS STS.
|
95
96
|
"""
|
96
97
|
|
@@ -10,6 +10,9 @@ from typing import (
|
|
10
10
|
Generic,
|
11
11
|
List,
|
12
12
|
Literal,
|
13
|
+
Mapping,
|
14
|
+
Protocol,
|
15
|
+
TypeAlias,
|
13
16
|
TypedDict,
|
14
17
|
TypeVar,
|
15
18
|
cast,
|
@@ -52,6 +55,9 @@ RegistryKey = TypeVar("RegistryKey", bound=str)
|
|
52
55
|
#: Type alias for a generic refreshable session type.
|
53
56
|
BRSSessionType = TypeVar("BRSSessionType", bound="BRSSession")
|
54
57
|
|
58
|
+
#: Type alias for values returned by get_identity
|
59
|
+
Identity: TypeAlias = dict[str, Any]
|
60
|
+
|
55
61
|
|
56
62
|
def refreshable_session(
|
57
63
|
cls: type[BRSSessionType],
|
@@ -126,6 +132,17 @@ class TemporaryCredentials(TypedDict):
|
|
126
132
|
expiry_time: datetime | str
|
127
133
|
|
128
134
|
|
135
|
+
class _CustomCredentialsMethod(Protocol):
|
136
|
+
def __call__(self, **kwargs: Any) -> TemporaryCredentials: ...
|
137
|
+
|
138
|
+
|
139
|
+
#: Type alias for custom credential retrieval methods.
|
140
|
+
CustomCredentialsMethod: TypeAlias = _CustomCredentialsMethod
|
141
|
+
|
142
|
+
#: Type alias for custom credential method arguments.
|
143
|
+
CustomCredentialsMethodArgs: TypeAlias = Mapping[str, Any]
|
144
|
+
|
145
|
+
|
129
146
|
class RefreshableTemporaryCredentials(TypedDict):
|
130
147
|
"""Refreshable IAM credentials.
|
131
148
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "boto3-refresh-session"
|
3
|
-
version = "2.0.
|
3
|
+
version = "2.0.10"
|
4
4
|
description = "A simple Python package for refreshing the temporary security credentials in a boto3.session.Session object automatically."
|
5
5
|
authors = [
|
6
6
|
{name = "Mike Letts",email = "lettsmt@gmail.com"}
|
File without changes
|
File without changes
|
File without changes
|
{boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/exceptions.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{boto3_refresh_session-2.0.8 → boto3_refresh_session-2.0.10}/boto3_refresh_session/session.py
RENAMED
File without changes
|