createBackendEnvironment method
Creates a new backend environment for an Amplify app.
This API is available only to Amplify Gen 1 applications where the backend is created using Amplify Studio or the Amplify command line interface (CLI). This API isn’t available to Amplify Gen 2 applications. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.
May throw BadRequestException.
May throw InternalFailureException.
May throw LimitExceededException.
May throw NotFoundException.
May throw UnauthorizedException.
Parameter appId :
The unique ID for an Amplify app.
Parameter environmentName :
The name for the backend environment.
Parameter deploymentArtifacts :
The name of deployment artifacts.
Parameter stackName :
The AWS CloudFormation stack name of a backend environment.
Implementation
Future<CreateBackendEnvironmentResult> createBackendEnvironment({
required String appId,
required String environmentName,
String? deploymentArtifacts,
String? stackName,
}) async {
final $payload = <String, dynamic>{
'environmentName': environmentName,
if (deploymentArtifacts != null)
'deploymentArtifacts': deploymentArtifacts,
if (stackName != null) 'stackName': stackName,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/apps/${Uri.encodeComponent(appId)}/backendenvironments',
exceptionFnMap: _exceptionFns,
);
return CreateBackendEnvironmentResult.fromJson(response);
}