Better Implementation of troposphere API
@markpeek
The way you implement the AWS Resource Class is this, and it uses customized getattr, setattr method:
class Instance(AWSObject):
resource_type = "AWS::EC2::Instance"
props = {
'Affinity': (str, False),
'AvailabilityZone': (str, False),
'BlockDeviceMappings': (list, False),
'CreditSpecification': (CreditSpecification, False),
'DisableApiTermination': (boolean, False),
'EbsOptimized': (boolean, False),
By doing this, No IDLE can predict what properties the class has, in another word, auto hint and auto completion will not work.
If you look at sqlalchemy, attrs, marshmallow or WtfForm, you will see that you should use MetaClass to implement that, here's the example, then the IDLE can tell users about it.
class Instance(object):
Affinity = Property(...)
AvailabilityZone = Property(...)
Have you ever thinking of refactor it with the better design?
@markpeek
I write a library https://github.com/MacHu-GWU/troposphere_mate-project on top of troposphere, it provides 100% API Compatible with troposphere, but enables Auto-Properties Hint.
Appreciate your effort on this project, it is really a great project to save me big amount of time on cloudformation.