Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
jzding committed May 19, 2024
1 parent 409f581 commit 6a89018
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 24 deletions.
14 changes: 13 additions & 1 deletion 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<[email protected]>
//
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
86 changes: 63 additions & 23 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 @@ -140,16 +157,20 @@
"type": "array",
"items": {
"$ref": "#/definitions/DataValue"
}
},
"x-go-name": "Values"
},
"version": {
"type": "string"
"type": "string",
"x-go-name": "Version"
}
}
},
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"DataType": {
"type": "string",
"title": "DataType ..."
"title": "DataType ...",
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"DataValue": {
"description": "{\n\"resource\": \"/cluster/node/ptp\",\n\"dataType\": \"notification\",\n\"valueType\": \"enumeration\",\n\"value\": \"ACQUIRING-SYNC\"\n}",
Expand All @@ -160,13 +181,17 @@
"$ref": "#/definitions/DataType"
},
"resource": {
"type": "string"
"type": "string",
"x-go-name": "Resource"
},
"value": {
"x-go-name": "Value"
},
"value": {},
"valueType": {
"$ref": "#/definitions/ValueType"
}
}
},
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"Event": {
"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",
Expand All @@ -178,28 +203,34 @@
},
"dataContentType": {
"description": "DataContentType - the Data content type\n+required",
"type": "string"
"type": "string",
"x-go-name": "DataContentType"
},
"dataSchema": {
"$ref": "#/definitions/URI"
},
"id": {
"description": "ID of the event; must be non-empty and unique within the scope of the producer.\n+required",
"type": "string"
"type": "string",
"x-go-name": "ID"
},
"source": {
"description": "Source - The source of the occurrence which has happened.\n+required",
"type": "string"
"type": "string",
"x-go-name": "Source"
},
"time": {
"description": "Time - A Timestamp when the event happened.\n+required",
"type": "string"
"type": "string",
"x-go-name": "Time"
},
"type": {
"description": "Type - The type of the occurrence which has happened.\n+required",
"type": "string"
"type": "string",
"x-go-name": "Type"
}
}
},
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
},
"PubSub": {
"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",
Expand All @@ -211,16 +242,19 @@
},
"id": {
"description": "ID of the pub/sub; is updated on successful creation of publisher/subscription.",
"type": "string"
"type": "string",
"x-go-name": "ID"
},
"resource": {
"description": "Resource - The type of the Resource.\n+required",
"type": "string"
"type": "string",
"x-go-name": "Resource"
},
"uriLocation": {
"$ref": "#/definitions/URI"
}
}
},
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/pubsub"
},
"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.",
Expand Down Expand Up @@ -259,15 +293,18 @@
"User": {
"$ref": "#/definitions/Userinfo"
}
}
},
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/types"
},
"Userinfo": {
"description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.",
"type": "object"
"type": "object",
"x-go-package": "net/url"
},
"ValueType": {
"type": "string",
"title": "ValueType ..."
"title": "ValueType ...",
"x-go-package": "github.com/redhat-cne/sdk-go/pkg/event"
}
},
"responses": {
Expand All @@ -279,7 +316,8 @@
"code": {
"description": "HTTP status code 202 - Accepted",
"type": "integer",
"format": "int64"
"format": "int64",
"x-go-name": "Code"
}
}
}
Expand All @@ -292,7 +330,8 @@
"code": {
"description": "HTTP status code 400 - Bad Request",
"type": "integer",
"format": "int64"
"format": "int64",
"x-go-name": "Code"
}
}
}
Expand All @@ -311,7 +350,8 @@
"code": {
"description": "HTTP status code 404 - Not Found",
"type": "integer",
"format": "int64"
"format": "int64",
"x-go-name": "Code"
}
}
}
Expand Down

0 comments on commit 6a89018

Please sign in to comment.