def _add_domain_name()

in chalice/package.py [0:0]


    def _add_domain_name(self, resource, template):
        # type: (models.RestAPI, Dict[str, Any]) -> None
        if resource.domain_name is None:
            return
        domain_name = resource.domain_name
        endpoint_type = resource.endpoint_type
        cfn_name = to_cfn_resource_name(domain_name.resource_name)
        properties = {
            'DomainName': domain_name.domain_name,
            'EndpointConfiguration': {
                'Types': [endpoint_type],
            }
        }  # type: Dict[str, Any]
        if endpoint_type == 'EDGE':
            properties['CertificateArn'] = domain_name.certificate_arn
        else:
            properties['RegionalCertificateArn'] = domain_name.certificate_arn
        if domain_name.tls_version is not None:
            properties['SecurityPolicy'] = domain_name.tls_version.value
        if domain_name.tags:
            properties['Tags'] = [
                {'Key': key, 'Value': value}
                for key, value in sorted(domain_name.tags.items())
            ]
        template['Resources'][cfn_name] = {
            'Type': 'AWS::ApiGateway::DomainName',
            'Properties': properties
        }
        template['Resources'][cfn_name + 'Mapping'] = {
            'Type': 'AWS::ApiGateway::BasePathMapping',
            'Properties': {
                'DomainName': {'Ref': 'ApiGatewayCustomDomain'},
                'RestApiId': {'Ref': 'RestAPI'},
                'BasePath': domain_name.api_mapping.mount_path,
                'Stage': resource.api_gateway_stage,
            }
        }