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.
- capo_codeguruprofiler/__init__.py +74 -0
- capo_codeguruprofiler/_async.py +25 -0
- capo_codeguruprofiler/_auth/_identity.py +16 -0
- capo_codeguruprofiler/_auth/_providers.py +886 -0
- capo_codeguruprofiler/_auth/_signers.py +88 -0
- capo_codeguruprofiler/_auth/_sigv4.py +434 -0
- capo_codeguruprofiler/_auth/_zapros_handler.py +80 -0
- capo_codeguruprofiler/_iter.py +113 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/add_notification_channels.py +185 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/batch_get_frame_metric_data.py +202 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/configure_agent.py +177 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/create_profiling_group.py +180 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/delete_profiling_group.py +165 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/describe_profiling_group.py +169 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/get_findings_report_account_summary.py +164 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/get_notification_configuration.py +168 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/get_policy.py +161 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/get_profile.py +196 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/get_recommendations.py +196 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/list_findings_reports.py +197 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/list_profile_times.py +196 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/list_profiling_groups.py +160 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/list_tags_for_resource.py +158 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/post_agent_profile.py +168 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/put_permission.py +182 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/remove_notification_channel.py +169 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/remove_permission.py +175 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/submit_feedback.py +170 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/tag_resource.py +158 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/untag_resource.py +156 -0
- capo_codeguruprofiler/_operations/code_guru_profiler/update_profiling_group.py +181 -0
- capo_codeguruprofiler/_pagination.py +21 -0
- capo_codeguruprofiler/_protocol/__init__.py +1 -0
- capo_codeguruprofiler/_protocol/errors.py +93 -0
- capo_codeguruprofiler/_protocol/eventstream.py +238 -0
- capo_codeguruprofiler/_protocol/serialize.py +47 -0
- capo_codeguruprofiler/_protocol/xml.py +33 -0
- capo_codeguruprofiler/_resources/code_guru_profiler/profiling_group.py +2257 -0
- capo_codeguruprofiler/_rule_engine/__init__.py +0 -0
- capo_codeguruprofiler/_rule_engine/_aws_partition.py +160 -0
- capo_codeguruprofiler/_rule_engine/_endpoint_rule_set.py +138 -0
- capo_codeguruprofiler/_rule_engine/_endpoint_runtime.py +389 -0
- capo_codeguruprofiler/_services/_aws_config.py +160 -0
- capo_codeguruprofiler/_services/_pipeline.py +198 -0
- capo_codeguruprofiler/_services/async_code_guru_profiler.py +377 -0
- capo_codeguruprofiler/_services/code_guru_profiler.py +373 -0
- capo_codeguruprofiler/errors/__init__.py +35 -0
- capo_codeguruprofiler/errors/_base.py +94 -0
- capo_codeguruprofiler/errors/conflict_exception.py +45 -0
- capo_codeguruprofiler/errors/internal_server_exception.py +47 -0
- capo_codeguruprofiler/errors/resource_not_found_exception.py +47 -0
- capo_codeguruprofiler/errors/service_quota_exceeded_exception.py +49 -0
- capo_codeguruprofiler/errors/throttling_exception.py +45 -0
- capo_codeguruprofiler/errors/validation_exception.py +45 -0
- capo_codeguruprofiler/py.typed +0 -0
- capo_codeguruprofiler/types/_prelude/blob.py +12 -0
- capo_codeguruprofiler/types/_prelude/timestamp.py +17 -0
- capo_codeguruprofiler/types/action_group.py +5 -0
- capo_codeguruprofiler/types/add_notification_channels_request.py +44 -0
- capo_codeguruprofiler/types/add_notification_channels_response.py +42 -0
- capo_codeguruprofiler/types/agent_configuration.py +58 -0
- capo_codeguruprofiler/types/agent_orchestration_config.py +28 -0
- capo_codeguruprofiler/types/agent_parameter_field.py +5 -0
- capo_codeguruprofiler/types/agent_parameters.py +27 -0
- capo_codeguruprofiler/types/agent_profile.py +15 -0
- capo_codeguruprofiler/types/aggregated_profile.py +15 -0
- capo_codeguruprofiler/types/aggregated_profile_time.py +45 -0
- capo_codeguruprofiler/types/aggregation_period.py +5 -0
- capo_codeguruprofiler/types/anomalies.py +29 -0
- capo_codeguruprofiler/types/anomaly.py +62 -0
- capo_codeguruprofiler/types/anomaly_instance.py +77 -0
- capo_codeguruprofiler/types/anomaly_instance_id.py +5 -0
- capo_codeguruprofiler/types/anomaly_instances.py +31 -0
- capo_codeguruprofiler/types/batch_get_frame_metric_data_request.py +56 -0
- capo_codeguruprofiler/types/batch_get_frame_metric_data_response.py +130 -0
- capo_codeguruprofiler/types/channel.py +58 -0
- capo_codeguruprofiler/types/channel_id.py +5 -0
- capo_codeguruprofiler/types/channel_uri.py +6 -0
- capo_codeguruprofiler/types/channels.py +29 -0
- capo_codeguruprofiler/types/client_token.py +5 -0
- capo_codeguruprofiler/types/compute_platform.py +5 -0
- capo_codeguruprofiler/types/configure_agent_request.py +50 -0
- capo_codeguruprofiler/types/configure_agent_response.py +43 -0
- capo_codeguruprofiler/types/create_profiling_group_request.py +81 -0
- capo_codeguruprofiler/types/create_profiling_group_response.py +45 -0
- capo_codeguruprofiler/types/delete_profiling_group_request.py +26 -0
- capo_codeguruprofiler/types/delete_profiling_group_response.py +18 -0
- capo_codeguruprofiler/types/describe_profiling_group_request.py +26 -0
- capo_codeguruprofiler/types/describe_profiling_group_response.py +45 -0
- capo_codeguruprofiler/types/event_publisher.py +5 -0
- capo_codeguruprofiler/types/event_publishers.py +19 -0
- capo_codeguruprofiler/types/feedback_type.py +5 -0
- capo_codeguruprofiler/types/findings_report_id.py +5 -0
- capo_codeguruprofiler/types/findings_report_summaries.py +35 -0
- capo_codeguruprofiler/types/findings_report_summary.py +73 -0
- capo_codeguruprofiler/types/fleet_instance_id.py +5 -0
- capo_codeguruprofiler/types/frame_metric.py +56 -0
- capo_codeguruprofiler/types/frame_metric_data.py +33 -0
- capo_codeguruprofiler/types/frame_metric_datum.py +56 -0
- capo_codeguruprofiler/types/frame_metric_value.py +5 -0
- capo_codeguruprofiler/types/frame_metric_values.py +30 -0
- capo_codeguruprofiler/types/frame_metrics.py +29 -0
- capo_codeguruprofiler/types/get_findings_report_account_summary_request.py +31 -0
- capo_codeguruprofiler/types/get_findings_report_account_summary_response.py +56 -0
- capo_codeguruprofiler/types/get_notification_configuration_request.py +26 -0
- capo_codeguruprofiler/types/get_notification_configuration_response.py +45 -0
- capo_codeguruprofiler/types/get_policy_request.py +26 -0
- capo_codeguruprofiler/types/get_policy_response.py +38 -0
- capo_codeguruprofiler/types/get_profile_request.py +39 -0
- capo_codeguruprofiler/types/get_profile_response.py +45 -0
- capo_codeguruprofiler/types/get_recommendations_request.py +34 -0
- capo_codeguruprofiler/types/get_recommendations_response.py +110 -0
- capo_codeguruprofiler/types/list_findings_reports_request.py +41 -0
- capo_codeguruprofiler/types/list_findings_reports_response.py +56 -0
- capo_codeguruprofiler/types/list_of_timestamps.py +33 -0
- capo_codeguruprofiler/types/list_profile_times_request.py +45 -0
- capo_codeguruprofiler/types/list_profile_times_response.py +50 -0
- capo_codeguruprofiler/types/list_profiling_groups_request.py +31 -0
- capo_codeguruprofiler/types/list_profiling_groups_response.py +77 -0
- capo_codeguruprofiler/types/list_tags_for_resource_request.py +24 -0
- capo_codeguruprofiler/types/list_tags_for_resource_response.py +34 -0
- capo_codeguruprofiler/types/locale.py +6 -0
- capo_codeguruprofiler/types/match.py +43 -0
- capo_codeguruprofiler/types/matches.py +29 -0
- capo_codeguruprofiler/types/max_depth.py +5 -0
- capo_codeguruprofiler/types/max_results.py +5 -0
- capo_codeguruprofiler/types/metadata.py +27 -0
- capo_codeguruprofiler/types/metadata_field.py +5 -0
- capo_codeguruprofiler/types/metric.py +54 -0
- capo_codeguruprofiler/types/metric_type.py +5 -0
- capo_codeguruprofiler/types/notification_configuration.py +36 -0
- capo_codeguruprofiler/types/order_by.py +5 -0
- capo_codeguruprofiler/types/pagination_token.py +5 -0
- capo_codeguruprofiler/types/pattern.py +95 -0
- capo_codeguruprofiler/types/percentage.py +5 -0
- capo_codeguruprofiler/types/period.py +5 -0
- capo_codeguruprofiler/types/post_agent_profile_request.py +51 -0
- capo_codeguruprofiler/types/post_agent_profile_response.py +18 -0
- capo_codeguruprofiler/types/principal.py +5 -0
- capo_codeguruprofiler/types/principals.py +17 -0
- capo_codeguruprofiler/types/profile_time.py +36 -0
- capo_codeguruprofiler/types/profile_times.py +29 -0
- capo_codeguruprofiler/types/profiling_group_arn.py +5 -0
- capo_codeguruprofiler/types/profiling_group_description.py +132 -0
- capo_codeguruprofiler/types/profiling_group_descriptions.py +37 -0
- capo_codeguruprofiler/types/profiling_group_name.py +5 -0
- capo_codeguruprofiler/types/profiling_group_names.py +19 -0
- capo_codeguruprofiler/types/profiling_status.py +83 -0
- capo_codeguruprofiler/types/put_permission_request.py +54 -0
- capo_codeguruprofiler/types/put_permission_response.py +38 -0
- capo_codeguruprofiler/types/recommendation.py +108 -0
- capo_codeguruprofiler/types/recommendations.py +31 -0
- capo_codeguruprofiler/types/remove_notification_channel_request.py +29 -0
- capo_codeguruprofiler/types/remove_notification_channel_response.py +42 -0
- capo_codeguruprofiler/types/remove_permission_request.py +32 -0
- capo_codeguruprofiler/types/remove_permission_response.py +38 -0
- capo_codeguruprofiler/types/revision_id.py +5 -0
- capo_codeguruprofiler/types/strings.py +14 -0
- capo_codeguruprofiler/types/submit_feedback_request.py +47 -0
- capo_codeguruprofiler/types/submit_feedback_response.py +18 -0
- capo_codeguruprofiler/types/tag_keys.py +14 -0
- capo_codeguruprofiler/types/tag_resource_request.py +40 -0
- capo_codeguruprofiler/types/tag_resource_response.py +18 -0
- capo_codeguruprofiler/types/tags_map.py +22 -0
- capo_codeguruprofiler/types/target_frame.py +14 -0
- capo_codeguruprofiler/types/target_frames.py +29 -0
- capo_codeguruprofiler/types/thread_states.py +14 -0
- capo_codeguruprofiler/types/timestamp.py +20 -0
- capo_codeguruprofiler/types/timestamp_structure.py +37 -0
- capo_codeguruprofiler/types/unprocessed_end_time_map.py +33 -0
- capo_codeguruprofiler/types/untag_resource_request.py +27 -0
- capo_codeguruprofiler/types/untag_resource_response.py +18 -0
- capo_codeguruprofiler/types/update_profiling_group_request.py +50 -0
- capo_codeguruprofiler/types/update_profiling_group_response.py +45 -0
- capo_codeguruprofiler/types/user_feedback.py +31 -0
- capo_codeguruprofiler-0.1.0.dist-info/METADATA +101 -0
- capo_codeguruprofiler-0.1.0.dist-info/RECORD +180 -0
- capo_codeguruprofiler-0.1.0.dist-info/WHEEL +5 -0
- capo_codeguruprofiler-0.1.0.dist-info/licenses/LICENSE +21 -0
- capo_codeguruprofiler-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""Generated from Smithy shape ``com.amazonaws.codeguruprofiler#GetRecommendations``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any
|
|
7
|
+
from urllib.parse import quote
|
|
8
|
+
|
|
9
|
+
import zapros
|
|
10
|
+
from typing_extensions import Never
|
|
11
|
+
|
|
12
|
+
import capo_codeguruprofiler._auth._signers
|
|
13
|
+
import capo_codeguruprofiler._auth._sigv4
|
|
14
|
+
import capo_codeguruprofiler._protocol.eventstream
|
|
15
|
+
import capo_codeguruprofiler.errors.internal_server_exception
|
|
16
|
+
import capo_codeguruprofiler.errors.resource_not_found_exception
|
|
17
|
+
import capo_codeguruprofiler.errors.throttling_exception
|
|
18
|
+
import capo_codeguruprofiler.errors.validation_exception
|
|
19
|
+
import capo_codeguruprofiler.types.anomalies
|
|
20
|
+
import capo_codeguruprofiler.types.get_recommendations_request
|
|
21
|
+
import capo_codeguruprofiler.types.get_recommendations_response
|
|
22
|
+
import capo_codeguruprofiler.types.recommendations
|
|
23
|
+
import capo_codeguruprofiler.types.timestamp
|
|
24
|
+
from capo_codeguruprofiler._protocol.errors import parse_error_metadata_json
|
|
25
|
+
from capo_codeguruprofiler._rule_engine._endpoint_rule_set import (
|
|
26
|
+
EndpointParams,
|
|
27
|
+
resolve,
|
|
28
|
+
)
|
|
29
|
+
from capo_codeguruprofiler._services._pipeline import (
|
|
30
|
+
AsyncOperationOptions,
|
|
31
|
+
OperationOptions,
|
|
32
|
+
)
|
|
33
|
+
from capo_codeguruprofiler.errors import UnknownServiceError
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def handle_error(response: zapros.Response) -> Never:
|
|
37
|
+
data = json.loads(response.read())
|
|
38
|
+
code, message = parse_error_metadata_json(response, data)
|
|
39
|
+
match code:
|
|
40
|
+
case "InternalServerException":
|
|
41
|
+
raise capo_codeguruprofiler.errors.internal_server_exception.InternalServerException.from_json(
|
|
42
|
+
data, message
|
|
43
|
+
)
|
|
44
|
+
case "ResourceNotFoundException":
|
|
45
|
+
raise capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
|
|
46
|
+
data, message
|
|
47
|
+
)
|
|
48
|
+
case "ThrottlingException":
|
|
49
|
+
raise capo_codeguruprofiler.errors.throttling_exception.ThrottlingException.from_json(
|
|
50
|
+
data, message
|
|
51
|
+
)
|
|
52
|
+
case "ValidationException":
|
|
53
|
+
raise capo_codeguruprofiler.errors.validation_exception.ValidationException.from_json(
|
|
54
|
+
data, message
|
|
55
|
+
)
|
|
56
|
+
case _:
|
|
57
|
+
raise UnknownServiceError(code=code, message=message, response=response)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def handle_response(
|
|
61
|
+
response: zapros.Response,
|
|
62
|
+
) -> (
|
|
63
|
+
capo_codeguruprofiler.types.get_recommendations_response.GetRecommendationsResponse
|
|
64
|
+
):
|
|
65
|
+
out: capo_codeguruprofiler.types.get_recommendations_response.GetRecommendationsResponse = capo_codeguruprofiler.types.get_recommendations_response.deserialize_json(
|
|
66
|
+
json.loads(response.read())
|
|
67
|
+
)
|
|
68
|
+
return out
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async def async_handle_response(
|
|
72
|
+
response: zapros.Response,
|
|
73
|
+
) -> (
|
|
74
|
+
capo_codeguruprofiler.types.get_recommendations_response.GetRecommendationsResponse
|
|
75
|
+
):
|
|
76
|
+
out: capo_codeguruprofiler.types.get_recommendations_response.GetRecommendationsResponse = capo_codeguruprofiler.types.get_recommendations_response.deserialize_json(
|
|
77
|
+
json.loads(await response.aread())
|
|
78
|
+
)
|
|
79
|
+
return out
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def get_signer(
|
|
83
|
+
options: AsyncOperationOptions | OperationOptions,
|
|
84
|
+
auth_schemes: list[dict[str, Any]] | None = None,
|
|
85
|
+
) -> capo_codeguruprofiler._auth._signers.Signer | None:
|
|
86
|
+
name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
|
|
87
|
+
if (
|
|
88
|
+
options.credentials_provider is not None
|
|
89
|
+
and name_to_schema
|
|
90
|
+
and not name_to_schema.keys() & {"sigv4", "sigv4-s3express"}
|
|
91
|
+
):
|
|
92
|
+
raise RuntimeError(
|
|
93
|
+
"Endpoint requires an unsupported auth scheme: " + ", ".join(name_to_schema)
|
|
94
|
+
)
|
|
95
|
+
if options.credentials_provider is not None:
|
|
96
|
+
endpoint_scheme = name_to_schema.get("sigv4") or name_to_schema.get(
|
|
97
|
+
"sigv4-s3express"
|
|
98
|
+
)
|
|
99
|
+
if endpoint_scheme is not None or not name_to_schema:
|
|
100
|
+
sigv4_config = capo_codeguruprofiler._auth._sigv4.build_sigv4_auth_scheme(
|
|
101
|
+
"codeguru-profiler", options.region, endpoint_scheme
|
|
102
|
+
)
|
|
103
|
+
if sigv4_config is not None:
|
|
104
|
+
return capo_codeguruprofiler._auth._signers.SigV4Signer(
|
|
105
|
+
options.credentials_provider, auth_scheme=sigv4_config
|
|
106
|
+
)
|
|
107
|
+
raise RuntimeError("Auth was not resolved")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def build_request(
|
|
111
|
+
options: OperationOptions | AsyncOperationOptions,
|
|
112
|
+
input_: capo_codeguruprofiler.types.get_recommendations_request.GetRecommendationsRequest,
|
|
113
|
+
) -> zapros.Request:
|
|
114
|
+
endpoint = resolve(
|
|
115
|
+
EndpointParams(
|
|
116
|
+
Region=options.region,
|
|
117
|
+
UseDualStack=options.use_dual_stack,
|
|
118
|
+
UseFIPS=options.use_fips,
|
|
119
|
+
Endpoint=options.endpoint,
|
|
120
|
+
)
|
|
121
|
+
) # noqa: F841
|
|
122
|
+
import capo_codeguruprofiler._protocol.serialize
|
|
123
|
+
|
|
124
|
+
url = (
|
|
125
|
+
endpoint.url.rstrip("/")
|
|
126
|
+
+ "/internal/profilingGroups/{profilingGroupName}/recommendations"
|
|
127
|
+
)
|
|
128
|
+
url = url.replace(
|
|
129
|
+
"{profilingGroupName}", quote(input_["profiling_group_name"], safe="")
|
|
130
|
+
)
|
|
131
|
+
params: list[tuple[str, str]] = []
|
|
132
|
+
if "start_time" in input_:
|
|
133
|
+
params.append(
|
|
134
|
+
(
|
|
135
|
+
"startTime",
|
|
136
|
+
capo_codeguruprofiler._protocol.serialize.fmt_date_time(
|
|
137
|
+
input_["start_time"]
|
|
138
|
+
),
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
if "end_time" in input_:
|
|
142
|
+
params.append(
|
|
143
|
+
(
|
|
144
|
+
"endTime",
|
|
145
|
+
capo_codeguruprofiler._protocol.serialize.fmt_date_time(
|
|
146
|
+
input_["end_time"]
|
|
147
|
+
),
|
|
148
|
+
)
|
|
149
|
+
)
|
|
150
|
+
if "locale" in input_:
|
|
151
|
+
params.append(("locale", input_["locale"]))
|
|
152
|
+
headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
|
|
153
|
+
body: bytes | None = b""
|
|
154
|
+
signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
|
|
155
|
+
normalized_url = zapros.URL(url)
|
|
156
|
+
for k, v in params:
|
|
157
|
+
normalized_url.search_params.append(k, v)
|
|
158
|
+
return zapros.Request(
|
|
159
|
+
normalized_url, "GET", headers=headers, body=body, context={"signer": signer}
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def get_recommendations(
|
|
164
|
+
options: OperationOptions,
|
|
165
|
+
input_: capo_codeguruprofiler.types.get_recommendations_request.GetRecommendationsRequest,
|
|
166
|
+
) -> tuple[
|
|
167
|
+
capo_codeguruprofiler.types.get_recommendations_response.GetRecommendationsResponse,
|
|
168
|
+
zapros.Response,
|
|
169
|
+
]:
|
|
170
|
+
response = options.client.handler.handle(build_request(options, input_))
|
|
171
|
+
try:
|
|
172
|
+
if response.status >= 300:
|
|
173
|
+
response.read()
|
|
174
|
+
handle_error(response)
|
|
175
|
+
return handle_response(response), response
|
|
176
|
+
except BaseException:
|
|
177
|
+
response.close()
|
|
178
|
+
raise
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def async_get_recommendations(
|
|
182
|
+
options: AsyncOperationOptions,
|
|
183
|
+
input_: capo_codeguruprofiler.types.get_recommendations_request.GetRecommendationsRequest,
|
|
184
|
+
) -> tuple[
|
|
185
|
+
capo_codeguruprofiler.types.get_recommendations_response.GetRecommendationsResponse,
|
|
186
|
+
zapros.Response,
|
|
187
|
+
]:
|
|
188
|
+
response = await options.client.handler.ahandle(build_request(options, input_))
|
|
189
|
+
try:
|
|
190
|
+
if response.status >= 300:
|
|
191
|
+
await response.aread()
|
|
192
|
+
handle_error(response)
|
|
193
|
+
return await async_handle_response(response), response
|
|
194
|
+
except BaseException:
|
|
195
|
+
await response.aclose()
|
|
196
|
+
raise
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""Generated from Smithy shape ``com.amazonaws.codeguruprofiler#ListFindingsReports``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any
|
|
7
|
+
from urllib.parse import quote
|
|
8
|
+
|
|
9
|
+
import zapros
|
|
10
|
+
from typing_extensions import Never
|
|
11
|
+
|
|
12
|
+
import capo_codeguruprofiler._auth._signers
|
|
13
|
+
import capo_codeguruprofiler._auth._sigv4
|
|
14
|
+
import capo_codeguruprofiler._protocol.eventstream
|
|
15
|
+
import capo_codeguruprofiler.errors.internal_server_exception
|
|
16
|
+
import capo_codeguruprofiler.errors.resource_not_found_exception
|
|
17
|
+
import capo_codeguruprofiler.errors.throttling_exception
|
|
18
|
+
import capo_codeguruprofiler.errors.validation_exception
|
|
19
|
+
import capo_codeguruprofiler.types.findings_report_summaries
|
|
20
|
+
import capo_codeguruprofiler.types.list_findings_reports_request
|
|
21
|
+
import capo_codeguruprofiler.types.list_findings_reports_response
|
|
22
|
+
import capo_codeguruprofiler.types.timestamp
|
|
23
|
+
from capo_codeguruprofiler._protocol.errors import parse_error_metadata_json
|
|
24
|
+
from capo_codeguruprofiler._rule_engine._endpoint_rule_set import (
|
|
25
|
+
EndpointParams,
|
|
26
|
+
resolve,
|
|
27
|
+
)
|
|
28
|
+
from capo_codeguruprofiler._services._pipeline import (
|
|
29
|
+
AsyncOperationOptions,
|
|
30
|
+
OperationOptions,
|
|
31
|
+
)
|
|
32
|
+
from capo_codeguruprofiler.errors import UnknownServiceError
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def handle_error(response: zapros.Response) -> Never:
|
|
36
|
+
data = json.loads(response.read())
|
|
37
|
+
code, message = parse_error_metadata_json(response, data)
|
|
38
|
+
match code:
|
|
39
|
+
case "InternalServerException":
|
|
40
|
+
raise capo_codeguruprofiler.errors.internal_server_exception.InternalServerException.from_json(
|
|
41
|
+
data, message
|
|
42
|
+
)
|
|
43
|
+
case "ResourceNotFoundException":
|
|
44
|
+
raise capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
|
|
45
|
+
data, message
|
|
46
|
+
)
|
|
47
|
+
case "ThrottlingException":
|
|
48
|
+
raise capo_codeguruprofiler.errors.throttling_exception.ThrottlingException.from_json(
|
|
49
|
+
data, message
|
|
50
|
+
)
|
|
51
|
+
case "ValidationException":
|
|
52
|
+
raise capo_codeguruprofiler.errors.validation_exception.ValidationException.from_json(
|
|
53
|
+
data, message
|
|
54
|
+
)
|
|
55
|
+
case _:
|
|
56
|
+
raise UnknownServiceError(code=code, message=message, response=response)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def handle_response(
|
|
60
|
+
response: zapros.Response,
|
|
61
|
+
) -> capo_codeguruprofiler.types.list_findings_reports_response.ListFindingsReportsResponse:
|
|
62
|
+
out: capo_codeguruprofiler.types.list_findings_reports_response.ListFindingsReportsResponse = capo_codeguruprofiler.types.list_findings_reports_response.deserialize_json(
|
|
63
|
+
json.loads(response.read())
|
|
64
|
+
)
|
|
65
|
+
return out
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def async_handle_response(
|
|
69
|
+
response: zapros.Response,
|
|
70
|
+
) -> capo_codeguruprofiler.types.list_findings_reports_response.ListFindingsReportsResponse:
|
|
71
|
+
out: capo_codeguruprofiler.types.list_findings_reports_response.ListFindingsReportsResponse = capo_codeguruprofiler.types.list_findings_reports_response.deserialize_json(
|
|
72
|
+
json.loads(await response.aread())
|
|
73
|
+
)
|
|
74
|
+
return out
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def get_signer(
|
|
78
|
+
options: AsyncOperationOptions | OperationOptions,
|
|
79
|
+
auth_schemes: list[dict[str, Any]] | None = None,
|
|
80
|
+
) -> capo_codeguruprofiler._auth._signers.Signer | None:
|
|
81
|
+
name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
|
|
82
|
+
if (
|
|
83
|
+
options.credentials_provider is not None
|
|
84
|
+
and name_to_schema
|
|
85
|
+
and not name_to_schema.keys() & {"sigv4", "sigv4-s3express"}
|
|
86
|
+
):
|
|
87
|
+
raise RuntimeError(
|
|
88
|
+
"Endpoint requires an unsupported auth scheme: " + ", ".join(name_to_schema)
|
|
89
|
+
)
|
|
90
|
+
if options.credentials_provider is not None:
|
|
91
|
+
endpoint_scheme = name_to_schema.get("sigv4") or name_to_schema.get(
|
|
92
|
+
"sigv4-s3express"
|
|
93
|
+
)
|
|
94
|
+
if endpoint_scheme is not None or not name_to_schema:
|
|
95
|
+
sigv4_config = capo_codeguruprofiler._auth._sigv4.build_sigv4_auth_scheme(
|
|
96
|
+
"codeguru-profiler", options.region, endpoint_scheme
|
|
97
|
+
)
|
|
98
|
+
if sigv4_config is not None:
|
|
99
|
+
return capo_codeguruprofiler._auth._signers.SigV4Signer(
|
|
100
|
+
options.credentials_provider, auth_scheme=sigv4_config
|
|
101
|
+
)
|
|
102
|
+
raise RuntimeError("Auth was not resolved")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def build_request(
|
|
106
|
+
options: OperationOptions | AsyncOperationOptions,
|
|
107
|
+
input_: capo_codeguruprofiler.types.list_findings_reports_request.ListFindingsReportsRequest,
|
|
108
|
+
) -> zapros.Request:
|
|
109
|
+
endpoint = resolve(
|
|
110
|
+
EndpointParams(
|
|
111
|
+
Region=options.region,
|
|
112
|
+
UseDualStack=options.use_dual_stack,
|
|
113
|
+
UseFIPS=options.use_fips,
|
|
114
|
+
Endpoint=options.endpoint,
|
|
115
|
+
)
|
|
116
|
+
) # noqa: F841
|
|
117
|
+
import capo_codeguruprofiler._protocol.serialize
|
|
118
|
+
|
|
119
|
+
url = (
|
|
120
|
+
endpoint.url.rstrip("/")
|
|
121
|
+
+ "/internal/profilingGroups/{profilingGroupName}/findingsReports"
|
|
122
|
+
)
|
|
123
|
+
url = url.replace(
|
|
124
|
+
"{profilingGroupName}", quote(input_["profiling_group_name"], safe="")
|
|
125
|
+
)
|
|
126
|
+
params: list[tuple[str, str]] = []
|
|
127
|
+
if "start_time" in input_:
|
|
128
|
+
params.append(
|
|
129
|
+
(
|
|
130
|
+
"startTime",
|
|
131
|
+
capo_codeguruprofiler._protocol.serialize.fmt_date_time(
|
|
132
|
+
input_["start_time"]
|
|
133
|
+
),
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
if "end_time" in input_:
|
|
137
|
+
params.append(
|
|
138
|
+
(
|
|
139
|
+
"endTime",
|
|
140
|
+
capo_codeguruprofiler._protocol.serialize.fmt_date_time(
|
|
141
|
+
input_["end_time"]
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
)
|
|
145
|
+
if "next_token" in input_:
|
|
146
|
+
params.append(("nextToken", input_["next_token"]))
|
|
147
|
+
if "max_results" in input_:
|
|
148
|
+
params.append(("maxResults", str(input_["max_results"])))
|
|
149
|
+
if "daily_reports_only" in input_:
|
|
150
|
+
params.append(
|
|
151
|
+
("dailyReportsOnly", "true" if input_["daily_reports_only"] else "false")
|
|
152
|
+
)
|
|
153
|
+
headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
|
|
154
|
+
body: bytes | None = b""
|
|
155
|
+
signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
|
|
156
|
+
normalized_url = zapros.URL(url)
|
|
157
|
+
for k, v in params:
|
|
158
|
+
normalized_url.search_params.append(k, v)
|
|
159
|
+
return zapros.Request(
|
|
160
|
+
normalized_url, "GET", headers=headers, body=body, context={"signer": signer}
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def list_findings_reports(
|
|
165
|
+
options: OperationOptions,
|
|
166
|
+
input_: capo_codeguruprofiler.types.list_findings_reports_request.ListFindingsReportsRequest,
|
|
167
|
+
) -> tuple[
|
|
168
|
+
capo_codeguruprofiler.types.list_findings_reports_response.ListFindingsReportsResponse,
|
|
169
|
+
zapros.Response,
|
|
170
|
+
]:
|
|
171
|
+
response = options.client.handler.handle(build_request(options, input_))
|
|
172
|
+
try:
|
|
173
|
+
if response.status >= 300:
|
|
174
|
+
response.read()
|
|
175
|
+
handle_error(response)
|
|
176
|
+
return handle_response(response), response
|
|
177
|
+
except BaseException:
|
|
178
|
+
response.close()
|
|
179
|
+
raise
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
async def async_list_findings_reports(
|
|
183
|
+
options: AsyncOperationOptions,
|
|
184
|
+
input_: capo_codeguruprofiler.types.list_findings_reports_request.ListFindingsReportsRequest,
|
|
185
|
+
) -> tuple[
|
|
186
|
+
capo_codeguruprofiler.types.list_findings_reports_response.ListFindingsReportsResponse,
|
|
187
|
+
zapros.Response,
|
|
188
|
+
]:
|
|
189
|
+
response = await options.client.handler.ahandle(build_request(options, input_))
|
|
190
|
+
try:
|
|
191
|
+
if response.status >= 300:
|
|
192
|
+
await response.aread()
|
|
193
|
+
handle_error(response)
|
|
194
|
+
return await async_handle_response(response), response
|
|
195
|
+
except BaseException:
|
|
196
|
+
await response.aclose()
|
|
197
|
+
raise
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""Generated from Smithy shape ``com.amazonaws.codeguruprofiler#ListProfileTimes``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any
|
|
7
|
+
from urllib.parse import quote
|
|
8
|
+
|
|
9
|
+
import zapros
|
|
10
|
+
from typing_extensions import Never
|
|
11
|
+
|
|
12
|
+
import capo_codeguruprofiler._auth._signers
|
|
13
|
+
import capo_codeguruprofiler._auth._sigv4
|
|
14
|
+
import capo_codeguruprofiler._protocol.eventstream
|
|
15
|
+
import capo_codeguruprofiler.errors.internal_server_exception
|
|
16
|
+
import capo_codeguruprofiler.errors.resource_not_found_exception
|
|
17
|
+
import capo_codeguruprofiler.errors.throttling_exception
|
|
18
|
+
import capo_codeguruprofiler.errors.validation_exception
|
|
19
|
+
import capo_codeguruprofiler.types.list_profile_times_request
|
|
20
|
+
import capo_codeguruprofiler.types.list_profile_times_response
|
|
21
|
+
import capo_codeguruprofiler.types.profile_times
|
|
22
|
+
import capo_codeguruprofiler.types.timestamp
|
|
23
|
+
from capo_codeguruprofiler._protocol.errors import parse_error_metadata_json
|
|
24
|
+
from capo_codeguruprofiler._rule_engine._endpoint_rule_set import (
|
|
25
|
+
EndpointParams,
|
|
26
|
+
resolve,
|
|
27
|
+
)
|
|
28
|
+
from capo_codeguruprofiler._services._pipeline import (
|
|
29
|
+
AsyncOperationOptions,
|
|
30
|
+
OperationOptions,
|
|
31
|
+
)
|
|
32
|
+
from capo_codeguruprofiler.errors import UnknownServiceError
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def handle_error(response: zapros.Response) -> Never:
|
|
36
|
+
data = json.loads(response.read())
|
|
37
|
+
code, message = parse_error_metadata_json(response, data)
|
|
38
|
+
match code:
|
|
39
|
+
case "InternalServerException":
|
|
40
|
+
raise capo_codeguruprofiler.errors.internal_server_exception.InternalServerException.from_json(
|
|
41
|
+
data, message
|
|
42
|
+
)
|
|
43
|
+
case "ResourceNotFoundException":
|
|
44
|
+
raise capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
|
|
45
|
+
data, message
|
|
46
|
+
)
|
|
47
|
+
case "ThrottlingException":
|
|
48
|
+
raise capo_codeguruprofiler.errors.throttling_exception.ThrottlingException.from_json(
|
|
49
|
+
data, message
|
|
50
|
+
)
|
|
51
|
+
case "ValidationException":
|
|
52
|
+
raise capo_codeguruprofiler.errors.validation_exception.ValidationException.from_json(
|
|
53
|
+
data, message
|
|
54
|
+
)
|
|
55
|
+
case _:
|
|
56
|
+
raise UnknownServiceError(code=code, message=message, response=response)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def handle_response(
|
|
60
|
+
response: zapros.Response,
|
|
61
|
+
) -> capo_codeguruprofiler.types.list_profile_times_response.ListProfileTimesResponse:
|
|
62
|
+
out: capo_codeguruprofiler.types.list_profile_times_response.ListProfileTimesResponse = capo_codeguruprofiler.types.list_profile_times_response.deserialize_json(
|
|
63
|
+
json.loads(response.read())
|
|
64
|
+
)
|
|
65
|
+
return out
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def async_handle_response(
|
|
69
|
+
response: zapros.Response,
|
|
70
|
+
) -> capo_codeguruprofiler.types.list_profile_times_response.ListProfileTimesResponse:
|
|
71
|
+
out: capo_codeguruprofiler.types.list_profile_times_response.ListProfileTimesResponse = capo_codeguruprofiler.types.list_profile_times_response.deserialize_json(
|
|
72
|
+
json.loads(await response.aread())
|
|
73
|
+
)
|
|
74
|
+
return out
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def get_signer(
|
|
78
|
+
options: AsyncOperationOptions | OperationOptions,
|
|
79
|
+
auth_schemes: list[dict[str, Any]] | None = None,
|
|
80
|
+
) -> capo_codeguruprofiler._auth._signers.Signer | None:
|
|
81
|
+
name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
|
|
82
|
+
if (
|
|
83
|
+
options.credentials_provider is not None
|
|
84
|
+
and name_to_schema
|
|
85
|
+
and not name_to_schema.keys() & {"sigv4", "sigv4-s3express"}
|
|
86
|
+
):
|
|
87
|
+
raise RuntimeError(
|
|
88
|
+
"Endpoint requires an unsupported auth scheme: " + ", ".join(name_to_schema)
|
|
89
|
+
)
|
|
90
|
+
if options.credentials_provider is not None:
|
|
91
|
+
endpoint_scheme = name_to_schema.get("sigv4") or name_to_schema.get(
|
|
92
|
+
"sigv4-s3express"
|
|
93
|
+
)
|
|
94
|
+
if endpoint_scheme is not None or not name_to_schema:
|
|
95
|
+
sigv4_config = capo_codeguruprofiler._auth._sigv4.build_sigv4_auth_scheme(
|
|
96
|
+
"codeguru-profiler", options.region, endpoint_scheme
|
|
97
|
+
)
|
|
98
|
+
if sigv4_config is not None:
|
|
99
|
+
return capo_codeguruprofiler._auth._signers.SigV4Signer(
|
|
100
|
+
options.credentials_provider, auth_scheme=sigv4_config
|
|
101
|
+
)
|
|
102
|
+
raise RuntimeError("Auth was not resolved")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def build_request(
|
|
106
|
+
options: OperationOptions | AsyncOperationOptions,
|
|
107
|
+
input_: capo_codeguruprofiler.types.list_profile_times_request.ListProfileTimesRequest,
|
|
108
|
+
) -> zapros.Request:
|
|
109
|
+
endpoint = resolve(
|
|
110
|
+
EndpointParams(
|
|
111
|
+
Region=options.region,
|
|
112
|
+
UseDualStack=options.use_dual_stack,
|
|
113
|
+
UseFIPS=options.use_fips,
|
|
114
|
+
Endpoint=options.endpoint,
|
|
115
|
+
)
|
|
116
|
+
) # noqa: F841
|
|
117
|
+
import capo_codeguruprofiler._protocol.serialize
|
|
118
|
+
|
|
119
|
+
url = (
|
|
120
|
+
endpoint.url.rstrip("/") + "/profilingGroups/{profilingGroupName}/profileTimes"
|
|
121
|
+
)
|
|
122
|
+
url = url.replace(
|
|
123
|
+
"{profilingGroupName}", quote(input_["profiling_group_name"], safe="")
|
|
124
|
+
)
|
|
125
|
+
params: list[tuple[str, str]] = []
|
|
126
|
+
if "start_time" in input_:
|
|
127
|
+
params.append(
|
|
128
|
+
(
|
|
129
|
+
"startTime",
|
|
130
|
+
capo_codeguruprofiler._protocol.serialize.fmt_date_time(
|
|
131
|
+
input_["start_time"]
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
if "end_time" in input_:
|
|
136
|
+
params.append(
|
|
137
|
+
(
|
|
138
|
+
"endTime",
|
|
139
|
+
capo_codeguruprofiler._protocol.serialize.fmt_date_time(
|
|
140
|
+
input_["end_time"]
|
|
141
|
+
),
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
if "period" in input_:
|
|
145
|
+
params.append(("period", input_["period"]))
|
|
146
|
+
if "order_by" in input_:
|
|
147
|
+
params.append(("orderBy", input_["order_by"]))
|
|
148
|
+
if "max_results" in input_:
|
|
149
|
+
params.append(("maxResults", str(input_["max_results"])))
|
|
150
|
+
if "next_token" in input_:
|
|
151
|
+
params.append(("nextToken", input_["next_token"]))
|
|
152
|
+
headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
|
|
153
|
+
body: bytes | None = b""
|
|
154
|
+
signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
|
|
155
|
+
normalized_url = zapros.URL(url)
|
|
156
|
+
for k, v in params:
|
|
157
|
+
normalized_url.search_params.append(k, v)
|
|
158
|
+
return zapros.Request(
|
|
159
|
+
normalized_url, "GET", headers=headers, body=body, context={"signer": signer}
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def list_profile_times(
|
|
164
|
+
options: OperationOptions,
|
|
165
|
+
input_: capo_codeguruprofiler.types.list_profile_times_request.ListProfileTimesRequest,
|
|
166
|
+
) -> tuple[
|
|
167
|
+
capo_codeguruprofiler.types.list_profile_times_response.ListProfileTimesResponse,
|
|
168
|
+
zapros.Response,
|
|
169
|
+
]:
|
|
170
|
+
response = options.client.handler.handle(build_request(options, input_))
|
|
171
|
+
try:
|
|
172
|
+
if response.status >= 300:
|
|
173
|
+
response.read()
|
|
174
|
+
handle_error(response)
|
|
175
|
+
return handle_response(response), response
|
|
176
|
+
except BaseException:
|
|
177
|
+
response.close()
|
|
178
|
+
raise
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def async_list_profile_times(
|
|
182
|
+
options: AsyncOperationOptions,
|
|
183
|
+
input_: capo_codeguruprofiler.types.list_profile_times_request.ListProfileTimesRequest,
|
|
184
|
+
) -> tuple[
|
|
185
|
+
capo_codeguruprofiler.types.list_profile_times_response.ListProfileTimesResponse,
|
|
186
|
+
zapros.Response,
|
|
187
|
+
]:
|
|
188
|
+
response = await options.client.handler.ahandle(build_request(options, input_))
|
|
189
|
+
try:
|
|
190
|
+
if response.status >= 300:
|
|
191
|
+
await response.aread()
|
|
192
|
+
handle_error(response)
|
|
193
|
+
return await async_handle_response(response), response
|
|
194
|
+
except BaseException:
|
|
195
|
+
await response.aclose()
|
|
196
|
+
raise
|