pyrax
Python Bindings for the Rackspace Cloud
|
This class handles all of the basic authentication requirements for working with an OpenStack Cloud system. More...
Public Member Functions | |
def | __init__ |
def | auth_token |
Simple alias to self.token. | |
def | auth_endpoint |
Abstracts out the logic for connecting to different auth endpoints. | |
def | set_credentials |
Sets the username and password directly. | |
def | set_credential_file |
Reads in the credentials from the supplied file. | |
def | auth_with_token |
If a valid token is already known, this call will use it to generate the service catalog. | |
def | method_get |
def | method_head |
def | method_post |
def | method_put |
def | method_delete |
def | authenticate |
Using the supplied credentials, connects to the specified authentication endpoint and attempts to log in. | |
def | unauthenticate |
Clears all authentication information. | |
def | get_extensions |
Returns a list of extensions enabled on this service. | |
def | get_token |
Returns the auth token, if it is valid. | |
def | list_tokens |
ADMIN ONLY. | |
def | check_token |
ADMIN ONLY. | |
def | get_token_endpoints |
ADMIN ONLY. | |
def | list_users |
ADMIN ONLY. | |
def | create_user |
ADMIN ONLY. | |
def | update_user |
ADMIN ONLY. | |
def | delete_user |
ADMIN ONLY. | |
def | list_roles_for_user |
ADMIN ONLY. | |
def | get_tenant |
Returns the tenant for the current user. | |
def | list_tenants |
ADMIN ONLY. | |
def | create_tenant |
ADMIN ONLY. | |
def | update_tenant |
ADMIN ONLY. | |
def | delete_tenant |
ADMIN ONLY. | |
Public Attributes | |
username | |
password | |
token | |
region | |
services | |
regions | |
tenant_id | |
tenant_name | |
expires | |
user | |
Static Public Attributes | |
string | username = "" |
string | password = "" |
string | token = "" |
string | expires = "" |
string | tenant_id = "" |
string | tenant_name = "" |
authenticated = False | |
string | user_agent = "pyrax" |
http_log_debug = False |
This class handles all of the basic authentication requirements for working with an OpenStack Cloud system.
def __init__ | ( | self, | |
username = None , |
|||
password = None , |
|||
token = None , |
|||
credential_file = None , |
|||
region = None , |
|||
timeout = None |
|||
) |
def auth_endpoint | ( | self | ) |
Abstracts out the logic for connecting to different auth endpoints.
def auth_token | ( | self | ) |
Simple alias to self.token.
def auth_with_token | ( | self, | |
token, | |||
tenant_id = None , |
|||
tenant_name = None |
|||
) |
If a valid token is already known, this call will use it to generate the service catalog.
Reimplemented in RaxIdentity.
def authenticate | ( | self | ) |
Using the supplied credentials, connects to the specified authentication endpoint and attempts to log in.
If successful, records the token information.
def check_token | ( | self, | |
token = None |
|||
) |
ADMIN ONLY.
Returns True or False, depending on whether the current token is valid.
def create_tenant | ( | self, | |
name, | |||
description = None , |
|||
enabled = True |
|||
) |
ADMIN ONLY.
Creates a new tenant.
def create_user | ( | self, | |
name, | |||
email, | |||
password = None , |
|||
enabled = True |
|||
) |
ADMIN ONLY.
Creates a new user for this tenant (account). The username and email address must be supplied. You may optionally supply the password for this user; if not, the API server will generate a password and return it in the 'password' attribute of the resulting User object. NOTE: this is the ONLY time the password will be returned; after the initial user creation, there is NO WAY to retrieve the user's password.
You may also specify that the user should be created but not active by passing False to the enabled parameter.
def delete_tenant | ( | self, | |
tenant | |||
) |
ADMIN ONLY.
Removes the tenant from the system. There is no 'undo' available, so you should be certain that the tenant specified is the tenant you wish to delete.
def delete_user | ( | self, | |
user | |||
) |
ADMIN ONLY.
Removes the user from the system. There is no 'undo' available, so you should be certain that the user specified is the user you wish to delete.
def get_extensions | ( | self | ) |
Returns a list of extensions enabled on this service.
def get_tenant | ( | self | ) |
Returns the tenant for the current user.
def get_token | ( | self, | |
force = False |
|||
) |
Returns the auth token, if it is valid.
If not, calls the auth endpoint to get a new token. Passing 'True' to 'force' will force a call for a new token, even if there already is a valid token.
def get_token_endpoints | ( | self | ) |
ADMIN ONLY.
Returns a list of all endpoints for the current auth token.
def list_roles_for_user | ( | self, | |
user | |||
) |
ADMIN ONLY.
Returns a list of roles for the specified user. Each role will be a 3-tuple, consisting of (role_id, role_name, role_description).
def list_tenants | ( | self | ) |
ADMIN ONLY.
Returns a list of all tenants.
def list_tokens | ( | self | ) |
ADMIN ONLY.
Returns a dict containing tokens, endpoints, user info, and role metadata.
def list_users | ( | self | ) |
ADMIN ONLY.
Returns a list of objects for all users for the tenant (account) if this request is issued by a user holding the admin role (identity:user-admin).
def method_delete | ( | self, | |
uri, | |||
admin = False , |
|||
data = None , |
|||
headers = None , |
|||
std_headers = True |
|||
) |
def method_get | ( | self, | |
uri, | |||
admin = False , |
|||
data = None , |
|||
headers = None , |
|||
std_headers = True |
|||
) |
def method_head | ( | self, | |
uri, | |||
admin = False , |
|||
data = None , |
|||
headers = None , |
|||
std_headers = True |
|||
) |
def method_post | ( | self, | |
uri, | |||
admin = False , |
|||
data = None , |
|||
headers = None , |
|||
std_headers = True |
|||
) |
def method_put | ( | self, | |
uri, | |||
admin = False , |
|||
data = None , |
|||
headers = None , |
|||
std_headers = True |
|||
) |
def set_credential_file | ( | self, | |
credential_file, | |||
region = None , |
|||
tenant_id = tenant_id , |
|||
authenticate = False |
|||
) |
Reads in the credentials from the supplied file.
It should be a standard config file in the format:
[keystone] username = myusername password = top_secret tenant_id = my_id
def set_credentials | ( | self, | |
username, | |||
password = None , |
|||
region = None , |
|||
tenant_id = None , |
|||
authenticate = False |
|||
) |
Sets the username and password directly.
def unauthenticate | ( | self | ) |
Clears all authentication information.
def update_tenant | ( | self, | |
tenant, | |||
name = None , |
|||
description = None , |
|||
enabled = True |
|||
) |
ADMIN ONLY.
Updates an existing tenant.
def update_user | ( | self, | |
user, | |||
email = None , |
|||
username = None , |
|||
uid = None , |
|||
enabled = None |
|||
) |
ADMIN ONLY.
Updates the user attributes with the supplied values.
authenticated = False [static] |
Reimplemented in RaxIdentity.
string expires = "" [static] |
http_log_debug = False [static] |
string password = "" [static] |
Reimplemented in RaxIdentity.
Reimplemented in RaxIdentity.
string tenant_id = "" [static] |
string tenant_name = "" [static] |
string token = "" [static] |
string user_agent = "pyrax" [static] |
string username = "" [static] |
Reimplemented in RaxIdentity.
Reimplemented in RaxIdentity.