createApp method
- required String name,
- String? accessToken,
- AutoBranchCreationConfig? autoBranchCreationConfig,
- List<
String> ? autoBranchCreationPatterns, - String? basicAuthCredentials,
- String? buildSpec,
- String? customHeaders,
- List<
CustomRule> ? customRules, - String? description,
- bool? enableAutoBranchCreation,
- bool? enableBasicAuth,
- bool? enableBranchAutoBuild,
- bool? enableBranchAutoDeletion,
- Map<
String, String> ? environmentVariables, - String? iamServiceRoleArn,
- String? oauthToken,
- Platform? platform,
- String? repository,
- Map<
String, String> ? tags,
Creates a new Amplify app.
May throw BadRequestException. May throw UnauthorizedException. May throw InternalFailureException. May throw LimitExceededException. May throw DependentServiceFailureException.
Parameter name
:
The name for an Amplify app.
Parameter accessToken
:
The personal access token for a third-party source control system for an
Amplify app. The personal access token is used to create a webhook and a
read-only deploy key. The token is not stored.
Parameter autoBranchCreationConfig
:
The automated branch creation configuration for an Amplify app.
Parameter autoBranchCreationPatterns
:
The automated branch creation glob patterns for an Amplify app.
Parameter basicAuthCredentials
:
The credentials for basic authorization for an Amplify app.
Parameter buildSpec
:
The build specification (build spec) for an Amplify app.
Parameter customHeaders
:
The custom HTTP headers for an Amplify app.
Parameter customRules
:
The custom rewrite and redirect rules for an Amplify app.
Parameter description
:
The description for an Amplify app.
Parameter enableAutoBranchCreation
:
Enables automated branch creation for an Amplify app.
Parameter enableBasicAuth
:
Enables basic authorization for an Amplify app. This will apply to all
branches that are part of this app.
Parameter enableBranchAutoBuild
:
Enables the auto building of branches for an Amplify app.
Parameter enableBranchAutoDeletion
:
Automatically disconnects a branch in the Amplify Console when you delete
a branch from your Git repository.
Parameter environmentVariables
:
The environment variables map for an Amplify app.
Parameter iamServiceRoleArn
:
The AWS Identity and Access Management (IAM) service role for an Amplify
app.
Parameter oauthToken
:
The OAuth token for a third-party source control system for an Amplify
app. The OAuth token is used to create a webhook and a read-only deploy
key. The OAuth token is not stored.
Parameter platform
:
The platform or framework for an Amplify app.
Parameter repository
:
The repository for an Amplify app.
Parameter tags
:
The tag for an Amplify app.
Implementation
Future<CreateAppResult> createApp({
required String name,
String? accessToken,
AutoBranchCreationConfig? autoBranchCreationConfig,
List<String>? autoBranchCreationPatterns,
String? basicAuthCredentials,
String? buildSpec,
String? customHeaders,
List<CustomRule>? customRules,
String? description,
bool? enableAutoBranchCreation,
bool? enableBasicAuth,
bool? enableBranchAutoBuild,
bool? enableBranchAutoDeletion,
Map<String, String>? environmentVariables,
String? iamServiceRoleArn,
String? oauthToken,
Platform? platform,
String? repository,
Map<String, String>? tags,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
255,
isRequired: true,
);
_s.validateStringLength(
'accessToken',
accessToken,
1,
255,
);
_s.validateStringLength(
'basicAuthCredentials',
basicAuthCredentials,
0,
2000,
);
_s.validateStringLength(
'buildSpec',
buildSpec,
1,
25000,
);
_s.validateStringLength(
'customHeaders',
customHeaders,
1,
25000,
);
_s.validateStringLength(
'description',
description,
0,
1000,
);
_s.validateStringLength(
'iamServiceRoleArn',
iamServiceRoleArn,
1,
1000,
);
_s.validateStringLength(
'oauthToken',
oauthToken,
0,
1000,
);
_s.validateStringLength(
'repository',
repository,
0,
1000,
);
final $payload = <String, dynamic>{
'name': name,
if (accessToken != null) 'accessToken': accessToken,
if (autoBranchCreationConfig != null)
'autoBranchCreationConfig': autoBranchCreationConfig,
if (autoBranchCreationPatterns != null)
'autoBranchCreationPatterns': autoBranchCreationPatterns,
if (basicAuthCredentials != null)
'basicAuthCredentials': basicAuthCredentials,
if (buildSpec != null) 'buildSpec': buildSpec,
if (customHeaders != null) 'customHeaders': customHeaders,
if (customRules != null) 'customRules': customRules,
if (description != null) 'description': description,
if (enableAutoBranchCreation != null)
'enableAutoBranchCreation': enableAutoBranchCreation,
if (enableBasicAuth != null) 'enableBasicAuth': enableBasicAuth,
if (enableBranchAutoBuild != null)
'enableBranchAutoBuild': enableBranchAutoBuild,
if (enableBranchAutoDeletion != null)
'enableBranchAutoDeletion': enableBranchAutoDeletion,
if (environmentVariables != null)
'environmentVariables': environmentVariables,
if (iamServiceRoleArn != null) 'iamServiceRoleArn': iamServiceRoleArn,
if (oauthToken != null) 'oauthToken': oauthToken,
if (platform != null) 'platform': platform.toValue(),
if (repository != null) 'repository': repository,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/apps',
exceptionFnMap: _exceptionFns,
);
return CreateAppResult.fromJson(response);
}