Ejemplo n.º 1
0
 def __init__(self, username, apikey, projectid,
              auth_url='https://auth.api.rackspacecloud.com/v1.0'):
     self.backup_schedules = BackupScheduleManager(self)
     self.client = OpenStackClient(username, apikey, projectid, auth_url)
     self.flavors = FlavorManager(self)
     self.images = ImageManager(self)
     self.ipgroups = IPGroupManager(self)
     self.servers = ServerManager(self)
     self.zones = ZoneManager(self)
Ejemplo n.º 2
0
class OpenStack(object):
    """
    Top-level object to access the OpenStack Nova API.

    Create an instance with your creds::

        >>> os = OpenStack(USERNAME, API_KEY, PROJECT_ID, AUTH_URL)

    Then call methods on its managers::

        >>> os.servers.list()
        ...
        >>> os.flavors.list()
        ...

    &c.
    """

    def __init__(self, username, apikey, projectid,
            auth_url='https://auth.api.rackspacecloud.com/v1.0', timeout=None):
        self.backup_schedules = BackupScheduleManager(self)
        self.client = OpenStackClient(username, apikey, projectid, auth_url,
                timeout=timeout)
        self.flavors = FlavorManager(self)
        self.images = ImageManager(self)
        self.ipgroups = IPGroupManager(self)
        self.servers = ServerManager(self)
        self.zones = ZoneManager(self)
        self.accounts = AccountManager(self)

    def authenticate(self):
        """
        Authenticate against the server.

        Normally this is called automatically when you first access the API,
        but you can call this method to force authentication right now.

        Returns on success; raises :exc:`novaclient.Unauthorized` if the
        credentials are wrong.
        """
        self.client.authenticate()
Ejemplo n.º 3
0
def client():
    cl = OpenStackClient("username", "apikey", "project_id", "auth_test")
    cl.management_url = "http://example.com"
    cl.auth_token = "token"
    return cl