getDistributions method

Future<GetDistributionsResult> getDistributions({
  1. String? distributionName,
  2. String? pageToken,
})

Returns information about one or more of your Amazon Lightsail content delivery network (CDN) distributions.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw UnauthenticatedException.

Parameter distributionName : The name of the distribution for which to return information.

Use the GetDistributions action to get a list of distribution names that you can specify.

When omitted, the response includes all of your distributions in the AWS Region where the request is made.

Parameter pageToken : The token to advance to the next page of results from your request.

To get a page token, perform an initial GetDistributions request. If your results are paginated, the response will return a next page token that you can specify as the page token in a subsequent request.

Implementation

Future<GetDistributionsResult> getDistributions({
  String? distributionName,
  String? pageToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.GetDistributions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (distributionName != null) 'distributionName': distributionName,
      if (pageToken != null) 'pageToken': pageToken,
    },
  );

  return GetDistributionsResult.fromJson(jsonResponse.body);
}