ror-api

module
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0

README

Dependabot Updates

ROR-API

WebAPI made with Golang and Gin WebAPI framework

Prerequisites

  • Golang 1.26
  • Vault, Valkey, RabbitMQ, MongoDB, OpenIDConnect service (see requirements on how to start)

Get started

Bash commands is from <repo root>

Start requirements

To start the environment:

cp .env.example .env
docker compose up -d

To stop the environment:

docker compose down
Optional

If extra functionality is needed, the docker compose file is build with profiles.

The current available profiles are:

  • ui: provides mongoexpress and rediscommander

  • tracing: otel collector and jaeger

Docker compose profiles can be utilized like this:

Single profiles:

docker compose --profile ui up -d
docker compose --profile tracing up -d

Or multiple profiles:

docker compose --profile ui,tracing up -d

To bring profiled docker compose manifests down, use the following:

docker compose --profile ui down
docker compose --profile tracing down

Or multiple profiles:

docker compose --profile ui,tracing down

Failure to do so will result in the containers related to that profile to keep running.

Start API

Visual Studio Code
  1. Open the repository in Visual Studio Code
  2. Go to Debugging
  3. On "Run and debug" select "Debug ROR-Api"
Terminal
go run cmd/api/main.go

Generate swagger docs:

Foreach endpoint function, you must add comments for it to show in generated openapi spec

ex:


// @Summary 	Create cluster
// @Schemes
// @Description Create a cluster
// @Tags 		cluster
// @Accept 		application/json
// @Produce 	application/json
// @Success 	200 {object} responses.ClusterResponse
// @Failure 	403  {string}  Forbidden
// @Failure 	401  {string}  Unauthorized
// @Failure 	500  {string}  Failure message
// @Router		/v1/cluster [post]
// @Security	ApiKey || AccessToken
func Create() gin.HandlerFunc {
	return func(c *gin.Context) {
		...
	}
}

Examples of annotations

To generate new swagger you need to install a cmd called swag (https://github.com/swaggo/swag):

go install github.com/swaggo/swag/cmd/swag@latest

(and remember to set <userprofile>\go\bin in PATH to terminal)

And run this command from ror-api root:

 swag init -g cmd/api/main.go --parseDependency --output internal/docs --parseInternal

the folder docs and docs\swagger.json and docs\swagger.yaml is updated/created

Development with Makefile

This project includes a comprehensive Makefile that provides a standardized way to build, test, and deploy the application. Run make help to see all available targets.

Quick Start
# Setup the project for development
make setup

# Build the application
make build

# Run tests
make test

# Run the application locally
make run
Common Development Tasks
# Build and test everything
make all

# Run with auto-reload for development
make dev

# Format, lint, and run security checks
make quality

# Run tests with coverage
make test-coverage

# Generate Swagger documentation
make swagger

# Build for production (static binary)
make build-static
Available Make Targets
Prerequisites
  • make check-prereqs - Check all required tools are installed
  • make install-tools - Install development tools (golangci-lint, gosec, swag)
Build and Test
  • make build - Build the application
  • make build-generator - Build the generator application
  • make build-static - Build with static linking for containers
  • make test - Run all tests
  • make test-coverage - Run tests with coverage report
  • make test-race - Run tests with race detection
  • make bench - Run benchmarks
Code Quality
  • make fmt - Format Go code
  • make vet - Run go vet
  • make lint - Run golangci-lint
  • make gosec - Run security analysis
  • make quality - Run all quality checks
Development
  • make run - Run the API server
  • make run-generator - Run the generator
  • make dev - Run with auto-reload (requires air)
  • make docs - Generate documentation
Docker
  • make docker-build - Build Docker image
Helm
  • make helm-install - Install with Helm
  • make helm-template - Generate Helm templates
Utilities
  • make clean - Remove build artifacts
  • make deps - Download and verify dependencies
  • make version - Show version information
Environment Variables

The Makefile supports several environment variables:

# Docker registry for pushing images
export DOCKER_REGISTRY=your-registry.com

# Override Docker image name and tag
export DOCKER_IMAGE=custom-ror-api
export DOCKER_TAG=v1.0.0
Development Tools
Air (Live Reload)

For development with auto-reload:

go install github.com/cosmtrek/air@latest
make dev
golangci-lint

For comprehensive linting:

make install-tools  # Installs golangci-lint
make lint

Configuration is in .golangci.yml.

Directories

Path Synopsis
cmd
api command
generator command
The Generator package provides a way to generate code for collecting, transfering and saving resources in the agent and api.
The Generator package provides a way to generate code for collecting, transfering and saving resources in the agent and api.
internal
acl/repositories
TODO: This library is imported from ror, should determine if its a public library or not Package provides functions to do crud operations on acl as well as verification fo access
TODO: This library is imported from ror, should determine if its a public library or not Package provides functions to do crud operations on acl as well as verification fo access
acl/services
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
apiservices/clustersservice
Package clustersservice cluster package provides services to get and manipulate the cluster object
Package clustersservice cluster package provides services to get and manipulate the cluster object
apiservices/resourcesService
the resource service package provides services to get and manipulate resources
the resource service package provides services to get and manipulate resources
auditlog
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
clients/gitlab
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
configuration
TODO: This library is imported from ror, should determine if its a public library or not the configuration package is responsible for loading and merging configurations it implements loaders and parsers
TODO: This library is imported from ror, should determine if its a public library or not the configuration package is responsible for loading and merging configurations it implements loaders and parsers
controllers/aclcontroller
The acl controller package provides controller functions for the /acl endpoints in the api V1.
The acl controller package provides controller functions for the /acl endpoints in the api V1.
controllers/auditlogscontroller
TODO: Describe package
TODO: Describe package
controllers/clusterscontroller
The clusters controller package provides controller functions for the /cluster and /clusters endpoints in the api V1.
The clusters controller package provides controller functions for the /cluster and /clusters endpoints in the api V1.
controllers/datacenterscontroller
TODO: Describe package
TODO: Describe package
controllers/desiredversioncontroller
TODO: Describe package
TODO: Describe package
TODO: Describe package
controllers/m2m/tokencontroller
TODO: Describe package
TODO: Describe package
controllers/metricscontroller
TODO: Describe package
TODO: Describe package
controllers/operatorconfigscontroller
TODO: Describe package
TODO: Describe package
controllers/pricescontroller
TODO: Describe package
TODO: Describe package
controllers/resourcescontroller
resourcecontroller implements all controllers for resources
resourcecontroller implements all controllers for resources
controllers/v2/resourcescontroller
resourcecontroller implements all controllers for resources
resourcecontroller implements all controllers for resources
databases/mongodb/mongoTypes
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/apikeys
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/auditlog
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/clusters
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/desiredversion
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/metrics
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/operatorconfig
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/prices
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/projects
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/resourcesmongodb
package implements repofunctions to do crud operations on resources
package implements repofunctions to do crud operations on resources
databases/mongodb/repositories/rulesets
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/tasks
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
databases/mongodb/repositories/views
TODO: This library is imported from ror, should determine if its a public library or not package implements repofunctions to get resources for views
TODO: This library is imported from ror, should determine if its a public library or not package implements repofunctions to get resources for views
databases/mongodb/repositories/workspaces
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
docs
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
factories/storagefactory
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
helpers/clusterHelper
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
helpers/mapping
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
helpers/mongoHelper
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
mocks/identitymocks
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models/ldapmodels
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models/m2mmodels
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models/operatormodels
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models/rorResources
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models/vaultmodels
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
models/viewsmodels
TODO: This library is imported from ror, should determine if its a public library or not this package provides models for views
TODO: This library is imported from ror, should determine if its a public library or not this package provides models for views
provider/clusterorder
The package clusterorder provides the interface and the factory method to create a new clusterorder based on the provider TODO: This might be a implementation in the upcoming ResourceFramework
The package clusterorder provides the interface and the factory method to create a new clusterorder based on the provider TODO: This might be a implementation in the upcoming ResourceFramework
provider/clusterorder/kindclusterorder
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
provider/clusterorder/talosclusterorder
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
provider/clusterorder/tanzuclusterorder
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
provider/clusterorder/utils
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
services/clusterservice
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
services/kubeconfigservice
TODO: This library is imported from ror, should determine if its a public library or not
TODO: This library is imported from ror, should determine if its a public library or not
pkg
helpers/gincontext
Package contextservices The package provides functions to get and work with ror contexts
Package contextservices The package provides functions to get and work with ror contexts

Jump to

Keyboard shortcuts

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