createService method
Creates a service. A service is any software application that can run on instances containers, or serverless functions within an account or virtual private cloud (VPC).
For more information, see Services in the Amazon VPC Lattice User Guide.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter name :
The name of the service. The name must be unique within the account. The
valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as
the first or last character, or immediately after another hyphen.
Parameter authType :
The type of IAM policy.
-
NONE: The resource does not use an IAM policy. This is the default. -
AWS_IAM: The resource uses an IAM policy. When this type is used, auth is enabled and an auth policy is required.
Parameter certificateArn :
The Amazon Resource Name (ARN) of the certificate.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If you retry a request that completed
successfully using the same client token and parameters, the retry
succeeds without performing any actions. If the parameters aren't
identical, the retry fails.
Parameter customDomainName :
The custom domain name of the service.
Parameter tags :
The tags for the service.
Implementation
Future<CreateServiceResponse> createService({
required String name,
AuthType? authType,
String? certificateArn,
String? clientToken,
String? customDomainName,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'name': name,
if (authType != null) 'authType': authType.value,
if (certificateArn != null) 'certificateArn': certificateArn,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (customDomainName != null) 'customDomainName': customDomainName,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/services',
exceptionFnMap: _exceptionFns,
);
return CreateServiceResponse.fromJson(response);
}