createRepositoryLink method

Future<CreateRepositoryLinkOutput> createRepositoryLink({
  1. required String connectionArn,
  2. required String ownerId,
  3. required String repositoryName,
  4. String? encryptionKeyArn,
  5. List<Tag>? tags,
})

Creates a link to a specified external Git repository. A repository link allows Git sync to monitor and sync changes to files in a specified Git repository.

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

Parameter connectionArn : The Amazon Resource Name (ARN) of the connection to be associated with the repository link.

Parameter ownerId : The owner ID for the repository associated with a specific sync configuration, such as the owner ID in GitHub.

Parameter repositoryName : The name of the repository to be associated with the repository link.

Parameter encryptionKeyArn : The Amazon Resource Name (ARN) encryption key for the repository to be associated with the repository link.

Parameter tags : The tags for the repository to be associated with the repository link.

Implementation

Future<CreateRepositoryLinkOutput> createRepositoryLink({
  required String connectionArn,
  required String ownerId,
  required String repositoryName,
  String? encryptionKeyArn,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'CodeStar_connections_20191201.CreateRepositoryLink'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConnectionArn': connectionArn,
      'OwnerId': ownerId,
      'RepositoryName': repositoryName,
      if (encryptionKeyArn != null) 'EncryptionKeyArn': encryptionKeyArn,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateRepositoryLinkOutput.fromJson(jsonResponse.body);
}