capo-trustedadvisor 0.1.0__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.
- capo_trustedadvisor-0.1.0/LICENSE +21 -0
- capo_trustedadvisor-0.1.0/PKG-INFO +101 -0
- capo_trustedadvisor-0.1.0/README.md +75 -0
- capo_trustedadvisor-0.1.0/pyproject.toml +60 -0
- capo_trustedadvisor-0.1.0/setup.cfg +4 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/__init__.py +72 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_async.py +25 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_auth/_identity.py +16 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_auth/_providers.py +886 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_auth/_signers.py +88 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_auth/_sigv4.py +434 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_auth/_zapros_handler.py +80 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_iter.py +113 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/batch_update_recommendation_resource_exclusion.py +172 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/get_organization_recommendation.py +171 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/get_recommendation.py +180 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/list_checks.py +200 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/list_organization_recommendation_accounts.py +177 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/list_organization_recommendation_resources.py +202 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/list_organization_recommendations.py +230 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/list_recommendation_resources.py +211 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/list_recommendations.py +245 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/update_organization_recommendation_lifecycle.py +158 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_operations/trusted_advisor/update_recommendation_lifecycle.py +158 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_pagination.py +21 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_protocol/__init__.py +1 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_protocol/errors.py +93 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_protocol/eventstream.py +238 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_protocol/serialize.py +47 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_protocol/xml.py +33 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_rule_engine/__init__.py +0 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_rule_engine/_aws_partition.py +160 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_rule_engine/_endpoint_rule_set.py +137 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_rule_engine/_endpoint_runtime.py +389 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_services/_aws_config.py +160 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_services/_pipeline.py +198 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_services/async_trusted_advisor.py +1248 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/_services/trusted_advisor.py +1237 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/__init__.py +33 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/_base.py +94 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/access_denied_exception.py +47 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/conflict_exception.py +45 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/internal_server_exception.py +47 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/resource_not_found_exception.py +47 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/throttling_exception.py +45 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/errors/validation_exception.py +45 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/py.typed +0 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/_prelude/blob.py +12 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/_prelude/timestamp.py +17 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/account_id.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/account_recommendation_arn.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/account_recommendation_identifier.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/account_recommendation_lifecycle_summary.py +116 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/account_recommendation_lifecycle_summary_list.py +39 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/batch_update_recommendation_resource_exclusion_request.py +45 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/batch_update_recommendation_resource_exclusion_response.py +45 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/check_arn.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/check_identifier.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/check_summary.py +128 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/check_summary_list.py +31 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/exclusion_status.py +17 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/get_organization_recommendation_request.py +24 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/get_organization_recommendation_response.py +42 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/get_recommendation_request.py +29 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/get_recommendation_response.py +40 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_checks_request.py +45 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_checks_response.py +47 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_organization_recommendation_accounts_request.py +31 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_organization_recommendation_accounts_response.py +51 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_organization_recommendation_resources_request.py +41 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_organization_recommendation_resources_response.py +51 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_organization_recommendations_request.py +61 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_organization_recommendations_response.py +51 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_recommendation_resources_request.py +43 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_recommendation_resources_response.py +51 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_recommendations_request.py +66 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/list_recommendations_response.py +51 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation.py +309 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation_arn.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation_identifier.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation_resource_summary.py +153 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation_resource_summary_list.py +39 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation_summary.py +240 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/organization_recommendation_summary_list.py +39 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation.py +322 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_aws_service.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_aws_service_list.py +19 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_cost_optimizing_aggregates.py +56 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_language.py +26 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_lifecycle_stage.py +19 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_pillar.py +21 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_pillar_list.py +33 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_pillar_specific_aggregates.py +42 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_region_code.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_resource_arn.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_resource_exclusion.py +40 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_resource_exclusion_list.py +39 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_resource_summary.py +138 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_resource_summary_list.py +39 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_resources_aggregates.py +52 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_source.py +29 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_status.py +18 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_summary.py +255 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_summary_list.py +35 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_type.py +17 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/recommendation_update_reason.py +5 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/resource_status.py +18 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/status_reason.py +14 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/string_map.py +22 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/update_organization_recommendation_lifecycle_request.py +78 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/update_recommendation_lifecycle_request.py +78 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/update_recommendation_lifecycle_stage.py +19 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/update_recommendation_lifecycle_stage_reason_code.py +22 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/update_recommendation_resource_exclusion_error.py +42 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor/types/update_recommendation_resource_exclusion_error_list.py +39 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor.egg-info/PKG-INFO +101 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor.egg-info/SOURCES.txt +119 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor.egg-info/dependency_links.txt +1 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor.egg-info/requires.txt +6 -0
- capo_trustedadvisor-0.1.0/src/capo_trustedadvisor.egg-info/top_level.txt +1 -0
- capo_trustedadvisor-0.1.0/tests/test_sigv4.py +557 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Karen Petrosyan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capo-trustedadvisor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Trustedadvisor.
|
|
5
|
+
Classifier: Development Status :: 4 - Beta
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: zapros>=0.13.0
|
|
21
|
+
Provides-Extra: sso
|
|
22
|
+
Requires-Dist: capo-sso>=0.2.0; extra == "sso"
|
|
23
|
+
Requires-Dist: capo-sso-oidc>=0.2.0; extra == "sso"
|
|
24
|
+
Requires-Dist: capo-sts>=0.3.0; extra == "sso"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Getting Started
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
pip install capo-trustedadvisor
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
async def main():
|
|
42
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
43
|
+
# Example: call the batch_update_recommendation_resource_exclusion operation
|
|
44
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion()
|
|
45
|
+
print(response["batch_update_recommendation_resource_exclusion_errors"])
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Pagination
|
|
49
|
+
|
|
50
|
+
Some operations in this SDK support pagination. If the operation supports pagination it will have an `iter_` prefixed method that returns an async iterator.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
async def main():
|
|
57
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
58
|
+
# Example: paginate over list_checks
|
|
59
|
+
async for item in trusted_advisor.iter_list_checks():
|
|
60
|
+
print(item)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Error Handling
|
|
64
|
+
|
|
65
|
+
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
69
|
+
from capo_trustedadvisor.error import AccessDeniedException
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
async def main():
|
|
73
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
74
|
+
try:
|
|
75
|
+
await trusted_advisor.batch_update_recommendation_resource_exclusion()
|
|
76
|
+
except AccessDeniedException as e:
|
|
77
|
+
print(f"Error: {e}")
|
|
78
|
+
print(e.data) # additional error data
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Retrying
|
|
82
|
+
|
|
83
|
+
The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their `is_retryable` and `is_throttling_error` attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the `@retryable` trait, are raised immediately without further attempts.
|
|
84
|
+
|
|
85
|
+
The number of attempts defaults to 3 and can be changed at the client level via `retry_max_attempts`, or per call via `config_overrides`.
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
async def main():
|
|
92
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
93
|
+
# Default: 3 attempts for every operation
|
|
94
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion()
|
|
95
|
+
|
|
96
|
+
# Override per operation
|
|
97
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion(config_overrides={"retry_max_attempts": 5})
|
|
98
|
+
|
|
99
|
+
# Disable retries for this call
|
|
100
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion(config_overrides={"retry_max_attempts": 1})
|
|
101
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
pip install capo-trustedadvisor
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def main():
|
|
16
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
17
|
+
# Example: call the batch_update_recommendation_resource_exclusion operation
|
|
18
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion()
|
|
19
|
+
print(response["batch_update_recommendation_resource_exclusion_errors"])
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Pagination
|
|
23
|
+
|
|
24
|
+
Some operations in this SDK support pagination. If the operation supports pagination it will have an `iter_` prefixed method that returns an async iterator.
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async def main():
|
|
31
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
32
|
+
# Example: paginate over list_checks
|
|
33
|
+
async for item in trusted_advisor.iter_list_checks():
|
|
34
|
+
print(item)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Error Handling
|
|
38
|
+
|
|
39
|
+
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
43
|
+
from capo_trustedadvisor.error import AccessDeniedException
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def main():
|
|
47
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
48
|
+
try:
|
|
49
|
+
await trusted_advisor.batch_update_recommendation_resource_exclusion()
|
|
50
|
+
except AccessDeniedException as e:
|
|
51
|
+
print(f"Error: {e}")
|
|
52
|
+
print(e.data) # additional error data
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Retrying
|
|
56
|
+
|
|
57
|
+
The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their `is_retryable` and `is_throttling_error` attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the `@retryable` trait, are raised immediately without further attempts.
|
|
58
|
+
|
|
59
|
+
The number of attempts defaults to 3 and can be changed at the client level via `retry_max_attempts`, or per call via `config_overrides`.
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from capo_trustedadvisor import AsyncTrustedAdvisorClient
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async def main():
|
|
66
|
+
async with AsyncTrustedAdvisorClient() as trusted_advisor:
|
|
67
|
+
# Default: 3 attempts for every operation
|
|
68
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion()
|
|
69
|
+
|
|
70
|
+
# Override per operation
|
|
71
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion(config_overrides={"retry_max_attempts": 5})
|
|
72
|
+
|
|
73
|
+
# Disable retries for this call
|
|
74
|
+
response = await trusted_advisor.batch_update_recommendation_resource_exclusion(config_overrides={"retry_max_attempts": 1})
|
|
75
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "capo-trustedadvisor"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python SDK for Trustedadvisor."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
classifiers = [
|
|
8
|
+
"Development Status :: 4 - Beta",
|
|
9
|
+
"Intended Audience :: Developers",
|
|
10
|
+
"License :: OSI Approved :: MIT License",
|
|
11
|
+
"Operating System :: OS Independent",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.10",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Programming Language :: Python :: 3.14",
|
|
18
|
+
"Topic :: Software Development :: Code Generators",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"zapros>=0.13.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
# IAM Identity Center (SSO), assume-role and web-identity credentials providers
|
|
27
|
+
sso = [
|
|
28
|
+
"capo-sso>=0.2.0",
|
|
29
|
+
"capo-sso-oidc>=0.2.0",
|
|
30
|
+
"capo-sts>=0.3.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[tool.pytest.ini_options]
|
|
34
|
+
pythonpath = ["src"]
|
|
35
|
+
testpaths = ["tests"]
|
|
36
|
+
|
|
37
|
+
[tool.ty.environment]
|
|
38
|
+
python-version = "3.14"
|
|
39
|
+
root = ["./src"]
|
|
40
|
+
|
|
41
|
+
[tool.ty.src]
|
|
42
|
+
include = ["src", "tests"]
|
|
43
|
+
|
|
44
|
+
[tool.ty.rules]
|
|
45
|
+
missing-typed-dict-key = "ignore"
|
|
46
|
+
unused-type-ignore-comment = "ignore"
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = ["E", "F", "I"]
|
|
50
|
+
ignore = ["E501", "E741"]
|
|
51
|
+
|
|
52
|
+
[dependency-groups]
|
|
53
|
+
dev = [
|
|
54
|
+
"inline-snapshot>=0.33.0",
|
|
55
|
+
# TODO: fix for 0.0.69
|
|
56
|
+
"ty==0.0.68",
|
|
57
|
+
"pytest>=9.0.3",
|
|
58
|
+
"ruff>=0.15.14",
|
|
59
|
+
"trio",
|
|
60
|
+
]
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from . import _iter as _iter
|
|
4
|
+
from . import _protocol as _protocol
|
|
5
|
+
from ._auth._identity import Credentials as Credentials
|
|
6
|
+
from ._auth._identity import Identity as Identity
|
|
7
|
+
from ._auth._providers import (
|
|
8
|
+
AssumeRoleCredentialsProvider as AssumeRoleCredentialsProvider,
|
|
9
|
+
)
|
|
10
|
+
from ._auth._providers import (
|
|
11
|
+
AssumeRoleError as AssumeRoleError,
|
|
12
|
+
)
|
|
13
|
+
from ._auth._providers import (
|
|
14
|
+
CachedProvider as CachedProvider,
|
|
15
|
+
)
|
|
16
|
+
from ._auth._providers import (
|
|
17
|
+
ChainedProvider as ChainedProvider,
|
|
18
|
+
)
|
|
19
|
+
from ._auth._providers import (
|
|
20
|
+
CredentialsProvider as CredentialsProvider,
|
|
21
|
+
)
|
|
22
|
+
from ._auth._providers import (
|
|
23
|
+
EnvCredentialsProvider as EnvCredentialsProvider,
|
|
24
|
+
)
|
|
25
|
+
from ._auth._providers import (
|
|
26
|
+
IdentityNotFound as IdentityNotFound,
|
|
27
|
+
)
|
|
28
|
+
from ._auth._providers import (
|
|
29
|
+
IdentityProvider as IdentityProvider,
|
|
30
|
+
)
|
|
31
|
+
from ._auth._providers import (
|
|
32
|
+
MissingDependencyError as MissingDependencyError,
|
|
33
|
+
)
|
|
34
|
+
from ._auth._providers import (
|
|
35
|
+
ProfileCredentialsProvider as ProfileCredentialsProvider,
|
|
36
|
+
)
|
|
37
|
+
from ._auth._providers import (
|
|
38
|
+
SsoCredentialsProvider as SsoCredentialsProvider,
|
|
39
|
+
)
|
|
40
|
+
from ._auth._providers import (
|
|
41
|
+
SSOError as SSOError,
|
|
42
|
+
)
|
|
43
|
+
from ._auth._providers import (
|
|
44
|
+
StaticAwsCredentialsProvider as StaticAwsCredentialsProvider,
|
|
45
|
+
)
|
|
46
|
+
from ._auth._providers import (
|
|
47
|
+
WebIdentityCredentialsProvider as WebIdentityCredentialsProvider,
|
|
48
|
+
)
|
|
49
|
+
from ._auth._signers import Signer as Signer
|
|
50
|
+
from ._auth._signers import SigV4Signer as SigV4Signer
|
|
51
|
+
from ._services._pipeline import (
|
|
52
|
+
AsyncOperationOptions as AsyncOperationOptions,
|
|
53
|
+
)
|
|
54
|
+
from ._services._pipeline import (
|
|
55
|
+
AsyncOperationRequest as AsyncOperationRequest,
|
|
56
|
+
)
|
|
57
|
+
from ._services._pipeline import (
|
|
58
|
+
AsyncOperationResponse as AsyncOperationResponse,
|
|
59
|
+
)
|
|
60
|
+
from ._services._pipeline import (
|
|
61
|
+
OperationOptions as OperationOptions,
|
|
62
|
+
)
|
|
63
|
+
from ._services._pipeline import (
|
|
64
|
+
OperationRequest as OperationRequest,
|
|
65
|
+
)
|
|
66
|
+
from ._services._pipeline import (
|
|
67
|
+
OperationResponse as OperationResponse,
|
|
68
|
+
)
|
|
69
|
+
from ._services.async_trusted_advisor import (
|
|
70
|
+
AsyncTrustedAdvisorClient as AsyncTrustedAdvisorClient,
|
|
71
|
+
)
|
|
72
|
+
from ._services.trusted_advisor import TrustedAdvisorClient as TrustedAdvisorClient
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
import trio
|
|
8
|
+
else:
|
|
9
|
+
try:
|
|
10
|
+
import trio
|
|
11
|
+
except ImportError:
|
|
12
|
+
trio = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def in_trio_run() -> bool:
|
|
16
|
+
if trio is None:
|
|
17
|
+
return False
|
|
18
|
+
return trio.lowlevel.in_trio_run()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async def anysleep(delay: float) -> None:
|
|
22
|
+
if in_trio_run():
|
|
23
|
+
await trio.sleep(delay)
|
|
24
|
+
else:
|
|
25
|
+
await asyncio.sleep(delay)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import TypedDict
|
|
5
|
+
|
|
6
|
+
from typing_extensions import NotRequired
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Identity(TypedDict):
|
|
10
|
+
expiration: NotRequired[datetime | None]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Credentials(Identity):
|
|
14
|
+
access_key: str
|
|
15
|
+
secret_key: str
|
|
16
|
+
session_token: NotRequired[str | None]
|