Skip to content

Instantly share code, notes, and snippets.

@dmendiza
Created January 24, 2014 21:42
Show Gist options
  • Save dmendiza/8607196 to your computer and use it in GitHub Desktop.
Save dmendiza/8607196 to your computer and use it in GitHub Desktop.
python-barbicanclient authentication with Rackspace Identity
from barbicanclient.common import auth
from barbicanclient import client
# using username and password
rack_auth = auth.RackspaceAuthV2(auth_url='http://identity.rackspace...',
username='username',
password='password')
# alternatively you can use an api-key instead of a password
rack_auth = auth.RackspaceAuthV2(auth_url='http://identity.rackspace...',
username='username',
api_key='api-key')
# now instantiate the client, this will authenticate and
# retrieve the barbican endpoint from the catalog
barbican = client.Client(auth_plugin=rack_auth)
# alternatively, you can specify the barbican endpoint
barbican = client.Client(auth_plugin=rack_auth, endpoint='htttp://barbican.rackspace...')
# now you can use the client to start the verification process
barbican.verifications.create(resource_ref='server_id', resource_type='image', resource_action='vm_attach')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment