createSyncConfiguration method

Future<CreateSyncConfigurationOutput> createSyncConfiguration({
  1. required String branch,
  2. required String configFile,
  3. required String repositoryLinkId,
  4. required String resourceName,
  5. required String roleArn,
  6. required SyncConfigurationType syncType,
  7. PublishDeploymentStatus? publishDeploymentStatus,
  8. TriggerResourceUpdateOn? triggerResourceUpdateOn,
})

Creates a sync configuration which allows Amazon Web Services to sync content from a Git repository to update a specified Amazon Web Services resource. Parameters for the sync configuration are determined by the sync type.

May throw AccessDeniedException. May throw ConcurrentModificationException. May throw InternalServerException. May throw InvalidInputException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ThrottlingException.

Parameter branch : The branch in the repository from which changes will be synced.

Parameter configFile : The file name of the configuration file that manages syncing between the connection and the repository. This configuration file is stored in the repository.

Parameter repositoryLinkId : The ID of the repository link created for the connection. A repository link allows Git sync to monitor and sync changes to files in a specified Git repository.

Parameter resourceName : The name of the Amazon Web Services resource (for example, a CloudFormation stack in the case of CFN_STACK_SYNC) that will be synchronized from the linked repository.

Parameter roleArn : The ARN of the IAM role that grants permission for Amazon Web Services to use Git sync to update a given Amazon Web Services resource on your behalf.

Parameter syncType : The type of sync configuration.

Parameter publishDeploymentStatus : Whether to enable or disable publishing of deployment status to source providers.

Parameter triggerResourceUpdateOn : When to trigger Git sync to begin the stack update.

Implementation

Future<CreateSyncConfigurationOutput> createSyncConfiguration({
  required String branch,
  required String configFile,
  required String repositoryLinkId,
  required String resourceName,
  required String roleArn,
  required SyncConfigurationType syncType,
  PublishDeploymentStatus? publishDeploymentStatus,
  TriggerResourceUpdateOn? triggerResourceUpdateOn,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'CodeStar_connections_20191201.CreateSyncConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Branch': branch,
      'ConfigFile': configFile,
      'RepositoryLinkId': repositoryLinkId,
      'ResourceName': resourceName,
      'RoleArn': roleArn,
      'SyncType': syncType.value,
      if (publishDeploymentStatus != null)
        'PublishDeploymentStatus': publishDeploymentStatus.value,
      if (triggerResourceUpdateOn != null)
        'TriggerResourceUpdateOn': triggerResourceUpdateOn.value,
    },
  );

  return CreateSyncConfigurationOutput.fromJson(jsonResponse.body);
}