createHostedConfigurationVersion method
Creates a new configuration in the AppConfig hosted configuration store. If you're creating a feature flag, we recommend you familiarize yourself with the JSON schema for feature flag data. For more information, see Type reference for AWS.AppConfig.FeatureFlags in the AppConfig User Guide.
May throw BadRequestException.
May throw ConflictException.
May throw InternalServerException.
May throw PayloadTooLargeException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
Parameter applicationId :
The application ID.
Parameter configurationProfileId :
The configuration profile ID.
Parameter content :
The configuration data, as bytes.
Parameter contentType :
A standard MIME type describing the format of the configuration content.
For more information, see Content-Type.
Parameter description :
A description of the configuration.
Parameter latestVersionNumber :
An optional locking token used to prevent race conditions from overwriting
configuration updates when creating a new version. To ensure your data is
not overwritten when creating multiple hosted configuration versions in
rapid succession, specify the version number of the latest hosted
configuration version.
Parameter versionLabel :
An optional, user-defined label for the AppConfig hosted configuration
version. This value must contain at least one non-numeric character. For
example, "v2.2.0".
Implementation
Future<HostedConfigurationVersion> createHostedConfigurationVersion({
required String applicationId,
required String configurationProfileId,
required Uint8List content,
required String contentType,
String? description,
int? latestVersionNumber,
String? versionLabel,
}) async {
final headers = <String, String>{
'Content-Type': contentType.toString(),
if (description != null) 'Description': description.toString(),
if (latestVersionNumber != null)
'Latest-Version-Number': latestVersionNumber.toString(),
if (versionLabel != null) 'VersionLabel': versionLabel.toString(),
};
final response = await _protocol.sendRaw(
payload: content,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/configurationprofiles/${Uri.encodeComponent(configurationProfileId)}/hostedconfigurationversions',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return HostedConfigurationVersion(
content: await response.stream.toBytes(),
applicationId:
_s.extractHeaderStringValue(response.headers, 'Application-Id'),
configurationProfileId: _s.extractHeaderStringValue(
response.headers, 'Configuration-Profile-Id'),
contentType:
_s.extractHeaderStringValue(response.headers, 'Content-Type'),
description: _s.extractHeaderStringValue(response.headers, 'Description'),
kmsKeyArn: _s.extractHeaderStringValue(response.headers, 'KmsKeyArn'),
versionLabel:
_s.extractHeaderStringValue(response.headers, 'VersionLabel'),
versionNumber:
_s.extractHeaderIntValue(response.headers, 'Version-Number'),
);
}