listAttributes method

Future<ListAttributesResponse> listAttributes({
  1. required TargetType targetType,
  2. String? attributeName,
  3. String? attributeValue,
  4. String? cluster,
  5. int? maxResults,
  6. String? nextToken,
})

Lists the attributes for Amazon ECS resources within a specified target type and cluster. When you specify a target type and cluster, ListAttributes returns a list of attribute objects, one for each attribute on each resource. You can filter the list of results to a single attribute name to only return results that have that name. You can also filter the results by attribute name and value, for example, to see which container instances in a cluster are running a Linux AMI (ecs.os-type=linux).

May throw ClusterNotFoundException. May throw InvalidParameterException.

Parameter targetType : The type of the target with which to list attributes.

Parameter attributeName : The name of the attribute with which to filter the results.

Parameter attributeValue : The value of the attribute with which to filter results. You must also specify an attribute name to use this parameter.

Parameter cluster : The short name or full Amazon Resource Name (ARN) of the cluster to list attributes. If you do not specify a cluster, the default cluster is assumed.

Parameter maxResults : The maximum number of cluster results returned by ListAttributes in paginated output. When this parameter is used, ListAttributes only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListAttributes request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListAttributes returns up to 100 results and a nextToken value if applicable.

Parameter nextToken : The nextToken value returned from a ListAttributes request indicating that more results are available to fulfill the request and further calls will be needed. If maxResults was provided, it is possible the number of results to be fewer than maxResults.

Implementation

Future<ListAttributesResponse> listAttributes({
  required TargetType targetType,
  String? attributeName,
  String? attributeValue,
  String? cluster,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(targetType, 'targetType');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerServiceV20141113.ListAttributes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'targetType': targetType.toValue(),
      if (attributeName != null) 'attributeName': attributeName,
      if (attributeValue != null) 'attributeValue': attributeValue,
      if (cluster != null) 'cluster': cluster,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListAttributesResponse.fromJson(jsonResponse.body);
}