I am trying to write a function that will print the values of a object but only those values that are defined in a list.
import boto.ec2.cloudwatch
conn = boto.ec2.cloudwatch.connect_to_region('ap-southeast-1')
alarms = conn.describe_alarms()
for alarm in alarms:
print alarm.name
this will return a particular value for all alarms. How ever I want to make it work in such a way that I am able to print all the values that are defined in a list. Here is what I am trying to do
import boto.ec2.cloudwatch
conn = boto.ec2.cloudwatch.connect_to_region('ap-southeast-1')
alarms = conn.describe_alarms()
whitelist = ["name", "metric", "namespace"]
for alarm in alarms:
print alarm.whitelist[0]
However this wont works of course. Any suggestion about what will be the best way to do that? SO that I am able to print everything that is defined in a whitelist.