describeStacks method

Future<DescribeStacksOutput> describeStacks({
  1. String? nextToken,
  2. String? stackName,
})

Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks created. For more information about a stack's event history, see Understand CloudFormation stack creation events in the CloudFormation User Guide.

Parameter nextToken : The token for the next set of items to return. (You received this token from a previous call.)

Parameter stackName :

Consider using the ListStacks API if you're not passing a parameter to StackName.

The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:::stack//" }] } The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:

  • Running stacks: You can specify either the stack's name or its unique stack ID.
  • Deleted stacks: You must specify the unique stack ID.

Implementation

Future<DescribeStacksOutput> describeStacks({
  String? nextToken,
  String? stackName,
}) async {
  final $request = <String, String>{
    if (nextToken != null) 'NextToken': nextToken,
    if (stackName != null) 'StackName': stackName,
  };
  final $result = await _protocol.send(
    $request,
    action: 'DescribeStacks',
    version: '2010-05-15',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'DescribeStacksResult',
  );
  return DescribeStacksOutput.fromXml($result);
}