createEnvironment method
- required String applicationName,
- String? cNAMEPrefix,
- String? description,
- String? environmentName,
- String? groupName,
- String? operationsRole,
- List<
ConfigurationOptionSetting> ? optionSettings, - List<
OptionSpecification> ? optionsToRemove, - String? platformArn,
- String? solutionStackName,
- List<
Tag> ? tags, - String? templateName,
- EnvironmentTier? tier,
- String? versionLabel,
Launches an AWS Elastic Beanstalk environment for the specified application using the specified configuration.
May throw TooManyEnvironmentsException. May throw InsufficientPrivilegesException.
Parameter applicationName
:
The name of the application that is associated with this environment.
Parameter cNAMEPrefix
:
If specified, the environment attempts to use this value as the prefix for
the CNAME in your Elastic Beanstalk environment URL. If not specified, the
CNAME is generated automatically by appending a random alphanumeric string
to the environment name.
Parameter description
:
Your description for this environment.
Parameter environmentName
:
A unique name for the environment.
Constraint: Must be from 4 to 40 characters in length. The name can
contain only letters, numbers, and hyphens. It can't start or end with a
hyphen. This name must be unique within a region in your account. If the
specified name already exists in the region, Elastic Beanstalk returns an
InvalidParameterValue
error.
If you don't specify the CNAMEPrefix
parameter, the
environment name becomes part of the CNAME, and therefore part of the
visible URL for your application.
Parameter groupName
:
The name of the group to which the target environment belongs. Specify a
group name only if the environment's name is specified in an environment
manifest and not with the environment name parameter. See Environment
Manifest (env.yaml) for details.
Parameter operationsRole
:
The Amazon Resource Name (ARN) of an existing IAM role to be used as the
environment's operations role. If specified, Elastic Beanstalk uses the
operations role for permissions to downstream services during this call
and during subsequent calls acting on this environment. To specify an
operations role, you must have the iam:PassRole
permission
for the role. For more information, see Operations
roles in the AWS Elastic Beanstalk Developer Guide.
Parameter optionSettings
:
If specified, AWS Elastic Beanstalk sets the specified configuration
options to the requested value in the configuration set for the new
environment. These override the values obtained from the solution stack or
the configuration template.
Parameter optionsToRemove
:
A list of custom user-defined configuration options to remove from the
configuration set for this new environment.
Parameter platformArn
:
The Amazon Resource Name (ARN) of the custom platform to use with the
environment. For more information, see Custom
Platforms in the AWS Elastic Beanstalk Developer Guide.
Parameter solutionStackName
:
The name of an Elastic Beanstalk solution stack (platform version) to use
with the environment. If specified, Elastic Beanstalk sets the
configuration values to the default values associated with the specified
solution stack. For a list of current solution stacks, see Elastic
Beanstalk Supported Platforms in the AWS Elastic Beanstalk
Platforms guide.
Parameter tags
:
Specifies the tags applied to resources in the environment.
Parameter templateName
:
The name of the Elastic Beanstalk configuration template to use with the
environment.
Parameter tier
:
Specifies the tier to use in creating this environment. The environment
tier that you choose determines whether Elastic Beanstalk provisions
resources to support a web application that handles HTTP(S) requests or a
web application that handles background-processing tasks.
Parameter versionLabel
:
The name of the application version to deploy.
Default: If not specified, Elastic Beanstalk attempts to deploy the sample application.
Implementation
Future<EnvironmentDescription> createEnvironment({
required String applicationName,
String? cNAMEPrefix,
String? description,
String? environmentName,
String? groupName,
String? operationsRole,
List<ConfigurationOptionSetting>? optionSettings,
List<OptionSpecification>? optionsToRemove,
String? platformArn,
String? solutionStackName,
List<Tag>? tags,
String? templateName,
EnvironmentTier? tier,
String? versionLabel,
}) async {
ArgumentError.checkNotNull(applicationName, 'applicationName');
_s.validateStringLength(
'applicationName',
applicationName,
1,
100,
isRequired: true,
);
_s.validateStringLength(
'cNAMEPrefix',
cNAMEPrefix,
4,
63,
);
_s.validateStringLength(
'description',
description,
0,
200,
);
_s.validateStringLength(
'environmentName',
environmentName,
4,
40,
);
_s.validateStringLength(
'groupName',
groupName,
1,
19,
);
_s.validateStringLength(
'operationsRole',
operationsRole,
1,
256,
);
_s.validateStringLength(
'templateName',
templateName,
1,
100,
);
_s.validateStringLength(
'versionLabel',
versionLabel,
1,
100,
);
final $request = <String, dynamic>{};
$request['ApplicationName'] = applicationName;
cNAMEPrefix?.also((arg) => $request['CNAMEPrefix'] = arg);
description?.also((arg) => $request['Description'] = arg);
environmentName?.also((arg) => $request['EnvironmentName'] = arg);
groupName?.also((arg) => $request['GroupName'] = arg);
operationsRole?.also((arg) => $request['OperationsRole'] = arg);
optionSettings?.also((arg) => $request['OptionSettings'] = arg);
optionsToRemove?.also((arg) => $request['OptionsToRemove'] = arg);
platformArn?.also((arg) => $request['PlatformArn'] = arg);
solutionStackName?.also((arg) => $request['SolutionStackName'] = arg);
tags?.also((arg) => $request['Tags'] = arg);
templateName?.also((arg) => $request['TemplateName'] = arg);
tier?.also((arg) => $request['Tier'] = arg);
versionLabel?.also((arg) => $request['VersionLabel'] = arg);
final $result = await _protocol.send(
$request,
action: 'CreateEnvironment',
version: '2010-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['CreateEnvironmentMessage'],
shapes: shapes,
resultWrapper: 'CreateEnvironmentResult',
);
return EnvironmentDescription.fromXml($result);
}