# SPDX-FileCopyrightText: 2025 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

openapi: 3.0.3
info:
  title: Metadata Broker API
  description: Store to share Metadata across orch sub-systems
  version: 0.0.1alpha
servers:
- url: '{apiRoot}'
  variables:
    apiRoot:
      default: https://<multitenancy-gateway-host>
tags:
- name: MetadataService
security:
- BearerAuth: []
paths:
  /v1/projects/{projectName}/metadata:
    delete:
      description: Delete deletes the specified metadata, returning the newly updated
        set.
      operationId: MetadataService_Delete
      parameters:
      - in: query
        name: key
        schema:
          type: string
      - in: query
        name: value
        schema:
          type: string
      - description: unique projectName for the resource
        in: path
        name: projectName
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataResponse'
          description: OK
      tags:
      - MetadataService
    get:
      description: GetMetadata retrieves the most recently updates set.
      operationId: MetadataService_GetMetadata
      parameters:
      - description: unique projectName for the resource
        in: path
        name: projectName
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataResponse'
          description: OK
      tags:
      - MetadataService
    post:
      description: CreateOrUpdateMetadata creates or updates the specified metadata,
        returning the newly updates set.
      operationId: MetadataService_CreateOrUpdateMetadata
      parameters:
      - description: unique projectName for the resource
        in: path
        name: projectName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetadataList'
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataResponse'
          description: OK
      tags:
      - MetadataService
components:
  schemas:
    Metadata:
      description: Metadata represents a single value of metadata.
      properties:
        key:
          type: string
        value:
          type: string
      required:
      - key
      - value
      type: object
    MetadataList:
      properties:
        metadata:
          items:
            $ref: '#/components/schemas/Metadata'
          type: array
      required:
      - metadata
      type: object
    MetadataResponse:
      properties:
        metadata:
          items:
            $ref: '#/components/schemas/StoredMetadata'
          type: array
      required:
      - metadata
      type: object
    StoredMetadata:
      description: StoredMetadata represents all stored metadata values for a given
        key.
      properties:
        key:
          type: string
        values:
          items:
            type: string
          type: array
      required:
      - key
      - values
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
