agent/acs/handler/refresh_credentials_handler.go
func validateIAMRoleCredentialsMessage(message *ecsacs.IAMRoleCredentialsMessage) error {
	if message == nil {
		return fmt.Errorf("empty credentials message")
	}

	messageId := aws.StringValue(message.MessageId)
	if messageId == "" {
		return fmt.Errorf("message id not set in credentials message")
	}

	if aws.StringValue(message.TaskArn) == "" {
		return fmt.Errorf("task Arn not set in credentials message")
	}

	if message.RoleCredentials == nil {
		return fmt.Errorf("role Credentials not set in credentials message: messageId: %s", messageId)
	}

	if aws.StringValue(message.RoleCredentials.CredentialsId) == "" {
		return fmt.Errorf("role Credentials ID not set in credentials message: messageId: %s", messageId)
	}

	return nil
}
func validateIAMRoleCredentialsMessage(message *ecsacs.IAMRoleCredentialsMessage) error {
	if message == nil {
		return fmt.Errorf("empty credentials message")
	}

	messageId := aws.StringValue(message.MessageId)
	if messageId == "" {
		return fmt.Errorf("message id not set in credentials message")
	}

	if aws.StringValue(message.TaskArn) == "" {
		return fmt.Errorf("task Arn not set in credentials message")
	}

	if message.RoleCredentials == nil {
		return fmt.Errorf("role Credentials not set in credentials message: messageId: %s", messageId)
	}

	if aws.StringValue(message.RoleCredentials.CredentialsId) == "" {
		return fmt.Errorf("role Credentials ID not set in credentials message: messageId: %s", messageId)
	}

	return nil
}
// validateIAMRoleCredentialsMessage validates fields in the IAMRoleCredentialsMessage
// It returns an error if any of the following fields are not set in the message:
// messageId, taskArn, roleCredentials