pyrax
Python Bindings for the Rackspace Cloud
|
This class handles all of the authentication requirements for working with the Rackspace Cloud. More...
Public Member Functions | |
def | set_credentials |
Sets the username and password directly. | |
def | authenticate |
If the user's credentials include an API key, the default behavior will work. | |
def | auth_with_token |
If a valid token is already known, this call will use it to generate the service catalog. | |
def | get_client |
Returns the client object for the specified service and region. | |
def | find_user_by_name |
Returns a User object by searching for the supplied user name. | |
def | find_user_by_email |
Returns a User object by searching for the supplied user's email address. | |
def | find_user_by_id |
Returns a User object by searching for the supplied user ID. | |
def | get_user |
Returns the user specified by either ID, username or email. | |
def | update_user |
Allows you to update settings for a given user. | |
def | reset_api_key |
Resets the API key for the specified user, or if no user is specified, for the current user. | |
Public Attributes | |
username | |
password | |
api_key | |
authenticated |
This class handles all of the authentication requirements for working with the Rackspace Cloud.
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.
def authenticate | ( | self, | |
username = None , |
|||
password = None , |
|||
api_key = None , |
|||
tenant_id = None , |
|||
connect = False |
|||
) |
If the user's credentials include an API key, the default behavior will work.
But if they are using a password, the initial attempt will fail, so try again, but this time using the standard password format.
The 'connect' parameter is retained for backwards compatibility. It no longer has any effect.
def find_user_by_email | ( | self, | |
) |
Returns a User object by searching for the supplied user's email address.
Returns None if there is no match for the given ID.
def find_user_by_id | ( | self, | |
uid | |||
) |
Returns a User object by searching for the supplied user ID.
Returns None if there is no match for the given ID.
def find_user_by_name | ( | self, | |
name | |||
) |
Returns a User object by searching for the supplied user name.
Returns None if there is no match for the given name.
def get_client | ( | self, | |
service, | |||
region, | |||
public = True , |
|||
cached = True |
|||
) |
Returns the client object for the specified service and region.
By default the public endpoint is used. If you wish to work with a services internal endpoints, specify `public=False`.
By default, if a client has already been created for the given service, region, and public values, that will be returned. To force a new client to be created, pass 'cached=False'.
def get_user | ( | self, | |
user_id = None , |
|||
username = None , |
|||
email = None |
|||
) |
Returns the user specified by either ID, username or email.
Since more than user can have the same email address, searching by that term will return a list of 1 or more User objects. Searching by username or ID will return a single User.
If a user_id that doesn't belong to the current account is searched for, a Forbidden exception is raised. When searching by username or email, a NotFound exception is raised if there is no matching user.
def reset_api_key | ( | self, | |
user = None |
|||
) |
Resets the API key for the specified user, or if no user is specified, for the current user.
Returns the newly-created API key.
Resetting an API key does not invalidate any authenticated sessions, nor does it revoke any tokens.
def set_credentials | ( | self, | |
username, | |||
password = None , |
|||
region = None , |
|||
tenant_id = None , |
|||
authenticate = False |
|||
) |
Sets the username and password directly.
Because Rackspace auth uses the api_key, make sure that any old values are cleared.
def update_user | ( | self, | |
user, | |||
email = None , |
|||
username = None , |
|||
uid = None , |
|||
defaultRegion = None , |
|||
enabled = None |
|||
) |
Allows you to update settings for a given user.