Skip to main content

vME APIs

Overview

vME's API allows you to programatically manage the vME instances and Docker engine.

All endpoints are authenticated according to the following headers schema:

{
"username" : "xxxxxx", # your username
"api-key" : "xxxxxx" # your api-key
}

Pool Routes

Show all pools

GET /pool/show

  • AUTHENTICATIONS: headers

  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    response = requests.get("https://1.23.45.67/pool/show", headers=headers)
    if response.status_code < 500:
    print(response.json())

Create a pool

POST /pool/create

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    name
    required
    String
    Name of pool to be created.
    device
    required
    ListList of device names.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "vme-pool",
    "device" : ["nvme0n2", "nvme0n3"]
    }
    response = requests.post("https://1.23.45.67/pool/create", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Destroy a pool

DELETE /pool/destroy

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

      {
    "name" : "vme-pool"
    }
    NameTypeDescription
    name
    required
    StringName of pool to be destroyed.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "vme-pool"
    }
    response = requests.delete("https://1.23.45.67/pool/destroy", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Show current status of a pool

GET /pool/status

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    name
    required
    StringThe name of the pool to show status on.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    "name" : "vme-pool"
    }
    response = requests.get("https://1.23.45.67/pool/status", params=params, headers=headers)
    if response.status_code < 500:
    print(response.json())

Show history of a pool

GET /pool/history

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    name
    required
    StringThe name of the pool to run the history command on.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    "name" : "vme-pool"
    }
    response = requests.get("https://1.23.45.67/pool/history", params=params headers=headers)
    if response.status_code < 500:
    print(response.json())

Register a pool

POST /pool/register

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    name
    required
    String
    The name of the pool to be registered.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {"name" : "vme-pool"}
    response = requests.post("https://1.23.45.67/pool/register", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Source Routes

Show all sources

GET /source/show

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    pool_name
    optional
    StringName of pool, default is vme-pool.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    "pool_name" : "vme-pool"
    }
    response = requests.get("https://1.23.45.67/source/show", params=params, headers=headers)
    if response.status_code < 500:
    print(response.json())

Create a source

POST /source/create

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    • database method: container
      {
      "pool_name" : "vme-pool",
      "name" : "foo",
      "quota" : "1G",
      "compression" : "lzjb"
      }
    • database method: network
      {
      "pool_name" : "vme-pool",
      "name" : "foo",
      "compression" : "lzjb",
      "database_method" : "network",
      "network_info" : {
      "client_address" : "9.87.65.43",
      "anonuid" : 123,
      "anongid" : 123
      }
      }
    NameTypeDescription
    name
    required
    StringName of source to be created.
    pool_name
    required
    StringName of pool that contains a source.
    dbtype
    optional
    StringDatabase type, such as mysql, mariadb, mssql, mongodb etc., used to label a source, default is unknown.
    quota
    optional
    StringA limit on the amount of disk space a dataset can consume, for example, 10G for ten GB.
    compression
    optional
    StringName of process where data is stored using less disk space, the name can be one of on, off, lzjb, gzip, gzip-1, gzip-2, gzip-3, gzip-4, gzip-5, gzip-6, gzip-7, gzip-8, gzip-9, zle, lz4, False, default is False.
    database_method
    optional
    StringDatabase method can be one of container, network, default is container.
    network_info
    optional
    DictionaryNetwork information containing with client_address, anonuid, anongid. It is required when database_method was set to network.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "name" : "foo"
    }
    response = requests.post("https://1.23.45.67/source/create", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Modify a source

POST /source/modify

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    name
    required
    StringName of source to be modified.
    pool_name
    required
    StringName of pool that contains a source.
    property
    required
    DictionaryThe properties of the source to be modified.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "name" : "foo",
    "property" : {
    "database_method" : "network",
    "quota" : "5G",
    "dbtype" : "mysql",
    "compression" : "gzip",
    "client_address" : "9.87.65.43"
    }
    }
    response = requests.post("https://1.23.45.67/source/modify", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Rename a source

PUT /source/rename

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "currentname" : "foo",
    "newname" : "foofoo"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool that contains a source.
    currentname
    required
    StringName of source to be renamed.
    newname
    required
    StringNew source name.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "currentname" : "foo",
    "newname" : "foofoo"
    }
    response = requests.put("https://1.23.45.67/source/rename", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Destroy a source

DELETE /source/destroy

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "source_name" : "foo"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool that contains a source.
    source_name
    required
    StringName of source to be destroyed.
    recursive
    optional
    BooleanThe recursive option, default is False.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "source_name" : "foo"
    }
    response = requests.delete("https://1.23.45.67/source/destroy", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Snapshot Routes

Show all snapshots

GET /snapshot/show

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    pool_name
    optional
    StringName of pool.
    source_name
    optional
    StringName of source/clone.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    "pool_name" : "vme-pool"
    }
    response = requests.get("https://1.23.45.67/snapshot/show", params=params, headers=headers)
    if response.status_code < 200:
    print(response.json())

Create a sanpshot

POST /snapshot/create

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "name" : "snap"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    source_name
    required
    StringName of source/clone.
    name
    required
    StringName of snapshot/bookmark to be created.
    recursive
    optional
    BooleanRecursive option, default is False.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "name" : "snap"
    }
    response = requests.post("https://1.23.45.67/snapshot/create", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Rollback a snapshot

POST /snapshot/rollback

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "snapshot_name" : "snap",
    "force" : true
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    source_name
    required
    StringName of source/clone.
    snapshot_name
    required
    StringName of snapshot/bookmark to be created.
    force
    optional
    BooleanForce option to rollback, default is False.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "snapshot_name" : "snap",
    "force" : True
    }
    response = requests.post("https://1.23.45.67/snapshot/rollback", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Rename a snapshot

PUT /snapshot/rename

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "currentname" : "snap",
    "newname" : "snap-new"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    source_name
    required
    StringName of source/clone.
    currentname
    required
    StringName of snapshot/bookmark to be renamed.
    newname
    required
    StringNew name of snapshot/bookmark.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "currentname" : "snap",
    "newname" : "snap-new"
    }
    response = requests.put("https://1.23.45.67/snapshot/rename", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Destroy a snapshot

DELETE /snapshot/destroy

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "snapshot_name" : "snap"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    source_name
    required
    StringName of source/clone.
    snapshot_name
    required
    StringName of snapshot/bookmark to be destroyed.
    recursive
    optional
    BooleanThe recursive option, default is False.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "snapshot_name" : "snap"
    }
    response = requests.delete("https://1.23.45.67/snapshot/destroy", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Clone Routes

Show all clones

GET /clone/show

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    pool_name
    optional
    StringName of pool.
    source_name
    optional
    StringName of source.
    snapshot_name
    optional
    StringName of snapshot.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    'pool_name' : 'vme-pool'
    }
    response = requests.get("https://1.23.45.67/clone/show", params=params, headers=headers)
    if response.status_code < 500:
    print(response.json())

Create a clone

POST /clone/create

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "snapshot_name" : "snap",
    "name" : "foo-clone"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    source_name
    required
    StringName of source.
    snapshot_name
    required
    StringName of snapshot.
    name
    required
    StringName of clone to be created.
    dbtype
    optional
    StringDatabase type, such as mysql, mariadb, mssql, mongodb etc., used to label a source, default is unknown.
    size
    optional
    IntegerNumber of clones (clonefarm) to be created, default is 1.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "source_name" : "foo",
    "snapshot_name" : "snap",
    "name" : "foo-clone"
    }
    response = requests.post("https://1.23.45.67/clone/create", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Modify a clone

POST /clone/modify

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    name
    required
    StringName of clone to be modified.
    pool_name
    required
    StringName of pool that contains a source.
    property
    required
    DictionaryThe properties of the source to be modified.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "name" : "foo-clone",
    "property" : {
    "database_method" : "network",
    "quota" : "5G",
    "dbtype" : "mysql",
    "compression" : "gzip",
    "client_address" : "9.87.65.43"
    }
    }
    response = requests.post("https://1.23.45.67/clone/modify", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Rename a clone

PUT /clone/rename

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "currentname" : "foo-clone",
    "newname" : "foofoo-clone"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    currentname
    required
    StringName of clone to be renamed.
    newname
    required
    StringNew name of clone.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "currentname" : "foo-clone",
    "newname" : "foofoo-clone"
    }
    response = requests.put("https://1.23.45.67/clone/rename", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Destroy a clone

DELETE /clone/destroy

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "clone_name" : "foo-clone"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    clone_name
    required
    StringName of clone to be destroyed.
    recursive
    optional
    BooleanThe recursive option, default is False.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "clone_name" : "foo-clone"
    }
    response = requests.delete("https://1.23.45.67/clone/destroy", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Docker Routes

List all images

Similar to the docker images command.

GET /docker/image/list

  • AUTHENTICATIONS: headers

  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    response = requests.get("https://1.23.45.67/docker/image/list", headers=headers)
    if response.status_code < 500:
    print(response.json())

List all containers

Similar to the docker ps -a command.

GET /docker/container/list

  • AUTHENTICATIONS: headers

  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    response = requests.get("https://1.23.45.67/docker/container/list", headers=headers)
    if response.status_code < 500:
    print(response.json())

Get a container log

GET /docker/container/log

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    name
    required
    StringName of container to get the log.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    "name" : "foo-con"
    }
    response = requests.get("https://1.23.45.67/docker/container/log", params=params, headers=headers)
    if response.status_code < 500:
    print(response.json())

Get a container detail

GET /docker/container/detail

  • AUTHENTICATIONS: headers

  • QUERY PARAMETERS:

    NameTypeDescription
    name
    required
    StringName of container to get the detail.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    params = {
    "name" : "foo-con"
    }
    response = requests.get("https://1.23.45.67/docker/container/detail", params=params, headers=headers)
    if response.status_code < 500:
    print(response.json())

Pull an image

Similar to the docker pull command.

POST /docker/image/pull

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "repository" : "mysql",
    "tag" : "8.4.0",
    "credential" : {"username":"","password":""}
    }
    NameTypeDescription
    repository
    required
    StringName of image repository to be pulled.
    tag
    optional
    StringName of tag, default is latest.
    dbtype
    optional
    StringDatabase type, such as mysql, mariadb, mssql, mongodb etc., used to label a source, default is same as repository name.
    credential
    optional
    DictionaryInformation used to verify repository accession, default is None.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "repository" : "mysql",
    }
    response = requests.post("https://1.23.45.67/docker/image/pull", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Register an image

POST /docker/image/register

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "name" : "mysql:latest",
    "dbtype" : "mysql"
    }
    NameTypeDescription
    name
    required
    StringName of image name:tag to be registered.
    dbtype
    optional
    StringDatabase type, such as mysql, mariadb, mssql, mongodb etc., used to label a source, default is same as repository name.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "mysql:latest",
    "dbtype" : "mysql"
    }
    response = requests.post("https://1.23.45.67/docker/image/register", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Save an image as .tar

POST /docker/image/save

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "image" : "mysql:latest",
    "filename" : "myimage.tar"
    }
    NameTypeDescription
    image
    required
    StringName of image name:tag to be saved.
    filename
    required
    StringFilename of saved image, the tar file will be saved at /home/vme/uploads.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "image" : "mysql:latest",
    "filename" : "myimage.tar"
    }
    response = requests.post("https://1.23.45.67/docker/image/save", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Load an image from .tar

POST /docker/image/load

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "filename" : "myimage.tar"
    }
    NameTypeDescription
    filename
    required
    StringFilename of image to be loaded.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "filename" : "myimage.tar"
    }
    response = requests.post("https://1.23.45.67/docker/image/load", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Create a container

Similar to the docker run command.

POST /docker/container/create

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "image" : "mysql:latest",
    "name" : "foo-mysql",
    "volumes" : ["/vme-pool/sources/foo:/var/lib/mysql"],
    "ports" : "8888:3306",
    "environment" : ["MYSQL_ROOT_PASSWORD=secret_password"]
    }
    NameTypeDescription
    image
    required
    StringName of image.
    name
    required
    StringName of container to be created.
    detach
    optional
    BooleanBoolean for running container in the background, default is True.
    command
    optional
    StringCommand to run in the container, default is None.
    environment
    optional
    List or DictionaryEnvironment variables to set inside the container, as a dictionary or a list of strings in the format ["SOMEVARIABLE=xxx"], default is None.
    volumes
    optional
    List or DictionaryConfigure volumes mounted inside the container, default is [].
    ports
    optional
    StringPorts to bind inside the container in the format "a:b,c:d,...", for example 8080:80 means map port 8080 on the host to TCP port 80 in the container, default is None.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "image" : "mysql:latest",
    "name" : "foo-mysql",
    "volumes" : ["/vme-pool/sources/foo:/var/lib/mysql"],
    "ports" : "8888:3306",
    "environment" : ["MYSQL_ROOT_PASSWORD=secret_password"]
    }
    response = requests.post("https://1.23.45.67/docker/container/create", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Start a container

Similar to the docker start command.

POST /docker/container/start

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    name
    required
    StringName of container to be started.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "foo-mysql"
    }
    response = requests.post("https://1.23.45.67/docker/container/start", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Stop a container

Similar to the docker stop command.

POST /docker/container/stop

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    name
    required
    StringName of container to be stoped.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "foo-mysql"
    }
    response = requests.post("https://1.23.45.67/docker/container/stop", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Execute command inside a container

Similar to the docker exec command.

POST /docker/container/exec

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "name" : "foo-mysql",
    "command" : "mysql --user=root --password=\"secret_password\" -e \"show databases;\""
    }
    NameTypeDescription
    name
    required
    StringName of container to be executed.
    command
    required
    String or ListCommands to be executed.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "foo-mysql",
    "command" : "mysql --user=root --password=\"secret_password\" -e \"show databases;\""
    }
    response = requests.post("https://1.23.45.67/docker/container/exec", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Remove an image

DELETE /docker/image/remove

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

      {
    "image" : "mysql:latest"
    }
    NameTypeDescription
    image
    required
    StringName of image name:tag to be removed.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "image" : "mysql:latest"
    }
    response = requests.delete("https://1.23.45.67/docker/image/remove", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Remove a container

Delete /docker/container/remove

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

      {
    "name" : "foo-mysql"
    }
    NameTypeDescription
    name
    required
    StringName of container to be removed.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "name" : "foo-mysql"
    }
    response = requests.delete("https://1.23.45.67/docker/container/remove", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Database Routes

Connect to database

POST /db/connect

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "dbtype" : "mysql",
    "host" : "localhost",
    "user" : "root",
    "password" : "secret_password",
    "port" : 8888
    }

    The body is the required credential information, the general formatting is {"dbtype": "<database_type>", "host": "<host>", "user": "<user>", "password": "<password>", "port": "<port>"}.

  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    credential = {
    "dbtype" : "mysql",
    "host" : "localhost",
    "user" : "root",
    "password" : "secret_password",
    "port" : 8888
    }
    response = requests.post("https://1.23.45.67/db/connect", json=credentail, headers=headers)
    if response.status_code < 500:
    print(response.json())

Receive database

Receive backup and restore dataset.

POST /db/receive

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    {
    "pool_name" : "vme-pool",
    "dataset_name" : "restored-sender-from-backup",
    "dbtype" : "mysql",
    "src" : "demo-pool-sources-sender@now-20230829183552.vmebk"
    }
    NameTypeDescription
    pool_name
    required
    StringName of pool.
    dataset_name
    required
    StringName of dataset to be restored.
    dbtype
    optional
    StringDatabase type, such as mysql, mariadb, mssql, mongodb etc., used to label a source, default is unknown.
    src
    required
    StringPath name of received backup file in .vmebk format, the default absolute path is /enov8/vme/data/<filename> when only the filename is provided.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "pool_name" : "vme-pool",
    "dataset_name" : "restored-sender-from-backup",
    "src" : "demo-pool-sources-sender@now-20230829183552.vmebk"
    }
    response = requests.post("https://1.23.45.67/db/receive", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Send database

POST /db/send

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    • pool2pool
      {
      "type" : "pool2pool",
      "dataset" : "demo-pool/sources/sender@now",
      "receiver" : {
      "pool_name" : "vme-pool",
      "dataset_name" : "receiver-snap"
      }
      }
    • sys2sys
      {
      "type" : "sys2sys",
      "dataset" : "demo-pool/sources/sender@now",
      "receiver" : {
      "address" : "https://9.87.654.321",
      "username" : "admin",
      "identity_file" : "/home/vme/uploads/key.pem",
      "api-key" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "pool_name" : "vme-pool",
      "dataset_name" : "receiver-sys2sys-snap"
      }
      }
    NameTypeDescription
    type
    required
    StringSending type, pool2pool or sys2sys.
    dataset
    required
    StringName of dataset to be send.
    receiver
    required
    DictionaryInformation of receiver contains pool_name, dataset_name, and other verification info for receiver.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "type" : "pool2pool",
    "dataset" : "demo-pool/sources/sender@now",
    "receiver" : {
    "pool_name" : "vme-pool",
    "dataset_name" : "receiver-snap"
    }
    }
    response = requests.post("https://1.23.45.67/db/send", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())

Backup database

Get all backup filenames.

GET /db/backup

  • AUTHENTICATIONS: headers

  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    response = requests.get("https://1.23.45.67/db/backup", headers=headers)
    if response.status_code < 500:
    print(response.json())

Create backup file.

POST /db/backup

  • AUTHENTICATIONS: headers

  • REQUEST BODY SCHEMA:

    NameTypeDescription
    dataset
    required
    StringName of dataset to be backup.
  • EXAMPLE:

    # Download the requests library from https://docs.python-requests.org/en/latest/
    import requests
    body = {
    "dataset" : "vme-pool/sources/foo"
    }
    response = requests.post("https://1.23.45.67/db/backup", json=body, headers=headers)
    if response.status_code < 500:
    print(response.json())