Skip to content

/AWS1/IF_CFS=>LISTDISCOVEREDRESOURCES()

About ListDiscoveredResources

Returns a list of resource resource identifiers for the specified resource types for the resources of that type. A resource identifier includes the resource type, ID, and (if available) the custom resource name.

The results consist of resources that Config has discovered, including those that Config is not currently recording. You can narrow the results to include only resources that have specific resource IDs or a resource name.

You can specify either resource IDs or a resource name, but not both, in the same request.

CloudFormation stack recording behavior in Config

When a CloudFormation stack fails to create (for example, it enters the ROLLBACK_FAILED state), Config does not record a configuration item (CI) for that stack. Configuration items are only recorded for stacks that reach the following states:

  • CREATE_COMPLETE

  • UPDATE_COMPLETE

  • UPDATE_ROLLBACK_COMPLETE

  • UPDATE_ROLLBACK_FAILED

  • DELETE_FAILED

  • DELETE_COMPLETE

Because no CI is created for a failed stack creation, you won't see configuration history for that stack in Config, even after the stack is deleted. This helps make sure that Config only tracks resources that were successfully provisioned.

Method Signature

IMPORTING

Required arguments:

iv_resourcetype TYPE /AWS1/CFSRESOURCETYPE /AWS1/CFSRESOURCETYPE

The type of resources that you want Config to list in the response.

Optional arguments:

it_resourceids TYPE /AWS1/CL_CFSRESOURCEIDLIST_W=>TT_RESOURCEIDLIST TT_RESOURCEIDLIST

The IDs of only those resources that you want Config to list in the response. If you do not specify this parameter, Config lists all resources of the specified type that it has discovered. You can list a minimum of 1 resourceID and a maximum of 20 resourceIds.

iv_resourcename TYPE /AWS1/CFSRESOURCENAME /AWS1/CFSRESOURCENAME

The custom name of only those resources that you want Config to list in the response. If you do not specify this parameter, Config lists all resources of the specified type that it has discovered.

iv_limit TYPE /AWS1/CFSLIMIT /AWS1/CFSLIMIT

The maximum number of resource identifiers returned on each page. The default is 100. You cannot specify a number greater than 100. If you specify 0, Config uses the default.

iv_includedeletedresources TYPE /AWS1/CFSBOOLEAN /AWS1/CFSBOOLEAN

Specifies whether Config includes deleted resources in the results. By default, deleted resources are not included.

iv_nexttoken TYPE /AWS1/CFSNEXTTOKEN /AWS1/CFSNEXTTOKEN

The nextToken string returned on a previous page that you use to get the next page of results in a paginated response.

RETURNING

oo_output TYPE REF TO /aws1/cl_cfslstdiscoveredres01 /AWS1/CL_CFSLSTDISCOVEREDRES01

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_cfs~listdiscoveredresources(
  it_resourceids = VALUE /aws1/cl_cfsresourceidlist_w=>tt_resourceidlist(
    ( new /aws1/cl_cfsresourceidlist_w( |string| ) )
  )
  iv_includedeletedresources = ABAP_TRUE
  iv_limit = 123
  iv_nexttoken = |string|
  iv_resourcename = |string|
  iv_resourcetype = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_resourceidentifiers( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_resourcetype = lo_row_1->get_resourcetype( ).
      lv_resourceid = lo_row_1->get_resourceid( ).
      lv_resourcename = lo_row_1->get_resourcename( ).
      lv_resourcedeletiontime = lo_row_1->get_resourcedeletiontime( ).
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.