createPublicDnsNamespace method
Creates a public namespace based on DNS, which will be visible on the
internet. The namespace defines your service naming scheme. For example,
if you name your namespace example.com
and name your service
backend
, the resulting DNS name for the service will be
backend.example.com
. For the current quota on the number of
namespaces that you can create using the same AWS account, see AWS
Cloud Map Limits in the AWS Cloud Map Developer Guide.
May throw InvalidInput. May throw NamespaceAlreadyExists. May throw ResourceLimitExceeded. May throw DuplicateRequest. May throw TooManyTagsException.
Parameter name
:
The name that you want to assign to this namespace.
Parameter creatorRequestId
:
A unique string that identifies the request and that allows failed
CreatePublicDnsNamespace
requests to be retried without the
risk of executing the operation twice. CreatorRequestId
can
be any unique string, for example, a date/time stamp.
Parameter description
:
A description for the namespace.
Parameter tags
:
The tags to add to the namespace. Each tag consists of a key and an
optional value, both of which you define. Tag keys can have a maximum
character length of 128 characters, and tag values can have a maximum
length of 256 characters.
Implementation
Future<CreatePublicDnsNamespaceResponse> createPublicDnsNamespace({
required String name,
String? creatorRequestId,
String? description,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
0,
1024,
isRequired: true,
);
_s.validateStringLength(
'creatorRequestId',
creatorRequestId,
0,
64,
);
_s.validateStringLength(
'description',
description,
0,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Route53AutoNaming_v20170314.CreatePublicDnsNamespace'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'CreatorRequestId': creatorRequestId ?? _s.generateIdempotencyToken(),
if (description != null) 'Description': description,
if (tags != null) 'Tags': tags,
},
);
return CreatePublicDnsNamespaceResponse.fromJson(jsonResponse.body);
}