getLatestConfiguration method

Future<GetLatestConfigurationResponse> getLatestConfiguration({
  1. required String configurationToken,
})

Retrieves the latest deployed configuration. This API may return empty configuration data if the client already has the latest version. For more information about this API action and to view example CLI commands that show how to use it with the StartConfigurationSession API action, see Retrieving the configuration in the AppConfig User Guide.

  • Each configuration token is only valid for one call to GetLatestConfiguration. The GetLatestConfiguration response includes a NextPollConfigurationToken that should always replace the token used for the just-completed call in preparation for the next one.
  • GetLatestConfiguration is a priced call. For more information, see Pricing.

May throw BadRequestException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter configurationToken : Token describing the current state of the configuration session. To obtain a token, first call the StartConfigurationSession API. Note that every call to GetLatestConfiguration will return a new ConfigurationToken (NextPollConfigurationToken in the response) and must be provided to subsequent GetLatestConfiguration API calls.

Implementation

Future<GetLatestConfigurationResponse> getLatestConfiguration({
  required String configurationToken,
}) async {
  final $query = <String, List<String>>{
    'configuration_token': [configurationToken],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri: '/configuration',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetLatestConfigurationResponse(
    configuration: await response.stream.toBytes(),
    contentType:
        _s.extractHeaderStringValue(response.headers, 'Content-Type'),
    nextPollConfigurationToken: _s.extractHeaderStringValue(
        response.headers, 'Next-Poll-Configuration-Token'),
    nextPollIntervalInSeconds: _s.extractHeaderIntValue(
        response.headers, 'Next-Poll-Interval-In-Seconds'),
    versionLabel:
        _s.extractHeaderStringValue(response.headers, 'Version-Label'),
  );
}