createEnvironment method
Creates an environment. For each application, you define one or more
environments. An environment is a deployment group of AppConfig targets,
such as applications in a Beta or Production
environment. You can also define environments for application
subcomponents such as the Web, Mobile and
Back-end components for your application. You can configure
Amazon CloudWatch alarms for each environment. The system monitors alarms
during a configuration deployment. If an alarm is triggered, the system
rolls back the configuration.
May throw BadRequestException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
Parameter applicationId :
The application ID.
Parameter name :
A name for the environment.
Parameter description :
A description of the environment.
Parameter monitors :
Amazon CloudWatch alarms to monitor during the deployment process.
Parameter tags :
Metadata to assign to the environment. Tags help organize and categorize
your AppConfig resources. Each tag consists of a key and an optional
value, both of which you define.
Implementation
Future<Environment> createEnvironment({
required String applicationId,
required String name,
String? description,
List<Monitor>? monitors,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'Name': name,
if (description != null) 'Description': description,
if (monitors != null) 'Monitors': monitors,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/environments',
exceptionFnMap: _exceptionFns,
);
return Environment.fromJson(response);
}