Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger update #65

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// Terms Of Service:
//
// Schemes: http, https
// Host: localhost:8080
// Host: localhost:8089
// basePath: /api/ocloudNotifications/v1
// Version: 1.0.0
// Contact: Aneesh Puttur<aputtur@redhat.com>
//
Expand Down Expand Up @@ -196,7 +197,7 @@ func (s *Server) Start() {
api := r.PathPrefix(s.apiPath).Subrouter()

// createSubscription create subscription and send it to a channel that is shared by middleware to process
// swagger:operation POST /subscriptions/ subscription createSubscription
// swagger:operation POST /subscriptions subscription createSubscription
// ---
// summary: Creates a new subscription.
// description: If subscription creation is success(or if already exists), subscription will be returned with Created (201).
Expand Down Expand Up @@ -237,6 +238,17 @@ func (s *Server) Start() {
404 Subscription resources are not available (not created).
*/
api.HandleFunc("/subscriptions", s.getSubscriptions).Methods(http.MethodGet)
//publishers create publisher and send it to a channel that is shared by middleware to process
// swagger:operation GET /publishers/ publishers getPublishers
// ---
// summary: Get publishers.
// description: If publisher creation is success(or if already exists), publisher will be returned with Created (201).
// parameters:
// responses:
// "200":
// "$ref": "#/responses/publishers"
// "404":
// "$ref": "#/responses/notFound"
api.HandleFunc("/publishers", s.getPublishers).Methods(http.MethodGet)
// 200 and 404
api.HandleFunc("/subscriptions/{subscriptionid}", s.getSubscriptionByID).Methods(http.MethodGet)
Expand Down
78 changes: 62 additions & 16 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"version": "1.0.0"
},
"host": "localhost:8080",
"host": "localhost:8089",
"basePath": "/api/ocloudNotifications/v1",
"paths": {
"/create/event/": {
"post": {
Expand Down Expand Up @@ -50,6 +51,22 @@
}
},
"/publishers/": {
"get": {
"description": "If publisher creation is success(or if already exists), publisher will be returned with Created (201).",
"tags": [
"publishers"
],
"summary": "Get publishers.",
"operationId": "getPublishers",
"responses": {
"200": {
"$ref": "#/responses/publishers"
},
"404": {
"$ref": "#/responses/notFound"
}
}
},
"post": {
"description": "If publisher creation is success(or if already exists), publisher will be returned with Created (201).",
"tags": [
Expand Down Expand Up @@ -77,7 +94,7 @@
}
}
},
"/subscriptions/": {
"/subscriptions": {
"post": {
"description": "If subscription creation is success(or if already exists), subscription will be returned with Created (201).",
"tags": [
Expand All @@ -104,12 +121,37 @@
}
}
}
},
"/subscriptions/status": {
"post": {
"description": "If publisher status ping is success, call will be returned with status accepted.",
"tags": [
"subscriptions"
],
"summary": "Get status of publishing events.",
"operationId": "pingForSubscribedEventStatus",
"parameters": [
{
"description": "subscription id to check status for",
"name": "subscriptionid"
}
],
"responses": {
"201": {
"$ref": "#/responses/pubSubResp"
},
"400": {
"$ref": "#/responses/badReq"
}
}
}
}
},
"definitions": {
"Data": {
"description": "Data ... cloud native events data\nData Json payload is as follows,\n{\n\"version\": \"v1.0\",\n\"values\": [{\n\"resource\": \"/cluster/node/ptp\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}, {\n\"resource\": \"/cluster/node/clock\",\n\"dataType\": \"metric\",\n\"valueType\": \"decimal64.3\",\n\"value\": 100.3\n}]\n}",
"description": "{\n\"version\": \"v1.0\",\n\"values\": [{\n\"resource\": \"/sync/sync-status/sync-state\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}, {\n\"resource\": \"/sync/sync-status/sync-state\",\n\"dataType\": \"metric\",\n\"valueType\": \"decimal64.3\",\n\"value\": 100.3\n}, {\n\"resource\": \"/redfish/v1/Systems\",\n\"dataType\": \"notification\",\n\"valueType\": \"redfish-event\",\n\"value\": {\n\"@odata.context\": \"/redfish/v1/$metadata#Event.Event\",\n\"@odata.type\": \"#Event.v1_3_0.Event\",\n\"Context\": \"any string is valid\",\n\"Events\": [{\"EventId\": \"2162\", \"MemberId\": \"615703\", \"MessageId\": \"TMP0100\"}],\n\"Id\": \"5e004f5a-e3d1-11eb-ae9c-3448edf18a38\",\n\"Name\": \"Event Array\"\n}\n}]\n}",
"type": "object",
"title": "Data ... cloud native events data\nData Json payload is as follows,",
"properties": {
"values": {
"type": "array",
Expand All @@ -131,9 +173,9 @@
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"DataValue": {
"description": "DataValue Json payload is as follows,\n{\n\"resource\": \"/cluster/node/ptp\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}",
"description": "{\n\"resource\": \"/cluster/node/ptp\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}",
"type": "object",
"title": "DataValue ...",
"title": "DataValue ...\nDataValue Json payload is as follows,",
"properties": {
"dataType": {
"$ref": "#/definitions/DataType"
Expand All @@ -143,7 +185,6 @@
"x-go-name": "Resource"
},
"value": {
"type": "object",
"x-go-name": "Value"
},
"valueType": {
Expand All @@ -153,9 +194,9 @@
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"Event": {
"description": "Event Json payload is as follows,\n{\n\"id\": \"5ce55d17-9234-4fee-a589-d0f10cb32b8e\",\n\"type\": \"event.synchronization-state-chang\",\n\"time\": \"2021-02-05T17:31:00Z\",\n\"data\": {\n\"version\": \"v1.0\",\n\"values\": [{\n\"resource\": \"/cluster/node/ptp\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}, {\n\"resource\": \"/cluster/node/clock\",\n\"dataType\": \"metric\",\n\"valueType\": \"decimal64.3\",\n\"value\": 100.3\n}]\n}\n}\nEvent request model",
"description": "{\n\"id\": \"5ce55d17-9234-4fee-a589-d0f10cb32b8e\",\n\"type\": \"event.sync.sync-status.synchronization-state-change\",\n\"source\": \"/cluster/node/example.com/ptp/clock_realtime\",\n\"time\": \"2021-02-05T17:31:00Z\",\n\"data\": {\n\"version\": \"v1.0\",\n\"values\": [{\n\"resource\": \"/sync/sync-status/sync-state\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}, {\n\"resource\": \"/sync/sync-status/sync-state\",\n\"dataType\": \"metric\",\n\"valueType\": \"decimal64.3\",\n\"value\": 100.3\n}]\n}\n}\n\nEvent request model",
"type": "object",
"title": "Event represents the canonical representation of a Cloud Native Event.",
"title": "Event represents the canonical representation of a Cloud Native Event.\nEvent Json payload is as follows,",
"properties": {
"data": {
"$ref": "#/definitions/Data"
Expand All @@ -173,8 +214,15 @@
"type": "string",
"x-go-name": "ID"
},
"source": {
"description": "Source - The source of the occurrence which has happened.\n+required",
"type": "string",
"x-go-name": "Source"
},
"time": {
"$ref": "#/definitions/Timestamp"
"description": "Time - A Timestamp when the event happened.\n+required",
"type": "string",
"x-go-name": "Time"
},
"type": {
"description": "Type - The type of the occurrence which has happened.\n+required",
Expand All @@ -185,9 +233,9 @@
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"PubSub": {
"description": "PubSub Json request payload is as follows,\n{\n\"id\": \"789be75d-7ac3-472e-bbbc-6d62878aad4a\",\n\"endpointUri\": \"http://localhost:9090/ack/event\",\n\"uriLocation\": \"http://localhost:8080/api/ocloudNotifications/v1/publishers/{publisherid}\",\n\"resource\": \"/east-edge-10/vdu3/o-ran-sync/sync-group/sync-status/sync-state\"\n}\nPubSub request model",
"description": "{\n\"id\": \"789be75d-7ac3-472e-bbbc-6d62878aad4a\",\n\"endpointUri\": \"http://localhost:9090/ack/event\",\n\"uriLocation\": \"http://localhost:8080/api/ocloudNotifications/v1/publishers/{publisherid}\",\n\"resource\": \"/east-edge-10/vdu3/o-ran-sync/sync-group/sync-status/sync-state\"\n}\n\nPubSub request model",
"type": "object",
"title": "PubSub represents the canonical representation of a Cloud Native Event Publisher and Subscribers .",
"title": "PubSub represents the canonical representation of a Cloud Native Event Publisher and Sender .\nPubSub Json request payload is as follows,",
"properties": {
"endpointUri": {
"$ref": "#/definitions/URI"
Expand All @@ -208,11 +256,6 @@
},
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/pubsub"
},
"Timestamp": {
"description": "Timestamp wraps time.Time to normalize the time layout to RFC3339. It is\nintended to enforce compliance with the Cloud Native events spec for their\ndefinition of Timestamp. Custom marshal methods are implemented to ensure\nthe outbound Timestamp is a string in the RFC3339 layout.",
"type": "object",
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/types"
},
"URI": {
"description": "URI is a wrapper to url.URL. It is intended to enforce compliance with\nthe Cloud Native Events spec for their definition of URI. Custom\nmarshal methods are implemented to ensure the outbound URI object\nis a flat string.",
"type": "object",
Expand All @@ -226,6 +269,9 @@
"Host": {
"type": "string"
},
"OmitHost": {
"type": "boolean"
},
"Opaque": {
"type": "string"
},
Expand Down
Loading
Loading