api

package
v0.0.0-...-6243be3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

README

API Directory

This directory contains all API-related files.

Structure

api
├── README.md
├── generated
│   └── alarms.generated.go           # Generated Go code (do not edit manually)
├── openapi.yaml                      # OpenAPI specification
└── tools
    ├── generate.go                   # Code generation script
    └── oapi-codegen.yaml             # Config file for `oapi-codegen` 

How to Generate Server Side Code

go generate ./...

How to Generate Client Side Code

Note: This is simply here for convenience and make sure we don't generate any internal endpoint clients

# overlay
overlay: 1.0.0
info:
  title: "Example to indicate how to use the OpenAPI Overlay specification (https://github.com/OAI/Overlay-Specification) and only generate external client-side code"
  version: 1.0.0
actions:
- target: $.paths.*.*[?(@.tags[*] == 'internal')]
  description: Remove internal endpoints (noted by internal tag)
  remove: true
# oapi-codegen-client-config.yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/oapi-codegen/oapi-codegen/HEAD/configuration-schema.json
package: client
output: client.generated.go

generate:
  client: true
  models: true

output-options:
  overlay:
    path: overlay.yaml

Documentation

Index

Constants

View Source
const (
	DefaultRetentionPeriod = 1 // Default retention of resolved alarms in days

)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlarmsServer

type AlarmsServer struct {
	// GlobalCloudID is the global O-Cloud identifier. Create subscription requests are blocked if the global O-Cloud identifier is not set
	GlobalCloudID uuid.UUID
	// AlarmsRepository is the repository for the alarms
	AlarmsRepository repo.AlarmRepositoryInterface
	// Infrastructure clients
	Infrastructure *infrastructure.Infrastructure
	// Wg to allow alarm server level background tasks to finish before graceful exit
	Wg sync.WaitGroup
	// NotificationProvider to handle new events
	NotificationProvider notifier.NotificationProvider
	// Notifier to notify subscribers with new events
	Notifier *notifier.Notifier
	// ServiceConfig config needed to manage ServiceConfig
	ServiceConfig serviceconfig.Config
}

func (*AlarmsServer) AmNotification

AmNotification handles an API request coming from AlertManager with CaaS alerts. This api is used internally. Note: the errors returned can also be view under alertmanager pod logs but also logging here for convenience

func (*AlarmsServer) CreateSubscription

CreateSubscription handles an API request to create an Alarm Subscription

func (*AlarmsServer) DeleteSubscription

DeleteSubscription handles an API request to delete an Alarm Subscription

func (*AlarmsServer) GetAlarm

GetAlarm handles an API request to retrieve an Alarm Event Record

func (*AlarmsServer) GetAlarms

GetAlarms handles an API request to fetch Alarm Event Records

func (*AlarmsServer) GetAllVersions

GetAllVersions receives the API request to this endpoint, executes the request, and responds appropriately

func (*AlarmsServer) GetMinorVersions

GetMinorVersions receives the API request to this endpoint, executes the request, and responds appropriately

func (*AlarmsServer) GetServiceConfiguration

GetServiceConfiguration handles an API request to fetch the Alarm Service Configuration

func (*AlarmsServer) GetSubscription

GetSubscription handles an API request to retrieve an Alarm Subscription

func (*AlarmsServer) GetSubscriptions

GetSubscriptions handles an API request to fetch Alarm Subscriptions

func (*AlarmsServer) HwNotification

func (*AlarmsServer) PatchAlarm

PatchAlarm handles an API request to patch an Alarm Event Record

func (*AlarmsServer) PatchAlarmServiceConfiguration

PatchAlarmServiceConfiguration handles an API request to patch the Alarm Service Configuration

type AlarmsServerConfig

type AlarmsServerConfig struct {
	utils.CommonServerConfig
	Address       string
	GlobalCloudID string
}

AlarmsServerConfig defines the configuration attributes for the alarms server

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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