diff --git a/server/models/models.go b/server/models/models.go index db54eb2..e28292f 100644 --- a/server/models/models.go +++ b/server/models/models.go @@ -4,6 +4,8 @@ import ( "encoding/json" ) +type JSONRawMessage json.RawMessage + type CloudEventReceived struct { CloudEvent struct { ID string `json:"id"` @@ -53,7 +55,7 @@ type CloudEventReceived struct { Value string `json:"Value"` } `json:"Vm"` } `json:"Vm"` - ConfigSpec *json.RawMessage `json:"configSpec"` + ConfigSpec *JSONRawMessage `json:"configSpec" swaggertype:"object"` ConfigChanges *ConfigChangesReceived `json:"configChanges"` // Modified to separate struct } `json:"data"` } `json:"cloudEvent"` diff --git a/server/router/docs/docs.go b/server/router/docs/docs.go index 8e029de..3e6b1e6 100644 --- a/server/router/docs/docs.go +++ b/server/router/docs/docs.go @@ -665,7 +665,156 @@ const docTemplate = `{ }, "definitions": { "models.CloudEventReceived": { - "type": "object" + "type": "object", + "properties": { + "cloudEvent": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "ChainId": { + "type": "integer" + }, + "ChangeTag": { + "type": "string" + }, + "ComputeResource": { + "type": "object", + "properties": { + "ComputeResource": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "Name": { + "type": "string" + } + } + }, + "CreatedTime": { + "description": "Modified from time.Time", + "type": "string" + }, + "Datacenter": { + "type": "object", + "properties": { + "Datacenter": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "Name": { + "type": "string" + } + } + }, + "Ds": {}, + "Dvs": {}, + "FullFormattedMessage": { + "type": "string" + }, + "Host": { + "type": "object", + "properties": { + "Host": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "Name": { + "type": "string" + } + } + }, + "Key": { + "type": "integer" + }, + "Net": {}, + "NewParent": { + "$ref": "#/definitions/models.CloudEventResourcePool" + }, + "OldParent": { + "$ref": "#/definitions/models.CloudEventResourcePool" + }, + "SrcTemplate": { + "$ref": "#/definitions/models.CloudEventVm" + }, + "Template": { + "type": "boolean" + }, + "UserName": { + "type": "string" + }, + "Vm": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Vm": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + } + } + }, + "configChanges": { + "description": "Modified to separate struct", + "allOf": [ + { + "$ref": "#/definitions/models.ConfigChangesReceived" + } + ] + }, + "configSpec": { + "type": "object" + } + } + }, + "id": { + "type": "string" + }, + "source": { + "type": "string" + }, + "specversion": { + "type": "string" + }, + "time": { + "description": "Modified from time.Time", + "type": "string" + }, + "type": { + "type": "string" + } + } + } + } }, "models.CloudEventResourcePool": { "type": "object", @@ -705,6 +854,14 @@ const docTemplate = `{ } } }, + "models.ConfigChangesReceived": { + "type": "object", + "properties": { + "modified": { + "type": "string" + } + } + }, "models.ImportReceived": { "type": "object", "properties": { diff --git a/server/router/docs/swagger.json b/server/router/docs/swagger.json index 62e3124..4fb3fa4 100644 --- a/server/router/docs/swagger.json +++ b/server/router/docs/swagger.json @@ -654,7 +654,156 @@ }, "definitions": { "models.CloudEventReceived": { - "type": "object" + "type": "object", + "properties": { + "cloudEvent": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "ChainId": { + "type": "integer" + }, + "ChangeTag": { + "type": "string" + }, + "ComputeResource": { + "type": "object", + "properties": { + "ComputeResource": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "Name": { + "type": "string" + } + } + }, + "CreatedTime": { + "description": "Modified from time.Time", + "type": "string" + }, + "Datacenter": { + "type": "object", + "properties": { + "Datacenter": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "Name": { + "type": "string" + } + } + }, + "Ds": {}, + "Dvs": {}, + "FullFormattedMessage": { + "type": "string" + }, + "Host": { + "type": "object", + "properties": { + "Host": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "Name": { + "type": "string" + } + } + }, + "Key": { + "type": "integer" + }, + "Net": {}, + "NewParent": { + "$ref": "#/definitions/models.CloudEventResourcePool" + }, + "OldParent": { + "$ref": "#/definitions/models.CloudEventResourcePool" + }, + "SrcTemplate": { + "$ref": "#/definitions/models.CloudEventVm" + }, + "Template": { + "type": "boolean" + }, + "UserName": { + "type": "string" + }, + "Vm": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Vm": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + } + } + }, + "configChanges": { + "description": "Modified to separate struct", + "allOf": [ + { + "$ref": "#/definitions/models.ConfigChangesReceived" + } + ] + }, + "configSpec": { + "type": "object" + } + } + }, + "id": { + "type": "string" + }, + "source": { + "type": "string" + }, + "specversion": { + "type": "string" + }, + "time": { + "description": "Modified from time.Time", + "type": "string" + }, + "type": { + "type": "string" + } + } + } + } }, "models.CloudEventResourcePool": { "type": "object", @@ -694,6 +843,14 @@ } } }, + "models.ConfigChangesReceived": { + "type": "object", + "properties": { + "modified": { + "type": "string" + } + } + }, "models.ImportReceived": { "type": "object", "properties": { diff --git a/server/router/docs/swagger.yaml b/server/router/docs/swagger.yaml index 44e1a19..193708d 100644 --- a/server/router/docs/swagger.yaml +++ b/server/router/docs/swagger.yaml @@ -1,5 +1,101 @@ definitions: models.CloudEventReceived: + properties: + cloudEvent: + properties: + data: + properties: + ChainId: + type: integer + ChangeTag: + type: string + ComputeResource: + properties: + ComputeResource: + properties: + Type: + type: string + Value: + type: string + type: object + Name: + type: string + type: object + CreatedTime: + description: Modified from time.Time + type: string + Datacenter: + properties: + Datacenter: + properties: + Type: + type: string + Value: + type: string + type: object + Name: + type: string + type: object + Ds: {} + Dvs: {} + FullFormattedMessage: + type: string + Host: + properties: + Host: + properties: + Type: + type: string + Value: + type: string + type: object + Name: + type: string + type: object + Key: + type: integer + Net: {} + NewParent: + $ref: '#/definitions/models.CloudEventResourcePool' + OldParent: + $ref: '#/definitions/models.CloudEventResourcePool' + SrcTemplate: + $ref: '#/definitions/models.CloudEventVm' + Template: + type: boolean + UserName: + type: string + Vm: + properties: + Name: + type: string + Vm: + properties: + Type: + type: string + Value: + type: string + type: object + type: object + configChanges: + allOf: + - $ref: '#/definitions/models.ConfigChangesReceived' + description: Modified to separate struct + configSpec: + type: object + type: object + id: + type: string + source: + type: string + specversion: + type: string + time: + description: Modified from time.Time + type: string + type: + type: string + type: object type: object models.CloudEventResourcePool: properties: @@ -25,6 +121,11 @@ definitions: type: string type: object type: object + models.ConfigChangesReceived: + properties: + modified: + type: string + type: object models.ImportReceived: properties: Cluster: