createConfigurationProfile method
Information that enables AppConfig to access the configuration source. Valid configuration sources include Systems Manager (SSM) documents, SSM Parameter Store parameters, and Amazon S3 objects. A configuration profile includes the following information.
- The Uri location of the configuration data.
- The AWS Identity and Access Management (IAM) role that provides access to the configuration data.
- A validator for the configuration data. Available validators include either a JSON Schema or an AWS Lambda function.
May throw BadRequestException. May throw ResourceNotFoundException. May throw InternalServerException.
Parameter applicationId
:
The application ID.
Parameter locationUri
:
A URI to locate the configuration. You can specify a Systems Manager (SSM)
document, an SSM Parameter Store parameter, or an Amazon S3 object. For an
SSM document, specify either the document name in the format
ssm-document://<Document_name>
or the Amazon Resource
Name (ARN). For a parameter, specify either the parameter name in the
format ssm-parameter://<Parameter_name>
or the ARN. For
an Amazon S3 object, specify the URI in the following format:
s3://<bucket>/<objectKey>
. Here is an example:
s3://my-bucket/my-app/us-east-1/my-config.json
Parameter name
:
A name for the configuration profile.
Parameter description
:
A description of the configuration profile.
Parameter retrievalRoleArn
:
The ARN of an IAM role with permission to access the configuration at the
specified LocationUri.
Parameter tags
:
Metadata to assign to the configuration profile. Tags help organize and
categorize your AppConfig resources. Each tag consists of a key and an
optional value, both of which you define.
Parameter validators
:
A list of methods for validating the configuration.
Implementation
Future<ConfigurationProfile> createConfigurationProfile({
required String applicationId,
required String locationUri,
required String name,
String? description,
String? retrievalRoleArn,
Map<String, String>? tags,
List<Validator>? validators,
}) async {
ArgumentError.checkNotNull(applicationId, 'applicationId');
ArgumentError.checkNotNull(locationUri, 'locationUri');
_s.validateStringLength(
'locationUri',
locationUri,
1,
2048,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
64,
isRequired: true,
);
_s.validateStringLength(
'description',
description,
0,
1024,
);
_s.validateStringLength(
'retrievalRoleArn',
retrievalRoleArn,
20,
2048,
);
final $payload = <String, dynamic>{
'LocationUri': locationUri,
'Name': name,
if (description != null) 'Description': description,
if (retrievalRoleArn != null) 'RetrievalRoleArn': retrievalRoleArn,
if (tags != null) 'Tags': tags,
if (validators != null) 'Validators': validators,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/configurationprofiles',
exceptionFnMap: _exceptionFns,
);
return ConfigurationProfile.fromJson(response);
}