createDomainAssociation method
Creates a new domain association for an Amplify app. This action associates a custom domain with the Amplify app
May throw BadRequestException.
May throw DependentServiceFailureException.
May throw InternalFailureException.
May throw LimitExceededException.
May throw NotFoundException.
May throw UnauthorizedException.
Parameter appId :
The unique ID for an Amplify app.
Parameter domainName :
The domain name for the domain association.
Parameter subDomainSettings :
The setting for the subdomain.
Parameter autoSubDomainCreationPatterns :
Sets the branch patterns for automatic subdomain creation.
Parameter autoSubDomainIAMRole :
The required AWS Identity and Access Management (IAM) service role for the
Amazon Resource Name (ARN) for automatically creating subdomains.
Parameter certificateSettings :
The type of SSL/TLS certificate to use for your custom domain. If you
don't specify a certificate type, Amplify uses the default certificate
that it provisions and manages for you.
Parameter enableAutoSubDomain :
Enables the automated creation of subdomains for branches.
Implementation
Future<CreateDomainAssociationResult> createDomainAssociation({
required String appId,
required String domainName,
required List<SubDomainSetting> subDomainSettings,
List<String>? autoSubDomainCreationPatterns,
String? autoSubDomainIAMRole,
CertificateSettings? certificateSettings,
bool? enableAutoSubDomain,
}) async {
final $payload = <String, dynamic>{
'domainName': domainName,
'subDomainSettings': subDomainSettings,
if (autoSubDomainCreationPatterns != null)
'autoSubDomainCreationPatterns': autoSubDomainCreationPatterns,
if (autoSubDomainIAMRole != null)
'autoSubDomainIAMRole': autoSubDomainIAMRole,
if (certificateSettings != null)
'certificateSettings': certificateSettings,
if (enableAutoSubDomain != null)
'enableAutoSubDomain': enableAutoSubDomain,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/apps/${Uri.encodeComponent(appId)}/domains',
exceptionFnMap: _exceptionFns,
);
return CreateDomainAssociationResult.fromJson(response);
}