For accurate reporting on the compliance status, you must record the AWS::Config::ResourceCompliance resource type.
For more information, see Recording Amazon Web Services Resources in the Config Resources Developer Guide.
Returns a list of configurations items (CIs) for the specified resource.
Contents
The list contains details about each state of the resource during the specified time interval. If you specified a retention period to retain your CIs between a minimum of 30 days and a maximum of 7 years (2557 days), Config returns the CIs for the specified retention period.
Pagination
The response is paginated. By default, Config returns a limit of 10 configuration items per page. You can customize this number with the limit parameter. The response includes a nextToken string. To get the next page of results, run the request again and specify the string for the nextToken parameter.
Each call to the API is limited to span a duration of seven days. It is likely that the number of records returned is smaller than the specified limit. In such cases, you can make another call, using the nextToken.
Parameters:
-
resource_type
(ResourceType)
–
-
resource_id
(ResourceId)
–
The ID of the resource (for example., sg-xxxxxx).
-
later_time
(Optional[LaterTime], default:
None
)
–
The chronologically latest time in the time range for which the history requested. If not specified, current time is taken.
-
earlier_time
(Optional[EarlierTime], default:
None
)
–
The chronologically earliest time in the time range for which the history requested. If not specified, the action returns paginated results that contain configuration items that start when the first configuration item was recorded.
-
chronological_order
(Optional[ChronologicalOrder], default:
None
)
–
The chronological order for configuration items listed. By default, the results are listed in reverse chronological order.
-
limit
(Optional[Limit], default:
None
)
–
The maximum number of configuration items returned on each page. The default is 10. You cannot specify a number greater than 100. If you specify 0, Config uses the default.
-
next_token
(Optional[NextToken], 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:
-
InvalidLimitException
–
The specified limit is outside the allowable range.
-
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.
-
InvalidTimeRangeException
–
The specified time range is not valid. The earlier time is not chronologically before the later time.
-
NoAvailableConfigurationRecorderException
–
There are no customer managed configuration recorders available to record your resources. Use the PutConfigurationRecorder operation to create the customer managed configuration recorder.
-
ResourceNotDiscoveredException
–
You have specified a resource that is either unknown or has not been discovered.
-
ValidationException
–
The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.
For PutStoredQuery, one of the following errors:
-
There are missing required fields.
-
The input value fails the validation.
-
You are trying to create more than 300 queries.
For DescribeConfigurationRecorders and DescribeConfigurationRecorderStatus, one of the following errors:
For AssociateResourceTypes and DisassociateResourceTypes, one of the following errors:
-
Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.
-
One or more of the specified resource types are already associated or disassociated with the configuration recorder.
-
For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.
For DeleteServiceLinkedConfigurationRecorder, one of the following errors:
-
You have provided both Arn and ServicePrincipal. Only one of Arn or ServicePrincipal can be specified.
-
You have provided a service principal for service-linked configuration recorder that is not valid.
-
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 get_resource_config_history(
self,
resource_type: "capo_config_service.types.resource_type.ResourceType",
resource_id: "capo_config_service.types.resource_id.ResourceId",
*,
config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
later_time: Optional["capo_config_service.types.later_time.LaterTime"] = None,
earlier_time: Optional[
"capo_config_service.types.earlier_time.EarlierTime"
] = None,
chronological_order: Optional[
"capo_config_service.types.chronological_order.ChronologicalOrder"
] = None,
limit: Optional["capo_config_service.types.limit.Limit"] = None,
next_token: Optional["capo_config_service.types.next_token.NextToken"] = None,
) -> "capo_config_service.types.get_resource_config_history_response.GetResourceConfigHistoryResponse":
"""<important> <p>For accurate reporting on the compliance status, you must record the <code>AWS::Config::ResourceCompliance</code> resource type.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/config/latest/developerguide/select-resources.html">Recording Amazon Web Services Resources</a> in the <i>Config Resources Developer Guide</i>.</p> </important> <p>Returns a list of configurations items (CIs) for the specified resource.</p> <p> <b>Contents</b> </p> <p>The list contains details about each state of the resource during the specified time interval. If you specified a retention period to retain your CIs between a minimum of 30 days and a maximum of 7 years (2557 days), Config returns the CIs for the specified retention period. </p> <p> <b>Pagination</b> </p> <p>The response is paginated. By default, Config returns a limit of 10 configuration items per page. You can customize this number with the <code>limit</code> parameter. The response includes a <code>nextToken</code> string. To get the next page of results, run the request again and specify the string for the <code>nextToken</code> parameter.</p> <note> <p>Each call to the API is limited to span a duration of seven days. It is likely that the number of records returned is smaller than the specified <code>limit</code>. In such cases, you can make another call, using the <code>nextToken</code>.</p> </note>
Args:
resource_type: <p>The resource type.</p>
resource_id: <p>The ID of the resource (for example., <code>sg-xxxxxx</code>).</p>
later_time: <p>The chronologically latest time in the time range for which the history requested. If not specified, current time is taken.</p>
earlier_time: <p>The chronologically earliest time in the time range for which the history requested. If not specified, the action returns paginated results that contain configuration items that start when the first configuration item was recorded.</p>
chronological_order: <p>The chronological order for configuration items listed. By default, the results are listed in reverse chronological order.</p>
limit: <p>The maximum number of configuration items returned on each page. The default is 10. You cannot specify a number greater than 100. If you specify 0, Config uses the default.</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_limit_exception.InvalidLimitException: <p>The specified limit is outside the allowable range.</p>
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_time_range_exception.InvalidTimeRangeException: <p>The specified time range is not valid. The earlier time is not chronologically before the later time.</p>
capo_config_service.errors.no_available_configuration_recorder_exception.NoAvailableConfigurationRecorderException: <p>There are no customer managed configuration recorders available to record your resources. Use the <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigurationRecorder.html">PutConfigurationRecorder</a> operation to create the customer managed configuration recorder.</p>
capo_config_service.errors.resource_not_discovered_exception.ResourceNotDiscoveredException: <p>You have specified a resource that is either unknown or has not been discovered.</p>
capo_config_service.errors.validation_exception.ValidationException: <p>The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.</p> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutStoredQuery.html">PutStoredQuery</a>, one of the following errors:</p> <ul> <li> <p>There are missing required fields.</p> </li> <li> <p>The input value fails the validation.</p> </li> <li> <p>You are trying to create more than 300 queries.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorders.html">DescribeConfigurationRecorders</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorderStatus.html">DescribeConfigurationRecorderStatus</a>, one of the following errors:</p> <ul> <li> <p>You have specified more than one configuration recorder.</p> </li> <li> <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_AssociateResourceTypes.html">AssociateResourceTypes</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DisassociateResourceTypes.html">DisassociateResourceTypes</a>, one of the following errors:</p> <ul> <li> <p>Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.</p> </li> <li> <p>One or more of the specified resource types are already associated or disassociated with the configuration recorder.</p> </li> <li> <p>For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html">DeleteServiceLinkedConfigurationRecorder</a>, one of the following errors:</p> <ul> <li> <p>You have provided both <code>Arn</code> and <code>ServicePrincipal</code>. Only one of <code>Arn</code> or <code>ServicePrincipal</code> can be specified.</p> </li> <li> <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p> </li> </ul>
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.get_resource_config_history_request.GetResourceConfigHistoryRequest]",
) -> AsyncOperationResponse[
"capo_config_service.types.get_resource_config_history_response.GetResourceConfigHistoryResponse"
]:
import capo_config_service._operations.starling_dove_service.get_resource_config_history
(
output,
http_response,
) = await capo_config_service._operations.starling_dove_service.get_resource_config_history.async_get_resource_config_history(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetResourceConfigHistory")
)
input_: capo_config_service.types.get_resource_config_history_request.GetResourceConfigHistoryRequest = {
"resource_type": resource_type,
"resource_id": resource_id,
}
if later_time is not None:
input_["later_time"] = later_time
if earlier_time is not None:
input_["earlier_time"] = earlier_time
if chronological_order is not None:
input_["chronological_order"] = chronological_order
if limit is not None:
input_["limit"] = limit
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
|