getConfiguration method
Receive information about a configuration.
To avoid excess charges, we recommend that you include the
ClientConfigurationVersion
value with every call to
GetConfiguration
. This value must be saved on your client.
Subsequent calls to GetConfiguration
must pass this value by
using the ClientConfigurationVersion
parameter.
May throw ResourceNotFoundException. May throw InternalServerException. May throw BadRequestException.
Parameter application
:
The application to get. Specify either the application name or the
application ID.
Parameter clientId
:
A unique 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 that you include the
ClientConfigurationVersion
value with every call to
GetConfiguration
. This value must be saved on your client.
Subsequent calls to GetConfiguration
must pass this value by
using the ClientConfigurationVersion
parameter.
For more information about working with configurations, see Retrieving
the Configuration in the AWS AppConfig User Guide.
Implementation
Future<Configuration> getConfiguration({
required String application,
required String clientId,
required String configuration,
required String environment,
String? clientConfigurationVersion,
}) async {
ArgumentError.checkNotNull(application, 'application');
_s.validateStringLength(
'application',
application,
1,
64,
isRequired: true,
);
ArgumentError.checkNotNull(clientId, 'clientId');
_s.validateStringLength(
'clientId',
clientId,
1,
64,
isRequired: true,
);
ArgumentError.checkNotNull(configuration, 'configuration');
_s.validateStringLength(
'configuration',
configuration,
1,
64,
isRequired: true,
);
ArgumentError.checkNotNull(environment, 'environment');
_s.validateStringLength(
'environment',
environment,
1,
64,
isRequired: true,
);
_s.validateStringLength(
'clientConfigurationVersion',
clientConfigurationVersion,
1,
1024,
);
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'),
);
}