Skip to content

SSE enabled get and set of runtime parameters using CIMI #40

Open

Description

@konstan

According to the new Runtime Parameter resource implement CIMI based

  • GET with SSE
  • PUT

Activity

  1. self-assigned this
    on Jul 24, 2017
  2. 0xbase12 commented on Jul 24, 2017

    @0xbase12
    Member

    GET run parameter resource

    Json:

    curl -i -b cookie.txt https://localhost/api/run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5 -k -H "Accept: application/json"

    HTTP/1.1 200 OK
    Server: nginx/1.12.0
    Date: Mon, 24 Jul 2017 12:18:13 GMT
    Content-Type: application/json
    Content-Length: 753
    Connection: keep-alive

    {
      "updated" : "2017-07-23T15:05:04.848Z",
      "name" : "vmstate",
      "value" : "test",
      "created" : "2017-07-20T15:07:23.663Z",
      "node-index" : 1,
      "id" : "run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5",
      "node-name" : "node2",
      "acl" : {
        "owner" : {
          "principal" : "ADMIN",
          "type" : "ROLE"
        },
        "rules" : [ {
          "principal" : "ADMIN",
          "right" : "ALL",
          "type" : "ROLE"
        } ]
      },
      "operations" : [ {
        "rel" : "edit",
        "href" : "run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5"
      }, {
        "rel" : "delete",
        "href" : "run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5"
      } ],
      "resourceURI" : "http://sixsq.com/slipstream/1/RunParameter",
      "run-id" : "f5a31680-aef3-4502-a648-a7b331deab02"
    }
    

    SSE:

    curl -i -X GET -b cookie.txt https://localhost/api/run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5 -k -H "Accept: text/event-stream"

    HTTP/1.1 200 OK
    Server: nginx/1.12.0
    Date: Mon, 24 Jul 2017 12:21:46 GMT
    Content-Type: text/event-stream; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Cache-Control: no-cache
    
    event: vmstate
    data: test
    id: run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5
    
    
    event: vmstate
    data: test2
    id: run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5
    

    PUT run parameter resource

    param.json is a file with following content:

     {"value": "newvalue"}
    

    curl -i -X PUT -b cookie.txt https://localhost/api/run-parameter/df0aff5a-d5da-4ab7-aa93-11a179f362e5 -k -H "Content-Type:application/json" -d @param.json

    HTTP/1.1 200 OK
    Server: nginx/1.12.0
    Date: Mon, 24 Jul 2017 12:24:33 GMT
    Content-Length: 0
    Connection: keep-alive
    

    GET resource collection

    Json

    curl -i -X GET -b cookie.txt 'https://localhost/api/run-parameter?$filter=run-id=%27b5d53585-edb4-4278-b267-006f65cdaeca%27' -k -H "Accept: application/json"

    HTTP/1.1 200 OK
    Server: nginx/1.12.0
    Date: Mon, 24 Jul 2017 12:38:10 GMT
    Content-Type: application/json
    Content-Length: 4414
    Connection: keep-alive
    
    {
      "acl" : {
        "owner" : {
          "principal" : "ADMIN",
          "type" : "ROLE"
        },
        "rules" : [ {
          "principal" : "USER",
          "type" : "ROLE",
          "right" : "MODIFY"
        } ]
      },
      "resourceURI" : "http://sixsq.com/slipstream/1/RunParameterCollection",
      "id" : "run-parameter",
      "operations" : [ {
        "rel" : "add",
        "href" : "run-parameter"
      } ],
      "runParameters" : [ {
        "updated" : "2017-07-20T14:07:43.902Z",
        "name" : "vmstate",
        "value" : "init",
        "created" : "2017-07-20T14:07:43.902Z",
        "node-index" : 1,
        "id" : "run-parameter/f5bc3bcc-3ee9-4585-8cf0-366707c5964a",
        "node-name" : "node1",
        "acl" : {
          "owner" : {
            "principal" : "ADMIN",
            "type" : "ROLE"
          },
          "rules" : [ {
            "type" : "ROLE",
            "principal" : "ADMIN",
            "right" : "ALL"
          } ]
        },
        "operations" : [ {
          "rel" : "edit",
          "href" : "run-parameter/f5bc3bcc-3ee9-4585-8cf0-366707c5964a"
    ...
        "name" : "state",
        "value" : "init",
        "created" : "2017-07-20T14:07:35.607Z",
        "id" : "run-parameter/b8c34367-d639-4a65-bee5-1f6848df1dfd",
        "acl" : {
          "owner" : {
            "principal" : "ADMIN",
            "type" : "ROLE"
          },
          "rules" : [ {
            "type" : "ROLE",
            "principal" : "ADMIN",
            "right" : "ALL"
          } ]
        },
        "operations" : [ {
          "rel" : "edit",
          "href" : "run-parameter/b8c34367-d639-4a65-bee5-1f6848df1dfd"
        }, {
          "rel" : "delete",
          "href" : "run-parameter/b8c34367-d639-4a65-bee5-1f6848df1dfd"
        } ],
        "resourceURI" : "http://sixsq.com/slipstream/1/RunParameter",
        "run-id" : "b5d53585-edb4-4278-b267-006f65cdaeca"
      } ],
      "count" : 5
    

    SSE

    curl -i -X GET -b cookie.txt 'https://localhost/api/run-parameter?$filter=run-id=%27b5d53585-edb4-4278-b267-006f65cdaeca%27' -k -H "Accept: text/event-stream"

    HTTP/1.1 200 OK
    Server: nginx/1.12.0
    Date: Mon, 24 Jul 2017 12:58:36 GMT
    Content-Type: text/event-stream; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Cache-Control: no-cache
    
    event: state
    data: init
    id: run-parameter/b8c34367-d639-4a65-bee5-1f6848df1dfd
    
  3. 0xbase12 commented on Jul 24, 2017

    @0xbase12
    Member

    Search for fully qualified name in collection which should return 1 or 0 answer:
    curl -i -X GET -b cookie.txt 'https://localhost/api/run-parameter?$filter=run-id=%27b5d53585-edb4-4278-b267-006f65cdaeca%27%20and%20node-name=%27node%27%20and%20node-index=%271%27%20and%20name=%27hostname%27'

  4. konstan commented on Jul 24, 2017

    @konstan
    MemberAuthor

    To get the actual unique map with the requested RTP
    $filter=... and $last="1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions