createDomain method
Creates a domain. CodeArtifact domains make it easier to manage multiple repositories across an organization. You can use a domain to apply permissions across many repositories owned by different Amazon Web Services accounts. An asset is stored only once in a domain, even if it's in multiple repositories.
Although you can have multiple domains, we recommend a single production domain that contains all published artifacts so that your development teams can find and share packages. You can use a second pre-production domain to test changes to the production domain configuration.
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 to create. All domain names in an Amazon Web
Services Region that are in the same Amazon Web Services account must be
unique. The domain name is used as the prefix in DNS hostnames. Do not use
sensitive information in a domain name because it is publicly
discoverable.
Parameter encryptionKey :
The encryption key for the domain. This is used to encrypt content stored
in a domain. An encryption key can be a key ID, a key Amazon Resource Name
(ARN), a key alias, or a key alias ARN. To specify an
encryptionKey, your IAM role must have
kms:DescribeKey and kms:CreateGrant permissions
on the encryption key that is used. For more information, see DescribeKey
in the Key Management Service API Reference and Key
Management Service API Permissions Reference in the Key Management
Service Developer Guide.
Parameter tags :
One or more tag key-value pairs for the domain.
Implementation
Future<CreateDomainResult> createDomain({
required String domain,
String? encryptionKey,
List<Tag>? tags,
}) async {
final $query = <String, List<String>>{
'domain': [domain],
};
final $payload = <String, dynamic>{
if (encryptionKey != null) 'encryptionKey': encryptionKey,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/domain',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return CreateDomainResult.fromJson(response);
}