api

package
v0.0.0-...-0725f5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 20 Imported by: 0

README

REST API component

Configuration

{
    "address" : "localhost",
    "port": "8088",
    "idle_timeout": "120s",
    "keep_alives_enabled": true,
    "jwt_public_key": "0123456789ABCDEF",
    "enable_swagger_ui": true
}
  • address: Hostname or IP to listen for requests
  • port: Port number (as string) to listen at
  • idle_timeout: Close connection after this time. Must be a parseable time for time.ParseDuration
  • keep_alives_enabled: Keep connections alive for some time
  • jwt_public_key: JWT public key used for authentication
  • enable_swagger_ui: Enable the Swagger UI, a web-based documentation of the REST API

Endpoints

  • http://address:port/api/query
  • http://address:port/api/write?cluster=<cluster>

See generated Swagger documentation or web-based Swagger UI for more information and the data format accepted by the endpoints

Documentation

Overview

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Package api Code generated by swaggo/swag. DO NOT EDIT

Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var SwaggerInfo = &swag.Spec{
	Version:          "1.0.0",
	Host:             "localhost:8098",
	BasePath:         "/api/",
	Schemes:          []string{},
	Title:            "cc-event-store REST API",
	Description:      "API for cc-event-store",
	InfoInstanceName: "swagger",
	SwaggerTemplate:  docTemplate,
	LeftDelim:        "{{",
	RightDelim:       "}}",
}

SwaggerInfo holds exported Swagger Info so clients can modify it

Functions

This section is empty.

Types

type API

type API interface {
	Init(wg *sync.WaitGroup, store storage.StorageManager, apiConfigFile string) error
	Start()
	Close()
}

func NewAPI

func NewAPI(wg *sync.WaitGroup, store storage.StorageManager, apiConfigFile string) (API, error)

type ApiMetricData

type ApiMetricData struct {
	Error *string              `json:"error,omitempty"`
	Data  []ApiMetricDataEntry `json:"data,omitempty"`
	From  int64                `json:"from"`
	To    int64                `json:"to"`
}

type ApiMetricDataEntry

type ApiMetricDataEntry struct {
	Event string `json:"Event"`
	Time  int64  `json:"timestamp"`
}

type ApiQuery

type ApiQuery struct {
	Type       *string  `json:"type,omitempty"`
	SubType    *string  `json:"subtype,omitempty"`
	Event      string   `json:"event"`
	Hostname   string   `json:"host"`
	TypeIds    []string `json:"type-ids,omitempty"`
	SubTypeIds []string `json:"subtype-ids,omitempty"`
}

type ApiQueryRequest

type ApiQueryRequest struct {
	Cluster     string     `json:"cluster"`
	Queries     []ApiQuery `json:"queries"`
	ForAllNodes []string   `json:"for-all-nodes"`
	From        int64      `json:"from"`
	To          int64      `json:"to"`
}

type ApiQueryResponse

type ApiQueryResponse struct {
	Queries []ApiQuery        `json:"queries,omitempty"`
	Results [][]ApiMetricData `json:"results"`
}

type ErrorResponse

type ErrorResponse struct {
	// Statustext of Errorcode
	Status string `json:"status"`
	Error  string `json:"error"` // Error Message
}

ErrorResponse model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL