listResources method

Future<ListResourcesOutput> listResources({
  1. required String typeName,
  2. int? maxResults,
  3. String? nextToken,
  4. String? resourceModel,
  5. String? roleArn,
  6. String? typeVersionId,
})

Returns information about the specified resources. For more information, see Discovering resources in the Amazon Web Services Cloud Control API User Guide.

You can use this action to return information about existing resources in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.

May throw AlreadyExistsException. May throw GeneralServiceException. May throw HandlerFailureException. May throw HandlerInternalFailureException. May throw InvalidCredentialsException. May throw InvalidRequestException. May throw NetworkFailureException. May throw NotStabilizedException. May throw NotUpdatableException. May throw PrivateTypeException. May throw ResourceConflictException. May throw ResourceNotFoundException. May throw ServiceInternalErrorException. May throw ServiceLimitExceededException. May throw ThrottlingException. May throw TypeNotFoundException. May throw UnsupportedActionException.

Parameter typeName : The name of the resource type.

Parameter maxResults : Reserved.

Parameter nextToken : If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.

Parameter resourceModel : The resource model to use to select the resources to return.

Parameter roleArn : The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the handlers section of the resource type definition schema.

If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials.

For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.

Parameter typeVersionId : For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.

Implementation

Future<ListResourcesOutput> listResources({
  required String typeName,
  int? maxResults,
  String? nextToken,
  String? resourceModel,
  String? roleArn,
  String? typeVersionId,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'CloudApiService.ListResources'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TypeName': typeName,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceModel != null) 'ResourceModel': resourceModel,
      if (roleArn != null) 'RoleArn': roleArn,
      if (typeVersionId != null) 'TypeVersionId': typeVersionId,
    },
  );

  return ListResourcesOutput.fromJson(jsonResponse.body);
}