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. You can do this, for example, to see which container instances in a cluster are running a Linux AMI (ecs.os-type=linux).

May throw AccessDeniedException. May throw ClientException. May throw ClusterNotFoundException. May throw InvalidParameterException. May throw ServerException.

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

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

Parameter attributeValue : The value of the attribute to filter results with. 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 that ListAttributes returned 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 isn't 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 are needed. If maxResults was provided, it's 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 {
  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.value,
      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);
}