multicloud-py-aws-common 0.1.6__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.
- multicloud_py_aws_common-0.1.6/LICENSE.txt +206 -0
- multicloud_py_aws_common-0.1.6/PKG-INFO +23 -0
- multicloud_py_aws_common-0.1.6/multicloud/aws_common/__init__.py +20 -0
- multicloud_py_aws_common-0.1.6/multicloud/aws_common/aws_client_config.py +84 -0
- multicloud_py_aws_common-0.1.6/multicloud/aws_common/aws_credentials.py +271 -0
- multicloud_py_aws_common-0.1.6/multicloud/aws_common/error_mapping.py +220 -0
- multicloud_py_aws_common-0.1.6/multicloud_py_aws_common.egg-info/PKG-INFO +23 -0
- multicloud_py_aws_common-0.1.6/multicloud_py_aws_common.egg-info/SOURCES.txt +11 -0
- multicloud_py_aws_common-0.1.6/multicloud_py_aws_common.egg-info/dependency_links.txt +1 -0
- multicloud_py_aws_common-0.1.6/multicloud_py_aws_common.egg-info/requires.txt +8 -0
- multicloud_py_aws_common-0.1.6/multicloud_py_aws_common.egg-info/top_level.txt +1 -0
- multicloud_py_aws_common-0.1.6/pyproject.toml +34 -0
- multicloud_py_aws_common-0.1.6/setup.cfg +4 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Apache License Version 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Salesforce, Inc.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright {yyyy} {name of copyright owner}
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: multicloud-py-aws-common
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Shared AWS credential resolution utilities for multicloud-* providers.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://github.com/salesforce/multicloud-py
|
|
7
|
+
Project-URL: Repository, https://github.com/salesforce/multicloud-py
|
|
8
|
+
Project-URL: Issues, https://github.com/salesforce/multicloud-py/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.txt
|
|
14
|
+
Requires-Dist: multicloud-py-common>=0.1.6
|
|
15
|
+
Requires-Dist: boto3>=1.18.0
|
|
16
|
+
Requires-Dist: botocore>=1.21.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
20
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
MultiCloud Python SDK package.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""AWS-specific cross-service utilities.
|
|
2
|
+
|
|
3
|
+
Shared helpers used by AWS provider modules across services
|
|
4
|
+
(STS, Blob, PubSub, DocStore). This package depends on AWS SDKs and
|
|
5
|
+
must not be imported by cloud-agnostic code (multicloud.common.*).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from multicloud.aws_common.aws_client_config import s3_client_config
|
|
9
|
+
from multicloud.aws_common.aws_credentials import get_session
|
|
10
|
+
from multicloud.aws_common.error_mapping import (
|
|
11
|
+
translate_aws_sns_error,
|
|
12
|
+
translate_aws_sqs_error,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"get_session",
|
|
17
|
+
"s3_client_config",
|
|
18
|
+
"translate_aws_sns_error",
|
|
19
|
+
"translate_aws_sqs_error",
|
|
20
|
+
]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Shared botocore client configuration for AWS S3 providers.
|
|
2
|
+
|
|
3
|
+
Isolates the S3 client settings that must be pinned explicitly rather than
|
|
4
|
+
inherited from AWS SDK defaults.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any, Optional
|
|
10
|
+
|
|
11
|
+
from multicloud.common.proxy import ProxyConfig
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from botocore.config import Config # type: ignore[import-not-found]
|
|
15
|
+
except ImportError as _exc:
|
|
16
|
+
raise ImportError(
|
|
17
|
+
"AWS dependencies not found. Install with: "
|
|
18
|
+
"pip install 'python-multicloud-sdk[aws]'"
|
|
19
|
+
) from _exc
|
|
20
|
+
|
|
21
|
+
# Signature version for S3 clients.
|
|
22
|
+
#
|
|
23
|
+
# The AWS SDK still defaults *presigned URL* generation to the legacy SigV2
|
|
24
|
+
# algorithm in every region whose published endpoint metadata lists SigV2 as
|
|
25
|
+
# supported (us-west-2, us-east-1, eu-west-1, the GovCloud regions, and
|
|
26
|
+
# others). The downgrade is applied by botocore's ``choose-signer.s3`` event
|
|
27
|
+
# handler, not by client config.
|
|
28
|
+
#
|
|
29
|
+
# SigV2 is deprecated by AWS and is rejected outright by buckets with KMS
|
|
30
|
+
# default encryption: such buckets answer a SigV2 presigned request with
|
|
31
|
+
# SignatureDoesNotMatch or InvalidArgument. Pinning "s3v4" makes presigned
|
|
32
|
+
# URLs SigV4 in every region.
|
|
33
|
+
#
|
|
34
|
+
# This does not change ordinary (non-presigned) requests -- those already
|
|
35
|
+
# resolve to SigV4 by default, so their signed request line and
|
|
36
|
+
# Authorization header are unaffected.
|
|
37
|
+
#
|
|
38
|
+
# Deliberately absent: ``s3={"addressing_style": "virtual"}``. The default
|
|
39
|
+
# global endpoint already accepts a correctly-scoped SigV4 signature, so
|
|
40
|
+
# forcing virtual addressing fixes nothing while breaking custom endpoints
|
|
41
|
+
# (MinIO/LocalStack become ``bucket.localhost:9000``) and pinning the host to
|
|
42
|
+
# the configured region, which turns a region mismatch into a hard HTTP 301.
|
|
43
|
+
_S3_SIGNATURE_VERSION = "s3v4"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def s3_client_config(
|
|
47
|
+
proxy_config: Optional[ProxyConfig] = None, **overrides: Any
|
|
48
|
+
) -> Config:
|
|
49
|
+
"""Build the botocore ``Config`` for an S3 client.
|
|
50
|
+
|
|
51
|
+
The signature version is always pinned to SigV4. A ``signature_version``
|
|
52
|
+
supplied in ``overrides`` is ignored -- callers cannot silently
|
|
53
|
+
reintroduce the deprecated SigV2 presigned-URL behavior this helper exists
|
|
54
|
+
to prevent.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
proxy_config: How to resolve the proxy. When omitted, botocore reads
|
|
58
|
+
the environment as usual.
|
|
59
|
+
**overrides: Additional botocore ``Config`` keyword arguments. Any
|
|
60
|
+
``signature_version`` entry is superseded by SigV4.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
A ``Config`` pinning the S3 signature version to SigV4.
|
|
64
|
+
"""
|
|
65
|
+
settings = dict(overrides)
|
|
66
|
+
proxies = _proxies_for(proxy_config)
|
|
67
|
+
if proxies is not None:
|
|
68
|
+
settings["proxies"] = proxies
|
|
69
|
+
return Config(**{**settings, "signature_version": _S3_SIGNATURE_VERSION})
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _proxies_for(proxy_config: Optional[ProxyConfig]) -> Optional[dict[str, str]]:
|
|
73
|
+
"""Translate a ProxyConfig into botocore's ``proxies`` setting.
|
|
74
|
+
|
|
75
|
+
None leaves it unset, which is what makes botocore read the environment;
|
|
76
|
+
an empty mapping is how a direct connection is requested.
|
|
77
|
+
"""
|
|
78
|
+
if proxy_config is None:
|
|
79
|
+
return None
|
|
80
|
+
if proxy_config.endpoint is not None:
|
|
81
|
+
return {"http": proxy_config.endpoint, "https": proxy_config.endpoint}
|
|
82
|
+
if not proxy_config.use_environment_variable_proxy_values:
|
|
83
|
+
return {}
|
|
84
|
+
return None
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"""AWS credential resolution from CredentialsOverrider.
|
|
2
|
+
|
|
3
|
+
Shared utility for all AWS provider modules (STS, Blob, PubSub, DocStore).
|
|
4
|
+
|
|
5
|
+
For ASSUME_ROLE and ASSUME_ROLE_WEB_IDENTITY, credentials are
|
|
6
|
+
auto-refreshed via botocore's built-in credential fetchers — the session
|
|
7
|
+
automatically re-assumes the role when the token approaches expiry.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import time
|
|
13
|
+
from typing import Any, Optional
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
import boto3 # type: ignore[import-not-found]
|
|
17
|
+
from botocore.credentials import ( # type: ignore[import-not-found]
|
|
18
|
+
AssumeRoleCredentialFetcher,
|
|
19
|
+
AssumeRoleWithWebIdentityCredentialFetcher,
|
|
20
|
+
DeferredRefreshableCredentials,
|
|
21
|
+
)
|
|
22
|
+
from botocore.session import (
|
|
23
|
+
get_session as _get_botocore_session, # type: ignore[import-not-found]
|
|
24
|
+
)
|
|
25
|
+
except ImportError as _exc:
|
|
26
|
+
raise ImportError(
|
|
27
|
+
"AWS dependencies not found. Install with: "
|
|
28
|
+
"pip install 'python-multicloud-sdk[aws]'"
|
|
29
|
+
) from _exc
|
|
30
|
+
|
|
31
|
+
from multicloud.common.credentials import (
|
|
32
|
+
CredentialsOverrider,
|
|
33
|
+
CredentialsType,
|
|
34
|
+
)
|
|
35
|
+
from multicloud.common.exceptions import InvalidArgumentException
|
|
36
|
+
|
|
37
|
+
_ASSUME_ROLE_METHOD = "sts-assume-role"
|
|
38
|
+
_WEB_IDENTITY_METHOD = "sts-assume-role-with-web-identity"
|
|
39
|
+
_DEFAULT_SESSION_NAME_PREFIX = "multicloud"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _default_session_name() -> str:
|
|
43
|
+
return f"{_DEFAULT_SESSION_NAME_PREFIX}-{int(time.time())}"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def get_session(
|
|
47
|
+
overrider: Optional[CredentialsOverrider],
|
|
48
|
+
region: Optional[str] = None,
|
|
49
|
+
) -> Any:
|
|
50
|
+
"""Build a boto3 Session from a CredentialsOverrider, or use defaults.
|
|
51
|
+
|
|
52
|
+
For ASSUME_ROLE and ASSUME_ROLE_WEB_IDENTITY, the returned session
|
|
53
|
+
auto-refreshes credentials when the token approaches expiry.
|
|
54
|
+
|
|
55
|
+
Credential resolution for ASSUME_ROLE and ASSUME_ROLE_WEB_IDENTITY is
|
|
56
|
+
deferred to the first AWS API call (botocore's
|
|
57
|
+
``DeferredRefreshableCredentials`` semantics). Invalid role ARNs,
|
|
58
|
+
expired source credentials, or missing IAM permissions surface at use
|
|
59
|
+
time rather than at Session construction.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
overrider: Credential override configuration. If None, returns
|
|
63
|
+
a default boto3 session using environment/config discovery.
|
|
64
|
+
region: AWS region name for the session.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
A ``boto3.Session`` configured with the resolved credentials.
|
|
68
|
+
"""
|
|
69
|
+
if overrider is None:
|
|
70
|
+
return boto3.Session()
|
|
71
|
+
|
|
72
|
+
if overrider.credentials_type == CredentialsType.SESSION:
|
|
73
|
+
# CredentialsOverrider.__post_init__ guarantees session_credentials
|
|
74
|
+
# is non-None for SESSION type.
|
|
75
|
+
creds = overrider.session_credentials
|
|
76
|
+
return boto3.Session(
|
|
77
|
+
aws_access_key_id=creds.access_key_id,
|
|
78
|
+
aws_secret_access_key=creds.access_key_secret,
|
|
79
|
+
aws_session_token=creds.security_token or None,
|
|
80
|
+
region_name=region,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if overrider.credentials_type == CredentialsType.ASSUME_ROLE:
|
|
84
|
+
return _build_session_with_fetcher(
|
|
85
|
+
_make_assume_role_fetcher(overrider, region),
|
|
86
|
+
method=_ASSUME_ROLE_METHOD,
|
|
87
|
+
region=region,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if overrider.credentials_type == CredentialsType.ASSUME_ROLE_WEB_IDENTITY:
|
|
91
|
+
return _build_session_with_fetcher(
|
|
92
|
+
_make_web_identity_fetcher(overrider, region),
|
|
93
|
+
method=_WEB_IDENTITY_METHOD,
|
|
94
|
+
region=region,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
raise InvalidArgumentException(
|
|
98
|
+
f"Unsupported credentials_type: {overrider.credentials_type}"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _build_session_with_fetcher(
|
|
103
|
+
fetcher: Any,
|
|
104
|
+
method: str,
|
|
105
|
+
region: Optional[str],
|
|
106
|
+
) -> Any:
|
|
107
|
+
"""Create a boto3 Session backed by a botocore credential fetcher."""
|
|
108
|
+
refreshable = DeferredRefreshableCredentials(
|
|
109
|
+
method=method,
|
|
110
|
+
refresh_using=fetcher.fetch_credentials,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# No public API exists for injecting credentials into a botocore
|
|
114
|
+
# session — this private-attr pattern is the standard approach.
|
|
115
|
+
botocore_session = _get_botocore_session()
|
|
116
|
+
botocore_session._credentials = refreshable
|
|
117
|
+
if region:
|
|
118
|
+
botocore_session.set_config_variable("region", region)
|
|
119
|
+
|
|
120
|
+
return boto3.Session(botocore_session=botocore_session)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _make_assume_role_fetcher(
|
|
124
|
+
overrider: CredentialsOverrider,
|
|
125
|
+
region: Optional[str],
|
|
126
|
+
) -> Any:
|
|
127
|
+
"""Build a botocore ``AssumeRoleCredentialFetcher`` from an overrider."""
|
|
128
|
+
source_session = boto3.Session()
|
|
129
|
+
source_credentials = source_session.get_credentials()
|
|
130
|
+
|
|
131
|
+
extra_args: dict[str, Any] = {
|
|
132
|
+
"RoleSessionName": overrider.session_name or _default_session_name(),
|
|
133
|
+
}
|
|
134
|
+
if overrider.duration_seconds is not None:
|
|
135
|
+
extra_args["DurationSeconds"] = overrider.duration_seconds
|
|
136
|
+
|
|
137
|
+
return AssumeRoleCredentialFetcher(
|
|
138
|
+
client_creator=source_session._session.create_client,
|
|
139
|
+
source_credentials=source_credentials,
|
|
140
|
+
role_arn=overrider.role,
|
|
141
|
+
extra_args=extra_args,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _make_web_identity_fetcher(
|
|
146
|
+
overrider: CredentialsOverrider,
|
|
147
|
+
region: Optional[str],
|
|
148
|
+
) -> Any:
|
|
149
|
+
"""Build a botocore ``AssumeRoleWithWebIdentityCredentialFetcher`` from an overrider.
|
|
150
|
+
|
|
151
|
+
The STS client used for the token exchange is anonymous — we do not
|
|
152
|
+
want it to recursively pick up ambient credentials.
|
|
153
|
+
"""
|
|
154
|
+
from botocore.credentials import Credentials as AnonymousCredentials
|
|
155
|
+
|
|
156
|
+
anon_botocore_session = _get_botocore_session()
|
|
157
|
+
anon_botocore_session._credentials = AnonymousCredentials("", "")
|
|
158
|
+
anon_session = boto3.Session(botocore_session=anon_botocore_session)
|
|
159
|
+
|
|
160
|
+
extra_args: dict[str, Any] = {
|
|
161
|
+
"RoleSessionName": overrider.session_name or _default_session_name(),
|
|
162
|
+
}
|
|
163
|
+
if overrider.duration_seconds is not None:
|
|
164
|
+
extra_args["DurationSeconds"] = overrider.duration_seconds
|
|
165
|
+
|
|
166
|
+
return AssumeRoleWithWebIdentityCredentialFetcher(
|
|
167
|
+
client_creator=anon_session._session.create_client,
|
|
168
|
+
web_identity_token_loader=overrider.web_identity_token_supplier, # type: ignore[arg-type]
|
|
169
|
+
role_arn=overrider.role,
|
|
170
|
+
extra_args=extra_args,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
async def get_aio_session(
|
|
175
|
+
overrider: Optional[CredentialsOverrider],
|
|
176
|
+
region: Optional[str] = None,
|
|
177
|
+
) -> Any:
|
|
178
|
+
"""Build an aiobotocore session from a CredentialsOverrider, or use defaults.
|
|
179
|
+
|
|
180
|
+
Async counterpart of :func:`get_session`. aiobotocore is imported lazily
|
|
181
|
+
so this module stays importable without the ``async`` extra installed.
|
|
182
|
+
|
|
183
|
+
For ASSUME_ROLE and ASSUME_ROLE_WEB_IDENTITY the returned session
|
|
184
|
+
auto-refreshes credentials via aiobotocore's deferred fetchers. Source
|
|
185
|
+
credentials are resolved asynchronously, which is why this helper is a
|
|
186
|
+
coroutine.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
overrider: Credential override configuration. If None, returns a
|
|
190
|
+
default aiobotocore session using environment/config discovery.
|
|
191
|
+
region: AWS region name for the session.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
An ``aiobotocore.session.AioSession`` configured with the resolved
|
|
195
|
+
credentials.
|
|
196
|
+
"""
|
|
197
|
+
try:
|
|
198
|
+
from aiobotocore.credentials import ( # type: ignore[import-not-found]
|
|
199
|
+
AioAssumeRoleCredentialFetcher,
|
|
200
|
+
AioAssumeRoleWithWebIdentityCredentialFetcher,
|
|
201
|
+
AioDeferredRefreshableCredentials,
|
|
202
|
+
)
|
|
203
|
+
from aiobotocore.session import (
|
|
204
|
+
get_session as _get_aio_session, # type: ignore[import-not-found]
|
|
205
|
+
)
|
|
206
|
+
except ImportError as exc:
|
|
207
|
+
raise ImportError(
|
|
208
|
+
"aiobotocore is required for async AWS credential resolution. "
|
|
209
|
+
"Install it with: pip install 'multicloud-py-blob-aws[async]'"
|
|
210
|
+
) from exc
|
|
211
|
+
|
|
212
|
+
session = _get_aio_session()
|
|
213
|
+
if region:
|
|
214
|
+
session.set_config_variable("region", region)
|
|
215
|
+
|
|
216
|
+
if overrider is None:
|
|
217
|
+
return session
|
|
218
|
+
|
|
219
|
+
if overrider.credentials_type == CredentialsType.SESSION:
|
|
220
|
+
# CredentialsOverrider.__post_init__ guarantees session_credentials
|
|
221
|
+
# is non-None for SESSION type.
|
|
222
|
+
creds = overrider.session_credentials
|
|
223
|
+
session.set_credentials(
|
|
224
|
+
creds.access_key_id,
|
|
225
|
+
creds.access_key_secret,
|
|
226
|
+
creds.security_token or None,
|
|
227
|
+
)
|
|
228
|
+
return session
|
|
229
|
+
|
|
230
|
+
if overrider.credentials_type == CredentialsType.ASSUME_ROLE:
|
|
231
|
+
source_credentials = await session.get_credentials()
|
|
232
|
+
fetcher = AioAssumeRoleCredentialFetcher(
|
|
233
|
+
client_creator=session.create_client,
|
|
234
|
+
source_credentials=source_credentials,
|
|
235
|
+
role_arn=overrider.role,
|
|
236
|
+
extra_args=_assume_role_extra_args(overrider),
|
|
237
|
+
)
|
|
238
|
+
session._credentials = AioDeferredRefreshableCredentials(
|
|
239
|
+
method=_ASSUME_ROLE_METHOD,
|
|
240
|
+
refresh_using=fetcher.fetch_credentials,
|
|
241
|
+
)
|
|
242
|
+
return session
|
|
243
|
+
|
|
244
|
+
if overrider.credentials_type == CredentialsType.ASSUME_ROLE_WEB_IDENTITY:
|
|
245
|
+
# The web-identity fetcher signs the STS exchange as UNSIGNED
|
|
246
|
+
# internally, so no source credentials are needed.
|
|
247
|
+
fetcher = AioAssumeRoleWithWebIdentityCredentialFetcher(
|
|
248
|
+
client_creator=session.create_client,
|
|
249
|
+
web_identity_token_loader=overrider.web_identity_token_supplier,
|
|
250
|
+
role_arn=overrider.role,
|
|
251
|
+
extra_args=_assume_role_extra_args(overrider),
|
|
252
|
+
)
|
|
253
|
+
session._credentials = AioDeferredRefreshableCredentials(
|
|
254
|
+
method=_WEB_IDENTITY_METHOD,
|
|
255
|
+
refresh_using=fetcher.fetch_credentials,
|
|
256
|
+
)
|
|
257
|
+
return session
|
|
258
|
+
|
|
259
|
+
raise InvalidArgumentException(
|
|
260
|
+
f"Unsupported credentials_type: {overrider.credentials_type}"
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def _assume_role_extra_args(overrider: CredentialsOverrider) -> dict[str, Any]:
|
|
265
|
+
"""Build the STS assume-role extra args shared by both async fetchers."""
|
|
266
|
+
extra_args: dict[str, Any] = {
|
|
267
|
+
"RoleSessionName": overrider.session_name or _default_session_name(),
|
|
268
|
+
}
|
|
269
|
+
if overrider.duration_seconds is not None:
|
|
270
|
+
extra_args["DurationSeconds"] = overrider.duration_seconds
|
|
271
|
+
return extra_args
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"""Shared AWS error translation helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from botocore import exceptions as boto_exceptions
|
|
6
|
+
from multicloud.common.exceptions import (
|
|
7
|
+
InvalidArgumentException,
|
|
8
|
+
ResourceExhaustedException,
|
|
9
|
+
ResourceNotFoundException,
|
|
10
|
+
SubstrateSdkException,
|
|
11
|
+
TransactionFailedException,
|
|
12
|
+
UnAuthorizedException,
|
|
13
|
+
UnknownException,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
#: Error codes meaning the caller is being throttled or the service is briefly
|
|
17
|
+
#: unavailable. Covers every code botocore itself retries as throttling, plus
|
|
18
|
+
#: ServiceUnavailable and RequestExpired, which services return for the same
|
|
19
|
+
#: condition without botocore counting them. Note
|
|
20
|
+
#: several arrive with HTTP 400 rather than 429 -- bare ``Throttling`` is what
|
|
21
|
+
#: the query-protocol services (STS, IAM) send -- which is why callers must
|
|
22
|
+
#: match on the code before falling back to the status.
|
|
23
|
+
#:
|
|
24
|
+
#: ``tests/common/unit/test_throttling_error_mapping.py`` asserts this stays a
|
|
25
|
+
#: superset of botocore's own list, so a new code added upstream is caught.
|
|
26
|
+
AWS_THROTTLING_CODES = frozenset(
|
|
27
|
+
{
|
|
28
|
+
"BandwidthLimitExceeded",
|
|
29
|
+
"EC2ThrottledException",
|
|
30
|
+
"LimitExceededException",
|
|
31
|
+
"PriorRequestNotComplete",
|
|
32
|
+
"ProvisionedThroughputExceededException",
|
|
33
|
+
"RequestExpired",
|
|
34
|
+
"RequestLimitExceeded",
|
|
35
|
+
"RequestThrottled",
|
|
36
|
+
"RequestThrottledException",
|
|
37
|
+
"ServiceUnavailable",
|
|
38
|
+
"SlowDown",
|
|
39
|
+
"Throttling",
|
|
40
|
+
"ThrottledException",
|
|
41
|
+
"ThrottlingException",
|
|
42
|
+
"TooManyRequestsException",
|
|
43
|
+
"TransactionInProgressException",
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
_SQS_AUTH_CODES = frozenset(
|
|
48
|
+
{
|
|
49
|
+
"InvalidClientTokenId",
|
|
50
|
+
"UnrecognizedClientException",
|
|
51
|
+
"ExpiredToken",
|
|
52
|
+
"IncompleteSignature",
|
|
53
|
+
"NotAuthorized",
|
|
54
|
+
"OptInRequired",
|
|
55
|
+
"AccountNotAuthorized",
|
|
56
|
+
"AccountProblem",
|
|
57
|
+
"AllAccessDisabled",
|
|
58
|
+
"InvalidAccessKeyId",
|
|
59
|
+
"InvalidPayer",
|
|
60
|
+
"InvalidSecurity",
|
|
61
|
+
"NotSignedUp",
|
|
62
|
+
"TokenRefreshRequired",
|
|
63
|
+
"AccessDenied",
|
|
64
|
+
"AccessDeniedException",
|
|
65
|
+
"UnauthorizedOperation",
|
|
66
|
+
"InvalidSecurityException",
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
#: SQS reports its queue-level limit with a code of its own.
|
|
70
|
+
_SQS_THROTTLING_CODES = AWS_THROTTLING_CODES | {"OverLimit"}
|
|
71
|
+
_SQS_INVALID_CODES = frozenset(
|
|
72
|
+
{
|
|
73
|
+
"InvalidAction",
|
|
74
|
+
"ValidationError",
|
|
75
|
+
"RequestTimeTooSkewed",
|
|
76
|
+
"SignatureDoesNotMatch",
|
|
77
|
+
"BadDigest",
|
|
78
|
+
"InvalidParameterValue",
|
|
79
|
+
"InvalidParameter",
|
|
80
|
+
"InvalidMessageBody",
|
|
81
|
+
"InvalidMessageAttributes",
|
|
82
|
+
"MessageTooLarge",
|
|
83
|
+
"BatchEntryIdsNotDistinct",
|
|
84
|
+
"InvalidIdFormat",
|
|
85
|
+
"ReceiptHandleIsInvalid",
|
|
86
|
+
"MessageNotInflight",
|
|
87
|
+
"InvalidAttributeName",
|
|
88
|
+
"InvalidBatchEntryId",
|
|
89
|
+
"InvalidMessageContents",
|
|
90
|
+
"TooManyEntriesInBatchRequest",
|
|
91
|
+
"UnsupportedOperation",
|
|
92
|
+
"EmptyBatchRequest",
|
|
93
|
+
"BatchRequestTooLong",
|
|
94
|
+
"PurgeQueueInProgress",
|
|
95
|
+
"QueueDeletedRecently",
|
|
96
|
+
"QueueNameExists",
|
|
97
|
+
"InvalidArgument",
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
_SQS_NOT_FOUND_CODES = frozenset(
|
|
101
|
+
{
|
|
102
|
+
"QueueDoesNotExist",
|
|
103
|
+
"AWS.SimpleQueueService.NonExistentQueue",
|
|
104
|
+
"NotFoundException",
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
_SQS_UNKNOWN_CODES = frozenset({"InternalError", "RequestCanceled"})
|
|
108
|
+
|
|
109
|
+
_SNS_AUTH_CODES = frozenset(
|
|
110
|
+
{
|
|
111
|
+
"InvalidClientTokenId",
|
|
112
|
+
"UnrecognizedClientException",
|
|
113
|
+
"ExpiredToken",
|
|
114
|
+
"IncompleteSignature",
|
|
115
|
+
"NotAuthorized",
|
|
116
|
+
"OptInRequired",
|
|
117
|
+
"AccountNotAuthorized",
|
|
118
|
+
"AccountProblem",
|
|
119
|
+
"AllAccessDisabled",
|
|
120
|
+
"InvalidAccessKeyId",
|
|
121
|
+
"InvalidPayer",
|
|
122
|
+
"InvalidSecurity",
|
|
123
|
+
"NotSignedUp",
|
|
124
|
+
"TokenRefreshRequired",
|
|
125
|
+
"AuthorizationError",
|
|
126
|
+
"AccessDenied",
|
|
127
|
+
"AccessDeniedException",
|
|
128
|
+
"KMSAccessDenied",
|
|
129
|
+
"KMSInvalidState",
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
#: SNS reports throttling and oversized batches with codes of its own.
|
|
133
|
+
_SNS_THROTTLING_CODES = AWS_THROTTLING_CODES | {
|
|
134
|
+
"Throttled",
|
|
135
|
+
"TooManyEntriesInBatchRequest",
|
|
136
|
+
}
|
|
137
|
+
_SNS_INVALID_CODES = frozenset(
|
|
138
|
+
{
|
|
139
|
+
"InvalidAction",
|
|
140
|
+
"ValidationError",
|
|
141
|
+
"RequestTimeTooSkewed",
|
|
142
|
+
"SignatureDoesNotMatch",
|
|
143
|
+
"BadDigest",
|
|
144
|
+
"InvalidParameter",
|
|
145
|
+
"InvalidParameterValue",
|
|
146
|
+
"InvalidMessage",
|
|
147
|
+
"InvalidMessageAttributes",
|
|
148
|
+
"MessageTooLong",
|
|
149
|
+
"InvalidTopicArn",
|
|
150
|
+
"InvalidTargetArn",
|
|
151
|
+
"InvalidPhoneNumber",
|
|
152
|
+
"InvalidSubject",
|
|
153
|
+
"PlatformApplicationDisabled",
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
_SNS_NOT_FOUND_CODES = frozenset(
|
|
157
|
+
{
|
|
158
|
+
"NotFound",
|
|
159
|
+
"TopicNotFound",
|
|
160
|
+
"EndpointNotFound",
|
|
161
|
+
"SubscriptionNotFound",
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def translate_aws_sqs_error(exc: Exception) -> SubstrateSdkException:
|
|
167
|
+
"""Translate AWS SQS errors to common exception hierarchy."""
|
|
168
|
+
return _translate_aws_error(
|
|
169
|
+
exc=exc,
|
|
170
|
+
auth_codes=_SQS_AUTH_CODES,
|
|
171
|
+
throttling_codes=_SQS_THROTTLING_CODES,
|
|
172
|
+
invalid_codes=_SQS_INVALID_CODES,
|
|
173
|
+
not_found_codes=_SQS_NOT_FOUND_CODES,
|
|
174
|
+
unknown_codes=_SQS_UNKNOWN_CODES,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def translate_aws_sns_error(exc: Exception) -> SubstrateSdkException:
|
|
179
|
+
"""Translate AWS SNS errors to common exception hierarchy."""
|
|
180
|
+
return _translate_aws_error(
|
|
181
|
+
exc=exc,
|
|
182
|
+
auth_codes=_SNS_AUTH_CODES,
|
|
183
|
+
throttling_codes=_SNS_THROTTLING_CODES,
|
|
184
|
+
invalid_codes=_SNS_INVALID_CODES,
|
|
185
|
+
not_found_codes=_SNS_NOT_FOUND_CODES,
|
|
186
|
+
unknown_codes=frozenset(),
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _translate_aws_error(
|
|
191
|
+
*,
|
|
192
|
+
exc: Exception,
|
|
193
|
+
auth_codes: frozenset[str],
|
|
194
|
+
throttling_codes: frozenset[str],
|
|
195
|
+
invalid_codes: frozenset[str],
|
|
196
|
+
not_found_codes: frozenset[str],
|
|
197
|
+
unknown_codes: frozenset[str],
|
|
198
|
+
) -> SubstrateSdkException:
|
|
199
|
+
if isinstance(exc, SubstrateSdkException):
|
|
200
|
+
return exc
|
|
201
|
+
|
|
202
|
+
if isinstance(exc, boto_exceptions.ClientError):
|
|
203
|
+
error_code = exc.response.get("Error", {}).get("Code", "")
|
|
204
|
+
if error_code in auth_codes:
|
|
205
|
+
return UnAuthorizedException(str(exc))
|
|
206
|
+
if error_code in throttling_codes:
|
|
207
|
+
return ResourceExhaustedException(str(exc))
|
|
208
|
+
if error_code in invalid_codes:
|
|
209
|
+
return InvalidArgumentException(str(exc))
|
|
210
|
+
if error_code == "InternalFailure":
|
|
211
|
+
return TransactionFailedException(str(exc))
|
|
212
|
+
if error_code in not_found_codes:
|
|
213
|
+
return ResourceNotFoundException(str(exc))
|
|
214
|
+
if error_code in unknown_codes:
|
|
215
|
+
return UnknownException(str(exc))
|
|
216
|
+
return UnknownException(str(exc))
|
|
217
|
+
|
|
218
|
+
if isinstance(exc, boto_exceptions.NoCredentialsError):
|
|
219
|
+
return UnAuthorizedException(str(exc))
|
|
220
|
+
return UnknownException(str(exc))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: multicloud-py-aws-common
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Shared AWS credential resolution utilities for multicloud-* providers.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://github.com/salesforce/multicloud-py
|
|
7
|
+
Project-URL: Repository, https://github.com/salesforce/multicloud-py
|
|
8
|
+
Project-URL: Issues, https://github.com/salesforce/multicloud-py/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.txt
|
|
14
|
+
Requires-Dist: multicloud-py-common>=0.1.6
|
|
15
|
+
Requires-Dist: boto3>=1.18.0
|
|
16
|
+
Requires-Dist: botocore>=1.21.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
20
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
MultiCloud Python SDK package.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
pyproject.toml
|
|
3
|
+
multicloud/aws_common/__init__.py
|
|
4
|
+
multicloud/aws_common/aws_client_config.py
|
|
5
|
+
multicloud/aws_common/aws_credentials.py
|
|
6
|
+
multicloud/aws_common/error_mapping.py
|
|
7
|
+
multicloud_py_aws_common.egg-info/PKG-INFO
|
|
8
|
+
multicloud_py_aws_common.egg-info/SOURCES.txt
|
|
9
|
+
multicloud_py_aws_common.egg-info/dependency_links.txt
|
|
10
|
+
multicloud_py_aws_common.egg-info/requires.txt
|
|
11
|
+
multicloud_py_aws_common.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
multicloud
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "multicloud-py-aws-common"
|
|
7
|
+
version = "0.1.6"
|
|
8
|
+
license = "Apache-2.0"
|
|
9
|
+
description = "Shared AWS credential resolution utilities for multicloud-* providers."
|
|
10
|
+
readme = {text = "MultiCloud Python SDK package.", content-type = "text/markdown"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"multicloud-py-common>=0.1.6",
|
|
18
|
+
"boto3>=1.18.0",
|
|
19
|
+
"botocore>=1.21.0",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/salesforce/multicloud-py"
|
|
24
|
+
Repository = "https://github.com/salesforce/multicloud-py"
|
|
25
|
+
Issues = "https://github.com/salesforce/multicloud-py/issues"
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["pytest>=7.0.0", "pytest-cov>=4.0.0", "mypy>=1.0.0"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools]
|
|
31
|
+
license-files = ["LICENSE.txt"]
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
include = ["multicloud*"]
|