listAssociations method

Future<ListAssociationsResponse> listAssociations({
  1. AssociationEdgeType? associationType,
  2. DateTime? createdAfter,
  3. DateTime? createdBefore,
  4. String? destinationArn,
  5. String? destinationType,
  6. int? maxResults,
  7. String? nextToken,
  8. SortAssociationsBy? sortBy,
  9. SortOrder? sortOrder,
  10. String? sourceArn,
  11. String? sourceType,
})

Lists the associations in your account and their properties.

May throw ResourceNotFound.

Parameter associationType : A filter that returns only associations of the specified type.

Parameter createdAfter : A filter that returns only associations created on or after the specified time.

Parameter createdBefore : A filter that returns only associations created on or before the specified time.

Parameter destinationArn : A filter that returns only associations with the specified destination Amazon Resource Name (ARN).

Parameter destinationType : A filter that returns only associations with the specified destination type.

Parameter maxResults : The maximum number of associations to return in the response. The default value is 10.

Parameter nextToken : If the previous call to ListAssociations didn't return the full set of associations, the call returns a token for getting the next set of associations.

Parameter sortBy : The property used to sort results. The default value is CreationTime.

Parameter sortOrder : The sort order. The default value is Descending.

Parameter sourceArn : A filter that returns only associations with the specified source ARN.

Parameter sourceType : A filter that returns only associations with the specified source type.

Implementation

Future<ListAssociationsResponse> listAssociations({
  AssociationEdgeType? associationType,
  DateTime? createdAfter,
  DateTime? createdBefore,
  String? destinationArn,
  String? destinationType,
  int? maxResults,
  String? nextToken,
  SortAssociationsBy? sortBy,
  SortOrder? sortOrder,
  String? sourceArn,
  String? sourceType,
}) async {
  _s.validateStringLength(
    'destinationArn',
    destinationArn,
    0,
    256,
  );
  _s.validateStringLength(
    'destinationType',
    destinationType,
    0,
    256,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  _s.validateStringLength(
    'sourceArn',
    sourceArn,
    0,
    256,
  );
  _s.validateStringLength(
    'sourceType',
    sourceType,
    0,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListAssociations'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (associationType != null)
        'AssociationType': associationType.toValue(),
      if (createdAfter != null)
        'CreatedAfter': unixTimestampToJson(createdAfter),
      if (createdBefore != null)
        'CreatedBefore': unixTimestampToJson(createdBefore),
      if (destinationArn != null) 'DestinationArn': destinationArn,
      if (destinationType != null) 'DestinationType': destinationType,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
      if (sourceArn != null) 'SourceArn': sourceArn,
      if (sourceType != null) 'SourceType': sourceType,
    },
  );

  return ListAssociationsResponse.fromJson(jsonResponse.body);
}