createRepository method

Future<CreateRepositoryResult> createRepository({
  1. required String domain,
  2. required String repository,
  3. String? description,
  4. String? domainOwner,
  5. List<Tag>? tags,
  6. List<UpstreamRepository>? upstreams,
})

Creates a repository.

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

Parameter domain : The name of the domain that contains the created repository.

Parameter repository : The name of the repository to create.

Parameter description : A description of the created repository.

Parameter domainOwner : The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

Parameter tags : One or more tag key-value pairs for the repository.

Parameter upstreams : A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when CodeArtifact looks for a requested package version. For more information, see Working with upstream repositories.

Implementation

Future<CreateRepositoryResult> createRepository({
  required String domain,
  required String repository,
  String? description,
  String? domainOwner,
  List<Tag>? tags,
  List<UpstreamRepository>? upstreams,
}) async {
  final $query = <String, List<String>>{
    'domain': [domain],
    'repository': [repository],
    if (domainOwner != null) 'domain-owner': [domainOwner],
  };
  final $payload = <String, dynamic>{
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
    if (upstreams != null) 'upstreams': upstreams,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/repository',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return CreateRepositoryResult.fromJson(response);
}