describeVolumes method

Future<DescribeVolumesResult> describeVolumes({
  1. String? instanceId,
  2. String? raidArrayId,
  3. String? stackId,
  4. List<String>? volumeIds,
})

Describes an instance's Amazon EBS volumes. 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 instanceId : The instance ID. If you use this parameter, DescribeVolumes returns descriptions of the volumes associated with the specified instance.

Parameter raidArrayId : The RAID array ID. If you use this parameter, DescribeVolumes returns descriptions of the volumes associated with the specified RAID array.

Parameter stackId : A stack ID. The action describes the stack's registered Amazon EBS volumes.

Parameter volumeIds : Am array of volume IDs. If you use this parameter, DescribeVolumes returns descriptions of the specified volumes. Otherwise, it returns a description of every volume.

Implementation

Future<DescribeVolumesResult> describeVolumes({
  String? instanceId,
  String? raidArrayId,
  String? stackId,
  List<String>? volumeIds,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.DescribeVolumes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (instanceId != null) 'InstanceId': instanceId,
      if (raidArrayId != null) 'RaidArrayId': raidArrayId,
      if (stackId != null) 'StackId': stackId,
      if (volumeIds != null) 'VolumeIds': volumeIds,
    },
  );

  return DescribeVolumesResult.fromJson(jsonResponse.body);
}