ror-api

module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: Apache-2.0

README

Dependabot Updates

ROR-API

WebAPI made with Golang and Gin WebAPI framework

Prerequisites

Get started

Bash commands is from <repo root>

Download dependencies:

go get ./...

Start WebAPI

Visual Studio Code
  1. Open the repository in Visual Studio Code
  2. Go to Debugging
  3. On "Run and debug" select "Debug ROR-Api" or "Debug ROR-Api tests"
Terminal
go run 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/helsegitlab
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
controllers/healthcontroller
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
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
mongodbrepo/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
mongodbrepo/repositories/apikeysRepo
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
mongodbrepo/repositories/auditlogRepo
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
mongodbrepo/repositories/clustersRepo
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
mongodbrepo/repositories/datacentersRepo
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
mongodbrepo/repositories/desiredversionRepo
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
mongodbrepo/repositories/metricsRepo
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
mongodbrepo/repositories/operatorconfigRepo
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
mongodbrepo/repositories/pricesRepo
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
mongodbrepo/repositories/projectsRepo
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
mongodbrepo/repositories/resourcesmongodbrepo
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
mongodbrepo/repositories/rulesetsRepo
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
mongodbrepo/repositories/tasksRepo
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
mongodbrepo/repositories/viewsRepo
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
mongodbrepo/repositories/workspacesRepo
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
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

Jump to

Keyboard shortcuts

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