describeSnapshots method
Returns the description of specific Amazon FSx for OpenZFS snapshots, if a
SnapshotIds value is provided. Otherwise, this operation
returns all snapshots owned by your Amazon Web Services account in the
Amazon Web Services Region of the endpoint that you're calling.
When retrieving all snapshots, you can optionally specify the
MaxResults parameter to limit the number of snapshots in a
response. If more backups remain, Amazon FSx returns a
NextToken value in the response. In this case, send a later
request with the NextToken request parameter set to the value
of NextToken from the last response.
Use this operation in an iterative process to retrieve a list of your
snapshots. DescribeSnapshots is called first without a
NextToken value. Then the operation continues to be called
with the NextToken parameter set to the value of the last
NextToken value until a response has no
NextToken value.
When using this operation, keep the following in mind:
-
The operation might return fewer than the
MaxResultsvalue of snapshot descriptions while still including aNextTokenvalue. -
The order of snapshots returned in the response of one
DescribeSnapshotscall and the order of backups returned across the responses of a multi-call iteration is unspecified.
May throw BadRequest.
May throw InternalServerError.
May throw SnapshotNotFound.
Parameter filters :
The filters structure. The supported names are file-system-id
or volume-id.
Parameter includeShared :
Set to false (default) if you want to only see the snapshots
owned by your Amazon Web Services account. Set to true if you
want to see the snapshots in your account and the ones shared with you
from another account.
Parameter snapshotIds :
The IDs of the snapshots that you want to retrieve. This parameter value
overrides any filters. If any IDs aren't found, a
SnapshotNotFound error occurs.
Implementation
Future<DescribeSnapshotsResponse> describeSnapshots({
List<SnapshotFilter>? filters,
bool? includeShared,
int? maxResults,
String? nextToken,
List<String>? snapshotIds,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
2147483647,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSSimbaAPIService_v20180301.DescribeSnapshots'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (filters != null) 'Filters': filters,
if (includeShared != null) 'IncludeShared': includeShared,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (snapshotIds != null) 'SnapshotIds': snapshotIds,
},
);
return DescribeSnapshotsResponse.fromJson(jsonResponse.body);
}