Added openapi 72/121072/13
authorRenu Kumari <renu.kumari@bell.ca>
Tue, 4 May 2021 13:02:14 +0000 (09:02 -0400)
committerRishi Chail <rishi.chail@est.tech>
Fri, 7 May 2021 08:06:25 +0000 (08:06 +0000)
Issue-ID: CPS-251
Signed-off-by: Renu Kumari <renu.kumari@bell.ca>
Change-Id: I3afbd52836d85111ea45e3b19a467a2b6275e650

docs/api/swagger/openapi.yml [new file with mode: 0644]

diff --git a/docs/api/swagger/openapi.yml b/docs/api/swagger/openapi.yml
new file mode 100644 (file)
index 0000000..a8c27e6
--- /dev/null
@@ -0,0 +1,238 @@
+openapi: 3.0.1
+info:
+  title: ONAP Open API v3 Configuration Persistence Service - Temporal
+  description: CPS-Temporal is time-series database for network data
+  version: 1.0.0
+  contact:
+    name: ONAP
+    url: 'https://onap.readthedocs.io'
+    email: onap-discuss@lists.onap.org
+  license:
+    name: Apache 2.0
+    url: 'http://www.apache.org/licenses/LICENSE-2.0'
+  x-planned-retirement-date: '202212'
+  x-component: Modeling
+servers:
+  - url: '//localhost:8088/cps-temporal/api'
+tags:
+  - name: cps-temporal-query
+    description: CPS Temporal Query
+paths:
+  '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/history':
+    get:
+      description: 'Read the data for the specified anchor based on filter criteria provided in query parameters'
+      tags:
+        - cps-temporal-query
+      summary: Get anchor data by name
+      operationId: getAnchorDataByName
+      parameters:
+        - $ref: '#/components/parameters/dataspaceName'
+        - name: anchor-name
+          in: path
+          description: Anchor Name
+          required: true
+          schema:
+            type: string
+        - $ref: '#/components/parameters/after'
+        - $ref: '#/components/parameters/simplePayloadFilter'
+        - $ref: '#/components/parameters/pointInTime'
+        - $ref: '#/components/parameters/pageNumber'
+        - $ref: '#/components/parameters/pageLimit'
+        - $ref: '#/components/parameters/sort'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AnchorDataByNameResponse'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '403':
+          $ref: '#/components/responses/Forbidden'
+  '/v1/dataspaces/{dataspace-name}/anchors/history':
+    get:
+      description: 'Read anchors data based on filter criteria provided in query parameters'
+      tags:
+        - cps-temporal-query
+      summary: Get anchors data based on filter criteria
+      operationId: getAnchorsDataByFilter
+      parameters:
+        - $ref: '#/components/parameters/dataspaceName'
+        - name: schemaset-name
+          in: query
+          description: Schema-set name
+          required: true
+          schema:
+            type: string
+        - $ref: '#/components/parameters/after'
+        - $ref: '#/components/parameters/simplePayloadFilter'
+        - $ref: '#/components/parameters/pointInTime'
+        - $ref: '#/components/parameters/pageNumber'
+        - $ref: '#/components/parameters/pageLimit'
+        - $ref: '#/components/parameters/sort'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AnchorsDataByFilterResponse'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '403':
+          $ref: '#/components/responses/Forbidden'
+components:
+  parameters:
+    dataspaceName:
+      name: dataspace-name
+      in: path
+      description: Dataspace Name
+      required: true
+      schema:
+        type: string
+    after:
+      name: after
+      in: query
+      description: Fetch data after <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
+      required: false
+      schema:
+        type: string
+        example: '2021-03-21T00:00:00.000000-0:00'
+    simplePayloadFilter:
+      name: simplePayloadFilter
+      in: query
+      description: Payload filter
+      required: false
+      schema:
+        type: string
+    pointInTime:
+      name: pointInTime
+      in: query
+      description: Consider data modified before <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
+      required: false
+      schema:
+        type: string
+        example: '2021-03-21T00:00:00.000000-0:00'
+    pageLimit:
+      in: query
+      name: pageLimit
+      required: false
+      schema:
+        type: integer
+        minimum: 0
+        maximum: 10000
+        default: 1000
+      description: The numbers of items to return
+    pageNumber:
+      name: pageNumber
+      in: query
+      description: Page number
+      required: false
+      schema:
+        type: integer
+        minimum: 0
+        default: 0
+    sort:
+      in: query
+      name: sort
+      required: false
+      schema:
+        type: string
+        default: timestamp:desc
+      description: "Sort by timestamp in 'asc' or 'desc' order. Supported values: <br/> timestamp:desc<br/>timestamp:asc"
+  responses:
+    BadRequest:
+      description: Bad Request
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/ErrorMessage'
+    Unauthorized:
+      description: Unauthorized
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/ErrorMessage'
+    Forbidden:
+      description: Forbidden
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/ErrorMessage'
+  schemas:
+    AnchorHistory:
+      type: object
+      title: AnchorHistory
+      properties:
+        nextRecordsLink:
+          type: string
+          example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=2
+        previousRecordsLink:
+          type: string
+          example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=0
+        records:
+          type: array
+          items:
+            type: object
+            properties:
+              timestamp:
+                type: string
+                format: date-time
+                example: '2021-03-21T00:00:00.000000-0:00'
+              dataspace:
+                type: string
+                example: 'my-dataspace'
+              schemaSet:
+                type: string
+                example: 'my-schema-set'
+              anchor:
+                type: string
+                example: 'my-anchor'
+              data:
+                type: object
+                example: { "status" : "UP" }
+      required:
+        - records
+
+    AnchorsDataByFilterResponse:
+      allOf:     # Combines the BasicErrorModel and the inline model
+        - $ref: '#/components/schemas/AnchorHistory'
+        - title: getAnchorDataByNameResponse
+          properties:
+            nextRecordsLink:
+              type: string
+              example: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=2
+            previousRecordsLink:
+              type: string
+              example: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=0
+
+    AnchorDataByNameResponse:
+      allOf:     # Combines the BasicErrorModel and the inline model
+        - $ref: '#/components/schemas/AnchorHistory'
+        - title: getAnchorDataByNameResponse
+          properties:
+            nextRecordsLink:
+              type: string
+              example: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=2
+            previousRecordsLink:
+              type: string
+              example: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=0
+
+    ErrorMessage:
+      type: object
+      title: Error
+      properties:
+        status:
+          type: string
+          example: 400
+        message:
+          type: string
+          example: Data could not be fetched
+        details:
+          type: string
+          example: "after parameter should have datetime value in ISO format yyyy-MM-ddTHH:mm:ss.SSSZ"