boto3-refresh-session 5.1.4__tar.gz → 5.1.5__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 (17) hide show
  1. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/PKG-INFO +31 -14
  2. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/README.md +30 -13
  3. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/__init__.py +1 -1
  4. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/pyproject.toml +1 -1
  5. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/LICENSE +0 -0
  6. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/NOTICE +0 -0
  7. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/exceptions.py +0 -0
  8. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/methods/__init__.py +0 -0
  9. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/methods/custom.py +0 -0
  10. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/methods/iot/__init__.py +0 -0
  11. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/methods/iot/core.py +0 -0
  12. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/methods/iot/x509.py +0 -0
  13. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/methods/sts.py +0 -0
  14. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/session.py +0 -0
  15. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/utils/__init__.py +0 -0
  16. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/utils/internal.py +0 -0
  17. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.5}/boto3_refresh_session/utils/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3-refresh-session
3
- Version: 5.1.4
3
+ Version: 5.1.5
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,credentials,token,refresh,iot,x509,mqtt
@@ -152,6 +152,23 @@ pip install boto3-refresh-session
152
152
 
153
153
  ## 📝 Usage
154
154
 
155
+ <details>
156
+ <summary><strong>Core Concepts (click to expand)</strong></summary>
157
+
158
+ ### Core Concepts
159
+
160
+ 1. `RefreshableSession` is the intended interface for using `boto3-refresh-session`. Whether you're using this package to refresh temporary credentials returned by STS, the IoT credential provider (which is really just STS, but I digress), or some custom authentication or credential provider, `RefreshableSession` is where you *ought to* be working when using `boto3-refresh-session`.
161
+
162
+ 2. *You can use all of the same keyword parameters normally associated with `boto3.session.Session`!* For instance, suppose you want to pass `region_name` to `RefreshableSession` as a parameter, whereby it's passed to `boto3.session.Session`. That's perfectly fine! Just pass it like you normally would when initializing `boto3.session.Session`. These keyword parameters are *completely optional*, though. If you're confused, the main idea to remember is this: if initializing `boto3.session.Session` *requires* a particular keyword parameter then pass it to `RefreshableSession`; if not, don't worry about it.
163
+
164
+ 3. To tell `RefreshableSession` which AWS service you're working with for authentication and credential retrieval purposes (STS vs. IoT vs. some custom credential provider), you'll need to pass a `method` parameter to `RefreshableSession`. Since the `service_name` namespace is already occupied by `boto3.sesssion.Session`, [`boto3-refresh-session` uses `method` instead of "service" so as to avoid confusion](https://github.com/michaelthomasletts/boto3-refresh-session/blob/04acb2adb34e505c4dc95711f6b2f97748a2a489/boto3_refresh_session/utils/typing.py#L40). If you're using `RefreshableSession` for STS, however, then `method` is set to `"sts"` by default. You don't need to pass the `method` keyword argument in that case.
165
+
166
+ 4. Using `RefreshableSession` for STS, IoT, or custom flows requires different keyword parameters that are unique to those particular methods. For instance, `STSRefreshableSession`, which is the engine for STS in `boto3-refresh-session`, requires `assume_role_kwargs` and optionally allows `sts_client_kwargs` whereas `CustomRefreshableSession` and `IoTX509RefreshableSession` do not. To familiarize yourself with the keyword parameters for each method, check the documentation for each of those engines [in the Refresh Strategies section here](https://michaelthomasletts.com/boto3-refresh-session/modules/index.html).
167
+
168
+ 5. Irrespective of whatever `method` you pass as a keyword parameter, `RefreshableSession` accepts a keyword parameter named `defer_refresh`. Basically, this boolean tells `boto3-refresh-session` either to refresh credentials *the moment they expire* or to *wait until credentials are explicitly needed*. If you are working in a low-latency environment then `defer_refresh = False` might be helpful. For most users, however, `defer_refresh = True` is most desirable. For that reason, `defer_refresh = True` is the default value. Most users, therefore, should not concern themselves too much with this feature.
169
+
170
+ </details>
171
+
155
172
  <details>
156
173
  <summary><strong>Clients and Resources (click to expand)</strong></summary>
157
174
 
@@ -228,12 +245,12 @@ pip install boto3-refresh-session
228
245
  ```python
229
246
  import boto3_refresh_session as brs
230
247
 
231
- # you can pass all of the params normally associated with boto3.session.Session
248
+ # OPTIONAL - you can pass all of the params normally associated with boto3.session.Session
232
249
  profile_name = "<your-profile-name>"
233
250
  region_name = "us-east-1"
234
251
  ...
235
252
 
236
- # as well as all of the params associated with STS.Client.assume_role
253
+ # REQUIRED - as well as all of the params associated with STS.Client.assume_role
237
254
  assume_role_kwargs = {
238
255
  "RoleArn": "<your-role-arn>",
239
256
  "RoleSessionName": "<your-role-session-name>",
@@ -241,7 +258,7 @@ pip install boto3-refresh-session
241
258
  ...
242
259
  }
243
260
 
244
- # as well as all of the params associated with STS.Client, except for 'service_name'
261
+ # OPTIONAL - as well as all of the params associated with STS.Client, except for 'service_name'
245
262
  sts_client_kwargs = {
246
263
  "region_name": region_name,
247
264
  ...
@@ -250,10 +267,10 @@ pip install boto3-refresh-session
250
267
  # basic initialization of boto3.session.Session
251
268
  session = brs.RefreshableSession(
252
269
  assume_role_kwargs=assume_role_kwargs, # required
253
- sts_client_kwargs=sts_client_kwargs,
254
- region_name=region_name,
255
- profile_name=profile_name,
256
- ...
270
+ sts_client_kwargs=sts_client_kwargs, # optional
271
+ region_name=region_name, # optional
272
+ profile_name=profile_name, # optional
273
+ ... # misc. params for boto3.session.Session
257
274
  )
258
275
  ```
259
276
 
@@ -279,12 +296,12 @@ pip install boto3-refresh-session
279
296
 
280
297
  # and pass it to RefreshableSession
281
298
  session = RefreshableSession(
282
- method="custom",
283
- custom_credentials_method=your_custom_credential_getter,
284
- custom_credentials_method_args=...,
285
- region_name=region_name,
286
- profile_name=profile_name,
287
- ...
299
+ method="custom", # required
300
+ custom_credentials_method=your_custom_credential_getter, # required
301
+ custom_credentials_method_args=..., # optional
302
+ region_name=region_name, # optional
303
+ profile_name=profile_name, # optional
304
+ ... # misc. params for boto3.session.Session
288
305
  )
289
306
  ```
290
307
 
@@ -125,6 +125,23 @@ pip install boto3-refresh-session
125
125
 
126
126
  ## 📝 Usage
127
127
 
128
+ <details>
129
+ <summary><strong>Core Concepts (click to expand)</strong></summary>
130
+
131
+ ### Core Concepts
132
+
133
+ 1. `RefreshableSession` is the intended interface for using `boto3-refresh-session`. Whether you're using this package to refresh temporary credentials returned by STS, the IoT credential provider (which is really just STS, but I digress), or some custom authentication or credential provider, `RefreshableSession` is where you *ought to* be working when using `boto3-refresh-session`.
134
+
135
+ 2. *You can use all of the same keyword parameters normally associated with `boto3.session.Session`!* For instance, suppose you want to pass `region_name` to `RefreshableSession` as a parameter, whereby it's passed to `boto3.session.Session`. That's perfectly fine! Just pass it like you normally would when initializing `boto3.session.Session`. These keyword parameters are *completely optional*, though. If you're confused, the main idea to remember is this: if initializing `boto3.session.Session` *requires* a particular keyword parameter then pass it to `RefreshableSession`; if not, don't worry about it.
136
+
137
+ 3. To tell `RefreshableSession` which AWS service you're working with for authentication and credential retrieval purposes (STS vs. IoT vs. some custom credential provider), you'll need to pass a `method` parameter to `RefreshableSession`. Since the `service_name` namespace is already occupied by `boto3.sesssion.Session`, [`boto3-refresh-session` uses `method` instead of "service" so as to avoid confusion](https://github.com/michaelthomasletts/boto3-refresh-session/blob/04acb2adb34e505c4dc95711f6b2f97748a2a489/boto3_refresh_session/utils/typing.py#L40). If you're using `RefreshableSession` for STS, however, then `method` is set to `"sts"` by default. You don't need to pass the `method` keyword argument in that case.
138
+
139
+ 4. Using `RefreshableSession` for STS, IoT, or custom flows requires different keyword parameters that are unique to those particular methods. For instance, `STSRefreshableSession`, which is the engine for STS in `boto3-refresh-session`, requires `assume_role_kwargs` and optionally allows `sts_client_kwargs` whereas `CustomRefreshableSession` and `IoTX509RefreshableSession` do not. To familiarize yourself with the keyword parameters for each method, check the documentation for each of those engines [in the Refresh Strategies section here](https://michaelthomasletts.com/boto3-refresh-session/modules/index.html).
140
+
141
+ 5. Irrespective of whatever `method` you pass as a keyword parameter, `RefreshableSession` accepts a keyword parameter named `defer_refresh`. Basically, this boolean tells `boto3-refresh-session` either to refresh credentials *the moment they expire* or to *wait until credentials are explicitly needed*. If you are working in a low-latency environment then `defer_refresh = False` might be helpful. For most users, however, `defer_refresh = True` is most desirable. For that reason, `defer_refresh = True` is the default value. Most users, therefore, should not concern themselves too much with this feature.
142
+
143
+ </details>
144
+
128
145
  <details>
129
146
  <summary><strong>Clients and Resources (click to expand)</strong></summary>
130
147
 
@@ -201,12 +218,12 @@ pip install boto3-refresh-session
201
218
  ```python
202
219
  import boto3_refresh_session as brs
203
220
 
204
- # you can pass all of the params normally associated with boto3.session.Session
221
+ # OPTIONAL - you can pass all of the params normally associated with boto3.session.Session
205
222
  profile_name = "<your-profile-name>"
206
223
  region_name = "us-east-1"
207
224
  ...
208
225
 
209
- # as well as all of the params associated with STS.Client.assume_role
226
+ # REQUIRED - as well as all of the params associated with STS.Client.assume_role
210
227
  assume_role_kwargs = {
211
228
  "RoleArn": "<your-role-arn>",
212
229
  "RoleSessionName": "<your-role-session-name>",
@@ -214,7 +231,7 @@ pip install boto3-refresh-session
214
231
  ...
215
232
  }
216
233
 
217
- # as well as all of the params associated with STS.Client, except for 'service_name'
234
+ # OPTIONAL - as well as all of the params associated with STS.Client, except for 'service_name'
218
235
  sts_client_kwargs = {
219
236
  "region_name": region_name,
220
237
  ...
@@ -223,10 +240,10 @@ pip install boto3-refresh-session
223
240
  # basic initialization of boto3.session.Session
224
241
  session = brs.RefreshableSession(
225
242
  assume_role_kwargs=assume_role_kwargs, # required
226
- sts_client_kwargs=sts_client_kwargs,
227
- region_name=region_name,
228
- profile_name=profile_name,
229
- ...
243
+ sts_client_kwargs=sts_client_kwargs, # optional
244
+ region_name=region_name, # optional
245
+ profile_name=profile_name, # optional
246
+ ... # misc. params for boto3.session.Session
230
247
  )
231
248
  ```
232
249
 
@@ -252,12 +269,12 @@ pip install boto3-refresh-session
252
269
 
253
270
  # and pass it to RefreshableSession
254
271
  session = RefreshableSession(
255
- method="custom",
256
- custom_credentials_method=your_custom_credential_getter,
257
- custom_credentials_method_args=...,
258
- region_name=region_name,
259
- profile_name=profile_name,
260
- ...
272
+ method="custom", # required
273
+ custom_credentials_method=your_custom_credential_getter, # required
274
+ custom_credentials_method_args=..., # optional
275
+ region_name=region_name, # optional
276
+ profile_name=profile_name, # optional
277
+ ... # misc. params for boto3.session.Session
261
278
  )
262
279
  ```
263
280
 
@@ -9,7 +9,7 @@ from .session import *
9
9
 
10
10
  __all__.extend(session.__all__)
11
11
  __all__.extend(exceptions.__all__)
12
- __version__ = "5.1.4"
12
+ __version__ = "5.1.5"
13
13
  __title__ = "boto3-refresh-session"
14
14
  __author__ = "Mike Letts"
15
15
  __maintainer__ = "Mike Letts"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "boto3-refresh-session"
3
- version = "5.1.4"
3
+ version = "5.1.5"
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"}