Indicates whether the specified Config rules are compliant. If a rule is noncompliant, this operation returns the number of Amazon Web Services resources that do not comply with the rule.
A rule is compliant if all of the evaluated resources comply with it. It is noncompliant if any of these resources do not comply.
If Config has no current evaluation results for the rule, it returns INSUFFICIENT_DATA. This result might indicate one of the following conditions:
-
Config has never invoked an evaluation for the rule. To check whether it has, use the DescribeConfigRuleEvaluationStatus action to get the LastSuccessfulInvocationTime and LastFailedInvocationTime.
-
The rule's Lambda function is failing to send evaluation results to Config. Verify that the role you assigned to your configuration recorder includes the config:PutEvaluations permission. If the rule is a custom rule, verify that the Lambda execution role includes the config:PutEvaluations permission.
-
The rule's Lambda function has returned NOT_APPLICABLE for all evaluation results. This can occur if the resources were deleted or removed from the rule's scope.
Parameters:
-
config_rule_names
(Optional[ConfigRuleNames], default:
None
)
–
Specify one or more Config rule names to filter the results by rule.
-
compliance_types
(Optional[ComplianceTypes], default:
None
)
–
Filters the results by compliance.
-
next_token
(Optional[String], default:
None
)
–
The nextToken string returned on a previous page that you use to get the next page of results in a paginated response.
Raises:
-
InvalidNextTokenException
–
The specified next token is not valid. Specify the nextToken string that was returned in the previous response to get the next page of results.
-
InvalidParameterValueException
–
One or more of the specified parameters are not valid. Verify that your parameters are valid and try again.
-
NoSuchConfigRuleException
–
The Config rule in the request is not valid. Verify that the rule is an Config Process Check rule, that the rule name is correct, and that valid Amazon Resouce Names (ARNs) are used before trying again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_config_service/_services/async_config_service.py
| async def describe_compliance_by_config_rule(
self,
*,
config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
config_rule_names: Optional[
"capo_config_service.types.config_rule_names.ConfigRuleNames"
] = None,
compliance_types: Optional[
"capo_config_service.types.compliance_types.ComplianceTypes"
] = None,
next_token: Optional["capo_config_service.types.string.String"] = None,
) -> "capo_config_service.types.describe_compliance_by_config_rule_response.DescribeComplianceByConfigRuleResponse":
"""<p>Indicates whether the specified Config rules are compliant. If a rule is noncompliant, this operation returns the number of Amazon Web Services resources that do not comply with the rule.</p> <p>A rule is compliant if all of the evaluated resources comply with it. It is noncompliant if any of these resources do not comply.</p> <p>If Config has no current evaluation results for the rule, it returns <code>INSUFFICIENT_DATA</code>. This result might indicate one of the following conditions:</p> <ul> <li> <p>Config has never invoked an evaluation for the rule. To check whether it has, use the <code>DescribeConfigRuleEvaluationStatus</code> action to get the <code>LastSuccessfulInvocationTime</code> and <code>LastFailedInvocationTime</code>.</p> </li> <li> <p>The rule's Lambda function is failing to send evaluation results to Config. Verify that the role you assigned to your configuration recorder includes the <code>config:PutEvaluations</code> permission. If the rule is a custom rule, verify that the Lambda execution role includes the <code>config:PutEvaluations</code> permission.</p> </li> <li> <p>The rule's Lambda function has returned <code>NOT_APPLICABLE</code> for all evaluation results. This can occur if the resources were deleted or removed from the rule's scope.</p> </li> </ul>
Args:
config_rule_names: <p>Specify one or more Config rule names to filter the results by rule.</p>
compliance_types: <p>Filters the results by compliance.</p>
next_token: <p>The <code>nextToken</code> string returned on a previous page that you use to get the next page of results in a paginated response.</p>
Raises:
capo_config_service.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The specified next token is not valid. Specify the <code>nextToken</code> string that was returned in the previous response to get the next page of results.</p>
capo_config_service.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One or more of the specified parameters are not valid. Verify that your parameters are valid and try again.</p>
capo_config_service.errors.no_such_config_rule_exception.NoSuchConfigRuleException: <p>The Config rule in the request is not valid. Verify that the rule is an Config Process Check rule, that the rule name is correct, and that valid Amazon Resouce Names (ARNs) are used before trying again.</p>
capo_config_service.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_config_service.types.describe_compliance_by_config_rule_request.DescribeComplianceByConfigRuleRequest]",
) -> AsyncOperationResponse[
"capo_config_service.types.describe_compliance_by_config_rule_response.DescribeComplianceByConfigRuleResponse"
]:
import capo_config_service._operations.starling_dove_service.describe_compliance_by_config_rule
(
output,
http_response,
) = await capo_config_service._operations.starling_dove_service.describe_compliance_by_config_rule.async_describe_compliance_by_config_rule(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DescribeComplianceByConfigRule")
)
input_: capo_config_service.types.describe_compliance_by_config_rule_request.DescribeComplianceByConfigRuleRequest = {}
if config_rule_names is not None:
input_["config_rule_names"] = config_rule_names
if compliance_types is not None:
input_["compliance_types"] = compliance_types
if next_token is not None:
input_["next_token"] = next_token
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|