Kubeshop template API

The template API from Kubeshop — 2 operation(s) for template.

OpenAPI Specification

kubeshop-template-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Testkube Standalone Agent api template API
  description: API for Testkube Standalone Agent
  contact:
    email: info@testkube.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: 1.0.0
servers:
- url: https://api.testkube.io
  description: Testkube Cloud Control Plane API Endpoint
- url: https://<your-testkube-api-host>
  description: Testkube On-Prem API Endpoint
tags:
- name: template
paths:
  /templates:
    post:
      tags:
      - template
      summary: Create new template
      description: Create new template based on variables passed in request
      operationId: createTemplate
      requestBody:
        description: template request body data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateCreateRequest'
          text/yaml:
            schema:
              type: string
      responses:
        200:
          description: successful operation
          content:
            text/yaml:
              schema:
                type: string
        201:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        400:
          description: problem with template definition - probably some bad input occurs (invalid JSON body or similar)
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    delete:
      tags:
      - template
      summary: Delete templates
      description: Deletes labeled templates
      operationId: deleteTemplates
      parameters:
      - $ref: '#/components/parameters/Selector'
      responses:
        204:
          description: no content
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /templates/{id}:
    delete:
      parameters:
      - $ref: '#/components/parameters/ID'
      tags:
      - template
      summary: Delete template
      description: Deletes template by its name
      operationId: deleteTemplate
      responses:
        204:
          description: template deleted successfuly
        404:
          description: template not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    get:
      parameters:
      - $ref: '#/components/parameters/ID'
      tags:
      - template
      summary: Get template details
      description: Returns template
      operationId: getTemplate
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
            text/yaml:
              schema:
                type: string
        400:
          description: problem with input for CRD generation
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: template not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with getting template data
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    patch:
      parameters:
      - $ref: '#/components/parameters/ID'
      tags:
      - template
      summary: Update new template
      description: Update new template based on variables passed in request
      operationId: updateTemplate
      requestBody:
        description: template request body data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateUpdateRequest'
          text/yaml:
            schema:
              type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        400:
          description: problem with template definition - probably some bad input occurs (invalid JSON body or similar)
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: template not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
components:
  parameters:
    Selector:
      in: query
      name: selector
      schema:
        type: string
        description: Labels to filter by
    ID:
      in: path
      name: id
      schema:
        type: string
      required: true
      description: unique id of the object
  schemas:
    TemplateType:
      description: template type by purpose
      type: string
      enum:
      - job
      - container
      - cronjob
      - scraper
      - pvc
      - webhook
      - pod
    Problem:
      description: problem response in case of error
      type: object
      properties:
        type:
          type: string
          description: Type contains a URI that identifies the problem type.
          example: https://kubeshop.io/testkube/problems/invalidtestname
        title:
          type: string
          description: Title is a short, human-readable summary of the problem type. This title SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
          example: Invalid test name
        status:
          type: integer
          description: HTTP status code for this occurrence of the problem.
          example: 500
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem.
          example: Your test name can't contain forbidden characters like "}}}" passed
        instance:
          type: string
          description: A URI that identifies the specific occurrence of the problem. This URI may or may not yield further information if de-referenced.
          example: http://10.23.23.123:8088/tests
    Template:
      description: Golang based template
      type: object
      required:
      - name
      - type
      - body
      properties:
        name:
          type: string
          description: template name for reference
          example: webhook-template
        namespace:
          type: string
          description: template namespace
          example: testkube
        type:
          $ref: '#/components/schemas/TemplateType'
        body:
          type: string
          description: template body to use
          example: '{"id": "{{ .Id }}"}'
        labels:
          type: object
          description: template labels
          additionalProperties:
            type: string
          example:
            env: prod
            app: backend
    TemplateCreateRequest:
      description: template create request body
      type: object
      allOf:
      - $ref: '#/components/schemas/Template'
    TemplateUpdateRequest:
      description: template update request body
      type: object
      nullable: true
      allOf:
      - $ref: '#/components/schemas/Template'