getConfiguration method
(Deprecated) Retrieves the latest deployed configuration.
- This API action is deprecated. Calls to receive configuration data should use the StartConfigurationSession and GetLatestConfiguration APIs instead.
- GetConfiguration is a priced call. For more information, see Pricing.
May throw BadRequestException.
May throw InternalServerException.
May throw ResourceNotFoundException.
Parameter application :
The application to get. Specify either the application name or the
application ID.
Parameter clientId :
The clientId parameter in the following command is a unique,
user-specified ID to identify the client for the configuration. This ID
enables AppConfig to deploy the configuration in intervals, as defined in
the deployment strategy.
Parameter configuration :
The configuration to get. Specify either the configuration name or the
configuration ID.
Parameter environment :
The environment to get. Specify either the environment name or the
environment ID.
Parameter clientConfigurationVersion :
The configuration version returned in the most recent
GetConfiguration response.
To avoid excess charges, we recommend you use the StartConfigurationSession
and GetLatestConfiguration
APIs, which track the client configuration version on your behalf. If you
choose to continue using GetConfiguration, we recommend that you
include the ClientConfigurationVersion value with every call
to GetConfiguration. The value to use for
ClientConfigurationVersion comes from the
ConfigurationVersion attribute returned by
GetConfiguration when there is new or updated data, and should be
saved for subsequent calls to GetConfiguration.
For more information about working with configurations, see Retrieving
feature flags and configuration data in AppConfig in the AppConfig
User Guide.
Implementation
Future<Configuration> getConfiguration({
required String application,
required String clientId,
required String configuration,
required String environment,
String? clientConfigurationVersion,
}) async {
final $query = <String, List<String>>{
'client_id': [clientId],
if (clientConfigurationVersion != null)
'client_configuration_version': [clientConfigurationVersion],
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri:
'/applications/${Uri.encodeComponent(application)}/environments/${Uri.encodeComponent(environment)}/configurations/${Uri.encodeComponent(configuration)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return Configuration(
content: await response.stream.toBytes(),
configurationVersion: _s.extractHeaderStringValue(
response.headers, 'Configuration-Version'),
contentType:
_s.extractHeaderStringValue(response.headers, 'Content-Type'),
);
}