Skip to content

put_intelligence_configuration

put_intelligence_configuration(
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = 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:

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.

>>> 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.
>>> 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/cloud_watch_omni.py
def put_intelligence_configuration(
    self,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    intelligence_enabled: Optional[bool] = None,
    kms_key_arn: Optional[
        "capo_cloudwatchomni.types.intelligence_kms_key_arn.IntelligenceKmsKeyArn"
    ] = None,
    remove_kms_key: Optional[bool] = None,
    client_token: Optional[
        "capo_cloudwatchomni.types.client_token.ClientToken"
    ] = None,
    notification_targets: Optional[
        "capo_cloudwatchomni.types.intelligence_notification_target_list.IntelligenceNotificationTargetList"
    ] = None,
    auto_investigations: Optional[
        "capo_cloudwatchomni.types.auto_investigation_entry_list.AutoInvestigationEntryList"
    ] = None,
) -> "capo_cloudwatchomni.types.put_intelligence_configuration_output.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).

    Args:
        intelligence_enabled: 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 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: Set to true to disassociate the configured KMS key. Mutually exclusive with kmsKeyArn; the service returns ValidationException if both are provided.
        client_token: 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: 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: 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:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.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.

        >>> 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.

        >>> 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')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.put_intelligence_configuration_input.PutIntelligenceConfigurationInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.put_intelligence_configuration_output.PutIntelligenceConfigurationOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.put_intelligence_configuration

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.put_intelligence_configuration.put_intelligence_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutIntelligenceConfiguration")
    )
    input_: capo_cloudwatchomni.types.put_intelligence_configuration_input.PutIntelligenceConfigurationInput = {}
    if intelligence_enabled is not None:
        input_["intelligence_enabled"] = intelligence_enabled
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if remove_kms_key is not None:
        input_["remove_kms_key"] = remove_kms_key
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if notification_targets is not None:
        input_["notification_targets"] = notification_targets
    if auto_investigations is not None:
        input_["auto_investigations"] = auto_investigations

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output