def get_obj(self, name):
"""
Returns the AWS object associated with a given option.
The heuristics used are a bit lame. If the option name contains
the word 'bucket' it is assumed to be an S3 bucket, if the name
contains the word 'queue' it is assumed to be an SQS queue and
if it contains the word 'domain' it is assumed to be a SimpleDB
domain. If the option name specified does not exist in the
config file or if the AWS object cannot be retrieved this
returns None.
"""
val = self.get(name)
if not val:
return None
if name.find('queue') >= 0:
obj = boto.lookup('sqs', val)
if obj:
obj.set_message_class(ServiceMessage)
elif name.find('bucket') >= 0:
obj = boto.lookup('s3', val)
elif name.find('domain') >= 0:
obj = boto.lookup('sdb', val)
else:
obj = None
return obj
评论列表
文章目录