Example #1
0
 def list_access(self, instance, username, hostname=None):
     """Show all databases the given user has access to. """
     instance_id = base.getid(instance)
     user = quote_user_host(username, hostname)
     url = "/instances/%(instance_id)s/users/%(user)s/databases"
     local_vars = locals()
     resp, body = self.api.client.get(url % local_vars)
     check_for_exceptions(resp, body)
     if not body:
         raise Exception("Call to %s did not return to a body" % url)
     return [databases.Database(self, db) for db in body['databases']]
Example #2
0
def data(TEST):
    cluster1 = clusters.Cluster(clusters.Clusters(None), CLUSTER_DATA_ONE)
    cluster2 = clusters.Cluster(clusters.Clusters(None), CLUSTER_DATA_TWO)
    database1 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_ONE)
    database2 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_TWO)
    bkup1 = backups.Backup(backups.Backups(None), BACKUP_ONE)
    bkup2 = backups.Backup(backups.Backups(None), BACKUP_TWO)
    bkup3 = backups.Backup(backups.Backups(None), BACKUP_TWO_INC)
    user1 = users.User(users.Users(None), USER_ONE)
    user_db1 = databases.Database(databases.Databases(None), USER_DB_ONE)

    datastore1 = datastores.Datastore(datastores.Datastores(None),
                                      DATASTORE_ONE)
    version1 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_ONE)

    flavor1 = flavors.Flavor(flavors.Flavors(None), FLAVOR_ONE)
    flavor2 = flavors.Flavor(flavors.Flavors(None), FLAVOR_TWO)
    flavor3 = flavors.Flavor(flavors.Flavors(None), FLAVOR_THREE)
    datastore_mongodb = datastores.Datastore(datastores.Datastores(None),
                                             DATASTORE_MONGODB)
    version_mongodb_2_6 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_MONGODB_2_6)

    TEST.trove_clusters = utils.TestDataContainer()
    TEST.trove_clusters.add(cluster1)
    TEST.trove_clusters.add(cluster2)
    TEST.databases = utils.TestDataContainer()
    TEST.database_backups = utils.TestDataContainer()
    TEST.database_users = utils.TestDataContainer()
    TEST.database_user_dbs = utils.TestDataContainer()
    TEST.database_flavors = utils.TestDataContainer()

    TEST.databases.add(database1)
    TEST.databases.add(database2)
    TEST.database_backups.add(bkup1)
    TEST.database_backups.add(bkup2)
    TEST.database_backups.add(bkup3)
    TEST.database_users.add(user1)
    TEST.database_user_dbs.add(user_db1)
    TEST.datastores = utils.TestDataContainer()
    TEST.datastores.add(datastore1)
    TEST.datastores.add(datastore_mongodb)
    TEST.database_flavors.add(flavor1, flavor2, flavor3)
    TEST.datastore_versions = utils.TestDataContainer()
    TEST.datastore_versions.add(version_mongodb_2_6)
    TEST.datastore_versions.add(version1)
Example #3
0
def data(TEST):
    database1 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_ONE)
    database2 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_TWO)
    bkup1 = backups.Backup(backups.Backups(None), BACKUP_ONE)
    bkup2 = backups.Backup(backups.Backups(None), BACKUP_TWO)
    bkup3 = backups.Backup(backups.Backups(None), BACKUP_TWO_INC)
    user1 = users.User(users.Users(None), USER_ONE)
    user_db1 = databases.Database(databases.Databases(None), USER_DB_ONE)

    datastore1 = datastores.Datastore(datastores.Datastores(None),
                                      DATASTORE_ONE)

    version1 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_ONE)
    version2 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_TWO)

    flavor1 = flavors.Flavor(flavors.Flavors(None), FLAVOR_ONE)
    flavor2 = flavors.Flavor(flavors.Flavors(None), FLAVOR_TWO)
    flavor3 = flavors.Flavor(flavors.Flavors(None), FLAVOR_THREE)

    TEST.databases = utils.TestDataContainer()
    TEST.database_backups = utils.TestDataContainer()
    TEST.database_users = utils.TestDataContainer()
    TEST.database_user_dbs = utils.TestDataContainer()
    TEST.database_flavors = utils.TestDataContainer()

    TEST.databases.add(database1)
    TEST.databases.add(database2)
    TEST.database_backups.add(bkup1)
    TEST.database_backups.add(bkup2)
    TEST.database_backups.add(bkup3)
    TEST.database_users.add(user1)
    TEST.database_user_dbs.add(user_db1)
    TEST.datastores = utils.TestDataContainer()
    TEST.datastores.add(datastore1)
    TEST.datastore_versions = utils.TestDataContainer()
    TEST.datastore_versions.add(version1)
    TEST.datastore_versions.add(version2)
    TEST.database_flavors.add(flavor1, flavor2, flavor3)
Example #4
0
 def get_databases_1(self):
     return databases.Database(None, self.fake_databases[0])
Example #5
0
 def get_instances_1234_users_access(self):
     return [
         databases.Database(self, db)
         for db in self.fake_user_access['databases']
     ]
Example #6
0
def data(TEST):
    cluster1 = clusters.Cluster(clusters.Clusters(None), CLUSTER_DATA_ONE)
    cluster2 = clusters.Cluster(clusters.Clusters(None), CLUSTER_DATA_TWO)
    database1 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_ONE)
    database2 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_TWO)
    database3 = instances.Instance(instances.Instances(None),
                                   DATABASE_DATA_THREE)
    bkup1 = backups.Backup(backups.Backups(None), BACKUP_ONE)
    bkup2 = backups.Backup(backups.Backups(None), BACKUP_TWO)
    bkup3 = backups.Backup(backups.Backups(None), BACKUP_TWO_INC)

    cfg1 = configurations.Configuration(configurations.Configurations(None),
                                        CONFIG_ONE)
    cfg2 = configurations.Configuration(configurations.Configurations(None),
                                        CONFIG_TWO)

    user1 = users.User(users.Users(None), USER_ONE)
    user_db1 = databases.Database(databases.Databases(None), USER_DB_ONE)
    user_root1 = databases.Database(databases.Databases(None), USER_ROOT_ONE)

    datastore1 = datastores.Datastore(datastores.Datastores(None),
                                      DATASTORE_ONE)
    version1 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_ONE)
    version2 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_TWO)

    flavor1 = flavors.Flavor(flavors.Flavors(None), FLAVOR_ONE)
    flavor2 = flavors.Flavor(flavors.Flavors(None), FLAVOR_TWO)
    flavor3 = flavors.Flavor(flavors.Flavors(None), FLAVOR_THREE)
    datastore_mongodb = datastores.Datastore(datastores.Datastores(None),
                                             DATASTORE_MONGODB)
    version_mongodb_2_6 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_MONGODB_2_6)
    datastore_redis = datastores.Datastore(datastores.Datastores(None),
                                           DATASTORE_REDIS)
    version_redis_3_0 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_REDIS_3_0)
    datastore_vertica = datastores.Datastore(datastores.Datastores(None),
                                             DATASTORE_VERTICA)
    version_vertica_7_1 = datastores.\
        DatastoreVersion(datastores.DatastoreVersions(None),
                         VERSION_VERTICA_7_1)

    log1 = instances.DatastoreLog(instances.Instances(None), LOG_1)
    log2 = instances.DatastoreLog(instances.Instances(None), LOG_2)
    log3 = instances.DatastoreLog(instances.Instances(None), LOG_3)
    log4 = instances.DatastoreLog(instances.Instances(None), LOG_4)

    TEST.trove_clusters = utils.TestDataContainer()
    TEST.trove_clusters.add(cluster1)
    TEST.trove_clusters.add(cluster2)
    TEST.databases = utils.TestDataContainer()
    TEST.database_backups = utils.TestDataContainer()
    TEST.database_configurations = utils.TestDataContainer()
    TEST.database_users = utils.TestDataContainer()
    TEST.database_user_dbs = utils.TestDataContainer()
    TEST.database_user_roots = utils.TestDataContainer()
    TEST.database_flavors = utils.TestDataContainer()

    TEST.databases.add(database1)
    TEST.databases.add(database2)
    TEST.databases.add(database3)
    TEST.database_backups.add(bkup1)
    TEST.database_backups.add(bkup2)
    TEST.database_backups.add(bkup3)

    TEST.database_configurations.add(cfg1)
    TEST.database_configurations.add(cfg2)

    TEST.configuration_parameters = utils.TestDataContainer()
    for parameter in CONFIG_PARAMS_ONE:
        TEST.configuration_parameters.add(
            configurations.ConfigurationParameter(
                configurations.ConfigurationParameters(None), parameter))

    TEST.configuration_instances = utils.TestDataContainer()
    TEST.configuration_instances.add(
        configurations.Configuration(configurations.Configurations(None),
                                     CONFIG_INSTANCE_ONE))

    TEST.database_users.add(user1)
    TEST.database_user_dbs.add(user_db1)
    TEST.database_user_roots.add(user_root1)
    TEST.datastores = utils.TestDataContainer()
    TEST.datastores.add(datastore_mongodb)
    TEST.datastores.add(datastore_redis)
    TEST.datastores.add(datastore_vertica)
    TEST.datastores.add(datastore1)
    TEST.database_flavors.add(flavor1, flavor2, flavor3)
    TEST.datastore_versions = utils.TestDataContainer()
    TEST.datastore_versions.add(version_vertica_7_1)
    TEST.datastore_versions.add(version_redis_3_0)
    TEST.datastore_versions.add(version_mongodb_2_6)
    TEST.datastore_versions.add(version1)
    TEST.datastore_versions.add(version2)

    TEST.logs = utils.TestDataContainer()
    TEST.logs.add(log1, log2, log3, log4)