From 0b8878d308801b4fc466376ed50ad75da5f5fb26 Mon Sep 17 00:00:00 2001
From: "Stanislav_Riabokon@epam.com" <Stanislav_Riabokon@epam.com>
Date: Sun, 3 Dec 2023 15:22:03 +0200
Subject: [PATCH] Added indexer_openapi.yaml

---
 docs/api/indexer_openapi.yaml                | 511 +++++++++++++++++++
 provider/indexer-gc/docs/baremetal/README.md |  18 +
 provider/indexer-gc/docs/gc/README.md        |  18 +
 3 files changed, 547 insertions(+)
 create mode 100644 docs/api/indexer_openapi.yaml

diff --git a/docs/api/indexer_openapi.yaml b/docs/api/indexer_openapi.yaml
new file mode 100644
index 000000000..2f7986e52
--- /dev/null
+++ b/docs/api/indexer_openapi.yaml
@@ -0,0 +1,511 @@
+openapi: 3.0.1
+info:
+  title: Indexer Service
+  description: Indexer service creates an index, which is a methodical arrangement of records designed to enable users to locate information quickly.
+  contact:
+    name: OSDU Data Platform Team
+    email: dps@OSDU.org
+  license:
+    name: Apache 2.0
+    url: https://www.apache.org/licenses/LICENSE-2.0.html
+  version: '2.0'
+servers:
+  - url: /api/indexer/v2
+security:
+  - Authorization: []
+tags:
+  - name: partition-setup-api
+    description: Partition Setup API
+  - name: reindex-api
+    description: Reindex API
+  - name: health-check-api
+    description: Health Check API
+  - name: cleanup-indicies-api
+    description: Cleanup Indicies API
+  - name: info
+    description: Version info endpoint
+paths:
+  /partitions/provision:
+    put:
+      tags:
+        - partition-setup-api
+      summary: Provision partition
+      description: 'Provision partition. Required roles: `users.datalake.ops`'
+      operationId: provisionPartition
+      parameters:
+        - name: data-partition-id
+          in: header
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: OK
+          content:
+            '*/*':
+              schema:
+                type: object
+        '400':
+          description: Bad Request
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '401':
+          description: Unauthorized
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '403':
+          description: User not authorized to perform the action
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '404':
+          description: Not Found
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '500':
+          description: Internal Server Error
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '502':
+          description: Bad Gateway
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '503':
+          description: Service Unavailable
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+      security:
+        - Authorization: []
+  /reindex:
+    post:
+      tags:
+        - reindex-api
+      summary: Re-index given 'kind'
+      description: 'This API allows users to re-index a ''kind'' without re-ingesting the records via storage API. Required roles: `service.search.admin`'
+      operationId: reindex
+      parameters:
+        - name: force_clean
+          in: query
+          description: Force Clean
+          required: false
+          schema:
+            type: boolean
+            default: false
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/RecordReindexRequest'
+        required: true
+      responses:
+        '200':
+          description: OK
+          content:
+            '*/*':
+              schema:
+                type: object
+        '400':
+          description: Bad Request
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '401':
+          description: Unauthorized
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '403':
+          description: User not authorized to perform the action
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '404':
+          description: Not Found
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '500':
+          description: Internal Server Error
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '502':
+          description: Bad Gateway
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '503':
+          description: Service Unavailable
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+      security:
+        - Authorization: []
+    patch:
+      tags:
+        - reindex-api
+      summary: Full Re-index by data partition
+      description: 'This API allows users to re-index an entire partition without re-ingesting the records via storage API.Required roles: `users.datalake.ops`'
+      operationId: fullReindex
+      parameters:
+        - name: force_clean
+          in: query
+          description: Force Clean
+          required: false
+          schema:
+            type: boolean
+            default: false
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: OK
+          content:
+            '*/*':
+              schema:
+                type: string
+        '400':
+          description: Bad Request
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '401':
+          description: Unauthorized
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '403':
+          description: User not authorized to perform the action
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '404':
+          description: Not Found
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '500':
+          description: Internal Server Error
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '502':
+          description: Bad Gateway
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '503':
+          description: Service Unavailable
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+      security:
+        - Authorization: []
+  /reindex/records:
+    post:
+      tags:
+        - reindex-api
+      summary: Re-index given records
+      description: 'This API allows users to re-index the given records by providing record ids without re-ingesting the records via storage API. Required roles: `service.search.admin`'
+      operationId: reindexRecords
+      parameters:
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/ReindexRecordsRequest'
+        required: true
+      responses:
+        '202':
+          description: Accepted
+          content:
+            '*/*':
+              schema:
+                type: object
+        '400':
+          description: Bad Request
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '401':
+          description: Unauthorized
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '403':
+          description: User not authorized to perform the action
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '404':
+          description: Not Found
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '500':
+          description: Internal Server Error
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '502':
+          description: Bad Gateway
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '503':
+          description: Service Unavailable
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/AppError'
+      security:
+        - Authorization: []
+  /readiness_check:
+    get:
+      tags:
+        - health-check-api
+      summary: Readiness Check endpoint
+      description: For deployment available public `/readiness_check` endpoint.
+      operationId: readinessCheck
+      parameters:
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: OK
+          content:
+            '*/*':
+              schema:
+                type: string
+  /liveness_check:
+    get:
+      tags:
+        - health-check-api
+      summary: Liveness Check endpoint
+      description: For deployment available public `/liveness_check` endpoint.
+      operationId: livenessCheck
+      parameters:
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: OK
+          content:
+            '*/*':
+              schema:
+                type: string
+  /info:
+    get:
+      tags:
+        - info
+      summary: Version info
+      description: For deployment available public `/info` endpoint, which provides build and git related information.
+      operationId: info
+      parameters:
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: Version info.
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/VersionInfo'
+  /index:
+    delete:
+      tags:
+        - cleanup-indicies-api
+      summary: Delete Index for the given kind
+      description: 'Delete Index for the given kind. Required roles: `users.datalake.ops`'
+      operationId: deleteIndex
+      parameters:
+        - name: kind
+          in: query
+          description: Kind
+          required: true
+          schema:
+            type: string
+          example: tenant1:public:well:1.0.2
+        - name: data-partition-id
+          in: header
+          description: Data Partition Id
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                type: string
+        '400':
+          description: Bad Request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '401':
+          description: Unauthorized
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '403':
+          description: User not authorized to perform the action
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '404':
+          description: Not Found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '500':
+          description: Internal Server Error
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '502':
+          description: Bad Gateway
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+        '503':
+          description: Service Unavailable
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/AppError'
+      security:
+        - Authorization: []
+components:
+  schemas:
+    AppError:
+      type: object
+      properties:
+        code:
+          type: integer
+          format: int32
+        reason:
+          type: string
+        message:
+          type: string
+    RecordReindexRequest:
+      required:
+        - kind
+      type: object
+      properties:
+        kind:
+          type: string
+        cursor:
+          type: string
+    ReindexRecordsRequest:
+      required:
+        - recordIds
+      type: object
+      properties:
+        recordIds:
+          maxItems: 1000
+          minItems: 1
+          type: array
+          items:
+            type: string
+    ConnectedOuterService:
+      type: object
+      properties:
+        name:
+          type: string
+        version:
+          type: string
+    VersionInfo:
+      type: object
+      properties:
+        groupId:
+          type: string
+        artifactId:
+          type: string
+        version:
+          type: string
+        buildTime:
+          type: string
+        branch:
+          type: string
+        commitId:
+          type: string
+        commitMessage:
+          type: string
+        connectedOuterServices:
+          type: array
+          items:
+            $ref: '#/components/schemas/ConnectedOuterService'
+  securitySchemes:
+    Authorization:
+      type: http
+      scheme: bearer
+      bearerFormat: Authorization
\ No newline at end of file
diff --git a/provider/indexer-gc/docs/baremetal/README.md b/provider/indexer-gc/docs/baremetal/README.md
index 270fa5070..558013905 100644
--- a/provider/indexer-gc/docs/baremetal/README.md
+++ b/provider/indexer-gc/docs/baremetal/README.md
@@ -284,3 +284,21 @@ Execute following command to build code and run all the integration tests:
 #       above are already exported in your environment.
 $ (cd testing/indexer-test-baremetal/ && mvn clean test)
 ```
+
+## License
+
+Copyright © Google LLC
+
+Copyright © EPAM Systems
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/provider/indexer-gc/docs/gc/README.md b/provider/indexer-gc/docs/gc/README.md
index 97c9c832c..76280f83f 100644
--- a/provider/indexer-gc/docs/gc/README.md
+++ b/provider/indexer-gc/docs/gc/README.md
@@ -218,3 +218,21 @@ Execute following command to build code and run all the integration tests:
 #       above are already exported in your environment.
 $ (cd testing/indexer-test-gc/ && mvn clean test)
 ```
+
+## License
+
+Copyright © Google LLC
+
+Copyright © EPAM Systems
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
-- 
GitLab