Created
January 24, 2014 21:42
-
-
Save dmendiza/8607196 to your computer and use it in GitHub Desktop.
python-barbicanclient authentication with Rackspace Identity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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