0

Method Signature: I have tried to change the implementation some different ways, but its not helping.

import troposphere.s3 as S3
class LifecycleConfiguration(AWSProperty):
props = {
    'Rules': ([LifecycleRule], True),
}

class LifecycleRule(AWSProperty):
props = {
    'ExpirationDate': (basestring, False),
    'ExpirationInDays': (positive_integer, False),
    'Id': (basestring, False),
    'Prefix': (basestring, False),
    'Status': (basestring, True),
    'Transition': (LifecycleRuleTransition, False),
}

Test Implimentation

myLifecycleConfiguration = S3.LifecycleConfiguration(title='myLifecycleConfiguration',
                                                 Rules=S3.LifecycleRule(title="check"))

Error Signature

TypeError: Rules is <class 'troposphere.s3.LifecycleRule'>, expected [<class 'troposphere.s3.LifecycleRule'>]
mtrw
  • 34,200
  • 7
  • 63
  • 71
Anup Singh
  • 313
  • 1
  • 5
  • 18

1 Answers1

1

That's normal, and the error message is telling you what the problem is : the 'Rules' property of a LifecycleConfiguration is expected to be a list of LifecycleRule objects (see in the code : 'Rules': ([LifecycleRule], True),)

But when you create your S3.LifecycleConfiguration, you feed the 'Rules' property with a single LifecycleRule object instead.

You shoud write:

    myLifecycleConfiguration = S3.LifecycleConfiguration(
      title='myLifecycleConfiguration',Rules=[S3.LifecycleRule(title="check")])
huelbois
  • 6,762
  • 1
  • 19
  • 21