updateDomainAssociation method
Creates a new domain association for an Amplify app.
May throw BadRequestException. May throw UnauthorizedException. May throw NotFoundException. May throw InternalFailureException. May throw DependentServiceFailureException.
Parameter appId
:
The unique ID for an Amplify app.
Parameter domainName
:
The name of the domain.
Parameter subDomainSettings
:
Describes the settings 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 enableAutoSubDomain
:
Enables the automated creation of subdomains for branches.
Implementation
Future<UpdateDomainAssociationResult> updateDomainAssociation({
required String appId,
required String domainName,
required List<SubDomainSetting> subDomainSettings,
List<String>? autoSubDomainCreationPatterns,
String? autoSubDomainIAMRole,
bool? enableAutoSubDomain,
}) async {
ArgumentError.checkNotNull(appId, 'appId');
_s.validateStringLength(
'appId',
appId,
1,
20,
isRequired: true,
);
ArgumentError.checkNotNull(domainName, 'domainName');
_s.validateStringLength(
'domainName',
domainName,
0,
255,
isRequired: true,
);
ArgumentError.checkNotNull(subDomainSettings, 'subDomainSettings');
_s.validateStringLength(
'autoSubDomainIAMRole',
autoSubDomainIAMRole,
0,
1000,
);
final $payload = <String, dynamic>{
'subDomainSettings': subDomainSettings,
if (autoSubDomainCreationPatterns != null)
'autoSubDomainCreationPatterns': autoSubDomainCreationPatterns,
if (autoSubDomainIAMRole != null)
'autoSubDomainIAMRole': autoSubDomainIAMRole,
if (enableAutoSubDomain != null)
'enableAutoSubDomain': enableAutoSubDomain,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/apps/${Uri.encodeComponent(appId)}/domains/${Uri.encodeComponent(domainName)}',
exceptionFnMap: _exceptionFns,
);
return UpdateDomainAssociationResult.fromJson(response);
}