{ "consumes": [ "application/json" ], "produces": [ "application/json" ], "schemes": [ "http" ], "swagger": "2.0", "info": { "description": "Documentation for the Interlock API", "title": "Interlock", "version": "1.0.0" }, "host": "interlock.interlock.svc.cluster.local", "basePath": "/", "paths": { "/v1/cluster": { "get": { "description": "Retrieve the current cluster state", "tags": [ "cluster" ], "operationId": "GetClusterState", "responses": { "200": { "$ref": "#/responses/ClusterStateResponse" }, "404": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } }, "patch": { "description": "Patch the cluster state", "tags": [ "cluster" ], "operationId": "PatchClusterState", "parameters": [ { "x-go-name": "ClusterState", "description": "The cluster state that the client wants to patch", "name": "state", "in": "body", "schema": { "$ref": "#/definitions/ClusterState" } } ], "responses": { "202": { "$ref": "#/responses/ClusterStateResponse" }, "404": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } } }, "/v1/host": { "get": { "description": "Retrieve the current host state", "tags": [ "host" ], "operationId": "GetHostState", "responses": { "200": { "$ref": "#/responses/HostStateResponse" }, "404": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } }, "patch": { "description": "Patch the host state", "tags": [ "host" ], "operationId": "PatchHostState", "parameters": [ { "x-go-name": "State", "description": "The host state that the client wants to patch", "name": "state", "in": "body", "schema": { "$ref": "#/definitions/HostState" } } ], "responses": { "202": { "$ref": "#/responses/HostStateResponse" }, "404": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } } }, "/v1/host/vnc": { "put": { "description": "Reset and replace the VNC state of the host node", "tags": [ "host" ], "operationId": "VNCPut", "parameters": [ { "name": "Body", "in": "body", "schema": { "$ref": "#/definitions/putVNCPayloads" } } ], "responses": { "202": { "$ref": "#/responses/HostStateResponse" }, "400": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } }, "post": { "description": "Update the VNC state of the host node", "tags": [ "host" ], "operationId": "VNCPost", "parameters": [ { "name": "Body", "in": "body", "schema": { "$ref": "#/definitions/postVNCPayload" } } ], "responses": { "202": { "$ref": "#/responses/HostStateResponse" }, "400": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } } }, "/v1/instances": { "get": { "description": "Retrieve the current instances state", "tags": [ "instances" ], "operationId": "GetInstancesState", "responses": { "200": { "$ref": "#/responses/InstancesStateResponse" }, "404": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } } }, "/v1/instances/{hostname}": { "get": { "description": "Retrieve the URL for the Interlock pod on the target host node", "tags": [ "instances" ], "operationId": "GetInstanceState", "parameters": [ { "type": "string", "x-go-name": "Hostname", "description": "Hostname of the target interlock instance", "name": "hostname", "in": "path", "required": true } ], "responses": { "200": { "$ref": "#/responses/InstanceResponse" }, "404": { "$ref": "#/responses/ErrorResponse" }, "405": { "$ref": "#/responses/ErrorResponse" }, "500": { "$ref": "#/responses/ErrorResponse" } } } }, "/v1/subscribe": { "get": { "description": "Subscribe to topics to receive event driven updates about state changes", "tags": [ "subscribe" ], "operationId": "SubscribeToTopics", "parameters": [ { "type": "array", "items": { "type": "string" }, "example": [ "host" ], "x-go-name": "Topics", "description": "The topics to subscribe to. Defaults to all", "name": "topic", "in": "query" } ], "responses": { "500": { "$ref": "#/responses/ErrorResponse" }, "default": { "$ref": "#/responses/EventResponse" } } } } }, "definitions": { "ClusterState": { "description": "State contains information about the D-SDS cluster", "type": "object", "properties": { "name": { "description": "Name of the cluster. This field is read only and will be kept up to date internally by Interlock", "type": "string", "x-go-name": "Name", "readOnly": true, "example": "store-123" } }, "x-go-name": "State", "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/cluster" }, "Error": { "description": "Error represents an individual error returned by the API", "type": "object", "required": [ "detail" ], "properties": { "detail": { "description": "A description of the error", "type": "string", "x-go-name": "Detail", "example": "X is a read-only field" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/internal/errors" }, "Errors": { "description": "Errors returned on API failures", "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/Error" }, "x-go-name": "Errors" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock" }, "Event": { "description": "Event represents an update event to a topics state", "type": "object", "required": [ "topic", "data" ], "properties": { "data": { "description": "The current state for the topic", "x-go-name": "Data", "example": "{\"hostname\": \"s2-worker-7\",\"network\": {\"lan-outage-detected\": true,\"lan-outage-mode\": true}}" }, "topic": { "description": "The topic that the update event was triggered for", "type": "string", "x-go-name": "Topic", "example": "host" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/websocket" }, "HostState": { "description": "State contains information about the local node", "type": "object", "properties": { "hostname": { "description": "Hostname of the host node. This field is read only and will be kept up to date internally by Interlock", "type": "string", "x-go-name": "Hostname", "readOnly": true, "example": "s1-master-1" }, "network": { "$ref": "#/definitions/Network" }, "node-uid": { "description": "UID of the host node. This field is read only and will be kept up to date internally by Interlock", "type": "string", "x-go-name": "NodeUID", "readOnly": true, "example": "abcdefgh-3aee-438b-a2a8-b4de3a8f470f" }, "vnc": { "$ref": "#/definitions/VNCStates" } }, "x-go-name": "State", "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" }, "Instance": { "description": "Instance contains information for a specific Interlock pod", "type": "object", "properties": { "url": { "description": "URL of the Interlock pod", "type": "string", "x-go-name": "URL", "readOnly": true, "example": "http://1.2.3.4:80" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/instances" }, "InstancesState": { "description": "State contains information about the Interlock services running on the\ncluster", "type": "object", "properties": { "instances": { "description": "Information about the different Interlock pods running on the cluster.\nThis field is read only and will be kept up to date internally by\nInterlock", "type": "object", "additionalProperties": { "$ref": "#/definitions/Instance" }, "x-go-name": "Instances", "readOnly": true, "example": { "node-name": { "url": "http://1.2.3.4:80" } } } }, "x-go-name": "State", "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/instances" }, "Network": { "description": "Network contains information about the network status of the local\nnode", "type": "object", "required": [ "lan-outage-detected", "lan-outage-mode" ], "properties": { "lan-outage-detected": { "description": "Whether or not a current LAN outage has been detected", "type": "boolean", "x-go-name": "LANOutageDetected" }, "lan-outage-mode": { "description": "Whether or not the host node is currently in LAN outage mode", "type": "boolean", "x-go-name": "LANOutageMode" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" }, "VNC": { "description": "VNC represents a VNC state for a request", "type": "object", "properties": { "connections": { "description": "Connections is the number of active connections on the VNC request", "type": "integer", "format": "int64", "x-go-name": "Connections" }, "requestId": { "description": "RequestID is the ID of the VNC request", "type": "string", "x-go-name": "RequestID" }, "status": { "description": "Status is the status of the VNC request\nREQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected", "type": "string", "enum": [ "REQUESTED", "ACCEPTED", "SUSPENDED", "REJECTED", "DROPPED", "CONNECTED" ], "x-go-enum-desc": "REQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected", "x-go-name": "Status" }, "timestamp": { "description": "TimeStamp is the time when the VNC state was last updated", "type": "string", "x-go-name": "TimeStamp" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" }, "VNCStates": { "description": "VNC states is a slice of VNC objects", "type": "array", "items": { "$ref": "#/definitions/VNC" }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" }, "postVNCPayload": { "type": "object", "properties": { "connections": { "description": "Number of active connections on the VNC request. Only expected alongside a CONNECTED status.", "type": "integer", "format": "int64", "x-go-name": "Connections", "example": 2 }, "requestId": { "description": "RequestID is the ID of the VNC request", "type": "string", "x-go-name": "RequestID", "example": "11asd123a" }, "status": { "description": "VNC status of the node\nREQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected", "type": "string", "enum": [ "REQUESTED", "ACCEPTED", "SUSPENDED", "REJECTED", "DROPPED", "CONNECTED" ], "x-go-enum-desc": "REQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected", "x-go-name": "Status", "example": "ACCEPTED" }, "timestamp": { "description": "Timestamp of VNC state", "type": "string", "format": "date-time", "x-go-name": "TimeStamp", "example": "\"2006-01-02T15:04:05Z07:00\"" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" }, "putVNCPayload": { "type": "object", "properties": { "connections": { "description": "Number of active connections on the VNC request. Only expected alongside a CONNECTED status.", "type": "integer", "format": "int64", "x-go-name": "Connections", "example": 2 }, "requestId": { "description": "RequestID is the ID of the VNC request", "type": "string", "x-go-name": "RequestID", "example": "11asd123a" }, "status": { "description": "VNC status of the node\nin: body\nREQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected", "type": "string", "enum": [ "REQUESTED", "ACCEPTED", "SUSPENDED", "REJECTED", "CONNECTED" ], "x-go-enum-desc": "REQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected", "x-go-name": "Status", "example": "ACCEPTED" }, "timestamp": { "description": "Timestamp of VNC state", "type": "string", "format": "date-time", "x-go-name": "TimeStamp", "example": "\"2006-01-02T15:04:05Z07:00\"" } }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" }, "putVNCPayloads": { "type": "array", "items": { "$ref": "#/definitions/putVNCPayload" }, "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host" } }, "responses": { "ClusterStateResponse": { "description": "The request was successful", "schema": { "$ref": "#/definitions/ClusterState" } }, "ErrorResponse": { "description": "The request has failed", "schema": { "$ref": "#/definitions/Errors" } }, "EventResponse": { "description": "The request was successful", "schema": { "$ref": "#/definitions/Event" } }, "HostStateResponse": { "description": "The request was successful", "schema": { "$ref": "#/definitions/HostState" } }, "InstanceResponse": { "description": "The request was successful", "schema": { "$ref": "#/definitions/Instance" } }, "InstancesStateResponse": { "description": "The request was successful", "schema": { "$ref": "#/definitions/InstancesState" } } } }