capo-codeguruprofiler 0.1.0__py3-none-any.whl

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 (180) hide show
  1. capo_codeguruprofiler/__init__.py +74 -0
  2. capo_codeguruprofiler/_async.py +25 -0
  3. capo_codeguruprofiler/_auth/_identity.py +16 -0
  4. capo_codeguruprofiler/_auth/_providers.py +886 -0
  5. capo_codeguruprofiler/_auth/_signers.py +88 -0
  6. capo_codeguruprofiler/_auth/_sigv4.py +434 -0
  7. capo_codeguruprofiler/_auth/_zapros_handler.py +80 -0
  8. capo_codeguruprofiler/_iter.py +113 -0
  9. capo_codeguruprofiler/_operations/code_guru_profiler/add_notification_channels.py +185 -0
  10. capo_codeguruprofiler/_operations/code_guru_profiler/batch_get_frame_metric_data.py +202 -0
  11. capo_codeguruprofiler/_operations/code_guru_profiler/configure_agent.py +177 -0
  12. capo_codeguruprofiler/_operations/code_guru_profiler/create_profiling_group.py +180 -0
  13. capo_codeguruprofiler/_operations/code_guru_profiler/delete_profiling_group.py +165 -0
  14. capo_codeguruprofiler/_operations/code_guru_profiler/describe_profiling_group.py +169 -0
  15. capo_codeguruprofiler/_operations/code_guru_profiler/get_findings_report_account_summary.py +164 -0
  16. capo_codeguruprofiler/_operations/code_guru_profiler/get_notification_configuration.py +168 -0
  17. capo_codeguruprofiler/_operations/code_guru_profiler/get_policy.py +161 -0
  18. capo_codeguruprofiler/_operations/code_guru_profiler/get_profile.py +196 -0
  19. capo_codeguruprofiler/_operations/code_guru_profiler/get_recommendations.py +196 -0
  20. capo_codeguruprofiler/_operations/code_guru_profiler/list_findings_reports.py +197 -0
  21. capo_codeguruprofiler/_operations/code_guru_profiler/list_profile_times.py +196 -0
  22. capo_codeguruprofiler/_operations/code_guru_profiler/list_profiling_groups.py +160 -0
  23. capo_codeguruprofiler/_operations/code_guru_profiler/list_tags_for_resource.py +158 -0
  24. capo_codeguruprofiler/_operations/code_guru_profiler/post_agent_profile.py +168 -0
  25. capo_codeguruprofiler/_operations/code_guru_profiler/put_permission.py +182 -0
  26. capo_codeguruprofiler/_operations/code_guru_profiler/remove_notification_channel.py +169 -0
  27. capo_codeguruprofiler/_operations/code_guru_profiler/remove_permission.py +175 -0
  28. capo_codeguruprofiler/_operations/code_guru_profiler/submit_feedback.py +170 -0
  29. capo_codeguruprofiler/_operations/code_guru_profiler/tag_resource.py +158 -0
  30. capo_codeguruprofiler/_operations/code_guru_profiler/untag_resource.py +156 -0
  31. capo_codeguruprofiler/_operations/code_guru_profiler/update_profiling_group.py +181 -0
  32. capo_codeguruprofiler/_pagination.py +21 -0
  33. capo_codeguruprofiler/_protocol/__init__.py +1 -0
  34. capo_codeguruprofiler/_protocol/errors.py +93 -0
  35. capo_codeguruprofiler/_protocol/eventstream.py +238 -0
  36. capo_codeguruprofiler/_protocol/serialize.py +47 -0
  37. capo_codeguruprofiler/_protocol/xml.py +33 -0
  38. capo_codeguruprofiler/_resources/code_guru_profiler/profiling_group.py +2257 -0
  39. capo_codeguruprofiler/_rule_engine/__init__.py +0 -0
  40. capo_codeguruprofiler/_rule_engine/_aws_partition.py +160 -0
  41. capo_codeguruprofiler/_rule_engine/_endpoint_rule_set.py +138 -0
  42. capo_codeguruprofiler/_rule_engine/_endpoint_runtime.py +389 -0
  43. capo_codeguruprofiler/_services/_aws_config.py +160 -0
  44. capo_codeguruprofiler/_services/_pipeline.py +198 -0
  45. capo_codeguruprofiler/_services/async_code_guru_profiler.py +377 -0
  46. capo_codeguruprofiler/_services/code_guru_profiler.py +373 -0
  47. capo_codeguruprofiler/errors/__init__.py +35 -0
  48. capo_codeguruprofiler/errors/_base.py +94 -0
  49. capo_codeguruprofiler/errors/conflict_exception.py +45 -0
  50. capo_codeguruprofiler/errors/internal_server_exception.py +47 -0
  51. capo_codeguruprofiler/errors/resource_not_found_exception.py +47 -0
  52. capo_codeguruprofiler/errors/service_quota_exceeded_exception.py +49 -0
  53. capo_codeguruprofiler/errors/throttling_exception.py +45 -0
  54. capo_codeguruprofiler/errors/validation_exception.py +45 -0
  55. capo_codeguruprofiler/py.typed +0 -0
  56. capo_codeguruprofiler/types/_prelude/blob.py +12 -0
  57. capo_codeguruprofiler/types/_prelude/timestamp.py +17 -0
  58. capo_codeguruprofiler/types/action_group.py +5 -0
  59. capo_codeguruprofiler/types/add_notification_channels_request.py +44 -0
  60. capo_codeguruprofiler/types/add_notification_channels_response.py +42 -0
  61. capo_codeguruprofiler/types/agent_configuration.py +58 -0
  62. capo_codeguruprofiler/types/agent_orchestration_config.py +28 -0
  63. capo_codeguruprofiler/types/agent_parameter_field.py +5 -0
  64. capo_codeguruprofiler/types/agent_parameters.py +27 -0
  65. capo_codeguruprofiler/types/agent_profile.py +15 -0
  66. capo_codeguruprofiler/types/aggregated_profile.py +15 -0
  67. capo_codeguruprofiler/types/aggregated_profile_time.py +45 -0
  68. capo_codeguruprofiler/types/aggregation_period.py +5 -0
  69. capo_codeguruprofiler/types/anomalies.py +29 -0
  70. capo_codeguruprofiler/types/anomaly.py +62 -0
  71. capo_codeguruprofiler/types/anomaly_instance.py +77 -0
  72. capo_codeguruprofiler/types/anomaly_instance_id.py +5 -0
  73. capo_codeguruprofiler/types/anomaly_instances.py +31 -0
  74. capo_codeguruprofiler/types/batch_get_frame_metric_data_request.py +56 -0
  75. capo_codeguruprofiler/types/batch_get_frame_metric_data_response.py +130 -0
  76. capo_codeguruprofiler/types/channel.py +58 -0
  77. capo_codeguruprofiler/types/channel_id.py +5 -0
  78. capo_codeguruprofiler/types/channel_uri.py +6 -0
  79. capo_codeguruprofiler/types/channels.py +29 -0
  80. capo_codeguruprofiler/types/client_token.py +5 -0
  81. capo_codeguruprofiler/types/compute_platform.py +5 -0
  82. capo_codeguruprofiler/types/configure_agent_request.py +50 -0
  83. capo_codeguruprofiler/types/configure_agent_response.py +43 -0
  84. capo_codeguruprofiler/types/create_profiling_group_request.py +81 -0
  85. capo_codeguruprofiler/types/create_profiling_group_response.py +45 -0
  86. capo_codeguruprofiler/types/delete_profiling_group_request.py +26 -0
  87. capo_codeguruprofiler/types/delete_profiling_group_response.py +18 -0
  88. capo_codeguruprofiler/types/describe_profiling_group_request.py +26 -0
  89. capo_codeguruprofiler/types/describe_profiling_group_response.py +45 -0
  90. capo_codeguruprofiler/types/event_publisher.py +5 -0
  91. capo_codeguruprofiler/types/event_publishers.py +19 -0
  92. capo_codeguruprofiler/types/feedback_type.py +5 -0
  93. capo_codeguruprofiler/types/findings_report_id.py +5 -0
  94. capo_codeguruprofiler/types/findings_report_summaries.py +35 -0
  95. capo_codeguruprofiler/types/findings_report_summary.py +73 -0
  96. capo_codeguruprofiler/types/fleet_instance_id.py +5 -0
  97. capo_codeguruprofiler/types/frame_metric.py +56 -0
  98. capo_codeguruprofiler/types/frame_metric_data.py +33 -0
  99. capo_codeguruprofiler/types/frame_metric_datum.py +56 -0
  100. capo_codeguruprofiler/types/frame_metric_value.py +5 -0
  101. capo_codeguruprofiler/types/frame_metric_values.py +30 -0
  102. capo_codeguruprofiler/types/frame_metrics.py +29 -0
  103. capo_codeguruprofiler/types/get_findings_report_account_summary_request.py +31 -0
  104. capo_codeguruprofiler/types/get_findings_report_account_summary_response.py +56 -0
  105. capo_codeguruprofiler/types/get_notification_configuration_request.py +26 -0
  106. capo_codeguruprofiler/types/get_notification_configuration_response.py +45 -0
  107. capo_codeguruprofiler/types/get_policy_request.py +26 -0
  108. capo_codeguruprofiler/types/get_policy_response.py +38 -0
  109. capo_codeguruprofiler/types/get_profile_request.py +39 -0
  110. capo_codeguruprofiler/types/get_profile_response.py +45 -0
  111. capo_codeguruprofiler/types/get_recommendations_request.py +34 -0
  112. capo_codeguruprofiler/types/get_recommendations_response.py +110 -0
  113. capo_codeguruprofiler/types/list_findings_reports_request.py +41 -0
  114. capo_codeguruprofiler/types/list_findings_reports_response.py +56 -0
  115. capo_codeguruprofiler/types/list_of_timestamps.py +33 -0
  116. capo_codeguruprofiler/types/list_profile_times_request.py +45 -0
  117. capo_codeguruprofiler/types/list_profile_times_response.py +50 -0
  118. capo_codeguruprofiler/types/list_profiling_groups_request.py +31 -0
  119. capo_codeguruprofiler/types/list_profiling_groups_response.py +77 -0
  120. capo_codeguruprofiler/types/list_tags_for_resource_request.py +24 -0
  121. capo_codeguruprofiler/types/list_tags_for_resource_response.py +34 -0
  122. capo_codeguruprofiler/types/locale.py +6 -0
  123. capo_codeguruprofiler/types/match.py +43 -0
  124. capo_codeguruprofiler/types/matches.py +29 -0
  125. capo_codeguruprofiler/types/max_depth.py +5 -0
  126. capo_codeguruprofiler/types/max_results.py +5 -0
  127. capo_codeguruprofiler/types/metadata.py +27 -0
  128. capo_codeguruprofiler/types/metadata_field.py +5 -0
  129. capo_codeguruprofiler/types/metric.py +54 -0
  130. capo_codeguruprofiler/types/metric_type.py +5 -0
  131. capo_codeguruprofiler/types/notification_configuration.py +36 -0
  132. capo_codeguruprofiler/types/order_by.py +5 -0
  133. capo_codeguruprofiler/types/pagination_token.py +5 -0
  134. capo_codeguruprofiler/types/pattern.py +95 -0
  135. capo_codeguruprofiler/types/percentage.py +5 -0
  136. capo_codeguruprofiler/types/period.py +5 -0
  137. capo_codeguruprofiler/types/post_agent_profile_request.py +51 -0
  138. capo_codeguruprofiler/types/post_agent_profile_response.py +18 -0
  139. capo_codeguruprofiler/types/principal.py +5 -0
  140. capo_codeguruprofiler/types/principals.py +17 -0
  141. capo_codeguruprofiler/types/profile_time.py +36 -0
  142. capo_codeguruprofiler/types/profile_times.py +29 -0
  143. capo_codeguruprofiler/types/profiling_group_arn.py +5 -0
  144. capo_codeguruprofiler/types/profiling_group_description.py +132 -0
  145. capo_codeguruprofiler/types/profiling_group_descriptions.py +37 -0
  146. capo_codeguruprofiler/types/profiling_group_name.py +5 -0
  147. capo_codeguruprofiler/types/profiling_group_names.py +19 -0
  148. capo_codeguruprofiler/types/profiling_status.py +83 -0
  149. capo_codeguruprofiler/types/put_permission_request.py +54 -0
  150. capo_codeguruprofiler/types/put_permission_response.py +38 -0
  151. capo_codeguruprofiler/types/recommendation.py +108 -0
  152. capo_codeguruprofiler/types/recommendations.py +31 -0
  153. capo_codeguruprofiler/types/remove_notification_channel_request.py +29 -0
  154. capo_codeguruprofiler/types/remove_notification_channel_response.py +42 -0
  155. capo_codeguruprofiler/types/remove_permission_request.py +32 -0
  156. capo_codeguruprofiler/types/remove_permission_response.py +38 -0
  157. capo_codeguruprofiler/types/revision_id.py +5 -0
  158. capo_codeguruprofiler/types/strings.py +14 -0
  159. capo_codeguruprofiler/types/submit_feedback_request.py +47 -0
  160. capo_codeguruprofiler/types/submit_feedback_response.py +18 -0
  161. capo_codeguruprofiler/types/tag_keys.py +14 -0
  162. capo_codeguruprofiler/types/tag_resource_request.py +40 -0
  163. capo_codeguruprofiler/types/tag_resource_response.py +18 -0
  164. capo_codeguruprofiler/types/tags_map.py +22 -0
  165. capo_codeguruprofiler/types/target_frame.py +14 -0
  166. capo_codeguruprofiler/types/target_frames.py +29 -0
  167. capo_codeguruprofiler/types/thread_states.py +14 -0
  168. capo_codeguruprofiler/types/timestamp.py +20 -0
  169. capo_codeguruprofiler/types/timestamp_structure.py +37 -0
  170. capo_codeguruprofiler/types/unprocessed_end_time_map.py +33 -0
  171. capo_codeguruprofiler/types/untag_resource_request.py +27 -0
  172. capo_codeguruprofiler/types/untag_resource_response.py +18 -0
  173. capo_codeguruprofiler/types/update_profiling_group_request.py +50 -0
  174. capo_codeguruprofiler/types/update_profiling_group_response.py +45 -0
  175. capo_codeguruprofiler/types/user_feedback.py +31 -0
  176. capo_codeguruprofiler-0.1.0.dist-info/METADATA +101 -0
  177. capo_codeguruprofiler-0.1.0.dist-info/RECORD +180 -0
  178. capo_codeguruprofiler-0.1.0.dist-info/WHEEL +5 -0
  179. capo_codeguruprofiler-0.1.0.dist-info/licenses/LICENSE +21 -0
  180. capo_codeguruprofiler-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,373 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codeguruprofiler#CodeGuruProfiler``."""
2
+
3
+ import warnings
4
+ from collections.abc import Iterator
5
+ from typing import TYPE_CHECKING, Any, Iterable, Optional
6
+
7
+ from typing_extensions import Self, TypedDict
8
+ from zapros import BaseHandler, Client
9
+
10
+ import capo_codeguruprofiler._auth._signers
11
+ import capo_codeguruprofiler._auth._sigv4
12
+ from capo_codeguruprofiler._auth._identity import Credentials
13
+ from capo_codeguruprofiler._auth._providers import (
14
+ CredentialsProvider,
15
+ IdentityProvider,
16
+ StaticAwsCredentialsProvider,
17
+ default_aws_credentials_chain,
18
+ )
19
+ from capo_codeguruprofiler._auth._zapros_handler import AuthMiddleware
20
+ from capo_codeguruprofiler._pagination import resolve_path as _resolve_path
21
+ from capo_codeguruprofiler._resources.code_guru_profiler.profiling_group import (
22
+ ProfilingGroup,
23
+ )
24
+ from capo_codeguruprofiler._services._aws_config import aws_config
25
+ from capo_codeguruprofiler._services._pipeline import (
26
+ Interceptor,
27
+ OperationOptions,
28
+ OperationRequest,
29
+ OperationResponse,
30
+ execute_pipeline,
31
+ retry,
32
+ )
33
+
34
+ if TYPE_CHECKING:
35
+ import capo_codeguruprofiler.types.get_findings_report_account_summary_request
36
+ import capo_codeguruprofiler.types.get_findings_report_account_summary_response
37
+ import capo_codeguruprofiler.types.list_tags_for_resource_request
38
+ import capo_codeguruprofiler.types.list_tags_for_resource_response
39
+ import capo_codeguruprofiler.types.max_results
40
+ import capo_codeguruprofiler.types.pagination_token
41
+ import capo_codeguruprofiler.types.profiling_group_arn
42
+ import capo_codeguruprofiler.types.tag_keys
43
+ import capo_codeguruprofiler.types.tag_resource_request
44
+ import capo_codeguruprofiler.types.tag_resource_response
45
+ import capo_codeguruprofiler.types.tags_map
46
+ import capo_codeguruprofiler.types.untag_resource_request
47
+ import capo_codeguruprofiler.types.untag_resource_response
48
+
49
+
50
+ class CodeGuruProfilerClientConfig(TypedDict, total=False, closed=True):
51
+ operation_interceptors: Iterable[Interceptor[Any, Any]]
52
+ retry_max_attempts: int | None
53
+ region: str | None
54
+ use_dual_stack: bool | None
55
+ use_fips: bool | None
56
+ endpoint: str | None
57
+ credentials_provider: IdentityProvider[Credentials] | None
58
+
59
+
60
+ class CodeGuruProfilerClient:
61
+ """A client for the ``CodeGuruProfiler`` service.
62
+
63
+ Args:
64
+ http_handler: HTTP handler for sending requests. If not provided, creates a default handler.
65
+ operation_interceptors: Interceptors that wrap every operation call. If not provided, defaults to an empty list.
66
+ retry_max_attempts: Maximum number of times to retry a failed operation. Defaults to 3.
67
+ region: The value of the ``AWS::Region`` endpoint parameter.
68
+ use_dual_stack: The value of the ``AWS::UseDualStack`` endpoint parameter.
69
+ use_fips: The value of the ``AWS::UseFIPS`` endpoint parameter.
70
+ endpoint: The value of the ``SDK::Endpoint`` endpoint parameter.
71
+ credentials: AWS credentials for request signing.
72
+ credentials_provider: Provider that resolves AWS credentials. Takes precedence over ``credentials``.
73
+ """
74
+
75
+ def __init__(
76
+ self,
77
+ http_handler: BaseHandler | None = None,
78
+ operation_interceptors: Iterable[Interceptor[Any, Any]] | None = None,
79
+ retry_max_attempts: int | None = None,
80
+ region: str | None = None,
81
+ use_dual_stack: bool | None = None,
82
+ use_fips: bool | None = None,
83
+ endpoint: str | None = None,
84
+ credentials: Credentials | None = None,
85
+ credentials_provider: CredentialsProvider | None = None,
86
+ ):
87
+ self._client = Client(http_handler).wrap_with_middleware(
88
+ lambda next: AuthMiddleware(next)
89
+ )
90
+ if credentials is not None and credentials_provider is not None:
91
+ warnings.warn(
92
+ "Both credentials and credentials_provider given; provider takes precedence"
93
+ )
94
+ resolved_credentials_provider: IdentityProvider[Credentials] | None = (
95
+ credentials_provider
96
+ )
97
+ if resolved_credentials_provider is None and credentials is not None:
98
+ resolved_credentials_provider = StaticAwsCredentialsProvider(credentials)
99
+ if resolved_credentials_provider is None and credentials is None:
100
+ resolved_credentials_provider = default_aws_credentials_chain(
101
+ Client(http_handler)
102
+ )
103
+ self._config = CodeGuruProfilerClientConfig(
104
+ {
105
+ "operation_interceptors": operation_interceptors or [],
106
+ "retry_max_attempts": retry_max_attempts,
107
+ "region": region,
108
+ "use_dual_stack": use_dual_stack,
109
+ "use_fips": use_fips,
110
+ "endpoint": endpoint,
111
+ "credentials_provider": resolved_credentials_provider,
112
+ }
113
+ )
114
+
115
+ # resources
116
+ self.profiling_group = ProfilingGroup(self)
117
+
118
+ def operation_options(
119
+ self, config_overrides: Optional[CodeGuruProfilerClientConfig] = None
120
+ ) -> tuple[Iterable[Interceptor[Any, Any]], OperationOptions]:
121
+ overrides: CodeGuruProfilerClientConfig = config_overrides or {}
122
+ interceptors_: list[Interceptor[Any, Any]] = [
123
+ *overrides.get(
124
+ "operation_interceptors", self._config.get("operation_interceptors", [])
125
+ ),
126
+ aws_config(),
127
+ retry(),
128
+ ]
129
+ options_: OperationOptions = OperationOptions(
130
+ client=self._client,
131
+ retry_max_attempts=overrides.get(
132
+ "retry_max_attempts", self._config.get("retry_max_attempts")
133
+ ),
134
+ region=overrides.get("region", self._config.get("region")),
135
+ use_dual_stack=overrides.get(
136
+ "use_dual_stack", self._config.get("use_dual_stack")
137
+ ),
138
+ use_fips=overrides.get("use_fips", self._config.get("use_fips")),
139
+ endpoint=overrides.get("endpoint", self._config.get("endpoint")),
140
+ credentials_provider=overrides.get(
141
+ "credentials_provider", self._config.get("credentials_provider")
142
+ ),
143
+ )
144
+ return interceptors_, options_
145
+
146
+ def get_findings_report_account_summary(
147
+ self,
148
+ *,
149
+ config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
150
+ next_token: Optional[
151
+ "capo_codeguruprofiler.types.pagination_token.PaginationToken"
152
+ ] = None,
153
+ max_results: Optional[
154
+ "capo_codeguruprofiler.types.max_results.MaxResults"
155
+ ] = None,
156
+ daily_reports_only: Optional[bool] = None,
157
+ ) -> "capo_codeguruprofiler.types.get_findings_report_account_summary_response.GetFindingsReportAccountSummaryResponse":
158
+ r"""<p> Returns a list of <a href=\"https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_FindingsReportSummary.html\"> <code>FindingsReportSummary</code> </a> objects that contain analysis results for all profiling groups in your AWS account. </p>
159
+
160
+ Args:
161
+ next_token: <p>The <code>nextToken</code> value returned from a previous paginated <code>GetFindingsReportAccountSummary</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. </p> <note> <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note>
162
+ max_results: <p>The maximum number of results returned by <code> GetFindingsReportAccountSummary</code> in paginated output. When this parameter is used, <code>GetFindingsReportAccountSummary</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>GetFindingsReportAccountSummary</code> request with the returned <code>nextToken</code> value.</p>
163
+ daily_reports_only: <p>A <code>Boolean</code> value indicating whether to only return reports from daily profiles. If set to <code>True</code>, only analysis data from daily profiles is returned. If set to <code>False</code>, analysis data is returned from smaller time windows (for example, one hour).</p>
164
+
165
+ Raises:
166
+ capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
167
+ capo_codeguruprofiler.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
168
+ capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
169
+ capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
170
+ """
171
+
172
+ def _handler(
173
+ req: "OperationRequest[capo_codeguruprofiler.types.get_findings_report_account_summary_request.GetFindingsReportAccountSummaryRequest]",
174
+ ) -> OperationResponse[
175
+ "capo_codeguruprofiler.types.get_findings_report_account_summary_response.GetFindingsReportAccountSummaryResponse"
176
+ ]:
177
+ import capo_codeguruprofiler._operations.code_guru_profiler.get_findings_report_account_summary
178
+
179
+ output, http_response = (
180
+ capo_codeguruprofiler._operations.code_guru_profiler.get_findings_report_account_summary.get_findings_report_account_summary(
181
+ req.options, req.input
182
+ )
183
+ )
184
+ return OperationResponse(output=output, response=http_response)
185
+
186
+ interceptors_, options_ = self.operation_options(config_overrides)
187
+ input_: capo_codeguruprofiler.types.get_findings_report_account_summary_request.GetFindingsReportAccountSummaryRequest = {}
188
+ if next_token is not None:
189
+ input_["next_token"] = next_token
190
+ if max_results is not None:
191
+ input_["max_results"] = max_results
192
+ if daily_reports_only is not None:
193
+ input_["daily_reports_only"] = daily_reports_only
194
+
195
+ response = execute_pipeline(
196
+ OperationRequest(input=input_, options=options_),
197
+ handler=_handler,
198
+ interceptors=list(interceptors_),
199
+ )
200
+ response.response.close()
201
+ return response.output
202
+
203
+ def iter_get_findings_report_account_summary(
204
+ self,
205
+ *,
206
+ config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
207
+ next_token: Optional[
208
+ "capo_codeguruprofiler.types.pagination_token.PaginationToken"
209
+ ] = None,
210
+ max_results: Optional[
211
+ "capo_codeguruprofiler.types.max_results.MaxResults"
212
+ ] = None,
213
+ daily_reports_only: Optional[bool] = None,
214
+ ) -> "Iterator[capo_codeguruprofiler.types.get_findings_report_account_summary_response.GetFindingsReportAccountSummaryResponse]":
215
+ _token = next_token
216
+ while True:
217
+ _response = self.get_findings_report_account_summary(
218
+ config_overrides=config_overrides,
219
+ next_token=_token,
220
+ max_results=max_results,
221
+ daily_reports_only=daily_reports_only,
222
+ )
223
+ yield _response
224
+ _token = _resolve_path(_response, ("next_token",))
225
+ if not _token:
226
+ break
227
+
228
+ def list_tags_for_resource(
229
+ self,
230
+ resource_arn: "capo_codeguruprofiler.types.profiling_group_arn.ProfilingGroupArn",
231
+ *,
232
+ config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
233
+ ) -> "capo_codeguruprofiler.types.list_tags_for_resource_response.ListTagsForResourceResponse":
234
+ """<p> Returns a list of the tags that are assigned to a specified resource. </p>
235
+
236
+ Args:
237
+ resource_arn: <p> The Amazon Resource Name (ARN) of the resource that contains the tags to return. </p>
238
+
239
+ Raises:
240
+ capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
241
+ capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
242
+ capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
243
+ capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
244
+ """
245
+
246
+ def _handler(
247
+ req: "OperationRequest[capo_codeguruprofiler.types.list_tags_for_resource_request.ListTagsForResourceRequest]",
248
+ ) -> OperationResponse[
249
+ "capo_codeguruprofiler.types.list_tags_for_resource_response.ListTagsForResourceResponse"
250
+ ]:
251
+ import capo_codeguruprofiler._operations.code_guru_profiler.list_tags_for_resource
252
+
253
+ output, http_response = (
254
+ capo_codeguruprofiler._operations.code_guru_profiler.list_tags_for_resource.list_tags_for_resource(
255
+ req.options, req.input
256
+ )
257
+ )
258
+ return OperationResponse(output=output, response=http_response)
259
+
260
+ interceptors_, options_ = self.operation_options(config_overrides)
261
+ input_: capo_codeguruprofiler.types.list_tags_for_resource_request.ListTagsForResourceRequest = {
262
+ "resource_arn": resource_arn
263
+ }
264
+
265
+ response = execute_pipeline(
266
+ OperationRequest(input=input_, options=options_),
267
+ handler=_handler,
268
+ interceptors=list(interceptors_),
269
+ )
270
+ response.response.close()
271
+ return response.output
272
+
273
+ def tag_resource(
274
+ self,
275
+ resource_arn: "capo_codeguruprofiler.types.profiling_group_arn.ProfilingGroupArn",
276
+ tags: "capo_codeguruprofiler.types.tags_map.TagsMap",
277
+ *,
278
+ config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
279
+ ) -> "capo_codeguruprofiler.types.tag_resource_response.TagResourceResponse":
280
+ """<p> Use to assign one or more tags to a resource. </p>
281
+
282
+ Args:
283
+ resource_arn: <p> The Amazon Resource Name (ARN) of the resource that the tags are added to. </p>
284
+ tags: <p> The list of tags that are added to the specified resource. </p>
285
+
286
+ Raises:
287
+ capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
288
+ capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
289
+ capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
290
+ capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
291
+ """
292
+
293
+ def _handler(
294
+ req: "OperationRequest[capo_codeguruprofiler.types.tag_resource_request.TagResourceRequest]",
295
+ ) -> OperationResponse[
296
+ "capo_codeguruprofiler.types.tag_resource_response.TagResourceResponse"
297
+ ]:
298
+ import capo_codeguruprofiler._operations.code_guru_profiler.tag_resource
299
+
300
+ output, http_response = (
301
+ capo_codeguruprofiler._operations.code_guru_profiler.tag_resource.tag_resource(
302
+ req.options, req.input
303
+ )
304
+ )
305
+ return OperationResponse(output=output, response=http_response)
306
+
307
+ interceptors_, options_ = self.operation_options(config_overrides)
308
+ input_: capo_codeguruprofiler.types.tag_resource_request.TagResourceRequest = {
309
+ "resource_arn": resource_arn,
310
+ "tags": tags,
311
+ }
312
+
313
+ response = execute_pipeline(
314
+ OperationRequest(input=input_, options=options_),
315
+ handler=_handler,
316
+ interceptors=list(interceptors_),
317
+ )
318
+ response.response.close()
319
+ return response.output
320
+
321
+ def untag_resource(
322
+ self,
323
+ resource_arn: "capo_codeguruprofiler.types.profiling_group_arn.ProfilingGroupArn",
324
+ tag_keys: "capo_codeguruprofiler.types.tag_keys.TagKeys",
325
+ *,
326
+ config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
327
+ ) -> "capo_codeguruprofiler.types.untag_resource_response.UntagResourceResponse":
328
+ """<p> Use to remove one or more tags from a resource. </p>
329
+
330
+ Args:
331
+ resource_arn: <p> The Amazon Resource Name (ARN) of the resource that contains the tags to remove. </p>
332
+ tag_keys: <p> A list of tag keys. Existing tags of resources with keys in this list are removed from the specified resource. </p>
333
+
334
+ Raises:
335
+ capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
336
+ capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
337
+ capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
338
+ capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
339
+ """
340
+
341
+ def _handler(
342
+ req: "OperationRequest[capo_codeguruprofiler.types.untag_resource_request.UntagResourceRequest]",
343
+ ) -> OperationResponse[
344
+ "capo_codeguruprofiler.types.untag_resource_response.UntagResourceResponse"
345
+ ]:
346
+ import capo_codeguruprofiler._operations.code_guru_profiler.untag_resource
347
+
348
+ output, http_response = (
349
+ capo_codeguruprofiler._operations.code_guru_profiler.untag_resource.untag_resource(
350
+ req.options, req.input
351
+ )
352
+ )
353
+ return OperationResponse(output=output, response=http_response)
354
+
355
+ interceptors_, options_ = self.operation_options(config_overrides)
356
+ input_: capo_codeguruprofiler.types.untag_resource_request.UntagResourceRequest = {
357
+ "resource_arn": resource_arn,
358
+ "tag_keys": tag_keys,
359
+ }
360
+
361
+ response = execute_pipeline(
362
+ OperationRequest(input=input_, options=options_),
363
+ handler=_handler,
364
+ interceptors=list(interceptors_),
365
+ )
366
+ response.response.close()
367
+ return response.output
368
+
369
+ def __enter__(self) -> Self:
370
+ return self
371
+
372
+ def __exit__(self, exc_type: Any, exc: Any, tb: Any):
373
+ self._client.close()
@@ -0,0 +1,35 @@
1
+ from __future__ import annotations
2
+
3
+ from ._base import (
4
+ CodeGuruProfilerError as CodeGuruProfilerError,
5
+ )
6
+ from ._base import (
7
+ DeserializationError as DeserializationError,
8
+ )
9
+ from ._base import (
10
+ SerializationError as SerializationError,
11
+ )
12
+ from ._base import (
13
+ ServiceError as ServiceError,
14
+ )
15
+ from ._base import (
16
+ UnknownServiceError as UnknownServiceError,
17
+ )
18
+ from ._base import (
19
+ WaiterFailedError as WaiterFailedError,
20
+ )
21
+ from ._base import (
22
+ WaiterTimeoutError as WaiterTimeoutError,
23
+ )
24
+ from .conflict_exception import ConflictException as ConflictException
25
+ from .internal_server_exception import (
26
+ InternalServerException as InternalServerException,
27
+ )
28
+ from .resource_not_found_exception import (
29
+ ResourceNotFoundException as ResourceNotFoundException,
30
+ )
31
+ from .service_quota_exceeded_exception import (
32
+ ServiceQuotaExceededException as ServiceQuotaExceededException,
33
+ )
34
+ from .throttling_exception import ThrottlingException as ThrottlingException
35
+ from .validation_exception import ValidationException as ValidationException
@@ -0,0 +1,94 @@
1
+ from typing import Literal
2
+
3
+
4
+ class CodeGuruProfilerError(Exception):
5
+ """Base class for all CodeGuruProfiler service errors."""
6
+
7
+
8
+ class ServiceError(CodeGuruProfilerError):
9
+ """Base class for all modeled service errors.
10
+
11
+ Args:
12
+ fault: ``"client"`` or ``"server"``.
13
+ is_throttling_error: Whether this error is a throttling error.
14
+ is_retryable: Whether this error is retryable.
15
+ code: The wire error code, or ``None``.
16
+ message: The error message, or ``None``.
17
+ """
18
+
19
+ code: str | None = None
20
+
21
+ def __init__(
22
+ self,
23
+ fault: Literal["client", "server"],
24
+ *,
25
+ is_throttling_error: bool,
26
+ is_retryable: bool,
27
+ code: str | None = None,
28
+ message: str | None = None,
29
+ ) -> None:
30
+ super().__init__(f"{code or '<no code>'}: {message or '<no message>'}")
31
+ self.fault = fault
32
+ self.is_throttling_error = is_throttling_error
33
+ self.is_retryable = is_retryable
34
+ self.code = code
35
+ self.message = message
36
+
37
+
38
+ class SerializationError(CodeGuruProfilerError):
39
+ """Raised when a value cannot be serialized."""
40
+
41
+
42
+ class DeserializationError(CodeGuruProfilerError):
43
+ """Raised when a value cannot be deserialized or a required member is missing."""
44
+
45
+
46
+ class UnknownServiceError(ServiceError):
47
+ """Raised when the server returns an error code the client does not model.
48
+
49
+ Args:
50
+ code: ``<Code>`` text from the response body, or ``None`` if absent.
51
+ message: ``<Message>`` text from the response body, or ``None``.
52
+ response: The original HTTP response object, for arbitrary inspection.
53
+ """
54
+
55
+ def __init__(
56
+ self, *, code: str | None, message: str | None, response: object
57
+ ) -> None:
58
+ _status = getattr(response, "status", 500)
59
+ _fault: Literal["client", "server"] = "client" if _status < 500 else "server"
60
+ _throttling = _status == 429
61
+ _retryable = _throttling or _status >= 500
62
+ super().__init__(
63
+ _fault,
64
+ is_throttling_error=_throttling,
65
+ is_retryable=_retryable,
66
+ code=code,
67
+ message=message,
68
+ )
69
+ self.response = response
70
+
71
+
72
+ class WaiterFailedError(CodeGuruProfilerError):
73
+ """Raised when a waiter hits an acceptor with ``state="failure"``.
74
+
75
+ Args:
76
+ waiter_name: snake_case waiter name (e.g. ``bucket_exists``).
77
+ reason: Short description of which acceptor fired.
78
+ """
79
+
80
+ def __init__(self, waiter_name: str, reason: str) -> None:
81
+ super().__init__(f"waiter {waiter_name} failed: {reason}")
82
+ self.waiter_name = waiter_name
83
+ self.reason = reason
84
+
85
+
86
+ class WaiterTimeoutError(CodeGuruProfilerError):
87
+ """Raised when a waiter exhausts ``max_wait_time`` without a terminal acceptor."""
88
+
89
+ def __init__(self, waiter_name: str, max_wait_time: float) -> None:
90
+ super().__init__(
91
+ f"waiter {waiter_name} timed out after {max_wait_time} seconds"
92
+ )
93
+ self.waiter_name = waiter_name
94
+ self.max_wait_time = max_wait_time
@@ -0,0 +1,45 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codeguruprofiler#ConflictException``."""
2
+
3
+ from typing_extensions import TypedDict
4
+
5
+ from capo_codeguruprofiler.errors import DeserializationError, ServiceError
6
+
7
+
8
+ class ConflictException_(TypedDict, closed=True):
9
+ message: "str"
10
+
11
+
12
+ # --- restJson1 ser/de ---
13
+ def serialize_json(value: ConflictException_) -> dict:
14
+ out: dict = {}
15
+ out["message"] = value["message"]
16
+ return out
17
+
18
+
19
+ def deserialize_json(data: dict) -> ConflictException_:
20
+ out: ConflictException_ = {} # type: ignore[typeddict-item]
21
+ if data.get("message") is not None:
22
+ out["message"] = data["message"]
23
+ else:
24
+ raise DeserializationError("ConflictException_.message required")
25
+ return out
26
+
27
+
28
+ class ConflictException(ServiceError):
29
+ """Modeled error for Smithy shape ``com.amazonaws.codeguruprofiler#ConflictException``."""
30
+
31
+ code: str | None = "ConflictException"
32
+
33
+ def __init__(self, data: ConflictException_, message: str | None = None):
34
+ super().__init__(
35
+ "client",
36
+ is_throttling_error=False,
37
+ is_retryable=False,
38
+ code="ConflictException",
39
+ message=message,
40
+ )
41
+ self.data = data
42
+
43
+ @classmethod
44
+ def from_json(cls, data: dict, message: str | None = None) -> "ConflictException":
45
+ return cls(deserialize_json(data), message)
@@ -0,0 +1,47 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codeguruprofiler#InternalServerException``."""
2
+
3
+ from typing_extensions import TypedDict
4
+
5
+ from capo_codeguruprofiler.errors import DeserializationError, ServiceError
6
+
7
+
8
+ class InternalServerException_(TypedDict, closed=True):
9
+ message: "str"
10
+
11
+
12
+ # --- restJson1 ser/de ---
13
+ def serialize_json(value: InternalServerException_) -> dict:
14
+ out: dict = {}
15
+ out["message"] = value["message"]
16
+ return out
17
+
18
+
19
+ def deserialize_json(data: dict) -> InternalServerException_:
20
+ out: InternalServerException_ = {} # type: ignore[typeddict-item]
21
+ if data.get("message") is not None:
22
+ out["message"] = data["message"]
23
+ else:
24
+ raise DeserializationError("InternalServerException_.message required")
25
+ return out
26
+
27
+
28
+ class InternalServerException(ServiceError):
29
+ """Modeled error for Smithy shape ``com.amazonaws.codeguruprofiler#InternalServerException``."""
30
+
31
+ code: str | None = "InternalServerException"
32
+
33
+ def __init__(self, data: InternalServerException_, message: str | None = None):
34
+ super().__init__(
35
+ "server",
36
+ is_throttling_error=False,
37
+ is_retryable=True,
38
+ code="InternalServerException",
39
+ message=message,
40
+ )
41
+ self.data = data
42
+
43
+ @classmethod
44
+ def from_json(
45
+ cls, data: dict, message: str | None = None
46
+ ) -> "InternalServerException":
47
+ return cls(deserialize_json(data), message)
@@ -0,0 +1,47 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codeguruprofiler#ResourceNotFoundException``."""
2
+
3
+ from typing_extensions import TypedDict
4
+
5
+ from capo_codeguruprofiler.errors import DeserializationError, ServiceError
6
+
7
+
8
+ class ResourceNotFoundException_(TypedDict, closed=True):
9
+ message: "str"
10
+
11
+
12
+ # --- restJson1 ser/de ---
13
+ def serialize_json(value: ResourceNotFoundException_) -> dict:
14
+ out: dict = {}
15
+ out["message"] = value["message"]
16
+ return out
17
+
18
+
19
+ def deserialize_json(data: dict) -> ResourceNotFoundException_:
20
+ out: ResourceNotFoundException_ = {} # type: ignore[typeddict-item]
21
+ if data.get("message") is not None:
22
+ out["message"] = data["message"]
23
+ else:
24
+ raise DeserializationError("ResourceNotFoundException_.message required")
25
+ return out
26
+
27
+
28
+ class ResourceNotFoundException(ServiceError):
29
+ """Modeled error for Smithy shape ``com.amazonaws.codeguruprofiler#ResourceNotFoundException``."""
30
+
31
+ code: str | None = "ResourceNotFoundException"
32
+
33
+ def __init__(self, data: ResourceNotFoundException_, message: str | None = None):
34
+ super().__init__(
35
+ "client",
36
+ is_throttling_error=False,
37
+ is_retryable=False,
38
+ code="ResourceNotFoundException",
39
+ message=message,
40
+ )
41
+ self.data = data
42
+
43
+ @classmethod
44
+ def from_json(
45
+ cls, data: dict, message: str | None = None
46
+ ) -> "ResourceNotFoundException":
47
+ return cls(deserialize_json(data), message)