How to attach a field to an entity programmatically? Is it possible to attach a field to an entity programmatically?

I want to create a new entity, say vehicle, which has radio buttons defined for the brand of the vehicle. I would like this field to not be able to be deleted or modified via the UI.
Yes, it is possible, the function is field_create_instance().
If the field was not created before, you will need to create it with field_create_field() first.