updateApp method

Future<UpdateAppResult> updateApp({
  1. required String appId,
  2. String? accessToken,
  3. AutoBranchCreationConfig? autoBranchCreationConfig,
  4. List<String>? autoBranchCreationPatterns,
  5. String? basicAuthCredentials,
  6. String? buildSpec,
  7. String? customHeaders,
  8. List<CustomRule>? customRules,
  9. String? description,
  10. bool? enableAutoBranchCreation,
  11. bool? enableBasicAuth,
  12. bool? enableBranchAutoBuild,
  13. bool? enableBranchAutoDeletion,
  14. Map<String, String>? environmentVariables,
  15. String? iamServiceRoleArn,
  16. String? name,
  17. String? oauthToken,
  18. Platform? platform,
  19. String? repository,
})

Updates an existing Amplify app.

May throw BadRequestException. May throw NotFoundException. May throw UnauthorizedException. May throw InternalFailureException.

Parameter appId : The unique ID for an Amplify app.

Parameter accessToken : The personal access token for a third-party source control system for an Amplify app. The token is used to create 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 : Describes the automated branch creation glob patterns for an Amplify app.

Parameter basicAuthCredentials : The basic authorization credentials 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 redirect and rewrite 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.

Parameter enableBranchAutoBuild : Enables branch auto-building 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 for an Amplify app.

Parameter iamServiceRoleArn : The AWS Identity and Access Management (IAM) service role for an Amplify app.

Parameter name : The name for an Amplify app.

Parameter oauthToken : The OAuth token for a third-party source control system for an Amplify app. The token is used to create a webhook and a read-only deploy key. The OAuth token is not stored.

Parameter platform : The platform for an Amplify app.

Parameter repository : The name of the repository for an Amplify app

Implementation

Future<UpdateAppResult> updateApp({
  required String appId,
  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? name,
  String? oauthToken,
  Platform? platform,
  String? repository,
}) async {
  ArgumentError.checkNotNull(appId, 'appId');
  _s.validateStringLength(
    'appId',
    appId,
    1,
    20,
    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(
    'name',
    name,
    1,
    255,
  );
  _s.validateStringLength(
    'oauthToken',
    oauthToken,
    0,
    1000,
  );
  _s.validateStringLength(
    'repository',
    repository,
    0,
    1000,
  );
  final $payload = <String, dynamic>{
    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 (name != null) 'name': name,
    if (oauthToken != null) 'oauthToken': oauthToken,
    if (platform != null) 'platform': platform.toValue(),
    if (repository != null) 'repository': repository,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/apps/${Uri.encodeComponent(appId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAppResult.fromJson(response);
}