diff --git a/examples/__init__.py b/examples/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/create_order.py b/examples/create_order.py deleted file mode 100644 index ee774f0f..00000000 --- a/examples/create_order.py +++ /dev/null @@ -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 diff --git a/examples/create_secret.py b/examples/create_secret.py deleted file mode 100644 index 9df92820..00000000 --- a/examples/create_secret.py +++ /dev/null @@ -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 diff --git a/examples/delete_order.py b/examples/delete_order.py deleted file mode 100644 index c2569f2b..00000000 --- a/examples/delete_order.py +++ /dev/null @@ -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) diff --git a/examples/delete_secret.py b/examples/delete_secret.py deleted file mode 100644 index 6582d90d..00000000 --- a/examples/delete_secret.py +++ /dev/null @@ -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) diff --git a/examples/get_order.py b/examples/get_order.py deleted file mode 100644 index dea72813..00000000 --- a/examples/get_order.py +++ /dev/null @@ -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 diff --git a/examples/get_secret.py b/examples/get_secret.py deleted file mode 100644 index 65698b55..00000000 --- a/examples/get_secret.py +++ /dev/null @@ -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 diff --git a/examples/list_orders.py b/examples/list_orders.py deleted file mode 100644 index f1531f83..00000000 --- a/examples/list_orders.py +++ /dev/null @@ -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) diff --git a/examples/list_secrets.py b/examples/list_secrets.py deleted file mode 100644 index a43e3f3b..00000000 --- a/examples/list_secrets.py +++ /dev/null @@ -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)