controller

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package controller implements controllers for API endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthController

type HealthController struct {
	Engine engine.Engine
}

HealthController implements handlers for health-related endpoints.

func NewHealthController

func NewHealthController(g engine.Engine) *HealthController

NewHealthController creates a new HealthController.

func (*HealthController) GetLiveness

func (r *HealthController) GetLiveness(c *gin.Context)

GetLiveness checks the liveness of the instance. @summary Check the liveness of the instance @router /livez [get] @tags health @success 200

func (*HealthController) GetReadiness

func (r *HealthController) GetReadiness(c *gin.Context)

GetReadiness checks the readiness of the instance. @summary Check the readiness of the instance @router /readyz [get] @tags health @success 200 @failure 503 {object} ratus.Error

type MetricsController

type MetricsController struct {
	// contains filtered or unexported fields
}

MetricsController implements handlers for metrics-related endpoints.

func NewMetricsController

func NewMetricsController(g engine.Engine) *MetricsController

NewMetricsController creates a new MetricsController.

func (*MetricsController) GetMetrics

func (r *MetricsController) GetMetrics(c *gin.Context)

GetMetrics gets Prometheus metrics of the instance. @summary Get Prometheus metrics of the instance @router /metrics [get] @tags metrics @produce text/plain @success 200 {object} string

type PromiseController

type PromiseController struct {
	Engine engine.Engine
}

PromiseController implements handlers for promise-related endpoints.

func NewPromiseController

func NewPromiseController(g engine.Engine) *PromiseController

NewPromiseController creates a new PromiseController.

func (*PromiseController) DeletePromise

func (r *PromiseController) DeletePromise(c *gin.Context)

DeletePromise deletes a promise by the unique ID of its target task. @summary Delete a promise by the unique ID of its target task @router /topics/{topic}/promises/{id} [delete] @tags promises @param topic path string true "Name of the topic" @param id path string true "Unique ID of the target task" @produce application/json @success 200 {object} ratus.Deleted @failure 500 {object} ratus.Error

func (*PromiseController) DeletePromises

func (r *PromiseController) DeletePromises(c *gin.Context)

DeletePromises deletes all promises in a topic. @summary Delete all promises in a topic @router /topics/{topic}/promises [delete] @tags promises @param topic path string true "Name of the topic" @produce application/json @success 200 {object} ratus.Deleted @failure 500 {object} ratus.Error

func (*PromiseController) GetPromise

func (r *PromiseController) GetPromise(c *gin.Context)

GetPromise gets a promise by the unique ID of its target task. @summary Get a promise by the unique ID of its target task @router /topics/{topic}/promises/{id} [get] @tags promises @param topic path string true "Name of the topic" @param id path string true "Unique ID of the target task" @produce application/json @success 200 {object} ratus.Promise @failure 404 {object} ratus.Error @failure 500 {object} ratus.Error

func (*PromiseController) GetPromises

func (r *PromiseController) GetPromises(c *gin.Context)

GetPromises lists all promises in a topic. @summary List all promises in a topic @router /topics/{topic}/promises [get] @tags promises @param topic path string true "Name of the topic" @param limit query int false "Maximum number of resources to return" @param offset query int false "Number of resources to skip" @produce application/json @success 200 {object} ratus.Promises @failure 400 {object} ratus.Error @failure 500 {object} ratus.Error

func (*PromiseController) PostPromise

func (r *PromiseController) PostPromise(c *gin.Context)

PostPromise makes a promise to claim and execute a task if it is in pending state. @summary Make a promise to claim and execute a task if it is in pending state @router /topics/{topic}/promises/{id} [post] @tags promises @param topic path string true "Name of the topic" @param id path string true "Unique ID of the target task" @param promise body ratus.Promise false "Promise object to be inserted" @accept application/json @produce application/json @success 200 {object} ratus.Task @failure 400 {object} ratus.Error @failure 404 {object} ratus.Error @failure 409 {object} ratus.Error @failure 500 {object} ratus.Error

func (*PromiseController) PostPromises

func (r *PromiseController) PostPromises(c *gin.Context)

PostPromises makes a promise to claim and execute the next available task in a topic. @summary Make a promise to claim and execute the next available task in a topic @router /topics/{topic}/promises [post] @tags promises @param topic path string true "Name of the topic" @param promise body ratus.Promise false "Wildcard promise object to be inserted" @accept application/json @produce application/json @success 200 {object} ratus.Task @failure 400 {object} ratus.Error @failure 404 {object} ratus.Error @failure 500 {object} ratus.Error

func (*PromiseController) PutPromise

func (r *PromiseController) PutPromise(c *gin.Context)

PutPromise makes a promise to claim and execute a task regardless of its current state. @summary Make a promise to claim and execute a task regardless of its current state @router /topics/{topic}/promises/{id} [put] @tags promises @param topic path string true "Name of the topic" @param id path string true "Unique ID of the target task" @param promise body ratus.Promise false "Promise object to be inserted or updated" @accept application/json @produce application/json @success 200 {object} ratus.Task @failure 400 {object} ratus.Error @failure 404 {object} ratus.Error @failure 500 {object} ratus.Error

type TaskController

type TaskController struct {
	Engine engine.Engine
}

TaskController implements handlers for task-related endpoints.

func NewTaskController

func NewTaskController(g engine.Engine) *TaskController

NewTaskController creates a new TaskController.

func (*TaskController) DeleteTask

func (r *TaskController) DeleteTask(c *gin.Context)

DeleteTask deletes a task by its unique ID. @summary Delete a task by its unique ID @router /topics/{topic}/tasks/{id} [delete] @tags tasks @param topic path string true "Name of the topic" @param id path string true "Unique ID of the task" @produce application/json @success 200 {object} ratus.Deleted @failure 500 {object} ratus.Error

func (*TaskController) DeleteTasks

func (r *TaskController) DeleteTasks(c *gin.Context)

DeleteTasks deletes all tasks in a topic. @summary Delete all tasks in a topic @router /topics/{topic}/tasks [delete] @tags tasks @param topic path string true "Name of the topic" @produce application/json @success 200 {object} ratus.Deleted @failure 500 {object} ratus.Error

func (*TaskController) GetTask

func (r *TaskController) GetTask(c *gin.Context)

GetTask gets a task by its unique ID. @summary Get a task by its unique ID @router /topics/{topic}/tasks/{id} [get] @tags tasks @param topic path string true "Name of the topic" @param id path string true "Unique ID of the task" @produce application/json @success 200 {object} ratus.Task @failure 404 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TaskController) GetTasks

func (r *TaskController) GetTasks(c *gin.Context)

GetTasks lists all tasks in a topic. @summary List all tasks in a topic @router /topics/{topic}/tasks [get] @tags tasks @param topic path string true "Name of the topic" @param limit query int false "Maximum number of resources to return" @param offset query int false "Number of resources to skip" @produce application/json @success 200 {object} ratus.Tasks @failure 400 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TaskController) PatchTask

func (r *TaskController) PatchTask(c *gin.Context)

PatchTask applies a set of updates to a task and returns the updated task. @summary Apply a set of updates to a task and return the updated task @router /topics/{topic}/tasks/{id} [patch] @tags tasks @param topic path string true "Name of the topic" @param id path string true "Unique ID of the task" @param commit body ratus.Commit false "Commit object to be applied" @accept application/json @produce application/json @success 200 {object} ratus.Task @failure 400 {object} ratus.Error @failure 404 {object} ratus.Error @failure 409 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TaskController) PostTask

func (r *TaskController) PostTask(c *gin.Context)

PostTask inserts a new task. @summary Insert a new task @router /topics/{topic}/tasks/{id} [post] @tags tasks @param topic path string true "Name of the topic" @param id path string true "Unique ID of the task" @param task body ratus.Task true "Task object to be inserted" @accept application/json @produce application/json @success 201 {object} ratus.Updated @failure 400 {object} ratus.Error @failure 409 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TaskController) PostTasks

func (r *TaskController) PostTasks(c *gin.Context)

PostTasks inserts a batch of tasks while ignoring existing ones. @summary Insert a batch of tasks while ignoring existing ones @router /topics/{topic}/tasks [post] @tags tasks @param topic path string true "Name of the topic" @param tasks body ratus.Tasks true "Batch of tasks to be inserted" @accept application/json @produce application/json @success 200 {object} ratus.Updated @success 201 {object} ratus.Updated @failure 400 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TaskController) PutTask

func (r *TaskController) PutTask(c *gin.Context)

PutTask inserts or updates a task. @summary Insert or update a task @router /topics/{topic}/tasks/{id} [put] @tags tasks @param topic path string true "Name of the topic" @param id path string true "Unique ID of the task" @param task body ratus.Task true "Task object to be inserted or updated" @accept application/json @produce application/json @success 200 {object} ratus.Updated @success 201 {object} ratus.Updated @failure 400 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TaskController) PutTasks

func (r *TaskController) PutTasks(c *gin.Context)

PutTasks inserts or updates a batch of tasks. @summary Insert or update a batch of tasks @router /topics/{topic}/tasks [put] @tags tasks @param topic path string true "Name of the topic" @param tasks body ratus.Tasks true "Batch of tasks to be inserted or updated" @accept application/json @produce application/json @success 200 {object} ratus.Updated @success 201 {object} ratus.Updated @failure 400 {object} ratus.Error @failure 500 {object} ratus.Error

type TopicController

type TopicController struct {
	Engine engine.Engine
}

TopicController implements handlers for topic-related endpoints.

func NewTopicController

func NewTopicController(g engine.Engine) *TopicController

NewTopicController creates a new TopicController.

func (*TopicController) DeleteTopic

func (r *TopicController) DeleteTopic(c *gin.Context)

DeleteTopic deletes a topic and its tasks. @summary Delete a topic and its tasks @router /topics/{topic} [delete] @tags topics @param topic path string true "Name of the topic" @produce application/json @success 200 {object} ratus.Deleted @failure 500 {object} ratus.Error

func (*TopicController) DeleteTopics

func (r *TopicController) DeleteTopics(c *gin.Context)

DeleteTopics deletes all topics and tasks. @summary Delete all topics and tasks @router /topics [delete] @tags topics @produce application/json @success 200 {object} ratus.Deleted @failure 500 {object} ratus.Error

func (*TopicController) GetTopic

func (r *TopicController) GetTopic(c *gin.Context)

GetTopic gets information about a topic. @summary Get information about a topic @router /topics/{topic} [get] @tags topics @param topic path string true "Name of the topic" @produce application/json @success 200 {object} ratus.Topic @failure 404 {object} ratus.Error @failure 500 {object} ratus.Error

func (*TopicController) GetTopics

func (r *TopicController) GetTopics(c *gin.Context)

GetTopics lists all topics. @summary List all topics @router /topics [get] @tags topics @param limit query int false "Maximum number of resources to return" @param offset query int false "Number of resources to skip" @produce application/json @success 200 {object} ratus.Topics @failure 400 {object} ratus.Error @failure 500 {object} ratus.Error

type V1

type V1 struct {
	Pagination gin.HandlerFunc

	Topic   *TopicController
	Task    *TaskController
	Promise *PromiseController
	Health  *HealthController
	Metrics *MetricsController
}

V1 implements endpoint mounting for API version 1.

func (*V1) Mount

func (v *V1) Mount(r *gin.RouterGroup)

Mount initializes group-level middlewares and mounts the endpoints.

func (*V1) Prefixes

func (v *V1) Prefixes() []string

Prefixes returns the common path prefixes for endpoints in the group.

Jump to

Keyboard shortcuts

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