Remove outdated examples

The examples directory contained a lot of examples written for version
1.0.  The examples do not work with the latest version of the client, so
this CR removes them to avoid confusion.

Change-Id: Ie421bb2a28c73b4b7ce2236af19d86216112af05
This commit is contained in:
Douglas Mendizabal
2014-10-08 16:52:28 -05:00
parent 0966770a0e
commit a096e67401
9 changed files with 0 additions and 548 deletions

View File

View File

@@ -1,77 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
return connection
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for creating barbican order.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used for authentication'
)
parser.add_argument(
'--endpoint',
default=ENDPOINT,
help='The barbican endpoint to test against'
)
parser.add_argument(
'--name',
help='Name of secret'
)
parser.add_argument(
'--mime-type',
help='MIME type of secret to create'
)
parser.add_argument(
'--algorithm',
help='Algorithm of secret to create'
)
parser.add_argument(
'--bit-length',
help='Bit length of secret to create'
)
parser.add_argument(
'--cypher-type',
help='Cypher type of secret to create'
)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
conn = connect(args.username, args.password, args.tenant, args.endpoint)
order = conn.create_order(args.name,
args.mime_type,
args.algorithm,
args.bit_length,
args.cypher_type)
print order

View File

@@ -1,88 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
return connection
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for creating barbican secret.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used for authentication'
)
parser.add_argument(
'--endpoint',
default=ENDPOINT,
help='The barbican endpoint to test against'
)
parser.add_argument(
'--name',
help='Name of secret'
)
parser.add_argument(
'--mime-type',
help='MIME type of secret to create'
)
parser.add_argument(
'--algorithm',
help='Algorithm of secret to create'
)
parser.add_argument(
'--bit-length',
help='Bit length of secret to create'
)
parser.add_argument(
'--cypher-type',
help='Cypher type of secret to create'
)
parser.add_argument(
'--plain-text',
help='Plain text of the secret'
)
parser.add_argument(
'--expiration',
default=None,
help='Plain text of the secret'
)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
conn = connect(args.username, args.password, args.tenant, args.endpoint)
secret_ref = conn.create_secret(args.name,
args.mime_type,
args.algorithm,
args.bit_length,
args.cypher_type,
args.plain_text,
args.expiration)
print secret_ref

View File

@@ -1,65 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
return connection
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for deleting barbican order.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used for authentication'
)
parser.add_argument(
'--endpoint',
default=ENDPOINT,
help='The barbican endpoint to test against'
)
parser.add_argument(
'--order-id',
default=None,
help='ID of secret'
)
parser.add_argument(
'--order-href',
default=None,
help='href of secret'
)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
conn = connect(args.username, args.password, args.tenant, args.endpoint)
if args.order_id is not None:
conn.delete_order_by_id(args.order_id)
else:
conn.delete_order(args.order_href)

View File

@@ -1,65 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
return connection
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for deleting barbican secret.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used for authentication'
)
parser.add_argument(
'--endpoint',
default=ENDPOINT,
help='The barbican endpoint to test against'
)
parser.add_argument(
'--secret-id',
default=None,
help='ID of secret'
)
parser.add_argument(
'--secret-href',
default=None,
help='href of secret'
)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
conn = connect(args.username, args.password, args.tenant, args.endpoint)
if args.secret_id is not None:
conn.delete_secret_by_id(args.secret_id)
else:
conn.delete_secret(args.secret_href)

View File

@@ -1,66 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
return connection
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for getting a barbican order.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used for authentication'
)
parser.add_argument(
'--endpoint',
default=ENDPOINT,
help='The barbican endpoint to test against'
)
parser.add_argument(
'--order-id',
default=None,
help='ID of order'
)
parser.add_argument(
'--order-href',
default=None,
help='href of order'
)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
conn = connect(args.username, args.password, args.tenant, args.endpoint)
if args.order_id is not None:
order = conn.get_order_by_id(args.order_id)
else:
order = conn.get_order(args.order_href)
print order

View File

@@ -1,77 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def connect(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
return connection
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for getting a barbican secret.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used for authentication'
)
parser.add_argument(
'--endpoint',
default=ENDPOINT,
help='The barbican endpoint to test against'
)
parser.add_argument(
'--secret-id',
default=None,
help='ID of secret'
)
parser.add_argument(
'--secret-href',
default=None,
help='href of secret'
)
parser.add_argument(
'--mime-type',
default=None,
help='MIME of secret'
)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
conn = connect(args.username, args.password, args.tenant, args.endpoint)
if args.mime_type is not None:
if args.secret_id is not None:
s = conn.get_raw_secret_by_id(args.secret_id, args.mime_type)
else:
s = conn.get_raw_secret(args.secret_href, args.mime_type)
else:
if args.secret_id is not None:
s = conn.get_secret_by_id(args.secret_id)
else:
s = conn.get_secret(args.secret_href)
print s

View File

@@ -1,55 +0,0 @@
import argparse
from barbicanclient import client
IDENTITY = 'https://identity.api.rackspacecloud.com/v2.0'
ENDPOINT = 'https://barbican.api.rackspacecloud.com/v1/'
def list_orders(username, password, tenant, endpoint):
connection = client.Connection(IDENTITY,
username,
password,
tenant,
endpoint=endpoint)
orders = connection.list_orders()
print 'Current Orders ({0}):'.format(len(orders))
for order in orders:
print order
def parse_args():
parser = argparse.ArgumentParser(
description='Testing code for barbican secrets api resource.'
)
parser.add_argument(
'--username',
help='The keystone username used for authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used 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_orders(args.username, args.password, args.tenant, args.endpoint)

View File

@@ -1,55 +0,0 @@
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 ({0}):'.format(len(secrets))
for secret in secrets:
print 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 authentication'
)
parser.add_argument(
'--password',
help='The keystone password used for authentication'
)
parser.add_argument(
'--tenant',
help='The keystone tenant used for authentication'
)
parser.add_argument(
'--keystone',
default=IDENTITY,
help='The keystone endpoint used 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)