describeInstances method
Requests a description of a set of instances. Required Permissions: To use this action, an IAM user must have a Show, Deploy, or Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information about user permissions, see Managing User Permissions.
May throw ValidationException. May throw ResourceNotFoundException.
Parameter instanceIds
:
An array of instance IDs to be described. If you use this parameter,
DescribeInstances
returns a description of the specified
instances. Otherwise, it returns a description of every instance.
Parameter layerId
:
A layer ID. If you use this parameter, DescribeInstances
returns descriptions of the instances associated with the specified layer.
Parameter stackId
:
A stack ID. If you use this parameter, DescribeInstances
returns descriptions of the instances associated with the specified stack.
Implementation
Future<DescribeInstancesResult> describeInstances({
List<String>? instanceIds,
String? layerId,
String? stackId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'OpsWorks_20130218.DescribeInstances'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (instanceIds != null) 'InstanceIds': instanceIds,
if (layerId != null) 'LayerId': layerId,
if (stackId != null) 'StackId': stackId,
},
);
return DescribeInstancesResult.fromJson(jsonResponse.body);
}