Skip to content
pglass edited this page Jul 30, 2015 · 23 revisions

Get Version

Request

GET http://{{host}}/

Response

{
    "version": "v1",
    "build": "0.1.0.201"
}

Create a Job

Parameters

  • name
  • actions: Contains a list of target objects
    • targets: List of target uuids
    • parameters (optional): Only required by specific actions

Request

POST http://{{host}}/v1/{{tenant_id}}/jobs

{
  "name": "Soft and then hard reboot db servers",
  "actions":[
    {
      "targets": ["83a57a53-4a50-42e5-acb4-dc301736062a"],
      "type": "nova-soft-reboot"
    },
    {
      "targets": [],
      "type": "remote-command",
      "parameters": {
         "command": "sudo service barbican-api restart"
      }
    }
  ]
}

Manually set a job to execute

Request

HEAD http://{{host}}/v1/{{tenant_id}}/jobs/{{job_id}}

Response

200 OK

Get a Job

Request

GET http://{{host}}/v1/{{tenant_id}}/jobs/{{job_id}}

Response

{
  "id": "4dcd8e8f-cdd4-4dc1-8f3c-8242db216388",
  "name": "Soft and then hard reboot db servers",
  "actions": [
    {
      "id": "2b9f9e3f-0b72-4edc-9c1d-dd643a8a4b2b",
      "targets": ["83a57a53-4a50-42e5-acb4-dc301736062a"],
      "type": "nova-soft-reboot"
    },
    {
      "id": "b9a17baf-c8a4-4050-9030-e10db3d1d0e0",
      "targets": [],
      "type": "nova-hard-reboot"
    }
  ]
}

Get all Jobs

Request

GET http://{{host}}/v1/{{tenant_id}}/jobs

Response

{
  "jobs": [
    {
      "id": "4dcd8e8f-cdd4-4dc1-8f3c-8242db216388",
      "name": "Sample Job"
    },
    {
      "id": "739bd4c4-b0a9-49d6-9997-c814b1f5a9c7",
      "name": "Hard Restart Sample Job"
    }
  ]
}

Create Target:

Parameters

  • type: Valid values ("ssh", "cloud-server" | "cloud-load-balancer" | etc)
  • name (optional): A user friendly way of identifying your targets
  • address: The address to connect to the target. Valid sub-attributes (ip | hostname | nova).
  • authentication: Allows for you to specify various ways of accessing your server
  • Eventually, it would be good to integration Barbican for key management of auth credentials.

Request

POST http://{{host}}/v1/{{tenant_id}}/targets

{
    "name": "Apache node 2",
    "type": "cloud-server",
    "address": {
        "nova": {
            "name": "apache-02.ord.dev",
            "region": "DFW"
         }
    },
    "authentication": {
        "rackspace": {
            "username": "your_username",
            "api_key": "your_api_key"
        }
    }
}

Supported Address Types

IP

"address": {
    "ip": {
        "address": "10.0.0.1",
        "port": 21
    }
}

Hostname

"address": {
    "hostname": {
        "address": "blarg.com",
        "port": 21
    }
}

Nova

"address": {
    "nova": {
        "name": "apache-02.ord.dev",
        "region": "DFW"
    }
}

Supported Authentication Methods

Rackspace

"rackspace" : {
    "username": "your_username",
    "api_key": "your_api_key"
}

SSH (key-based)

"ssh": {
    "username": "your_ssh_username",
    "private_key": "-----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED...",
    "private_key_password": "your_key_password"
}

SSH (password)

"ssh": {
    "username": "your_ssh_username",
    "password": "your_ssh_password"
}

Get Target

Request

GET http://{{host}}/v1/{{tenant_id}}/targets/{{target_id}}

Response

{
    "id": "83a57a53-4a50-42e5-acb4-dc301736062a",
    "address": {
        "ip": {
            "address": "10.0.0.1",
            "port": 21
        }
    },
    "authentication": {
        "rackspace": {
            "username": "your_username",
            "api_key": "your_api_key"
        }
    }
}

Get Targets

Request

GET http://{{host}}/v1/{{tenant_id}}/targets

Response

{
  "targets": [
    {
      "name": "ptr_test",
      "id": "48179d41-16e1-4918-a11d-a2367963f443",
      "type": "cloud-server"
    }
  ]
}

Get Schedules

Request

GET http://{{host}}/v1/{{tenant_id}}/schedules

Response

{
  "schedules": [
    {
      "name": "a schedule",
      "id": "241e95df-8f68-48d5-bb26-035da3c26501",
      "entries": [
        {
          "job_id": "1",
          "delay": "00:00:05"
        },
        {
          "job_id": "2",
          "delay": "00:00:10"
        }
      ]
    }
  ]
}

Get Schedule

Request

GET http://{{host}}/v1/{{tenant}}/schedules/{{schedule_id}}

Response

{
  "name": "a schedule",
  "id": "241e95df-8f68-48d5-bb26-035da3c26501",
  "entries": [
    {
      "job_id": "1",
      "delay": "00:00:05"
    },
    {
      "job_id": "2",
      "delay": "00:00:10"
    }
  ]
}

Create Schedule

Request

POST http://{{host}}/v1/{{tenant}}/schedules

{
  "name": "a schedule",
  "entries": [
    {
      "delay": "00:00:05",
      "job_id": "1"
    },
    {
      "delay": "00:00:10",
      "job_id": "2"
    }
  ]
}

Run a Schedule

Request

HEAD http://{{host}}/v1/{{tenant}}/schedules/{{schedule_id}}

Delete Schedule

Request

DELETE http://{{host}}/v1/{{tenant}}/schedules/{{schedule_id}}

Clone this wiki locally