listResourceSnapshots method

Future<ListResourceSnapshotsResponse> listResourceSnapshots({
  1. required String catalog,
  2. required String engagementIdentifier,
  3. String? createdBy,
  4. int? maxResults,
  5. String? nextToken,
  6. String? resourceIdentifier,
  7. String? resourceSnapshotTemplateIdentifier,
  8. ResourceType? resourceType,
})

Retrieves a list of resource view snapshots based on specified criteria. This operation supports various use cases, including:

  • Fetching all snapshots associated with an engagement.
  • Retrieving snapshots of a specific resource type within an engagement.
  • Obtaining snapshots for a particular resource using a specified template.
  • Accessing the latest snapshot of a resource within an engagement.
  • Filtering snapshots by resource owner.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter catalog : Specifies the catalog related to the request.

Parameter engagementIdentifier : The unique identifier of the engagement associated with the snapshots.

Parameter createdBy : Filters the response to include only snapshots of resources owned by the specified AWS account.

Parameter maxResults : The maximum number of results to return in a single call.

Parameter nextToken : The token for the next set of results.

Parameter resourceIdentifier : Filters the response to include only snapshots of the specified resource.

Parameter resourceSnapshotTemplateIdentifier : Filters the response to include only snapshots created using the specified template.

Parameter resourceType : Filters the response to include only snapshots of the specified resource type.

Implementation

Future<ListResourceSnapshotsResponse> listResourceSnapshots({
  required String catalog,
  required String engagementIdentifier,
  String? createdBy,
  int? maxResults,
  String? nextToken,
  String? resourceIdentifier,
  String? resourceSnapshotTemplateIdentifier,
  ResourceType? resourceType,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSPartnerCentralSelling.ListResourceSnapshots'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      'EngagementIdentifier': engagementIdentifier,
      if (createdBy != null) 'CreatedBy': createdBy,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceIdentifier != null)
        'ResourceIdentifier': resourceIdentifier,
      if (resourceSnapshotTemplateIdentifier != null)
        'ResourceSnapshotTemplateIdentifier':
            resourceSnapshotTemplateIdentifier,
      if (resourceType != null) 'ResourceType': resourceType.value,
    },
  );

  return ListResourceSnapshotsResponse.fromJson(jsonResponse.body);
}