#@ load("openapi.lib.yml", "response", "reference", "type", "array")

paths:
  /collections/{collection_name}/shards:
    put:
      tags:
        - Distributed
      summary: Create shard key
      operationId: create_shard_key
      requestBody:
        description: Shard key configuration
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateShardingKey"
      parameters:
        - name: collection_name
          in: path
          description: Name of the collection to create shards for
          required: true
          schema:
            type: string
        - name: timeout
          in: query
          description: |
            Wait for operation commit timeout in seconds.
            If timeout is reached - request will return with service error.
          schema:
            type: integer
            minimum: 1
      responses: #@ response(type("boolean"))
    get:
      tags:
        - Distributed
      summary: List shard keys
      operationId: list_shard_keys
      parameters:
        - name: collection_name
          in: path
          description: Name of the collection to list shard keys for
          required: true
          schema:
            type: string
      responses: #@ response(reference("ShardKeysResponse"))
  /collections/{collection_name}/shards/delete:
    post:
      tags:
        - Distributed
      summary: Delete shard key
      operationId: delete_shard_key
      requestBody:
        description: Select shard key to delete
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DropShardingKey"
      parameters:
        - name: collection_name
          in: path
          description: Name of the collection to create shards for
          required: true
          schema:
            type: string
        - name: timeout
          in: query
          description: |
            Wait for operation commit timeout in seconds.
            If timeout is reached - request will return with service error.
          schema:
            type: integer
            minimum: 1
      responses: #@ response(type("boolean"))
