services

package
v0.0.0-...-b4f9143 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FeedbackLimit describes maximum number of feedbacks a user can submit in a day.
	FeedbackLimit = 3
)

Variables

This section is empty.

Functions

func AcceptTermsAndConditions

func AcceptTermsAndConditions(c *gin.Context)

AcceptTermsAndConditions godoc @Summary Accept terms and conditions @Description Accept terms and conditions @Tags tnc @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/tnc [post]

func AddCapacity

func AddCapacity(capacity models.Capacity, catalogCapacity pac.Capacity) (models.Capacity, error)

TODO: Move to utils if needed

func AdminChangeGroup

func AdminChangeGroup(c *gin.Context)

AdminChangeGroup godoc @Summary Change User Group @Description Change user group to provided group @Tags user @Accept json @Produce json @Param id path string true "user-id for user to be modified" @Param group path string true "new group to add user to" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/users/{id}/group/{group} [put]

func AdminDeleteUser

func AdminDeleteUser(c *gin.Context)

func AdminEndConversation

func AdminEndConversation(c *gin.Context)

AdminEndConversation lets an admin close a conversation on behalf of the user. It notifies the user's live WebSocket session via the hub so the user's UI transitions to a fresh conversation immediately.

func AdminReply

func AdminReply(c *gin.Context)

AdminReply posts an admin reply into an existing conversation.

func AdminWatchAll

func AdminWatchAll(c *gin.Context)

AdminWatchAll upgrades an admin request to a WebSocket that receives a notification for every incoming user message across ALL conversations. The admin panel uses this single connection to drive unread indicators in the sidebar without polling. Each frame contains user_id and conversation_id so the frontend can match the right sidebar entry.

func AdminWatchConversation

func AdminWatchConversation(c *gin.Context)

AdminWatchConversation upgrades an admin request to a WebSocket and streams new user messages for the specified conversation in real time. The admin opens this connection after selecting a conversation; from that point on, every message the user sends is forwarded here immediately without polling.

func ApproveRequest

func ApproveRequest(c *gin.Context)

ApproveRequest godoc @Summary Approve request @Description Approve request @Tags requests @Accept json @Produce json @Param id path string true "request-id for the request to be approved" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/requests/{id}/approve [post]

func CreateCatalog

func CreateCatalog(c *gin.Context)

CreateCatalog godoc @Summary Create catalog @Description Create catalog resource @Tags catalogs @Accept json @Produce json @Param catalog body models.Catalog true "Create catalog" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/catalogs [post]

func CreateFeedback

func CreateFeedback(c *gin.Context)

CreateFeedback godoc @Summary Create Feedback given by user @Description Create feedback resource @Tags feedbacks @Accept json @Produce json @Param feedback body models.Feedback true "Create feedback" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/feedbacks [post]

func CreateKey

func CreateKey(c *gin.Context)

CreateKey godoc @Summary Create key @Description Create key @Tags keys @Accept json @Produce json @Param key body models.Key true "Create key" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/keys [post]

func CreateMaintenanceWindow

func CreateMaintenanceWindow(c *gin.Context)

CreateMaintenanceWindow godoc @Summary Create a new maintenance notification window @Description Create a new maintenance notification window (admin only) @Tags maintenance @Accept json @Produce json @Param maintenance body models.MaintenanceCreateRequest true "Maintenance window configuration" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 201 {object} models.MaintenanceResponse @Router /api/v1/maintenance [post]

func CreateQuota

func CreateQuota(c *gin.Context)

CreateQuota godoc @Summary Create quota @Description Create quota @Tags quota @Accept json @Produce json @Param quota body models.Quota true "Create quota" @Param id path string true "group-id where quota has to be created" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups/{id}/quota [post]

func CreateService

func CreateService(c *gin.Context)

CreateService godoc @Summary Create service @Description Create service @Tags services @Accept json @Produce json @Param service body models.Service true "Create service" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1//services [post]

func DeleteCatalog

func DeleteCatalog(c *gin.Context)

DeleteCatalog godoc @Summary Delete catalog @Description Delete catalog resource @Tags catalogs @Accept json @Produce json @Param name path string true "catalog name to be deleted" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/catalogs/{name} [delete]

func DeleteKeyHandler

func DeleteKeyHandler(c *gin.Context)

DeleteKey godoc @Summary Delete key @Description Delete key @Tags keys @Accept json @Produce json @Param id path string true "key-id to be deleted" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/keys/{id} [delete]

func DeleteMaintenanceWindow

func DeleteMaintenanceWindow(c *gin.Context)

DeleteMaintenanceWindow godoc @Summary Delete a maintenance notification window @Description Delete a maintenance notification window (admin only) @Tags maintenance @Accept json @Produce json @Param id path string true "Maintenance Window ID" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 204 "No Content" @Router /api/v1/maintenance/{id} [delete]

func DeleteQuota

func DeleteQuota(c *gin.Context)

DeleteQuota godoc @Summary Delete quota @Description Delete quota @Tags quota @Accept json @Produce json @Param id path string true "group-id where quota has to be deleted" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups/{id}/quota [delete]

func DeleteRequest

func DeleteRequest(c *gin.Context)

DeleteRequest godoc @Summary Delete request @Description Delete request @Tags requests @Accept json @Produce json @Param id path string true "request-id for the request to be deleted" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/requests/{id} [delete]

func DeleteServiceHandler

func DeleteServiceHandler(c *gin.Context)

DeleteService godoc @Summary Delete service @Description Delete service @Tags services @Accept json @Produce json @Param name path string true "service name to be deleted" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/services/{name} [delete]

func DeleteUser

func DeleteUser(c *gin.Context)

func ExitGroup

func ExitGroup(c *gin.Context)

ExitGroup godoc @Summary Exit group request @Description Request to exit from group @Tags requests @Accept json @Produce json @Param id path string true "group-id for the group to be exited from" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups/{id}/exit [post]

func ExpiryNotification

func ExpiryNotification(ctx context.Context)

ExpiryNotification raises notification for about-to-expire services. It blocks until ctx is cancelled, so callers must run it in a goroutine.

func GetAdminConversationMessages

func GetAdminConversationMessages(c *gin.Context)

GetAdminConversationMessages returns all messages for a specific conversation.

func GetAdminConversations

func GetAdminConversations(c *gin.Context)

GetAdminConversations returns a list of all user conversations for the admin panel. For any conversation whose username was not stored in the DB (legacy data), the username is resolved from Keycloak by userID and backfilled in the response.

func GetAllCatalogs

func GetAllCatalogs(c *gin.Context)

GetAllCatalogs godoc @Summary Get all catalogs @Description Get all catalogs resource @Tags catalogs @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/catalogs [get]

func GetAllGroups

func GetAllGroups(c *gin.Context)

GetAllGroups godoc @Summary Get all groups @Description Get all groups @Tags groups @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups [get]

func GetAllKeysHandler

func GetAllKeysHandler(c *gin.Context)

GetAllKeys godoc @Summary Get all keys @Description Get all keys @Tags keys @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/keys [get] Get the Key values and update.

func GetAllRequests

func GetAllRequests(c *gin.Context)

GetAllRequests godoc @Summary Get all requests @Description Get all requests @Tags requests @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/requests [get]

func GetAllServicesHandler

func GetAllServicesHandler(c *gin.Context)

GetAllServices godoc @Summary Get all services @Description Get all services @Tags services @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/services [get]

func GetCatalog

func GetCatalog(c *gin.Context)

GetCatalog godoc @Summary Get catalog as specified in request @Description Get catalog resource @Tags catalogs @Accept json @Produce json @Param name path string true "catalog name to be fetched" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/catalogs/{name} [get]

func GetEvents

func GetEvents(c *gin.Context)

GetEvents godoc @Summary Get events @Description Get events @Tags events @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/events [get] GetEvents returns all events

func GetFeedback

func GetFeedback(c *gin.Context)

GetFeedback godoc @Summary Get feedbacks submitted by users @Description Get feedback resource @Tags feedbacks @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Param page query int false "Page number for pagination" @Param per_page query int false "Number of items per page" @Success 200 @Router /api/v1/feedbacks [get]

func GetGroup

func GetGroup(c *gin.Context)

GetGroup godoc @Summary Get group @Description Get group as specified in request @Tags groups @Accept json @Produce json @Param id path string true "group-id to be fetched" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups/{id} [get]

func GetKey

func GetKey(c *gin.Context)

GetKey godoc @Summary Get key @Description Get key @Tags keys @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Param id path string true "key-id to be fetched" @Success 200 @Router /api/v1/keys/{id} [get]

func GetMaintenanceWindows

func GetMaintenanceWindows(c *gin.Context)

GetMaintenanceWindows godoc @Summary Get maintenance notification windows @Description Get maintenance windows. Use ?all=true (admin only) to get all windows with audit details and pagination, otherwise returns only the earliest active window @Tags maintenance @Accept json @Produce json @Param all query bool false "Get all windows (admin only)" @Param page query int false "Page number for pagination (admin only)" @Param per_page query int false "Number of items per page (admin only)" @Success 200 {object} models.MaintenanceListResponse @Router /api/v1/maintenance [get]

func GetQuota

func GetQuota(c *gin.Context)

GetQuota godoc @Summary Get quota @Description Get quota @Tags quota @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Param id path string true "group-id to be fetched" @Success 200 @Router /api/v1/groups/{id}/quota [get] Get the respective quota of the group ID passed.

func GetRequest

func GetRequest(c *gin.Context)

GetRequest godoc @Summary Get request @Description Get request @Tags requests @Accept json @Produce json @Param id path string true "request-id for request to be fetched" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/requests/{id} [get]

func GetService

func GetService(c *gin.Context)

GetService godoc @Summary Get service @Description Get service @Tags services @Accept json @Produce json @Param name path string true "service name" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/services/{name} [get]

func GetTermsAndConditionsStatus

func GetTermsAndConditionsStatus(c *gin.Context)

GetTermsAndConditionsStatus godoc @Summary Get terms and conditions @Description Get terms and conditions @Tags tnc @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/tnc [get]

func GetUser

func GetUser(c *gin.Context)

GetUser godoc @Summary Get user @Description Get user based on given id @Tags user @Accept json @Produce json @Param id path string true "user-id for user to be fetched" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/users/{id} [get]

func GetUserConversationMessages

func GetUserConversationMessages(c *gin.Context)

GetUserConversationMessages returns messages for one of the calling user's own conversations.

func GetUserConversations

func GetUserConversations(c *gin.Context)

GetUserConversations returns the list of the calling user's own conversations.

func GetUserQuota

func GetUserQuota(c *gin.Context)

GetUserQuota godoc @Summary Get user quota @Description Get user quota @Tags quota @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/quota [get]

func GetUsers

func GetUsers(c *gin.Context)

GetUsers godoc @Summary Get all users @Description Get all users @Tags user @Accept json @Produce json @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/users [get]

func HandleChatWebSocket

func HandleChatWebSocket(c *gin.Context)

HandleChatWebSocket upgrades the connection to WebSocket and handles real-time chat messages for the authenticated user.

func ListUserServices

func ListUserServices(userId string) ([]models.Service, error)

func NewGroupRequest

func NewGroupRequest(c *gin.Context)

NewGroupRequest godoc @Summary New group request @Description Request to switch to new group @Tags requests @Accept json @Produce json @Param id path string true "group-id for the requested group" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups/{id}/request [post]

func RejectRequest

func RejectRequest(c *gin.Context)

RejectRequest godoc @Summary Reject request @Description Reject request @Tags requests @Accept json @Produce json @Param id path string true "request-id for the request to be rejected" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/requests/{id}/reject [post]

func RetireCatalog

func RetireCatalog(c *gin.Context)

RetireCatalog godoc @Summary Reire catalog @Description Reire catalog resource @Tags catalogs @Accept json @Produce json @Param name path string true "catalog name to be retired" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/catalogs/{name}/retire [put]

func SetDB

func SetDB(db db.DB)

func SetKubeClient

func SetKubeClient(client kubernetes.Client)

func StartAdminReplyWorker

func StartAdminReplyWorker(ctx context.Context)

StartAdminReplyWorker drains adminReplyQueue and persists each message to MongoDB. It must be started once from main() before the HTTP server begins accepting requests. It exits when ctx is cancelled (server shutdown).

func UpdateMaintenanceWindow

func UpdateMaintenanceWindow(c *gin.Context)

UpdateMaintenanceWindow godoc @Summary Update a maintenance notification window @Description Update an existing maintenance notification window (admin only) @Tags maintenance @Accept json @Produce json @Param id path string true "Maintenance Window ID" @Param maintenance body models.MaintenanceUpdateRequest true "Maintenance window configuration" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 {object} models.MaintenanceResponse @Router /api/v1/maintenance/{id} [put]

func UpdateQuota

func UpdateQuota(c *gin.Context)

UpdateQuota godoc @Summary Update quota @Description Update quota @Tags quota @Accept json @Produce json @Param quota body models.Quota true "Update quota" @Param id path string true "group-id where quota has to be updated" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/groups/{id}/quota [put]

func UpdateServiceExpiryRequest

func UpdateServiceExpiryRequest(c *gin.Context)

UpdateServiceExpiryRequest godoc @Summary Update service expiry request @Description Update service expiry for a particular service @Tags requests @Accept json @Produce json @Param name path string true "service name" @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>) @Success 200 @Router /api/v1/services/{name}/expiry [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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