createRepository method

Future<CreateRepositoryOutput> createRepository({
  1. required String connectionArn,
  2. required String name,
  3. required RepositoryProvider provider,
  4. String? encryptionKey,
  5. List<Tag>? tags,
})

Create and register a link to a repository. Proton uses the link to repeatedly access the repository, to either push to it (self-managed provisioning) or pull from it (template sync). You can share a linked repository across multiple resources (like environments using self-managed provisioning, or synced templates). When you create a repository link, Proton creates a service-linked role for you.

For more information, see Self-managed provisioning, Template bundles, and 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 connectionArn : The Amazon Resource Name (ARN) of your AWS CodeStar connection that connects Proton to your repository provider account. For more information, see Setting up for Proton in the Proton User Guide.

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

Parameter provider : The repository provider.

Parameter encryptionKey : The ARN of your customer Amazon Web Services Key Management Service (Amazon Web Services KMS) key.

Parameter tags : An optional list of metadata items that you can associate with the Proton repository. A tag is a key-value pair.

For more information, see Proton resources and tagging in the Proton User Guide.

Implementation

Future<CreateRepositoryOutput> createRepository({
  required String connectionArn,
  required String name,
  required RepositoryProvider provider,
  String? encryptionKey,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AwsProton20200720.CreateRepository'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'connectionArn': connectionArn,
      'name': name,
      'provider': provider.value,
      if (encryptionKey != null) 'encryptionKey': encryptionKey,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateRepositoryOutput.fromJson(jsonResponse.body);
}