Files
python-barbicanclient/examples/secrets.py
Jarret Raim 8be384c292 List Secrets
Added in iso8601 dependency for timeutils
2013-05-21 08:45:27 -05:00

34 lines
1.3 KiB
Python

import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def list_secrets(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY, username, password, tenant, endpoint=endpoint)
secrets = connection.list_secrets()
print 'Current Secrets (%d):' % (len(secrets))
for secret in secrets:
print '- %s' % secret
def parse_args():
parser = argparse.ArgumentParser(description='Testing code for barbican secrets api resource.')
parser.add_argument('--username', help='The keystone username used for for authentication')
parser.add_argument('--password', help='The keystone password used for for authentication')
parser.add_argument('--tenant', help='The keystone tenant used for for authentication')
parser.add_argument('--keystone', default=IDENTITY,
help='The keystone endpoint used for for authentication')
parser.add_argument('--endpoint', default=ENDPOINT,
help='The barbican endpoint to test against')
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
list_secrets(args.username, args.password, args.tenant, args.endpoint)