put_intelligence_configuration
async
¶
put_intelligence_configuration(
*,
config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
intelligence_enabled: Optional[bool] = None,
kms_key_arn: Optional[IntelligenceKmsKeyArn] = None,
remove_kms_key: Optional[bool] = None,
client_token: Optional[ClientToken] = None,
notification_targets: Optional[IntelligenceNotificationTargetList] = None,
auto_investigations: Optional[AutoInvestigationEntryList] = None,
) -> PutIntelligenceConfigurationOutput
Creates or updates the intelligence configuration for the calling account in the current Region. The account is the account of the caller's credentials; the request does not name it. Set intelligenceEnabled to true to enable Observations, or to false to disable it. A request that sets no setting fails with ValidationException. Each setting that the request sends replaces the stored value, and each setting that it omits stays unchanged. An automatic-investigation entry for the stored integration sent without minimumSeverity keeps the stored minimumSeverity. The service does not check whether the configuration changed after the caller last read it. The request carries no version, so a request based on an earlier GetIntelligenceConfiguration response replaces any change saved after that read, and no error is returned. One exception is a notification target sent with a targetId that is no longer stored, for example because another save removed it, which fails with ValidationException. ConflictException means only that another update was saved while this request was being processed, after the service read the configuration for this request and before it saved the result. The service checks for such a change to the notification targets when the request carries notificationTargets, to the automatic-investigation entries when it carries autoInvestigations, and to the KMS key when it sets a new key or removes the key. A request that adds a notification target or changes its filter also fails with ConflictException if Observations is turned off while the request is being processed. Other updates saved while the request is being processed can also cause ConflictException. When the request fails with ConflictException, nothing is saved. To lower the chance of replacing another caller's change, call GetIntelligenceConfiguration right before saving, and omit each setting that you do not mean to change. The service does not use clientToken to recognize a retry, so a retried request is processed again like a new one (see clientToken).
Parameters:
-
intelligence_enabled(Optional[bool], default:None) –Whether to enable Observations, which detects anomalies and correlates them into observations, for the calling account. Set it to true to enable and to false to disable. Observations is in preview release and is subject to change.
-
kms_key_arn(Optional[IntelligenceKmsKeyArn], default:None) –Optional KMS key ARN to configure customer-managed encryption for anomaly data. The key must be in the calling account and in the current Region. A key in another account or another Region fails with ValidationException and nothing is saved.
-
remove_kms_key(Optional[bool], default:None) –Set to true to disassociate the configured KMS key. Mutually exclusive with kmsKeyArn; the service returns ValidationException if both are provided.
-
client_token(Optional[ClientToken], default:None) –A token that identifies the request: 1 to 64 printable ASCII characters, with no spaces. For this operation, the token does not make a retry safe: the service checks only its format, and does not store the token or compare it with earlier requests, so a request sent again with the same token is processed again as a new request, not answered with the first result. Sending the same settings again saves them again, and a notification target sent without a targetId is added again with a new targetId. A retry fails with ConflictException only if another update of the configuration is saved while the retry is being processed. To find out whether an earlier attempt was saved, call GetIntelligenceConfiguration.
-
notification_targets(Optional[IntelligenceNotificationTargetList], default:None) –The destinations Intelligence notifications are sent to. Omit it to leave the stored targets unchanged, send an empty list to remove all targets, and send any other list to replace the stored list in full. Send a new entry without a targetId; the service assigns one. For an existing entry, echo its targetId and its target, including metadata, unchanged; its filter may change. Every write that changes the list re-validates all of its targets, and if any target fails, the request fails with ValidationException and nothing is stored. A save that adds a target, or changes the filter of a stored target, needs Intelligence already enabled on the account and not turned off by the same request, permission to view observations (cloudwatch:ListObservations), and kms:Decrypt on the configuration's customer managed key when one is set. A save that adds a slack or pagerduty target, or changes its filter, also needs cloudwatch:InvokeIntegration on its integration. A save that adds an sns target also needs sns:GetTopicAttributes on its topic. Removing targets and sending an empty list need none of these. The list replaces the targets stored when the service reads the configuration for this request, so of two requests that change the targets one after the other, the later one replaces the list the earlier one saved. If the stored targets change while the request is being saved, the request fails with ConflictException and nothing is stored, so the caller reads the configuration again and retries. There is no version member to send for the targets: the service compares against the targets it read for this request. Observations is in preview release and is subject to change.
-
auto_investigations(Optional[AutoInvestigationEntryList], default:None) –The automatic-investigation entries for the account in this Region. Omit it to leave the stored entries unchanged, send an empty list to turn automatic investigations off, and send any other list to replace the stored entries in full. An entry for the stored integration sent without minimumSeverity keeps the stored minimumSeverity. Each entry names the ARN of an active AWS DevOps Agent integration in the account and Region. For each entry that the request adds, or whose integration or effective minimumSeverity it changes, the caller needs permission to view and to invoke that integration. At most one entry is accepted, and it covers the entire account. If any check fails, the request fails and nothing is stored. If the stored entries change while the request is being saved, the request fails with ConflictException and nothing is stored, so the caller reads the configuration again and retries. There is no version member to send for these entries: the service compares against the entries it read for this request. Observations is in preview release and is subject to change.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
ConflictException–The operation could not be completed because of a conflict with the current state of the resource.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Configure a customer-managed KMS key The following example sets the customer-managed KMS key used to encrypt the account's intelligence data. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.put_intelligence_configuration(kms_key_arn='arn:aws:kms:us-east-1:123456789012:key/1a2b3c4d-5e6f-4a3b-8c9d-0e1f2a3b4c5d', client_token='b3f8c7d6-5b4a-4c3d-9e2f-1a0b2c3d4e5f')
Add notification targets and turn on automatic investigations
The following example, for an account that already has Observations enabled, adds a Slack target for HIGH observations of one service and an Amazon SNS target for every observation, and starts automatic investigations for HIGH observations. The service assigns each new target its targetId. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.put_intelligence_configuration(notification_targets=[{'target': {'type': 'slack', 'arn': 'arn:aws:cloudwatch:us-east-1:123456789012:integration/a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', 'metadata': {'channel': 'checkout-oncall'}}, 'filter': {'services': ['checkout-service'], 'minimumSeverity': 'HIGH'}}, {'target': {'type': 'sns', 'arn': 'arn:aws:sns:us-east-1:123456789012:checkout-oncall'}}], auto_investigations=[{'integrationArn': 'arn:aws:cloudwatch:us-east-1:123456789012:integration/f0e1d2c3-b4a5-4968-8776-655443322110', 'minimumSeverity': 'HIGH'}], client_token='c4a9d8e7-6c5b-4d4e-8f3a-2b1c0d9e8f7a')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 | |