api

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRouter

func GetRouter(config configuration.Config, command Controller) http.Handler

@title Permissions API @version 0.1 @license.name Apache 2.0 @license.url http://www.apache.org/licenses/LICENSE-2.0.html @BasePath / @securityDefinitions.apikey Bearer @in header @name Authorization @description Type "Bearer" followed by a space and JWT token.

func Start

func Start(ctx context.Context, config configuration.Config, ctrl Controller) (err error)

Types

type AdminInterface

type AdminInterface interface {
	ListTopics(token string, options model.ListOptions) (result []model.Topic, err error, code int)
	GetTopic(token string, id string) (result model.Topic, err error, code int)
	RemoveTopic(token string, id string) (err error, code int)
	SetTopic(token string, topic model.Topic) (result model.Topic, err error, code int)
}

type EndpointMethod

type EndpointMethod = func(config configuration.Config, router *http.ServeMux, ctrl Controller)

type HealthEndpoints

type HealthEndpoints struct{}

func (*HealthEndpoints) HealthCheck

func (this *HealthEndpoints) HealthCheck(config configuration.Config, router *http.ServeMux, ctrl Controller)

HealthCheck godoc @Summary health check @Description checks health and reachability of the service @Tags health @Success 200 @Router / [get]

func (*HealthEndpoints) HealthCheck2

func (this *HealthEndpoints) HealthCheck2(config configuration.Config, router *http.ServeMux, ctrl Controller)

HealthCheck godoc @Summary health check @Description checks health and reachability of the service @Tags health @Success 200 @Router /health [get]

type PermissionsCheckEndpoints

type PermissionsCheckEndpoints struct{}

func (*PermissionsCheckEndpoints) CheckMultiplePermissions

func (this *PermissionsCheckEndpoints) CheckMultiplePermissions(config configuration.Config, router *http.ServeMux, ctrl Controller)

CheckMultiplePermissions godoc @Summary check multiple permissions @Description check multiple permissions @Tags check @Security Bearer @Param topic path string true "Topic Id" @Param ids query string true "Resource Ids, comma seperated" @Param permissions query string false "checked permissions in the form of 'rwxa', defaults to 'r'" @Produce json @Success 200 {object} map[string]bool @Failure 400 @Failure 401 @Failure 500 @Router /check/{topic} [get]

func (*PermissionsCheckEndpoints) CheckPermission

func (this *PermissionsCheckEndpoints) CheckPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)

CheckPermission godoc @Summary check permission @Description check permission @Tags check @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Param permissions query string false "checked permissions in the form of 'rwxa', defaults to 'r'" @Produce json @Success 200 {object} bool @Failure 400 @Failure 401 @Failure 500 @Router /check/{topic}/{id} [get]

func (*PermissionsCheckEndpoints) ListAccessibleResourceIds

func (this *PermissionsCheckEndpoints) ListAccessibleResourceIds(config configuration.Config, router *http.ServeMux, ctrl Controller)

ListAccessibleResourceIds godoc @Summary list accessible resource ids @Description list accessible resource ids @Tags accessible, resource @Security Bearer @Param topic path string true "Topic Id" @Param permissions query string false "checked permissions in the form of 'rwxa', defaults to 'r'" @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} string @Failure 400 @Failure 401 @Failure 500 @Router /accessible/{topic} [get]

type PermissionsCheckInterface

type PermissionsCheckInterface interface {
	CheckPermission(token string, topicId string, id string, permissions string) (access bool, err error, code int)
	CheckMultiplePermissions(token string, topicId string, ids []string, permissions string) (access map[string]bool, err error, code int)
	ListAccessibleResourceIds(token string, topicId string, permissions string, options model.ListOptions) (ids []string, err error, code int)
}

type PermissionsManagementEndpoints

type PermissionsManagementEndpoints struct{}

func (*PermissionsManagementEndpoints) GetResource

func (this *PermissionsManagementEndpoints) GetResource(config configuration.Config, router *http.ServeMux, ctrl Controller)

GetResource godoc @Summary get resource @Description get resource, requesting user must have admin right @Tags manage, resource @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Produce json @Success 200 {object} model.Resource @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic}/{id} [get]

func (*PermissionsManagementEndpoints) ListResourcesWithAdminPermission

func (this *PermissionsManagementEndpoints) ListResourcesWithAdminPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)

ListResourcesWithAdminPermission godoc @Summary lists resources the user has admin rights to @Description lists resources the user has admin rights to @Tags manage, resource @Security Bearer @Param topic path string true "Topic Id" @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} model.Resource @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic} [get]

func (*PermissionsManagementEndpoints) SetPermission

func (this *PermissionsManagementEndpoints) SetPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)

SetPermission godoc @Summary set resource rights @Description get resource rights, requesting user must have admin right @Tags manage, resource-rights @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Param wait query bool false "if set to true, the response will be sent after the corresponding kafka done signal has been received" @Param message body model.ResourcePermissions true "Topic" @Accept json @Produce json @Success 200 {object} model.ResourcePermissions @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic}/{id} [put]

type PermissionsManagementInterface

type PermissionsManagementInterface interface {
	ListResourcesWithAdminPermission(token string, topicId string, options model.ListOptions) (result []model.Resource, err error, code int)
	GetResource(token string, topicId string, id string) (result model.Resource, err error, code int)
	SetPermission(token string, topicId string, id string, permissions model.ResourcePermissions, options model.SetPermissionOptions) (result model.ResourcePermissions, err error, code int)
}

type SwaggerEndpoints

type SwaggerEndpoints struct{}

func (*SwaggerEndpoints) Swagger

func (this *SwaggerEndpoints) Swagger(config configuration.Config, router *http.ServeMux, ctrl Controller)

type TopicsEndpoints

type TopicsEndpoints struct{}

func (*TopicsEndpoints) DeleteTopic

func (this *TopicsEndpoints) DeleteTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)

DeleteTopic godoc @Summary remove topic config @Description remove topic config, requesting user must be admin @Tags topics @Security Bearer @Param id path string true "Topic Id" @Success 200 @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics/{id} [delete]

func (*TopicsEndpoints) GetTopic

func (this *TopicsEndpoints) GetTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)

GetTopic godoc @Summary get topic config @Description get topic config, requesting user must be admin @Tags topics @Security Bearer @Param id path string true "Topic Id" @Produce json @Success 200 {object} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics/{id} [get]

func (*TopicsEndpoints) ListTopics

func (this *TopicsEndpoints) ListTopics(config configuration.Config, router *http.ServeMux, ctrl Controller)

ListTopics godoc @Summary lists topics with their configuration @Description lists topics with their configuration, requesting user must be admin @Tags topics @Security Bearer @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /admin/topics [get]

func (*TopicsEndpoints) SetTopic

func (this *TopicsEndpoints) SetTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)

SetTopic godoc @Summary set topic config @Description set topic config, requesting user must be admin @Tags topics @Accept json @Produce json @Security Bearer @Param id path string true "Topic Id" @Param message body model.Topic true "Topic" @Success 200 {object} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics/{id} [put]

func (*TopicsEndpoints) SetTopicByPost

func (this *TopicsEndpoints) SetTopicByPost(config configuration.Config, router *http.ServeMux, ctrl Controller)

SetTopicByPost godoc @Summary set topic config @Description set topic config, requesting user must be admin @Tags topics @Accept json @Produce json @Security Bearer @Param message body model.Topic true "Topic" @Success 200 {object} model.Topic @Success 202 {object} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics [POST]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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