agent/api/eni/eni.go
func ValidateTaskENI(acsenis []*ecsacs.ElasticNetworkInterface) error {
	// Only one eni should be associated with the task
	// Only one ipv4 should be associated with the eni
	// No more than one ipv6 should be associated with the eni
	if len(acsenis) != 1 {
		return errors.Errorf("eni message validation: more than one ENIs in the message(%d)", len(acsenis))
	} else if len(acsenis[0].Ipv4Addresses) != 1 {
		return errors.Errorf("eni message validation: more than one ipv4 addresses in the message(%d)", len(acsenis[0].Ipv4Addresses))
	} else if len(acsenis[0].Ipv6Addresses) > 1 {
		return errors.Errorf("eni message validation: more than one ipv6 addresses in the message(%d)", len(acsenis[0].Ipv6Addresses))
	}

	if acsenis[0].MacAddress == nil {
		return errors.Errorf("eni message validation: empty eni mac address in the message")
	}

	if acsenis[0].Ec2Id == nil {
		return errors.Errorf("eni message validation: empty eni id in the message")
	}

	return nil
}
func ValidateTaskENI(acsenis []*ecsacs.ElasticNetworkInterface) error {
	// Only one eni should be associated with the task
	// Only one ipv4 should be associated with the eni
	// No more than one ipv6 should be associated with the eni
	if len(acsenis) != 1 {
		return errors.Errorf("eni message validation: more than one ENIs in the message(%d)", len(acsenis))
	} else if len(acsenis[0].Ipv4Addresses) != 1 {
		return errors.Errorf("eni message validation: more than one ipv4 addresses in the message(%d)", len(acsenis[0].Ipv4Addresses))
	} else if len(acsenis[0].Ipv6Addresses) > 1 {
		return errors.Errorf("eni message validation: more than one ipv6 addresses in the message(%d)", len(acsenis[0].Ipv6Addresses))
	}

	if acsenis[0].MacAddress == nil {
		return errors.Errorf("eni message validation: empty eni mac address in the message")
	}

	if acsenis[0].Ec2Id == nil {
		return errors.Errorf("eni message validation: empty eni id in the message")
	}

	return nil
}
func ValidateTaskENI ( acsenis [ ] * ecsacs . ElasticNetworkInterface ) error { // Only one eni should be associated with the task // Only one ipv4 should be associated with the eni // No more than one ipv6 should be associated with the eni if len ( acsenis ) != 1 { return errors . Errorf ( " " , len ( acsenis ) ) } else if len ( acsenis [ 0 ] . Ipv4Addresses ) != 1 { return errors . Errorf ( " " , len ( acsenis [ 0 ] . Ipv4Addresses ) ) } else if len ( acsenis [ 0 ] . Ipv6Addresses ) > 1 { return errors . Errorf ( " " , len ( acsenis [ 0 ] . Ipv6Addresses ) ) } if acsenis [ 0 ] . MacAddress == nil { return errors . Errorf ( " " ) } if acsenis [ 0 ] . Ec2Id == nil { return errors . Errorf ( " " ) } return nil }
// ValidateTaskENI validates the eni informaiton sent from acs
ValidateTaskENI validates the eni informaiton sent from acs