createTemplateSyncConfig method

Future<CreateTemplateSyncConfigOutput> createTemplateSyncConfig({
  1. required String branch,
  2. required String repositoryName,
  3. required RepositoryProvider repositoryProvider,
  4. required String templateName,
  5. required TemplateType templateType,
  6. String? subdirectory,
})

Set up a template to create new template versions automatically by tracking a linked repository. A linked repository is a repository that has been registered with Proton. For more information, see CreateRepository.

When a commit is pushed to your linked repository, Proton checks for changes to your repository template bundles. If it detects a template bundle change, a new major or minor version of its template is created, if the version doesn’t already exist. For more information, see Template sync configurations in the Proton User Guide.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter branch : The repository branch for your template.

Parameter repositoryName : The repository name (for example, myrepos/myrepo).

Parameter repositoryProvider : The provider type for your repository.

Parameter templateName : The name of your registered template.

Parameter templateType : The type of the registered template.

Parameter subdirectory : A repository subdirectory path to your template bundle directory. When included, Proton limits the template bundle search to this repository directory.

Implementation

Future<CreateTemplateSyncConfigOutput> createTemplateSyncConfig({
  required String branch,
  required String repositoryName,
  required RepositoryProvider repositoryProvider,
  required String templateName,
  required TemplateType templateType,
  String? subdirectory,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AwsProton20200720.CreateTemplateSyncConfig'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'branch': branch,
      'repositoryName': repositoryName,
      'repositoryProvider': repositoryProvider.value,
      'templateName': templateName,
      'templateType': templateType.value,
      if (subdirectory != null) 'subdirectory': subdirectory,
    },
  );

  return CreateTemplateSyncConfigOutput.fromJson(jsonResponse.body);
}