agent/api/eni/eni.go
func ENIFromACS(acsenis []*ecsacs.ElasticNetworkInterface) (*ENI, error) {
	err := ValidateTaskENI(acsenis)
	if err != nil {
		return nil, err
	}

	var ipv4 []*ENIIPV4Address
	var ipv6 []*ENIIPV6Address

	// Read ipv4 address information of the eni
	for _, ec2Ipv4 := range acsenis[0].Ipv4Addresses {
		ipv4 = append(ipv4, &ENIIPV4Address{
			Primary: aws.BoolValue(ec2Ipv4.Primary),
			Address: aws.StringValue(ec2Ipv4.PrivateAddress),
		})
	}

	// Read ipv6 address information of the eni
	for _, ec2Ipv6 := range acsenis[0].Ipv6Addresses {
		ipv6 = append(ipv6, &ENIIPV6Address{
			Address: aws.StringValue(ec2Ipv6.Address),
		})
	}

	eni := &ENI{
		ID:                       aws.StringValue(acsenis[0].Ec2Id),
		IPV4Addresses:            ipv4,
		IPV6Addresses:            ipv6,
		MacAddress:               aws.StringValue(acsenis[0].MacAddress),
		PrivateDNSName:           aws.StringValue(acsenis[0].PrivateDnsName),
		SubnetGatewayIPV4Address: aws.StringValue(acsenis[0].SubnetGatewayIpv4Address),
	}
	for _, nameserverIP := range acsenis[0].DomainNameServers {
		eni.DomainNameServers = append(eni.DomainNameServers, aws.StringValue(nameserverIP))
	}
	for _, nameserverDomain := range acsenis[0].DomainName {
		eni.DomainNameSearchList = append(eni.DomainNameSearchList, aws.StringValue(nameserverDomain))
	}

	return eni, nil
}
func ENIFromACS(acsenis []*ecsacs.ElasticNetworkInterface) (*ENI, error) {
	err := ValidateTaskENI(acsenis)
	if err != nil {
		return nil, err
	}

	var ipv4 []*ENIIPV4Address
	var ipv6 []*ENIIPV6Address

	// Read ipv4 address information of the eni
	for _, ec2Ipv4 := range acsenis[0].Ipv4Addresses {
		ipv4 = append(ipv4, &ENIIPV4Address{
			Primary: aws.BoolValue(ec2Ipv4.Primary),
			Address: aws.StringValue(ec2Ipv4.PrivateAddress),
		})
	}

	// Read ipv6 address information of the eni
	for _, ec2Ipv6 := range acsenis[0].Ipv6Addresses {
		ipv6 = append(ipv6, &ENIIPV6Address{
			Address: aws.StringValue(ec2Ipv6.Address),
		})
	}

	eni := &ENI{
		ID:                       aws.StringValue(acsenis[0].Ec2Id),
		IPV4Addresses:            ipv4,
		IPV6Addresses:            ipv6,
		MacAddress:               aws.StringValue(acsenis[0].MacAddress),
		PrivateDNSName:           aws.StringValue(acsenis[0].PrivateDnsName),
		SubnetGatewayIPV4Address: aws.StringValue(acsenis[0].SubnetGatewayIpv4Address),
	}
	for _, nameserverIP := range acsenis[0].DomainNameServers {
		eni.DomainNameServers = append(eni.DomainNameServers, aws.StringValue(nameserverIP))
	}
	for _, nameserverDomain := range acsenis[0].DomainName {
		eni.DomainNameSearchList = append(eni.DomainNameSearchList, aws.StringValue(nameserverDomain))
	}

	return eni, nil
}
// ENIFromACS validates the information from acs message and create the ENI object