Kubeshop Webhooks API

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

OpenAPI Specification

kubeshop-webhooks-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Testkube Standalone Agent api Webhooks 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: Webhooks
paths:
  /webhooks:
    get:
      summary: List webhooks
      description: List webhooks available in cluster
      operationId: listWebhooks
      parameters:
      - $ref: '#/components/parameters/Selector'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Webhook'
            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'
        '502':
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
      tags:
      - Webhooks
    post:
      summary: Create new webhook
      description: Create new webhook based on variables passed in request
      operationId: createWebhook
      requestBody:
        description: webhook request body data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookCreateRequest'
          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/Webhook'
        '400':
          description: problem with webhook 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'
      tags:
      - Webhooks
    delete:
      summary: Delete webhooks
      description: Deletes labeled webhooks
      operationId: deleteWebhooks
      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'
      tags:
      - Webhooks
  /webhooks/{id}:
    delete:
      parameters:
      - $ref: '#/components/parameters/ID'
      summary: Delete webhook
      description: Deletes webhook by its name
      operationId: deleteWebhook
      responses:
        '204':
          description: webhook deleted successfuly
        '404':
          description: webhook 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'
      tags:
      - Webhooks
    get:
      parameters:
      - $ref: '#/components/parameters/ID'
      summary: Get webhook details
      description: Returns webhook
      operationId: getWebhook
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
            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: webhook not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        '500':
          description: problem with getting webhook 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'
      tags:
      - Webhooks
    patch:
      parameters:
      - $ref: '#/components/parameters/ID'
      summary: Update new webhook
      description: Update new webhook based on variables passed in request
      operationId: updateWebhook
      requestBody:
        description: webhook request body data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookUpdateRequest'
          text/yaml:
            schema:
              type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '400':
          description: problem with webhook 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: webhook 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'
      tags:
      - Webhooks
components:
  schemas:
    WebhookUpdateRequest:
      description: webhook update request body
      type: object
      nullable: true
      allOf:
      - $ref: '#/components/schemas/Webhook'
    Syncable:
      description: 'source information about resources that may have been synced from multiple sources.

        An empty source indicates that the source was the UI/API for backwards compatibility.

        '
      type: object
      properties:
        creationSource:
          description: the original source from which the resource was created
          $ref: '#/components/schemas/Source'
        lastModificationSource:
          description: the source from which the last modification of the resource originated
          $ref: '#/components/schemas/Source'
    Webhook:
      description: CRD based webhook data
      type: object
      required:
      - name
      properties:
        name:
          type: string
          example: webhook1
        namespace:
          type: string
          example: testkube
        labels:
          type: object
          description: webhook labels
          additionalProperties:
            type: string
          example:
            env: prod
            app: backend
        annotations:
          type: object
          description: webhook annotations
          additionalProperties:
            type: string
          example:
            env: prod
            app: backend
        created:
          type: string
          format: date-time
          example: '2022-07-30T06:54:15Z'
        updated:
          type: string
          format: date-time
          example: '2022-07-30T06:54:15Z'
        disabled:
          type: boolean
          description: whether webhook is disabled
          default: false
          example:
          - true
          - false
        uri:
          type: string
          example: https://hooks.app.com/services/1
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventType'
        selector:
          type: string
          description: Labels to filter for tests and test suites
        payloadObjectField:
          type: string
          description: will load the generated payload for notification inside the object
        payloadTemplate:
          type: string
          description: golang based template for notification payload
        payloadTemplateReference:
          type: string
          description: name of the template resource
        headers:
          type: object
          description: webhook headers (golang template supported)
          additionalProperties:
            type: string
          example:
            Content-Type: application/xml
        config:
          $ref: '#/components/schemas/WebhookConfig'
        parameters:
          type: array
          items:
            $ref: '#/components/schemas/WebhookParameterSchema'
        webhookTemplateRef:
          $ref: '#/components/schemas/WebhookTemplateRef'
        sync:
          $ref: '#/components/schemas/Syncable'
        target:
          $ref: '#/components/schemas/ExecutionTarget'
    Source:
      description: synchronisation sources
      type: string
      enum:
      - kubernetes
    EventType:
      type: string
      enum:
      - queue-testworkflow
      - start-testworkflow
      - end-testworkflow-success
      - end-testworkflow-failed
      - end-testworkflow-aborted
      - end-testworkflow-canceled
      - end-testworkflow-not-passed
      - become-testworkflow-up
      - become-testworkflow-down
      - become-testworkflow-failed
      - become-testworkflow-aborted
      - become-testworkflow-canceled
      - become-testworkflow-not-passed
      - created
      - updated
      - deleted
    SecretRef:
      required:
      - name
      - key
      type: object
      description: Testkube internal reference for secret storage in Kubernetes secrets
      properties:
        namespace:
          type: string
          description: object kubernetes namespace
        name:
          type: string
          description: object name
        key:
          type: string
          description: object key
    WebhookConfig:
      type: object
      description: configuration values
      additionalProperties:
        $ref: '#/components/schemas/WebhookConfigValue'
    WebhookCreateRequest:
      description: webhook create request body
      type: object
      allOf:
      - $ref: '#/components/schemas/Webhook'
    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
    WebhookTemplateRef:
      type: object
      properties:
        name:
          description: webhook template name to use
          type: string
      required:
      - name
    ExecutionTarget:
      type: object
      properties:
        match:
          type: object
          description: runner labels to match
          additionalProperties:
            type: array
            items:
              type: string
        not:
          type: object
          description: runner labels to NOT match
          additionalProperties:
            type: array
            items:
              type: string
        replicate:
          type: array
          description: list of runner labels to replicate the executions
          items:
            type: string
    BoxedString:
      type: object
      properties:
        value:
          type: string
      required:
      - value
    WebhookConfigValue:
      type: object
      description: configuration value
      properties:
        value:
          description: public value to use in webhook template
          $ref: '#/components/schemas/BoxedString'
        secret:
          description: private value stored in secret to use in webhook template
          $ref: '#/components/schemas/SecretRef'
    WebhookParameterSchema:
      type: object
      description: parameter definition
      properties:
        name:
          description: unique parameter name
          type: string
        description:
          description: description for the parameter
          type: string
        required:
          description: whether parameter is required
          type: boolean
          default: false
        example:
          description: example value for the parameter
          type: string
        default:
          $ref: '#/components/schemas/BoxedString'
        pattern:
          type: string
          description: regular expression to match
      required:
      - name
  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