def register_database_laas(database):
    workspace_json = {}
    workspace_json["team"] = {
        "name": database.team.name,
        "users": get_users_for_team(database.team),
    }

    if re.match(r'^mongo.*', database.engine_type):
        app = ["mongod.27017"]
    elif re.match(r'^mysql.*', database.engine_type):
        app = ["mysqld", "mysql-slow"]
    elif re.match(r'^redis.*', database.engine_type):
        app = ["redis", "sentinel"]

    hosts = get_hosts_for_database(database)

    groups = [{
        "filter_name": "host:(%s) AND app:(%s)" % (" OR ".join(hosts), " OR ".join(app)),
        "name": get_group_name(database)
    }]

    workspace_json["workspace"] = {
        "description": "%s Workspace" % database.team.name,
        "name": database.team.name,
        "groups": groups
    }

    workspace_json = json.dumps(workspace_json)
    LOG.info("Register workspace on LaaS. Workspace info: %s" %
             (workspace_json))
    try:
        LaaSProvider.update_laas_workspace(
            environment=database.environment, laas_workspace=workspace_json)
    except Exception as e:
        LOG.error("Ops... something went wrong: %s" % e)
dataset/ETHPy150Open globocom/database-as-a-service/dbaas/util/laas.py/register_database_laas/original