-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.py
executable file
·28 lines (22 loc) · 1.02 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
# example.py
# ==========
#
# This shows how to authenticate to HP Cloud's REST API with a user's access
# key ID and secret key instead of their username and password. This could be
# used to authenticate to any OpenStack implementation that also uses
# ``apiAccessKeyCredentials`` in the JSON body of the authentication request.
from novaclient.client import Client
ACCESS_KEY_ID = 'FIBVLEKFOSIFJS68FI8L'
SECRET_KEY = 'Mu8E/fsleibv8f2j7G97pzqKusive8ofieFkeNs1'
TENANT_NAME = '[email protected]'
AUTH_URL = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
REGION_NAME = 'az-3.region-a.geo-1'
nova = Client('2', 'dummyvalue', 'dummyvalue', TENANT_NAME,
auth_system='secretkey', auth_url=AUTH_URL, region_name=REGION_NAME)
# the constructor does not accept the plugin values, so the plugin just
# looks for them as attributes of the nova.client object
nova.client.os_access_key_id = ACCESS_KEY_ID
nova.client.os_secret_key = SECRET_KEY
nova.authenticate()
print nova.servers.list()