createEnvironment method
- required String name,
- required String spec,
- required String templateMajorVersion,
- required String templateName,
- String? codebuildRoleArn,
- String? componentRoleArn,
- String? description,
- String? environmentAccountConnectionId,
- String? protonServiceRoleArn,
- RepositoryBranchInput? provisioningRepository,
- List<
Tag> ? tags, - String? templateMinorVersion,
Deploy a new environment. An Proton environment is created from an environment template that defines infrastructure and resources that can be shared across services.
You can provision environments using the following methods:
- Amazon Web Services-managed provisioning: Proton makes direct calls to provision your resources.
- Self-managed provisioning: Proton makes pull requests on your repository to provide compiled infrastructure as code (IaC) files that your IaC engine uses to provision resources.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter name :
The name of the environment.
Parameter spec :
A YAML formatted string that provides inputs as defined in the environment
template bundle schema file. For more information, see Environments
in the Proton User Guide.
Parameter templateMajorVersion :
The major version of the environment template.
Parameter templateName :
The name of the environment template. For more information, see Environment
Templates in the Proton User Guide.
Parameter codebuildRoleArn :
The Amazon Resource Name (ARN) of the IAM service role that allows Proton
to provision infrastructure using CodeBuild-based provisioning on your
behalf.
To use CodeBuild-based provisioning for the environment or for any service
instance running in the environment, specify either the
environmentAccountConnectionId or
codebuildRoleArn parameter.
Parameter componentRoleArn :
The Amazon Resource Name (ARN) of the IAM service role that Proton uses
when provisioning directly defined components in this environment. It
determines the scope of infrastructure that a component can provision.
You must specify componentRoleArn to allow directly defined
components to be associated with this environment.
For more information about components, see Proton components in the Proton User Guide.
Parameter description :
A description of the environment that's being created and deployed.
Parameter environmentAccountConnectionId :
The ID of the environment account connection that you provide if you're
provisioning your environment infrastructure resources to an environment
account. For more information, see Environment
account connections in the Proton User guide.
To use Amazon Web Services-managed provisioning for the environment,
specify either the environmentAccountConnectionId or
protonServiceRoleArn parameter and omit the
provisioningRepository parameter.
Parameter protonServiceRoleArn :
The Amazon Resource Name (ARN) of the Proton service role that allows
Proton to make calls to other services on your behalf.
To use Amazon Web Services-managed provisioning for the environment,
specify either the environmentAccountConnectionId or
protonServiceRoleArn parameter and omit the
provisioningRepository parameter.
Parameter provisioningRepository :
The linked repository that you use to host your rendered infrastructure
templates for self-managed provisioning. A linked repository is a
repository that has been registered with Proton. For more information, see
CreateRepository.
To use self-managed provisioning for the environment, specify this
parameter and omit the environmentAccountConnectionId and
protonServiceRoleArn parameters.
Parameter tags :
An optional list of metadata items that you can associate with the Proton
environment. A tag is a key-value pair.
For more information, see Proton resources and tagging in the Proton User Guide.
Parameter templateMinorVersion :
The minor version of the environment template.
Implementation
Future<CreateEnvironmentOutput> createEnvironment({
required String name,
required String spec,
required String templateMajorVersion,
required String templateName,
String? codebuildRoleArn,
String? componentRoleArn,
String? description,
String? environmentAccountConnectionId,
String? protonServiceRoleArn,
RepositoryBranchInput? provisioningRepository,
List<Tag>? tags,
String? templateMinorVersion,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AwsProton20200720.CreateEnvironment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'name': name,
'spec': spec,
'templateMajorVersion': templateMajorVersion,
'templateName': templateName,
if (codebuildRoleArn != null) 'codebuildRoleArn': codebuildRoleArn,
if (componentRoleArn != null) 'componentRoleArn': componentRoleArn,
if (description != null) 'description': description,
if (environmentAccountConnectionId != null)
'environmentAccountConnectionId': environmentAccountConnectionId,
if (protonServiceRoleArn != null)
'protonServiceRoleArn': protonServiceRoleArn,
if (provisioningRepository != null)
'provisioningRepository': provisioningRepository,
if (tags != null) 'tags': tags,
if (templateMinorVersion != null)
'templateMinorVersion': templateMinorVersion,
},
);
return CreateEnvironmentOutput.fromJson(jsonResponse.body);
}