actions

package
v0.0.0-...-ac0b2cf Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = api.Module{
	Name: "actions",
	Setup: func(r api.Router) error {
		return newAPI().setup(r)
	},
}

Module is the API module for managing actions

Functions

This section is empty.

Types

type Action

type Action struct {
	// Name is the name of the action
	Name string `json:"name" gorm:"primary_key"`

	// Help is a human-readable help text mainly used
	// for UI purposes
	Help string `json:"help"`

	// Owner is the owner of the action and should
	// match the owners origin/audience
	Owner string `json:"owner"`
}

Action is an action that can be performed on some resource It is mainly used for AuthZ purposes together with the IAM service of Tierklinik Dobersberg

type Database

type Database interface {
	// Create creates a new action
	CreateAction(context.Context, Action) error

	// GetAction returns the action with the given name
	GetAction(context.Context, string) (*Action, error)

	// ListActions lists all available actions
	ListActions(context.Context) ([]*Action, error)

	// LitsActionsByOwner returns all actions that belong to a given owner
	ListActionsByOwner(context.Context, string) ([]*Action, error)

	// UpdateAction updates an existing action
	UpdateAction(context.Context, string, *Action) error

	// DeleteAction deletes an existing action
	DeleteAction(context.Context, string) error
}

Database encapsulates access to actions

func GetDatabase

func GetDatabase(r api.Router) Database

GetDatabase returns the action database associated with r

Jump to

Keyboard shortcuts

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