capo-codeguru-security 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_codeguru_security/__init__.py +74 -0
- capo_codeguru_security/_async.py +25 -0
- capo_codeguru_security/_auth/_identity.py +16 -0
- capo_codeguru_security/_auth/_providers.py +886 -0
- capo_codeguru_security/_auth/_signers.py +88 -0
- capo_codeguru_security/_auth/_sigv4.py +434 -0
- capo_codeguru_security/_auth/_zapros_handler.py +80 -0
- capo_codeguru_security/_iter.py +113 -0
- capo_codeguru_security/_operations/aws_code_guru_security/batch_get_findings.py +167 -0
- capo_codeguru_security/_operations/aws_code_guru_security/create_scan.py +183 -0
- capo_codeguru_security/_operations/aws_code_guru_security/create_upload_url.py +165 -0
- capo_codeguru_security/_operations/aws_code_guru_security/get_account_configuration.py +161 -0
- capo_codeguru_security/_operations/aws_code_guru_security/get_findings.py +191 -0
- capo_codeguru_security/_operations/aws_code_guru_security/get_metrics_summary.py +176 -0
- capo_codeguru_security/_operations/aws_code_guru_security/get_scan.py +173 -0
- capo_codeguru_security/_operations/aws_code_guru_security/list_findings_metrics.py +185 -0
- capo_codeguru_security/_operations/aws_code_guru_security/list_scans.py +167 -0
- capo_codeguru_security/_operations/aws_code_guru_security/list_tags_for_resource.py +173 -0
- capo_codeguru_security/_operations/aws_code_guru_security/tag_resource.py +173 -0
- capo_codeguru_security/_operations/aws_code_guru_security/untag_resource.py +171 -0
- capo_codeguru_security/_operations/aws_code_guru_security/update_account_configuration.py +172 -0
- capo_codeguru_security/_pagination.py +21 -0
- capo_codeguru_security/_protocol/__init__.py +1 -0
- capo_codeguru_security/_protocol/errors.py +93 -0
- capo_codeguru_security/_protocol/eventstream.py +238 -0
- capo_codeguru_security/_protocol/serialize.py +47 -0
- capo_codeguru_security/_protocol/xml.py +33 -0
- capo_codeguru_security/_rule_engine/__init__.py +0 -0
- capo_codeguru_security/_rule_engine/_aws_partition.py +160 -0
- capo_codeguru_security/_rule_engine/_endpoint_rule_set.py +137 -0
- capo_codeguru_security/_rule_engine/_endpoint_runtime.py +389 -0
- capo_codeguru_security/_services/_aws_config.py +160 -0
- capo_codeguru_security/_services/_pipeline.py +198 -0
- capo_codeguru_security/_services/async_code_guru_security.py +934 -0
- capo_codeguru_security/_services/code_guru_security.py +921 -0
- capo_codeguru_security/errors/__init__.py +33 -0
- capo_codeguru_security/errors/_base.py +94 -0
- capo_codeguru_security/errors/access_denied_exception.py +67 -0
- capo_codeguru_security/errors/conflict_exception.py +67 -0
- capo_codeguru_security/errors/internal_server_exception.py +53 -0
- capo_codeguru_security/errors/resource_not_found_exception.py +69 -0
- capo_codeguru_security/errors/throttling_exception.py +65 -0
- capo_codeguru_security/errors/validation_exception.py +98 -0
- capo_codeguru_security/py.typed +0 -0
- capo_codeguru_security/types/_prelude/blob.py +12 -0
- capo_codeguru_security/types/_prelude/timestamp.py +17 -0
- capo_codeguru_security/types/account_findings_metric.py +118 -0
- capo_codeguru_security/types/analysis_type.py +17 -0
- capo_codeguru_security/types/batch_get_findings_error.py +61 -0
- capo_codeguru_security/types/batch_get_findings_errors.py +35 -0
- capo_codeguru_security/types/batch_get_findings_request.py +47 -0
- capo_codeguru_security/types/batch_get_findings_response.py +61 -0
- capo_codeguru_security/types/categories_with_most_findings.py +37 -0
- capo_codeguru_security/types/category_with_finding_num.py +29 -0
- capo_codeguru_security/types/client_token.py +5 -0
- capo_codeguru_security/types/code_line.py +29 -0
- capo_codeguru_security/types/code_snippet.py +29 -0
- capo_codeguru_security/types/create_scan_request.py +101 -0
- capo_codeguru_security/types/create_scan_response.py +78 -0
- capo_codeguru_security/types/create_upload_url_request.py +31 -0
- capo_codeguru_security/types/create_upload_url_response.py +59 -0
- capo_codeguru_security/types/detector_tags.py +14 -0
- capo_codeguru_security/types/encryption_config.py +28 -0
- capo_codeguru_security/types/error_code.py +20 -0
- capo_codeguru_security/types/error_message.py +5 -0
- capo_codeguru_security/types/file_path.py +62 -0
- capo_codeguru_security/types/finding.py +207 -0
- capo_codeguru_security/types/finding_identifier.py +33 -0
- capo_codeguru_security/types/finding_identifiers.py +33 -0
- capo_codeguru_security/types/finding_metrics_value_per_severity.py +87 -0
- capo_codeguru_security/types/findings.py +29 -0
- capo_codeguru_security/types/findings_metric_list.py +35 -0
- capo_codeguru_security/types/get_account_configuration_request.py +18 -0
- capo_codeguru_security/types/get_account_configuration_response.py +45 -0
- capo_codeguru_security/types/get_findings_request.py +32 -0
- capo_codeguru_security/types/get_findings_response.py +43 -0
- capo_codeguru_security/types/get_metrics_summary_request.py +24 -0
- capo_codeguru_security/types/get_metrics_summary_response.py +42 -0
- capo_codeguru_security/types/get_scan_request.py +27 -0
- capo_codeguru_security/types/get_scan_response.py +132 -0
- capo_codeguru_security/types/header_key.py +5 -0
- capo_codeguru_security/types/header_value.py +5 -0
- capo_codeguru_security/types/kms_key_arn.py +5 -0
- capo_codeguru_security/types/list_findings_metrics_request.py +32 -0
- capo_codeguru_security/types/list_findings_metrics_response.py +49 -0
- capo_codeguru_security/types/list_scans_request.py +26 -0
- capo_codeguru_security/types/list_scans_response.py +43 -0
- capo_codeguru_security/types/list_tags_for_resource_request.py +24 -0
- capo_codeguru_security/types/list_tags_for_resource_response.py +34 -0
- capo_codeguru_security/types/metrics_summary.py +121 -0
- capo_codeguru_security/types/next_token.py +5 -0
- capo_codeguru_security/types/recommendation.py +29 -0
- capo_codeguru_security/types/reference_urls.py +14 -0
- capo_codeguru_security/types/related_vulnerabilities.py +14 -0
- capo_codeguru_security/types/remediation.py +63 -0
- capo_codeguru_security/types/request_header_map.py +29 -0
- capo_codeguru_security/types/resource.py +29 -0
- capo_codeguru_security/types/resource_id.py +32 -0
- capo_codeguru_security/types/s3_url.py +5 -0
- capo_codeguru_security/types/scan_name.py +5 -0
- capo_codeguru_security/types/scan_name_arn.py +5 -0
- capo_codeguru_security/types/scan_name_with_finding_num.py +29 -0
- capo_codeguru_security/types/scan_state.py +18 -0
- capo_codeguru_security/types/scan_summaries.py +29 -0
- capo_codeguru_security/types/scan_summary.py +99 -0
- capo_codeguru_security/types/scan_type.py +17 -0
- capo_codeguru_security/types/scans_with_most_open_critical_findings.py +37 -0
- capo_codeguru_security/types/scans_with_most_open_findings.py +37 -0
- capo_codeguru_security/types/severity.py +20 -0
- capo_codeguru_security/types/status.py +18 -0
- capo_codeguru_security/types/suggested_fix.py +29 -0
- capo_codeguru_security/types/suggested_fixes.py +31 -0
- capo_codeguru_security/types/tag_key.py +5 -0
- capo_codeguru_security/types/tag_key_list.py +17 -0
- capo_codeguru_security/types/tag_map.py +29 -0
- capo_codeguru_security/types/tag_resource_request.py +40 -0
- capo_codeguru_security/types/tag_resource_response.py +18 -0
- capo_codeguru_security/types/tag_value.py +5 -0
- capo_codeguru_security/types/untag_resource_request.py +27 -0
- capo_codeguru_security/types/untag_resource_response.py +18 -0
- capo_codeguru_security/types/update_account_configuration_request.py +45 -0
- capo_codeguru_security/types/update_account_configuration_response.py +45 -0
- capo_codeguru_security/types/uuid.py +5 -0
- capo_codeguru_security/types/validation_exception_field.py +33 -0
- capo_codeguru_security/types/validation_exception_field_list.py +37 -0
- capo_codeguru_security/types/validation_exception_reason.py +20 -0
- capo_codeguru_security/types/vulnerability.py +90 -0
- capo_codeguru_security-0.1.0.dist-info/METADATA +101 -0
- capo_codeguru_security-0.1.0.dist-info/RECORD +132 -0
- capo_codeguru_security-0.1.0.dist-info/WHEEL +5 -0
- capo_codeguru_security-0.1.0.dist-info/licenses/LICENSE +21 -0
- capo_codeguru_security-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
"""Generated from Smithy shape ``com.amazonaws.codegurusecurity#AwsCodeGuruSecurity``."""
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
import uuid
|
|
5
|
+
import warnings
|
|
6
|
+
from collections.abc import Iterator
|
|
7
|
+
from typing import TYPE_CHECKING, Any, Iterable, Optional
|
|
8
|
+
|
|
9
|
+
from typing_extensions import Self, TypedDict
|
|
10
|
+
from zapros import BaseHandler, Client
|
|
11
|
+
|
|
12
|
+
import capo_codeguru_security._auth._signers
|
|
13
|
+
import capo_codeguru_security._auth._sigv4
|
|
14
|
+
from capo_codeguru_security._auth._identity import Credentials
|
|
15
|
+
from capo_codeguru_security._auth._providers import (
|
|
16
|
+
CredentialsProvider,
|
|
17
|
+
IdentityProvider,
|
|
18
|
+
StaticAwsCredentialsProvider,
|
|
19
|
+
default_aws_credentials_chain,
|
|
20
|
+
)
|
|
21
|
+
from capo_codeguru_security._auth._zapros_handler import AuthMiddleware
|
|
22
|
+
from capo_codeguru_security._pagination import resolve_path as _resolve_path
|
|
23
|
+
from capo_codeguru_security._services._aws_config import aws_config
|
|
24
|
+
from capo_codeguru_security._services._pipeline import (
|
|
25
|
+
Interceptor,
|
|
26
|
+
OperationOptions,
|
|
27
|
+
OperationRequest,
|
|
28
|
+
OperationResponse,
|
|
29
|
+
execute_pipeline,
|
|
30
|
+
retry,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if TYPE_CHECKING:
|
|
34
|
+
import capo_codeguru_security.types.account_findings_metric
|
|
35
|
+
import capo_codeguru_security.types.analysis_type
|
|
36
|
+
import capo_codeguru_security.types.batch_get_findings_request
|
|
37
|
+
import capo_codeguru_security.types.batch_get_findings_response
|
|
38
|
+
import capo_codeguru_security.types.client_token
|
|
39
|
+
import capo_codeguru_security.types.create_scan_request
|
|
40
|
+
import capo_codeguru_security.types.create_scan_response
|
|
41
|
+
import capo_codeguru_security.types.create_upload_url_request
|
|
42
|
+
import capo_codeguru_security.types.create_upload_url_response
|
|
43
|
+
import capo_codeguru_security.types.encryption_config
|
|
44
|
+
import capo_codeguru_security.types.finding
|
|
45
|
+
import capo_codeguru_security.types.finding_identifiers
|
|
46
|
+
import capo_codeguru_security.types.get_account_configuration_request
|
|
47
|
+
import capo_codeguru_security.types.get_account_configuration_response
|
|
48
|
+
import capo_codeguru_security.types.get_findings_request
|
|
49
|
+
import capo_codeguru_security.types.get_findings_response
|
|
50
|
+
import capo_codeguru_security.types.get_metrics_summary_request
|
|
51
|
+
import capo_codeguru_security.types.get_metrics_summary_response
|
|
52
|
+
import capo_codeguru_security.types.get_scan_request
|
|
53
|
+
import capo_codeguru_security.types.get_scan_response
|
|
54
|
+
import capo_codeguru_security.types.list_findings_metrics_request
|
|
55
|
+
import capo_codeguru_security.types.list_findings_metrics_response
|
|
56
|
+
import capo_codeguru_security.types.list_scans_request
|
|
57
|
+
import capo_codeguru_security.types.list_scans_response
|
|
58
|
+
import capo_codeguru_security.types.list_tags_for_resource_request
|
|
59
|
+
import capo_codeguru_security.types.list_tags_for_resource_response
|
|
60
|
+
import capo_codeguru_security.types.next_token
|
|
61
|
+
import capo_codeguru_security.types.resource_id
|
|
62
|
+
import capo_codeguru_security.types.scan_name
|
|
63
|
+
import capo_codeguru_security.types.scan_name_arn
|
|
64
|
+
import capo_codeguru_security.types.scan_summary
|
|
65
|
+
import capo_codeguru_security.types.scan_type
|
|
66
|
+
import capo_codeguru_security.types.status
|
|
67
|
+
import capo_codeguru_security.types.tag_key_list
|
|
68
|
+
import capo_codeguru_security.types.tag_map
|
|
69
|
+
import capo_codeguru_security.types.tag_resource_request
|
|
70
|
+
import capo_codeguru_security.types.tag_resource_response
|
|
71
|
+
import capo_codeguru_security.types.untag_resource_request
|
|
72
|
+
import capo_codeguru_security.types.untag_resource_response
|
|
73
|
+
import capo_codeguru_security.types.update_account_configuration_request
|
|
74
|
+
import capo_codeguru_security.types.update_account_configuration_response
|
|
75
|
+
import capo_codeguru_security.types.uuid
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class CodeGuruSecurityClientConfig(TypedDict, total=False, closed=True):
|
|
79
|
+
operation_interceptors: Iterable[Interceptor[Any, Any]]
|
|
80
|
+
retry_max_attempts: int | None
|
|
81
|
+
region: str | None
|
|
82
|
+
use_dual_stack: bool | None
|
|
83
|
+
use_fips: bool | None
|
|
84
|
+
endpoint: str | None
|
|
85
|
+
credentials_provider: IdentityProvider[Credentials] | None
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class CodeGuruSecurityClient:
|
|
89
|
+
"""A client for the ``CodeGuruSecurity`` service.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
http_handler: HTTP handler for sending requests. If not provided, creates a default handler.
|
|
93
|
+
operation_interceptors: Interceptors that wrap every operation call. If not provided, defaults to an empty list.
|
|
94
|
+
retry_max_attempts: Maximum number of times to retry a failed operation. Defaults to 3.
|
|
95
|
+
region: The value of the ``AWS::Region`` endpoint parameter.
|
|
96
|
+
use_dual_stack: The value of the ``AWS::UseDualStack`` endpoint parameter.
|
|
97
|
+
use_fips: The value of the ``AWS::UseFIPS`` endpoint parameter.
|
|
98
|
+
endpoint: The value of the ``SDK::Endpoint`` endpoint parameter.
|
|
99
|
+
credentials: AWS credentials for request signing.
|
|
100
|
+
credentials_provider: Provider that resolves AWS credentials. Takes precedence over ``credentials``.
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
def __init__(
|
|
104
|
+
self,
|
|
105
|
+
http_handler: BaseHandler | None = None,
|
|
106
|
+
operation_interceptors: Iterable[Interceptor[Any, Any]] | None = None,
|
|
107
|
+
retry_max_attempts: int | None = None,
|
|
108
|
+
region: str | None = None,
|
|
109
|
+
use_dual_stack: bool | None = None,
|
|
110
|
+
use_fips: bool | None = None,
|
|
111
|
+
endpoint: str | None = None,
|
|
112
|
+
credentials: Credentials | None = None,
|
|
113
|
+
credentials_provider: CredentialsProvider | None = None,
|
|
114
|
+
):
|
|
115
|
+
self._client = Client(http_handler).wrap_with_middleware(
|
|
116
|
+
lambda next: AuthMiddleware(next)
|
|
117
|
+
)
|
|
118
|
+
if credentials is not None and credentials_provider is not None:
|
|
119
|
+
warnings.warn(
|
|
120
|
+
"Both credentials and credentials_provider given; provider takes precedence"
|
|
121
|
+
)
|
|
122
|
+
resolved_credentials_provider: IdentityProvider[Credentials] | None = (
|
|
123
|
+
credentials_provider
|
|
124
|
+
)
|
|
125
|
+
if resolved_credentials_provider is None and credentials is not None:
|
|
126
|
+
resolved_credentials_provider = StaticAwsCredentialsProvider(credentials)
|
|
127
|
+
if resolved_credentials_provider is None and credentials is None:
|
|
128
|
+
resolved_credentials_provider = default_aws_credentials_chain(
|
|
129
|
+
Client(http_handler)
|
|
130
|
+
)
|
|
131
|
+
self._config = CodeGuruSecurityClientConfig(
|
|
132
|
+
{
|
|
133
|
+
"operation_interceptors": operation_interceptors or [],
|
|
134
|
+
"retry_max_attempts": retry_max_attempts,
|
|
135
|
+
"region": region,
|
|
136
|
+
"use_dual_stack": use_dual_stack,
|
|
137
|
+
"use_fips": use_fips,
|
|
138
|
+
"endpoint": endpoint,
|
|
139
|
+
"credentials_provider": resolved_credentials_provider,
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
def operation_options(
|
|
144
|
+
self, config_overrides: Optional[CodeGuruSecurityClientConfig] = None
|
|
145
|
+
) -> tuple[Iterable[Interceptor[Any, Any]], OperationOptions]:
|
|
146
|
+
overrides: CodeGuruSecurityClientConfig = config_overrides or {}
|
|
147
|
+
interceptors_: list[Interceptor[Any, Any]] = [
|
|
148
|
+
*overrides.get(
|
|
149
|
+
"operation_interceptors", self._config.get("operation_interceptors", [])
|
|
150
|
+
),
|
|
151
|
+
aws_config(),
|
|
152
|
+
retry(),
|
|
153
|
+
]
|
|
154
|
+
options_: OperationOptions = OperationOptions(
|
|
155
|
+
client=self._client,
|
|
156
|
+
retry_max_attempts=overrides.get(
|
|
157
|
+
"retry_max_attempts", self._config.get("retry_max_attempts")
|
|
158
|
+
),
|
|
159
|
+
region=overrides.get("region", self._config.get("region")),
|
|
160
|
+
use_dual_stack=overrides.get(
|
|
161
|
+
"use_dual_stack", self._config.get("use_dual_stack")
|
|
162
|
+
),
|
|
163
|
+
use_fips=overrides.get("use_fips", self._config.get("use_fips")),
|
|
164
|
+
endpoint=overrides.get("endpoint", self._config.get("endpoint")),
|
|
165
|
+
credentials_provider=overrides.get(
|
|
166
|
+
"credentials_provider", self._config.get("credentials_provider")
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
return interceptors_, options_
|
|
170
|
+
|
|
171
|
+
def batch_get_findings(
|
|
172
|
+
self,
|
|
173
|
+
finding_identifiers: "capo_codeguru_security.types.finding_identifiers.FindingIdentifiers",
|
|
174
|
+
*,
|
|
175
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
176
|
+
) -> "capo_codeguru_security.types.batch_get_findings_response.BatchGetFindingsResponse":
|
|
177
|
+
"""<p>Returns a list of requested findings from standard scans.</p>
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
finding_identifiers: <p>A list of finding identifiers. Each identifier consists of a <code>scanName</code> and a <code>findingId</code>. You retrieve the <code>findingId</code> when you call <code>GetFindings</code>.</p>
|
|
181
|
+
|
|
182
|
+
Raises:
|
|
183
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
184
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
185
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
186
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
187
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
def _handler(
|
|
191
|
+
req: "OperationRequest[capo_codeguru_security.types.batch_get_findings_request.BatchGetFindingsRequest]",
|
|
192
|
+
) -> OperationResponse[
|
|
193
|
+
"capo_codeguru_security.types.batch_get_findings_response.BatchGetFindingsResponse"
|
|
194
|
+
]:
|
|
195
|
+
import capo_codeguru_security._operations.aws_code_guru_security.batch_get_findings
|
|
196
|
+
|
|
197
|
+
output, http_response = (
|
|
198
|
+
capo_codeguru_security._operations.aws_code_guru_security.batch_get_findings.batch_get_findings(
|
|
199
|
+
req.options, req.input
|
|
200
|
+
)
|
|
201
|
+
)
|
|
202
|
+
return OperationResponse(output=output, response=http_response)
|
|
203
|
+
|
|
204
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
205
|
+
input_: capo_codeguru_security.types.batch_get_findings_request.BatchGetFindingsRequest = {
|
|
206
|
+
"finding_identifiers": finding_identifiers
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
response = execute_pipeline(
|
|
210
|
+
OperationRequest(input=input_, options=options_),
|
|
211
|
+
handler=_handler,
|
|
212
|
+
interceptors=list(interceptors_),
|
|
213
|
+
)
|
|
214
|
+
response.response.close()
|
|
215
|
+
return response.output
|
|
216
|
+
|
|
217
|
+
def create_scan(
|
|
218
|
+
self,
|
|
219
|
+
resource_id: "capo_codeguru_security.types.resource_id.ResourceId",
|
|
220
|
+
scan_name: "capo_codeguru_security.types.scan_name.ScanName",
|
|
221
|
+
*,
|
|
222
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
223
|
+
client_token: Optional[
|
|
224
|
+
"capo_codeguru_security.types.client_token.ClientToken"
|
|
225
|
+
] = None,
|
|
226
|
+
scan_type: Optional["capo_codeguru_security.types.scan_type.ScanType"] = None,
|
|
227
|
+
analysis_type: Optional[
|
|
228
|
+
"capo_codeguru_security.types.analysis_type.AnalysisType"
|
|
229
|
+
] = None,
|
|
230
|
+
tags: Optional["capo_codeguru_security.types.tag_map.TagMap"] = None,
|
|
231
|
+
) -> "capo_codeguru_security.types.create_scan_response.CreateScanResponse":
|
|
232
|
+
"""<p>Use to create a scan using code uploaded to an Amazon S3 bucket.</p>
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
client_token: <p>The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.</p>
|
|
236
|
+
resource_id: <p>The identifier for the resource object to be scanned.</p>
|
|
237
|
+
scan_name: <p>The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a <code>STANDARD</code> scan type. </p>
|
|
238
|
+
scan_type: <p>The type of scan, either <code>Standard</code> or <code>Express</code>. Defaults to <code>Standard</code> type if missing.</p> <p> <code>Express</code> scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. <code>Standard</code> scans have standard resource limits and use the full set of detectors to analyze your code.</p>
|
|
239
|
+
analysis_type: <p>The type of analysis you want CodeGuru Security to perform in the scan, either <code>Security</code> or <code>All</code>. The <code>Security</code> type only generates findings related to security. The <code>All</code> type generates both security findings and quality findings. Defaults to <code>Security</code> type if missing.</p>
|
|
240
|
+
tags: <p>An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:</p> <ul> <li> <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p> </li> <li> <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p> </li> </ul>
|
|
241
|
+
|
|
242
|
+
Raises:
|
|
243
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
244
|
+
capo_codeguru_security.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
|
|
245
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
246
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
247
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
248
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
249
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
250
|
+
"""
|
|
251
|
+
|
|
252
|
+
def _handler(
|
|
253
|
+
req: "OperationRequest[capo_codeguru_security.types.create_scan_request.CreateScanRequest]",
|
|
254
|
+
) -> OperationResponse[
|
|
255
|
+
"capo_codeguru_security.types.create_scan_response.CreateScanResponse"
|
|
256
|
+
]:
|
|
257
|
+
import capo_codeguru_security._operations.aws_code_guru_security.create_scan
|
|
258
|
+
|
|
259
|
+
output, http_response = (
|
|
260
|
+
capo_codeguru_security._operations.aws_code_guru_security.create_scan.create_scan(
|
|
261
|
+
req.options, req.input
|
|
262
|
+
)
|
|
263
|
+
)
|
|
264
|
+
return OperationResponse(output=output, response=http_response)
|
|
265
|
+
|
|
266
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
267
|
+
input_: capo_codeguru_security.types.create_scan_request.CreateScanRequest = {
|
|
268
|
+
"resource_id": resource_id,
|
|
269
|
+
"scan_name": scan_name,
|
|
270
|
+
}
|
|
271
|
+
if client_token is None:
|
|
272
|
+
client_token = str(uuid.uuid4())
|
|
273
|
+
input_["client_token"] = client_token
|
|
274
|
+
if scan_type is not None:
|
|
275
|
+
input_["scan_type"] = scan_type
|
|
276
|
+
if analysis_type is not None:
|
|
277
|
+
input_["analysis_type"] = analysis_type
|
|
278
|
+
if tags is not None:
|
|
279
|
+
input_["tags"] = tags
|
|
280
|
+
|
|
281
|
+
response = execute_pipeline(
|
|
282
|
+
OperationRequest(input=input_, options=options_),
|
|
283
|
+
handler=_handler,
|
|
284
|
+
interceptors=list(interceptors_),
|
|
285
|
+
)
|
|
286
|
+
response.response.close()
|
|
287
|
+
return response.output
|
|
288
|
+
|
|
289
|
+
def create_upload_url(
|
|
290
|
+
self,
|
|
291
|
+
scan_name: "capo_codeguru_security.types.scan_name.ScanName",
|
|
292
|
+
*,
|
|
293
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
294
|
+
) -> "capo_codeguru_security.types.create_upload_url_response.CreateUploadUrlResponse":
|
|
295
|
+
"""<p>Generates a pre-signed URL, request headers used to upload a code resource, and code artifact identifier for the uploaded resource.</p> <p>You can upload your code resource to the URL with the request headers using any HTTP client.</p>
|
|
296
|
+
|
|
297
|
+
Args:
|
|
298
|
+
scan_name: <p>The name of the scan that will use the uploaded resource. CodeGuru Security uses the unique scan name to track revisions across multiple scans of the same resource. Use this <code>scanName</code> when you call <code>CreateScan</code> on the code resource you upload to this URL.</p>
|
|
299
|
+
|
|
300
|
+
Raises:
|
|
301
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
302
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
303
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
304
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
305
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
306
|
+
"""
|
|
307
|
+
|
|
308
|
+
def _handler(
|
|
309
|
+
req: "OperationRequest[capo_codeguru_security.types.create_upload_url_request.CreateUploadUrlRequest]",
|
|
310
|
+
) -> OperationResponse[
|
|
311
|
+
"capo_codeguru_security.types.create_upload_url_response.CreateUploadUrlResponse"
|
|
312
|
+
]:
|
|
313
|
+
import capo_codeguru_security._operations.aws_code_guru_security.create_upload_url
|
|
314
|
+
|
|
315
|
+
output, http_response = (
|
|
316
|
+
capo_codeguru_security._operations.aws_code_guru_security.create_upload_url.create_upload_url(
|
|
317
|
+
req.options, req.input
|
|
318
|
+
)
|
|
319
|
+
)
|
|
320
|
+
return OperationResponse(output=output, response=http_response)
|
|
321
|
+
|
|
322
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
323
|
+
input_: capo_codeguru_security.types.create_upload_url_request.CreateUploadUrlRequest = {
|
|
324
|
+
"scan_name": scan_name
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
response = execute_pipeline(
|
|
328
|
+
OperationRequest(input=input_, options=options_),
|
|
329
|
+
handler=_handler,
|
|
330
|
+
interceptors=list(interceptors_),
|
|
331
|
+
)
|
|
332
|
+
response.response.close()
|
|
333
|
+
return response.output
|
|
334
|
+
|
|
335
|
+
def get_account_configuration(
|
|
336
|
+
self, *, config_overrides: Optional[CodeGuruSecurityClientConfig] = None
|
|
337
|
+
) -> "capo_codeguru_security.types.get_account_configuration_response.GetAccountConfigurationResponse":
|
|
338
|
+
"""<p>Use to get the encryption configuration for an account.</p>
|
|
339
|
+
|
|
340
|
+
Raises:
|
|
341
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
342
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
343
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
344
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
345
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
def _handler(
|
|
349
|
+
req: "OperationRequest[capo_codeguru_security.types.get_account_configuration_request.GetAccountConfigurationRequest]",
|
|
350
|
+
) -> OperationResponse[
|
|
351
|
+
"capo_codeguru_security.types.get_account_configuration_response.GetAccountConfigurationResponse"
|
|
352
|
+
]:
|
|
353
|
+
import capo_codeguru_security._operations.aws_code_guru_security.get_account_configuration
|
|
354
|
+
|
|
355
|
+
output, http_response = (
|
|
356
|
+
capo_codeguru_security._operations.aws_code_guru_security.get_account_configuration.get_account_configuration(
|
|
357
|
+
req.options, req.input
|
|
358
|
+
)
|
|
359
|
+
)
|
|
360
|
+
return OperationResponse(output=output, response=http_response)
|
|
361
|
+
|
|
362
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
363
|
+
input_: capo_codeguru_security.types.get_account_configuration_request.GetAccountConfigurationRequest = {}
|
|
364
|
+
|
|
365
|
+
response = execute_pipeline(
|
|
366
|
+
OperationRequest(input=input_, options=options_),
|
|
367
|
+
handler=_handler,
|
|
368
|
+
interceptors=list(interceptors_),
|
|
369
|
+
)
|
|
370
|
+
response.response.close()
|
|
371
|
+
return response.output
|
|
372
|
+
|
|
373
|
+
def get_findings(
|
|
374
|
+
self,
|
|
375
|
+
scan_name: "capo_codeguru_security.types.scan_name.ScanName",
|
|
376
|
+
*,
|
|
377
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
378
|
+
next_token: Optional[
|
|
379
|
+
"capo_codeguru_security.types.next_token.NextToken"
|
|
380
|
+
] = None,
|
|
381
|
+
max_results: Optional[int] = None,
|
|
382
|
+
status: Optional["capo_codeguru_security.types.status.Status"] = None,
|
|
383
|
+
) -> "capo_codeguru_security.types.get_findings_response.GetFindingsResponse":
|
|
384
|
+
"""<p>Returns a list of all findings generated by a particular scan.</p>
|
|
385
|
+
|
|
386
|
+
Args:
|
|
387
|
+
scan_name: <p>The name of the scan you want to retrieve findings from.</p>
|
|
388
|
+
next_token: <p>A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the <code>nextToken</code> value returned from the previous request to continue listing results after the first page.</p>
|
|
389
|
+
max_results: <p>The maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the <code>nextToken</code> element is returned in the response. Use <code>nextToken</code> in a subsequent request to retrieve additional results. If not specified, returns 1000 results.</p>
|
|
390
|
+
status: <p>The status of the findings you want to get. Pass either <code>Open</code>, <code>Closed</code>, or <code>All</code>.</p>
|
|
391
|
+
|
|
392
|
+
Raises:
|
|
393
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
394
|
+
capo_codeguru_security.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
|
|
395
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
396
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
397
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
398
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
399
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
400
|
+
"""
|
|
401
|
+
|
|
402
|
+
def _handler(
|
|
403
|
+
req: "OperationRequest[capo_codeguru_security.types.get_findings_request.GetFindingsRequest]",
|
|
404
|
+
) -> OperationResponse[
|
|
405
|
+
"capo_codeguru_security.types.get_findings_response.GetFindingsResponse"
|
|
406
|
+
]:
|
|
407
|
+
import capo_codeguru_security._operations.aws_code_guru_security.get_findings
|
|
408
|
+
|
|
409
|
+
output, http_response = (
|
|
410
|
+
capo_codeguru_security._operations.aws_code_guru_security.get_findings.get_findings(
|
|
411
|
+
req.options, req.input
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
return OperationResponse(output=output, response=http_response)
|
|
415
|
+
|
|
416
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
417
|
+
input_: capo_codeguru_security.types.get_findings_request.GetFindingsRequest = {
|
|
418
|
+
"scan_name": scan_name
|
|
419
|
+
}
|
|
420
|
+
if next_token is not None:
|
|
421
|
+
input_["next_token"] = next_token
|
|
422
|
+
if max_results is not None:
|
|
423
|
+
input_["max_results"] = max_results
|
|
424
|
+
if status is not None:
|
|
425
|
+
input_["status"] = status
|
|
426
|
+
|
|
427
|
+
response = execute_pipeline(
|
|
428
|
+
OperationRequest(input=input_, options=options_),
|
|
429
|
+
handler=_handler,
|
|
430
|
+
interceptors=list(interceptors_),
|
|
431
|
+
)
|
|
432
|
+
response.response.close()
|
|
433
|
+
return response.output
|
|
434
|
+
|
|
435
|
+
def iter_get_findings(
|
|
436
|
+
self,
|
|
437
|
+
scan_name: "capo_codeguru_security.types.scan_name.ScanName",
|
|
438
|
+
*,
|
|
439
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
440
|
+
next_token: Optional[
|
|
441
|
+
"capo_codeguru_security.types.next_token.NextToken"
|
|
442
|
+
] = None,
|
|
443
|
+
max_results: Optional[int] = None,
|
|
444
|
+
status: Optional["capo_codeguru_security.types.status.Status"] = None,
|
|
445
|
+
) -> "Iterator[capo_codeguru_security.types.finding.Finding]":
|
|
446
|
+
_token = next_token
|
|
447
|
+
while True:
|
|
448
|
+
_response = self.get_findings(
|
|
449
|
+
scan_name,
|
|
450
|
+
config_overrides=config_overrides,
|
|
451
|
+
next_token=_token,
|
|
452
|
+
max_results=max_results,
|
|
453
|
+
status=status,
|
|
454
|
+
)
|
|
455
|
+
_page = _resolve_path(_response, ("findings",))
|
|
456
|
+
for _item in _page or []:
|
|
457
|
+
yield _item
|
|
458
|
+
_token = _resolve_path(_response, ("next_token",))
|
|
459
|
+
if not _token:
|
|
460
|
+
break
|
|
461
|
+
|
|
462
|
+
def get_metrics_summary(
|
|
463
|
+
self,
|
|
464
|
+
date: datetime.datetime,
|
|
465
|
+
*,
|
|
466
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
467
|
+
) -> "capo_codeguru_security.types.get_metrics_summary_response.GetMetricsSummaryResponse":
|
|
468
|
+
"""<p>Returns a summary of metrics for an account from a specified date, including number of open findings, the categories with most findings, the scans with most open findings, and scans with most open critical findings. </p>
|
|
469
|
+
|
|
470
|
+
Args:
|
|
471
|
+
date: <p>The date you want to retrieve summary metrics from, rounded to the nearest day. The date must be within the past two years.</p>
|
|
472
|
+
|
|
473
|
+
Raises:
|
|
474
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
475
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
476
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
477
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
478
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
479
|
+
"""
|
|
480
|
+
|
|
481
|
+
def _handler(
|
|
482
|
+
req: "OperationRequest[capo_codeguru_security.types.get_metrics_summary_request.GetMetricsSummaryRequest]",
|
|
483
|
+
) -> OperationResponse[
|
|
484
|
+
"capo_codeguru_security.types.get_metrics_summary_response.GetMetricsSummaryResponse"
|
|
485
|
+
]:
|
|
486
|
+
import capo_codeguru_security._operations.aws_code_guru_security.get_metrics_summary
|
|
487
|
+
|
|
488
|
+
output, http_response = (
|
|
489
|
+
capo_codeguru_security._operations.aws_code_guru_security.get_metrics_summary.get_metrics_summary(
|
|
490
|
+
req.options, req.input
|
|
491
|
+
)
|
|
492
|
+
)
|
|
493
|
+
return OperationResponse(output=output, response=http_response)
|
|
494
|
+
|
|
495
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
496
|
+
input_: capo_codeguru_security.types.get_metrics_summary_request.GetMetricsSummaryRequest = {
|
|
497
|
+
"date": date
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
response = execute_pipeline(
|
|
501
|
+
OperationRequest(input=input_, options=options_),
|
|
502
|
+
handler=_handler,
|
|
503
|
+
interceptors=list(interceptors_),
|
|
504
|
+
)
|
|
505
|
+
response.response.close()
|
|
506
|
+
return response.output
|
|
507
|
+
|
|
508
|
+
def get_scan(
|
|
509
|
+
self,
|
|
510
|
+
scan_name: "capo_codeguru_security.types.scan_name.ScanName",
|
|
511
|
+
*,
|
|
512
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
513
|
+
run_id: Optional["capo_codeguru_security.types.uuid.Uuid"] = None,
|
|
514
|
+
) -> "capo_codeguru_security.types.get_scan_response.GetScanResponse":
|
|
515
|
+
"""<p>Returns details about a scan, including whether or not a scan has completed.</p>
|
|
516
|
+
|
|
517
|
+
Args:
|
|
518
|
+
scan_name: <p>The name of the scan you want to view details about.</p>
|
|
519
|
+
run_id: <p>UUID that identifies the individual scan run you want to view details about. You retrieve this when you call the <code>CreateScan</code> operation. Defaults to the latest scan run if missing.</p>
|
|
520
|
+
|
|
521
|
+
Raises:
|
|
522
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
523
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
524
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
525
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
526
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
527
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
528
|
+
"""
|
|
529
|
+
|
|
530
|
+
def _handler(
|
|
531
|
+
req: "OperationRequest[capo_codeguru_security.types.get_scan_request.GetScanRequest]",
|
|
532
|
+
) -> OperationResponse[
|
|
533
|
+
"capo_codeguru_security.types.get_scan_response.GetScanResponse"
|
|
534
|
+
]:
|
|
535
|
+
import capo_codeguru_security._operations.aws_code_guru_security.get_scan
|
|
536
|
+
|
|
537
|
+
output, http_response = (
|
|
538
|
+
capo_codeguru_security._operations.aws_code_guru_security.get_scan.get_scan(
|
|
539
|
+
req.options, req.input
|
|
540
|
+
)
|
|
541
|
+
)
|
|
542
|
+
return OperationResponse(output=output, response=http_response)
|
|
543
|
+
|
|
544
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
545
|
+
input_: capo_codeguru_security.types.get_scan_request.GetScanRequest = {
|
|
546
|
+
"scan_name": scan_name
|
|
547
|
+
}
|
|
548
|
+
if run_id is not None:
|
|
549
|
+
input_["run_id"] = run_id
|
|
550
|
+
|
|
551
|
+
response = execute_pipeline(
|
|
552
|
+
OperationRequest(input=input_, options=options_),
|
|
553
|
+
handler=_handler,
|
|
554
|
+
interceptors=list(interceptors_),
|
|
555
|
+
)
|
|
556
|
+
response.response.close()
|
|
557
|
+
return response.output
|
|
558
|
+
|
|
559
|
+
def list_findings_metrics(
|
|
560
|
+
self,
|
|
561
|
+
start_date: datetime.datetime,
|
|
562
|
+
end_date: datetime.datetime,
|
|
563
|
+
*,
|
|
564
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
565
|
+
next_token: Optional[
|
|
566
|
+
"capo_codeguru_security.types.next_token.NextToken"
|
|
567
|
+
] = None,
|
|
568
|
+
max_results: Optional[int] = None,
|
|
569
|
+
) -> "capo_codeguru_security.types.list_findings_metrics_response.ListFindingsMetricsResponse":
|
|
570
|
+
"""<p>Returns metrics about all findings in an account within a specified time range.</p>
|
|
571
|
+
|
|
572
|
+
Args:
|
|
573
|
+
next_token: <p>A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the <code>nextToken</code> value returned from the previous request to continue listing results after the first page.</p>
|
|
574
|
+
max_results: <p>The maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the <code>nextToken</code> element is returned in the response. Use <code>nextToken</code> in a subsequent request to retrieve additional results. If not specified, returns 1000 results.</p>
|
|
575
|
+
start_date: <p>The start date of the interval which you want to retrieve metrics from. Rounds to the nearest day.</p>
|
|
576
|
+
end_date: <p>The end date of the interval which you want to retrieve metrics from. Round to the nearest day.</p>
|
|
577
|
+
|
|
578
|
+
Raises:
|
|
579
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
580
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
581
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
582
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
583
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
584
|
+
"""
|
|
585
|
+
|
|
586
|
+
def _handler(
|
|
587
|
+
req: "OperationRequest[capo_codeguru_security.types.list_findings_metrics_request.ListFindingsMetricsRequest]",
|
|
588
|
+
) -> OperationResponse[
|
|
589
|
+
"capo_codeguru_security.types.list_findings_metrics_response.ListFindingsMetricsResponse"
|
|
590
|
+
]:
|
|
591
|
+
import capo_codeguru_security._operations.aws_code_guru_security.list_findings_metrics
|
|
592
|
+
|
|
593
|
+
output, http_response = (
|
|
594
|
+
capo_codeguru_security._operations.aws_code_guru_security.list_findings_metrics.list_findings_metrics(
|
|
595
|
+
req.options, req.input
|
|
596
|
+
)
|
|
597
|
+
)
|
|
598
|
+
return OperationResponse(output=output, response=http_response)
|
|
599
|
+
|
|
600
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
601
|
+
input_: capo_codeguru_security.types.list_findings_metrics_request.ListFindingsMetricsRequest = {
|
|
602
|
+
"start_date": start_date,
|
|
603
|
+
"end_date": end_date,
|
|
604
|
+
}
|
|
605
|
+
if next_token is not None:
|
|
606
|
+
input_["next_token"] = next_token
|
|
607
|
+
if max_results is not None:
|
|
608
|
+
input_["max_results"] = max_results
|
|
609
|
+
|
|
610
|
+
response = execute_pipeline(
|
|
611
|
+
OperationRequest(input=input_, options=options_),
|
|
612
|
+
handler=_handler,
|
|
613
|
+
interceptors=list(interceptors_),
|
|
614
|
+
)
|
|
615
|
+
response.response.close()
|
|
616
|
+
return response.output
|
|
617
|
+
|
|
618
|
+
def iter_list_findings_metrics(
|
|
619
|
+
self,
|
|
620
|
+
start_date: datetime.datetime,
|
|
621
|
+
end_date: datetime.datetime,
|
|
622
|
+
*,
|
|
623
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
624
|
+
next_token: Optional[
|
|
625
|
+
"capo_codeguru_security.types.next_token.NextToken"
|
|
626
|
+
] = None,
|
|
627
|
+
max_results: Optional[int] = None,
|
|
628
|
+
) -> "Iterator[capo_codeguru_security.types.account_findings_metric.AccountFindingsMetric]":
|
|
629
|
+
_token = next_token
|
|
630
|
+
while True:
|
|
631
|
+
_response = self.list_findings_metrics(
|
|
632
|
+
start_date,
|
|
633
|
+
end_date,
|
|
634
|
+
config_overrides=config_overrides,
|
|
635
|
+
next_token=_token,
|
|
636
|
+
max_results=max_results,
|
|
637
|
+
)
|
|
638
|
+
_page = _resolve_path(_response, ("findings_metrics",))
|
|
639
|
+
for _item in _page or []:
|
|
640
|
+
yield _item
|
|
641
|
+
_token = _resolve_path(_response, ("next_token",))
|
|
642
|
+
if not _token:
|
|
643
|
+
break
|
|
644
|
+
|
|
645
|
+
def list_scans(
|
|
646
|
+
self,
|
|
647
|
+
*,
|
|
648
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
649
|
+
next_token: Optional[
|
|
650
|
+
"capo_codeguru_security.types.next_token.NextToken"
|
|
651
|
+
] = None,
|
|
652
|
+
max_results: Optional[int] = None,
|
|
653
|
+
) -> "capo_codeguru_security.types.list_scans_response.ListScansResponse":
|
|
654
|
+
"""<p>Returns a list of all scans in an account. Does not return <code>EXPRESS</code> scans.</p>
|
|
655
|
+
|
|
656
|
+
Args:
|
|
657
|
+
next_token: <p>A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the <code>nextToken</code> value returned from the previous request to continue listing results after the first page.</p>
|
|
658
|
+
max_results: <p>The maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the <code>nextToken</code> element is returned in the response. Use <code>nextToken</code> in a subsequent request to retrieve additional results. If not specified, returns 100 results.</p>
|
|
659
|
+
|
|
660
|
+
Raises:
|
|
661
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
662
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
663
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
664
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
665
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
666
|
+
"""
|
|
667
|
+
|
|
668
|
+
def _handler(
|
|
669
|
+
req: "OperationRequest[capo_codeguru_security.types.list_scans_request.ListScansRequest]",
|
|
670
|
+
) -> OperationResponse[
|
|
671
|
+
"capo_codeguru_security.types.list_scans_response.ListScansResponse"
|
|
672
|
+
]:
|
|
673
|
+
import capo_codeguru_security._operations.aws_code_guru_security.list_scans
|
|
674
|
+
|
|
675
|
+
output, http_response = (
|
|
676
|
+
capo_codeguru_security._operations.aws_code_guru_security.list_scans.list_scans(
|
|
677
|
+
req.options, req.input
|
|
678
|
+
)
|
|
679
|
+
)
|
|
680
|
+
return OperationResponse(output=output, response=http_response)
|
|
681
|
+
|
|
682
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
683
|
+
input_: capo_codeguru_security.types.list_scans_request.ListScansRequest = {}
|
|
684
|
+
if next_token is not None:
|
|
685
|
+
input_["next_token"] = next_token
|
|
686
|
+
if max_results is not None:
|
|
687
|
+
input_["max_results"] = max_results
|
|
688
|
+
|
|
689
|
+
response = execute_pipeline(
|
|
690
|
+
OperationRequest(input=input_, options=options_),
|
|
691
|
+
handler=_handler,
|
|
692
|
+
interceptors=list(interceptors_),
|
|
693
|
+
)
|
|
694
|
+
response.response.close()
|
|
695
|
+
return response.output
|
|
696
|
+
|
|
697
|
+
def iter_list_scans(
|
|
698
|
+
self,
|
|
699
|
+
*,
|
|
700
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
701
|
+
next_token: Optional[
|
|
702
|
+
"capo_codeguru_security.types.next_token.NextToken"
|
|
703
|
+
] = None,
|
|
704
|
+
max_results: Optional[int] = None,
|
|
705
|
+
) -> "Iterator[capo_codeguru_security.types.scan_summary.ScanSummary]":
|
|
706
|
+
_token = next_token
|
|
707
|
+
while True:
|
|
708
|
+
_response = self.list_scans(
|
|
709
|
+
config_overrides=config_overrides,
|
|
710
|
+
next_token=_token,
|
|
711
|
+
max_results=max_results,
|
|
712
|
+
)
|
|
713
|
+
_page = _resolve_path(_response, ("summaries",))
|
|
714
|
+
for _item in _page or []:
|
|
715
|
+
yield _item
|
|
716
|
+
_token = _resolve_path(_response, ("next_token",))
|
|
717
|
+
if not _token:
|
|
718
|
+
break
|
|
719
|
+
|
|
720
|
+
def list_tags_for_resource(
|
|
721
|
+
self,
|
|
722
|
+
resource_arn: "capo_codeguru_security.types.scan_name_arn.ScanNameArn",
|
|
723
|
+
*,
|
|
724
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
725
|
+
) -> "capo_codeguru_security.types.list_tags_for_resource_response.ListTagsForResourceResponse":
|
|
726
|
+
"""<p>Returns a list of all tags associated with a scan.</p>
|
|
727
|
+
|
|
728
|
+
Args:
|
|
729
|
+
resource_arn: <p>The ARN of the <code>ScanName</code> object. You can retrieve this ARN by calling <code>CreateScan</code>, <code>ListScans</code>, or <code>GetScan</code>.</p>
|
|
730
|
+
|
|
731
|
+
Raises:
|
|
732
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
733
|
+
capo_codeguru_security.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
|
|
734
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
735
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
736
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
737
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
738
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
739
|
+
"""
|
|
740
|
+
|
|
741
|
+
def _handler(
|
|
742
|
+
req: "OperationRequest[capo_codeguru_security.types.list_tags_for_resource_request.ListTagsForResourceRequest]",
|
|
743
|
+
) -> OperationResponse[
|
|
744
|
+
"capo_codeguru_security.types.list_tags_for_resource_response.ListTagsForResourceResponse"
|
|
745
|
+
]:
|
|
746
|
+
import capo_codeguru_security._operations.aws_code_guru_security.list_tags_for_resource
|
|
747
|
+
|
|
748
|
+
output, http_response = (
|
|
749
|
+
capo_codeguru_security._operations.aws_code_guru_security.list_tags_for_resource.list_tags_for_resource(
|
|
750
|
+
req.options, req.input
|
|
751
|
+
)
|
|
752
|
+
)
|
|
753
|
+
return OperationResponse(output=output, response=http_response)
|
|
754
|
+
|
|
755
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
756
|
+
input_: capo_codeguru_security.types.list_tags_for_resource_request.ListTagsForResourceRequest = {
|
|
757
|
+
"resource_arn": resource_arn
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
response = execute_pipeline(
|
|
761
|
+
OperationRequest(input=input_, options=options_),
|
|
762
|
+
handler=_handler,
|
|
763
|
+
interceptors=list(interceptors_),
|
|
764
|
+
)
|
|
765
|
+
response.response.close()
|
|
766
|
+
return response.output
|
|
767
|
+
|
|
768
|
+
def tag_resource(
|
|
769
|
+
self,
|
|
770
|
+
resource_arn: "capo_codeguru_security.types.scan_name_arn.ScanNameArn",
|
|
771
|
+
tags: "capo_codeguru_security.types.tag_map.TagMap",
|
|
772
|
+
*,
|
|
773
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
774
|
+
) -> "capo_codeguru_security.types.tag_resource_response.TagResourceResponse":
|
|
775
|
+
"""<p>Use to add one or more tags to an existing scan.</p>
|
|
776
|
+
|
|
777
|
+
Args:
|
|
778
|
+
resource_arn: <p>The ARN of the <code>ScanName</code> object. You can retrieve this ARN by calling <code>CreateScan</code>, <code>ListScans</code>, or <code>GetScan</code>.</p>
|
|
779
|
+
tags: <p>An array of key-value pairs used to tag an existing scan. A tag is a custom attribute label with two parts:</p> <ul> <li> <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p> </li> <li> <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p> </li> </ul>
|
|
780
|
+
|
|
781
|
+
Raises:
|
|
782
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
783
|
+
capo_codeguru_security.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
|
|
784
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
785
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
786
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
787
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
788
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
789
|
+
"""
|
|
790
|
+
|
|
791
|
+
def _handler(
|
|
792
|
+
req: "OperationRequest[capo_codeguru_security.types.tag_resource_request.TagResourceRequest]",
|
|
793
|
+
) -> OperationResponse[
|
|
794
|
+
"capo_codeguru_security.types.tag_resource_response.TagResourceResponse"
|
|
795
|
+
]:
|
|
796
|
+
import capo_codeguru_security._operations.aws_code_guru_security.tag_resource
|
|
797
|
+
|
|
798
|
+
output, http_response = (
|
|
799
|
+
capo_codeguru_security._operations.aws_code_guru_security.tag_resource.tag_resource(
|
|
800
|
+
req.options, req.input
|
|
801
|
+
)
|
|
802
|
+
)
|
|
803
|
+
return OperationResponse(output=output, response=http_response)
|
|
804
|
+
|
|
805
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
806
|
+
input_: capo_codeguru_security.types.tag_resource_request.TagResourceRequest = {
|
|
807
|
+
"resource_arn": resource_arn,
|
|
808
|
+
"tags": tags,
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
response = execute_pipeline(
|
|
812
|
+
OperationRequest(input=input_, options=options_),
|
|
813
|
+
handler=_handler,
|
|
814
|
+
interceptors=list(interceptors_),
|
|
815
|
+
)
|
|
816
|
+
response.response.close()
|
|
817
|
+
return response.output
|
|
818
|
+
|
|
819
|
+
def untag_resource(
|
|
820
|
+
self,
|
|
821
|
+
resource_arn: "capo_codeguru_security.types.scan_name_arn.ScanNameArn",
|
|
822
|
+
tag_keys: "capo_codeguru_security.types.tag_key_list.TagKeyList",
|
|
823
|
+
*,
|
|
824
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
825
|
+
) -> "capo_codeguru_security.types.untag_resource_response.UntagResourceResponse":
|
|
826
|
+
"""<p>Use to remove one or more tags from an existing scan.</p>
|
|
827
|
+
|
|
828
|
+
Args:
|
|
829
|
+
resource_arn: <p>The ARN of the <code>ScanName</code> object. You can retrieve this ARN by calling <code>CreateScan</code>, <code>ListScans</code>, or <code>GetScan</code>.</p>
|
|
830
|
+
tag_keys: <p>A list of keys for each tag you want to remove from a scan.</p>
|
|
831
|
+
|
|
832
|
+
Raises:
|
|
833
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
834
|
+
capo_codeguru_security.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
|
|
835
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
836
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
837
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
838
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
839
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
840
|
+
"""
|
|
841
|
+
|
|
842
|
+
def _handler(
|
|
843
|
+
req: "OperationRequest[capo_codeguru_security.types.untag_resource_request.UntagResourceRequest]",
|
|
844
|
+
) -> OperationResponse[
|
|
845
|
+
"capo_codeguru_security.types.untag_resource_response.UntagResourceResponse"
|
|
846
|
+
]:
|
|
847
|
+
import capo_codeguru_security._operations.aws_code_guru_security.untag_resource
|
|
848
|
+
|
|
849
|
+
output, http_response = (
|
|
850
|
+
capo_codeguru_security._operations.aws_code_guru_security.untag_resource.untag_resource(
|
|
851
|
+
req.options, req.input
|
|
852
|
+
)
|
|
853
|
+
)
|
|
854
|
+
return OperationResponse(output=output, response=http_response)
|
|
855
|
+
|
|
856
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
857
|
+
input_: capo_codeguru_security.types.untag_resource_request.UntagResourceRequest = {
|
|
858
|
+
"resource_arn": resource_arn,
|
|
859
|
+
"tag_keys": tag_keys,
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
response = execute_pipeline(
|
|
863
|
+
OperationRequest(input=input_, options=options_),
|
|
864
|
+
handler=_handler,
|
|
865
|
+
interceptors=list(interceptors_),
|
|
866
|
+
)
|
|
867
|
+
response.response.close()
|
|
868
|
+
return response.output
|
|
869
|
+
|
|
870
|
+
def update_account_configuration(
|
|
871
|
+
self,
|
|
872
|
+
encryption_config: "capo_codeguru_security.types.encryption_config.EncryptionConfig",
|
|
873
|
+
*,
|
|
874
|
+
config_overrides: Optional[CodeGuruSecurityClientConfig] = None,
|
|
875
|
+
) -> "capo_codeguru_security.types.update_account_configuration_response.UpdateAccountConfigurationResponse":
|
|
876
|
+
"""<p>Use to update the encryption configuration for an account.</p>
|
|
877
|
+
|
|
878
|
+
Args:
|
|
879
|
+
encryption_config: <p>The customer-managed KMS key ARN you want to use for encryption. If not specified, CodeGuru Security will use an AWS-managed key for encryption. If you previously specified a customer-managed KMS key and want CodeGuru Security to use an AWS-managed key for encryption instead, pass nothing.</p>
|
|
880
|
+
|
|
881
|
+
Raises:
|
|
882
|
+
capo_codeguru_security.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
|
|
883
|
+
capo_codeguru_security.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
|
|
884
|
+
capo_codeguru_security.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
|
|
885
|
+
capo_codeguru_security.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
|
|
886
|
+
capo_codeguru_security.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
|
|
887
|
+
capo_codeguru_security.errors.UnknownServiceError: The service returned an error code this client does not model.
|
|
888
|
+
"""
|
|
889
|
+
|
|
890
|
+
def _handler(
|
|
891
|
+
req: "OperationRequest[capo_codeguru_security.types.update_account_configuration_request.UpdateAccountConfigurationRequest]",
|
|
892
|
+
) -> OperationResponse[
|
|
893
|
+
"capo_codeguru_security.types.update_account_configuration_response.UpdateAccountConfigurationResponse"
|
|
894
|
+
]:
|
|
895
|
+
import capo_codeguru_security._operations.aws_code_guru_security.update_account_configuration
|
|
896
|
+
|
|
897
|
+
output, http_response = (
|
|
898
|
+
capo_codeguru_security._operations.aws_code_guru_security.update_account_configuration.update_account_configuration(
|
|
899
|
+
req.options, req.input
|
|
900
|
+
)
|
|
901
|
+
)
|
|
902
|
+
return OperationResponse(output=output, response=http_response)
|
|
903
|
+
|
|
904
|
+
interceptors_, options_ = self.operation_options(config_overrides)
|
|
905
|
+
input_: capo_codeguru_security.types.update_account_configuration_request.UpdateAccountConfigurationRequest = {
|
|
906
|
+
"encryption_config": encryption_config
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
response = execute_pipeline(
|
|
910
|
+
OperationRequest(input=input_, options=options_),
|
|
911
|
+
handler=_handler,
|
|
912
|
+
interceptors=list(interceptors_),
|
|
913
|
+
)
|
|
914
|
+
response.response.close()
|
|
915
|
+
return response.output
|
|
916
|
+
|
|
917
|
+
def __enter__(self) -> Self:
|
|
918
|
+
return self
|
|
919
|
+
|
|
920
|
+
def __exit__(self, exc_type: Any, exc: Any, tb: Any):
|
|
921
|
+
self._client.close()
|