Example #1
0
def add(name, type_id):
    """Add a database."""
    try:
        client().databases.add(name, "db-" + type_id)
        logger.success("ctl:db:create", "Added {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #2
0
def delete(id):
    """Delete a virtual disk"""
    try:
        client().filesystems.delete(id)
        logger.success("ctl:fs:delete", "Deleted {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #3
0
def enable(id):
    """Mount a filesystem on boot"""
    try:
        client().filesystems.enable(id)
        logger.success("ctl:fs:enable", "Enabled {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #4
0
def edit(id, address, port, new_name):
    """Edit a website"""
    try:
        client().websites.edit(id, new_name, address, port)
        logger.success("ctl:site:edit", "Edited {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #5
0
def revoke(key):
    """Revoke an API key."""
    try:
        client().apikeys.revoke(key)
        logger.info("ctl:keys:revoke", "API key revoked")
    except Exception as e:
        raise CLIException(str(e))
Example #6
0
def add_user(name, password, domain, first_name, last_name, admin, sudo):
    """Add a user to arkOS LDAP"""
    try:
        client().roles.add_user(name, password, domain, first_name, last_name, admin, sudo)
        logger.success("ctl:usr:add", "Added {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #7
0
def disable(name):
    """Disable a service on boot"""
    try:
        client().services.disable(name)
        logger.success("ctl:svc:disable", "Disabled {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #8
0
def local(id):
    """Allow local network access only to service"""
    try:
        client().security.update_policy(id, "local")
        logger.success("ctl:sec:local", "Access to {0} restricted".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #9
0
def block(id):
    """Block all network access to service"""
    try:
        client().security.update_policy(id, "block")
        logger.success("ctl:sec:block", "Access to {0} blocked".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #10
0
def delete(id):
    """Delete a certificate."""
    try:
        client().certificates.delete(id=id)
        logger.success("ctl:cert:delete", "Deleted {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #11
0
def allow(id):
    """Allow all access to service"""
    try:
        client().security.update_policy(id, "allow")
        logger.success("ctl:sec:allow", "Access to {0} allowed".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #12
0
def unassign(id, type, appid, specialid):
    """Unassign a certificate from an app or website."""
    try:
        client().certificates.unassign(id, type, appid, specialid)
        logger.info("ctl:cert:unassign", "Unassigned {0} from {0}".format(id, appid))
    except Exception as e:
        raise CLIException(str(e))
Example #13
0
def assign(id, type, appid, specialid):
    """Assign a certificate to an app or website."""
    try:
        client().certificates.assign(id, type, appid, specialid)
        logger.info("ctl:cert:assign", "Assigned {0} to {0}".format(id, appid))
    except Exception as e:
        raise CLIException(str(e))
Example #14
0
def add_user(name, type_id):
    """Add a database user."""
    try:
        client().databases.add_user(name, type_id)
        logger.success("ctl:dbusr:add", "Added user {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #15
0
def add_domain(name):
    """Add a domain to arkOS LDAP"""
    try:
        client().roles.add_domain(name)
        logger.success("ctl:dom:add", "Added {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #16
0
def delete(id):
    """Delete a network connection"""
    try:
        client().networks.delete(id)
        logger.success("ctl:net:delete", "Deleted {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #17
0
def delete_domain(name):
    """Delete an arkOS LDAP domain"""
    try:
        client().roles.delete_domain(name)
        logger.success("ctl:dom:delete", "Deleted {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #18
0
def connect(id):
    """Connect to a network"""
    try:
        client().networks.connect(id)
        logger.success("ctl:net:connect", "Connected {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #19
0
def stop(name):
    """Stop a service"""
    try:
        client().services.stop(name)
        logger.success("ctl:svc:stop", "Stopped {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #20
0
def disconnect(id):
    """Disconnect from a network"""
    try:
        client().networks.disconnect(id)
        logger.success("ctl:net:disconnect", "Disconnected {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #21
0
def update(id):
    """Update a website"""
    try:
        client().websites.update(id)
        logger.success("ctl:site:update", "Updated {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #22
0
def disable(id):
    """Disable connection to a network on boot"""
    try:
        client().networks.disable(id)
        logger.success("ctl:net:disable", "Disabled {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #23
0
def disable(id):
    """Disable a website"""
    try:
        client().websites.disable(id)
        logger.success("ctl:site:disable", "Disabled {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #24
0
def update_share(id, expires):
    """Update a fileshare link's expiration."""
    try:
        client().files.update_share(id, expires)
        logger.success("ctl:links:update", "Updated share {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #25
0
def update():
    """Updates system package index"""
    try:
        client().packages.get(refresh=True)
        logger.success("ctl:pkg:update", "Index updated")
    except Exception as e:
        raise CLIException(str(e))
Example #26
0
def remove_share(id):
    """Disable a fileshare link."""
    try:
        client().files.remove_share(id)
        logger.success("ctl:links:delete", "Deleted share {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #27
0
def umount(id):
    """Unmount a filesystem"""
    try:
        client().filesystems.umount(id)
        logger.success("ctl:fs:umount", "Unmounted {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #28
0
def add_group(name, users):
    """Add a group to arkOS LDAP"""
    try:
        client().roles.add_group(name, users)
        logger.success("ctl:grp:add", "Added {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))
Example #29
0
def disable(id):
    """Disable mounting a filesystem on boot"""
    try:
        client().filesystems.disable(id)
        logger.success("ctl:fs:disable", "Disabled {0}".format(id))
    except Exception as e:
        raise CLIException(str(e))
Example #30
0
def drop_user(name):
    """Delete a database user."""
    try:
        client().databases.delete_user(name)
        logger.success("ctl:dbusr:drop", "Dropped {0}".format(name))
    except Exception as e:
        raise CLIException(str(e))