Skip to content

User Guide

Daniel Clavijo Coca edited this page Oct 23, 2023 · 9 revisions

REST API Endpoints

The API documentation can be found at SwaggerHub.

CLI Client Tool

The client tool http_cli.rb is a ruby http client that can be used to easily interact with the provision engine using the CLI. It is meant to be a convenient alternative to using curl. Change the variables USERNAME and PASSWORD inside the SimpleHttpClient class according to your credentials.

client.rb [get|post|put|delete] <URI> <JSON file path (for POST and PUT only)>

For example

./client.rb post http://localhost:1337/serverless-runtimes runtime_spec.json

However you can use any regular HTTP Client for this. Basic authentication is required.

Example runtime specifications

FaaS only runtime. Resulting service will create a VM with the default nature role VM Template contents.

{
  "SERVERLESS_RUNTIME": {
    "FAAS": {
      "FLAVOUR": "nature"
    },
    "SCHEDULING": {},
    "DEVICE_INFO": {}
  }
}

FaaS + DaaS + Custom VM requirements + Name.

{
  "SERVERLESS_RUNTIME": {
    "NAME": "Example Serverless Runtime",
    "FAAS": {
      "CPU": 1,
      "MEMORY": 128,
      "DISK_SIZE": 1024,
      "FLAVOUR": "nature"
    },
    "DAAS": {
      "CPU": 1,
      "MEMORY": 128,
      "DISK_SIZE": 1024,
      "FLAVOUR": "s3"
    },
    "SCHEDULING": {},
    "DEVICE_INFO": {}
  }
}

Usage

Create a Serverless Runtime

Create minimal runtime

/http_cli.rb post http://localhost:1337/serverless-runtimes ../../tests/templates/sr_faas_minimal.json
{
  "SERVERLESS_RUNTIME": {
    "NAME": "Function_3c007555-cf5d-4ee4-a1ac-49ab99955216",
    "ID": 805,
    "FAAS": {
      "FLAVOUR": "Function",
      "VM_ID": 562,
      "STATE": "PENDING",
      "ENDPOINT": null,
      "CPU": 0.1,
      "VCPU": 0,
      "MEMORY": 128,
      "DISK_SIZE": 200
    },
    "SCHEDULING": {
    },
    "DEVICE_INFO": {
    },
    "SERVICE_ID": 804
  }
}

Create a complex runtime

./http_cli.rb post http://localhost:1337/serverless-runtimes ../../tests/templates/sr_daas_capacity.json                4s
{
  "SERVERLESS_RUNTIME": {
    "NAME": "Function and Data as a Service",
    "ID": 807,
    "FAAS": {
      "CPU": 0.11,
      "VCPU": 2,
      "MEMORY": 133,
      "DISK_SIZE": 1025,
      "FLAVOUR": "Function",
      "VM_ID": 563,
      "STATE": "PENDING",
      "ENDPOINT": null
    },
    "DAAS": {
      "CPU": 0.33,
      "VCPU": 1,
      "MEMORY": 197,
      "DISK_SIZE": 1337,
      "FLAVOUR": "Data",
      "VM_ID": 564,
      "STATE": "PENDING",
      "ENDPOINT": null
    },
    "SCHEDULING": {
    },
    "DEVICE_INFO": {
    },
    "SERVICE_ID": 806
  }
}

Get detailed Serverless Runtime information

./http_cli.rb get http://localhost:1337/serverless-runtimes/807                                                         5s
{
  "SERVERLESS_RUNTIME": {
    "NAME": "Function and Data as a Service",
    "ID": 807,
    "FAAS": {
      "CPU": 0.11,
      "VCPU": 2,
      "MEMORY": 133,
      "DISK_SIZE": 1025,
      "FLAVOUR": "Function",
      "VM_ID": 563,
      "STATE": "RUNNING",
      "ENDPOINT": null
    },
    "DAAS": {
      "CPU": 0.33,
      "VCPU": 1,
      "MEMORY": 197,
      "DISK_SIZE": 1337,
      "FLAVOUR": "Data",
      "VM_ID": 564,
      "STATE": "RUNNING",
      "ENDPOINT": null
    },
    "SCHEDULING": {
    },
    "DEVICE_INFO": {
    },
    "SERVICE_ID": 806
  }
}
Clone this wiki locally