func (p *AWSProvider) newChange(action string, endpoint *endpoint.Endpoint, recordsCache []*endpoint.Endpoint, zones map[string]*route53.HostedZone) *route53.Change {
	change := &route53.Change{
		Action: aws.String(action),
		ResourceRecordSet: &route53.ResourceRecordSet{
			Name: aws.String(endpoint.DNSName),
		},
	}

	if isAWSLoadBalancer(endpoint) {
		evalTargetHealth := p.evaluateTargetHealth
		if prop, ok := endpoint.GetProviderSpecificProperty(providerSpecificEvaluateTargetHealth); ok {
			evalTargetHealth = prop.Value == "true"
		}

		change.ResourceRecordSet.Type = aws.String(route53.RRTypeA)
		change.ResourceRecordSet.AliasTarget = &route53.AliasTarget{
			DNSName:              aws.String(endpoint.Targets[0]),
			HostedZoneId:         aws.String(canonicalHostedZone(endpoint.Targets[0])),
			EvaluateTargetHealth: aws.Bool(evalTargetHealth),
		}
	} else if hostedZone := isAWSAlias(endpoint, recordsCache); hostedZone != "" {
		for _, zone := range zones {
			change.ResourceRecordSet.Type = aws.String(route53.RRTypeA)
			change.ResourceRecordSet.AliasTarget = &route53.AliasTarget{
				DNSName:              aws.String(endpoint.Targets[0]),
				HostedZoneId:         aws.String(cleanZoneID(*zone.Id)),
				EvaluateTargetHealth: aws.Bool(p.evaluateTargetHealth),
			}
		}
	} else {
		change.ResourceRecordSet.Type = aws.String(endpoint.RecordType)
		if !endpoint.RecordTTL.IsConfigured() {
			change.ResourceRecordSet.TTL = aws.Int64(recordTTL)
		} else {
			change.ResourceRecordSet.TTL = aws.Int64(int64(endpoint.RecordTTL))
		}
		change.ResourceRecordSet.ResourceRecords = make([]*route53.ResourceRecord, len(endpoint.Targets))
		for idx, val := range endpoint.Targets {
			change.ResourceRecordSet.ResourceRecords[idx] = &route53.ResourceRecord{
				Value: aws.String(val),
			}
		}
	}

	return change
}
func (p *AWSProvider) newChange(action string, endpoint *endpoint.Endpoint, recordsCache []*endpoint.Endpoint, zones map[string]*route53.HostedZone) *route53.Change {
	change := &route53.Change{
		Action: aws.String(action),
		ResourceRecordSet: &route53.ResourceRecordSet{
			Name: aws.String(endpoint.DNSName),
		},
	}

	if isAWSLoadBalancer(endpoint) {
		evalTargetHealth := p.evaluateTargetHealth
		if prop, ok := endpoint.GetProviderSpecificProperty(providerSpecificEvaluateTargetHealth); ok {
			evalTargetHealth = prop.Value == "true"
		}

		change.ResourceRecordSet.Type = aws.String(route53.RRTypeA)
		change.ResourceRecordSet.AliasTarget = &route53.AliasTarget{
			DNSName:              aws.String(endpoint.Targets[0]),
			HostedZoneId:         aws.String(canonicalHostedZone(endpoint.Targets[0])),
			EvaluateTargetHealth: aws.Bool(evalTargetHealth),
		}
	} else if hostedZone := isAWSAlias(endpoint, recordsCache); hostedZone != "" {
		for _, zone := range zones {
			change.ResourceRecordSet.Type = aws.String(route53.RRTypeA)
			change.ResourceRecordSet.AliasTarget = &route53.AliasTarget{
				DNSName:              aws.String(endpoint.Targets[0]),
				HostedZoneId:         aws.String(cleanZoneID(*zone.Id)),
				EvaluateTargetHealth: aws.Bool(p.evaluateTargetHealth),
			}
		}
	} else {
		change.ResourceRecordSet.Type = aws.String(endpoint.RecordType)
		if !endpoint.RecordTTL.IsConfigured() {
			change.ResourceRecordSet.TTL = aws.Int64(recordTTL)
		} else {
			change.ResourceRecordSet.TTL = aws.Int64(int64(endpoint.RecordTTL))
		}
		change.ResourceRecordSet.ResourceRecords = make([]*route53.ResourceRecord, len(endpoint.Targets))
		for idx, val := range endpoint.Targets {
			change.ResourceRecordSet.ResourceRecords[idx] = &route53.ResourceRecord{
				Value: aws.String(val),
			}
		}
	}

	return change
}
// newChange returns a Change of the given record by the given action, e.g.
// action=ChangeActionCreate returns a change for creation of the record and
// action=ChangeActionDelete returns a change for deletion of the record.