client

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 28 Imported by: 53

Documentation

Index

Constants

View Source
const Administrate = model.Administrate // user may delete resource; user may change resource rights (e.g. delete device)
View Source
const ClientVersion = model.ClientVersion
View Source
const Execute = model.Execute //user may use the resource (e.g. cmd to device; read device data; read database)
View Source
const InternalAdminToken = `` /* 727-byte string literal not displayed */

InternalAdminToken is expired and invalid. but because this service does not validate the received tokens, it may be used by trusted internal services which are within the same network (kubernetes cluster). requests with this token may not be routed over an ingres with token validation

View Source
const Read = model.Read //user may read the resource (metadata)  (e.g. read device name)
View Source
const Write = model.Write //user may write the resource (metadata)(e.g. rename device)

Variables

This section is empty.

Functions

func EmbedPermissionsClientIntoRouter added in v0.0.24

func EmbedPermissionsClientIntoRouter(client Client, router http.Handler, prefix string, pathFilter func(method string, path string) bool) http.Handler

func GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient added in v0.0.32

func GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient(packageName string, prefix string, location string, topicList []string, pathFilter func(method string, path string) bool) error

GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient generates a go file with swaggo comments needed to generate swagger documentation - location: defines where the new go file should be generated (containing the file-name e.g. "../generated_permissions.go") - packageName: sets the package name of the generated file - prefix: is the prefix before the permission endpoints. may have "/" prefix und suffix (e.g. "/permissions/"). default = "permissions" - topicList: replaces endpoints with {topic} placeholder with explicit endpoints; may be nil to keep placeholder - pathFilter:

  • function to filter undesired endpoints (like DELETE endpoints)
  • may be nil to allow all endpoints
  • pathFilter should return true to allow the endpoint
  • no guarantee if the input path contains placeholders like {topic} and {id}, or if the placeholder is replaced
  • the input path contains the prefix parameter to ensure compatibility with EmbedPermissionsClientIntoRouter

func NewTestClient

func NewTestClient(ctx context.Context) (client *controller.Controller, err error)

func NewTokenProvider

func NewTokenProvider(authEndpoint string, authClientId string, authClientSecret string) func() (string, error)

func NewUserTokenProvider

func NewUserTokenProvider(authEndpoint string, authClientId string, authClientSecret string, userName string, pw string) func() (string, error)

Types

type Client

type Client interface {
	api.Controller
}

type ClientImpl added in v0.0.11

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

func New

func New(serverUrl string) (client *ClientImpl)

func (*ClientImpl) AdminListResourceIds added in v0.0.11

func (this *ClientImpl) AdminListResourceIds(token string, topicId string, options ListOptions) (ids []string, err error, code int)

func (*ClientImpl) AdminLoadFromPermissionSearch added in v0.0.27

func (this *ClientImpl) AdminLoadFromPermissionSearch(req model.AdminLoadPermSearchRequest) (updateCount int, err error, code int)

AdminLoadFromPermissionSearch is not supported by the client because this request should never be automated

func (*ClientImpl) CheckMultiplePermissions added in v0.0.11

func (this *ClientImpl) CheckMultiplePermissions(token string, topicId string, ids []string, permissions ...Permission) (access map[string]bool, err error, code int)

func (*ClientImpl) CheckPermission added in v0.0.11

func (this *ClientImpl) CheckPermission(token string, topicId string, id string, permissions ...Permission) (access bool, err error, code int)

func (*ClientImpl) Export added in v0.0.28

func (this *ClientImpl) Export(token string, options model.ImportExportOptions) (result model.ImportExport, err error, code int)

func (*ClientImpl) GetResource added in v0.0.11

func (this *ClientImpl) GetResource(token string, topicId string, id string) (result Resource, err error, code int)

func (*ClientImpl) GetTopic added in v0.0.11

func (this *ClientImpl) GetTopic(token string, id string) (result Topic, err error, code int)

func (*ClientImpl) Import added in v0.0.28

func (this *ClientImpl) Import(token string, importModel model.ImportExport, options model.ImportExportOptions) (err error, code int)

func (*ClientImpl) ListAccessibleResourceIds added in v0.0.11

func (this *ClientImpl) ListAccessibleResourceIds(token string, topicId string, options ListOptions, permissions ...Permission) (ids []string, err error, code int)

func (*ClientImpl) ListComputedPermissions added in v0.0.15

func (this *ClientImpl) ListComputedPermissions(token string, topicId string, ids []string) (result []model.ComputedPermissions, err error, code int)

func (*ClientImpl) ListResourcesWithAdminPermission added in v0.0.11

func (this *ClientImpl) ListResourcesWithAdminPermission(token string, topicId string, options ListOptions) (result []Resource, err error, code int)

func (*ClientImpl) ListTopics added in v0.0.11

func (this *ClientImpl) ListTopics(token string, options ListOptions) (result []Topic, err error, code int)

func (*ClientImpl) RemoveResource added in v0.0.11

func (this *ClientImpl) RemoveResource(token string, topicId string, id string) (err error, code int)

RemoveResource removes a resource only admins may remove resources

func (*ClientImpl) RemoveTopic added in v0.0.11

func (this *ClientImpl) RemoveTopic(token string, id string) (err error, code int)

func (*ClientImpl) SetPermission added in v0.0.11

func (this *ClientImpl) SetPermission(token string, topicId string, id string, permissions ResourcePermissions) (result ResourcePermissions, err error, code int)

SetPermission sets the permissions of a resource. resource initialization needs to be done by an admin; user tokens may update their rights but may not create the initial resource

func (*ClientImpl) SetTopic added in v0.0.11

func (this *ClientImpl) SetTopic(token string, topic Topic) (result Topic, err error, code int)

type GetOptions added in v0.0.11

type GetOptions = model.GetOptions

type GroupPermissions added in v0.0.11

type GroupPermissions = model.GroupPermissions

type ImportExport added in v0.0.28

type ImportExport = model.ImportExport

type ImportExportOptions added in v0.0.28

type ImportExportOptions = model.ImportExportOptions

type ListOptions added in v0.0.11

type ListOptions = model.ListOptions

type OpenidToken

type OpenidToken struct {
	AccessToken      string    `json:"access_token"`
	ExpiresIn        float64   `json:"expires_in"`
	RefreshExpiresIn float64   `json:"refresh_expires_in"`
	RefreshToken     string    `json:"refresh_token"`
	TokenType        string    `json:"token_type"`
	RequestTime      time.Time `json:"-"`
}

type Permission added in v0.0.11

type Permission = model.Permission

type PermissionList added in v0.0.11

type PermissionList = model.PermissionList

type PermissionsMap added in v0.0.11

type PermissionsMap = model.PermissionsMap

type Resource added in v0.0.11

type Resource = model.Resource

type ResourcePermissions added in v0.0.11

type ResourcePermissions = model.ResourcePermissions

type Topic added in v0.0.11

type Topic = model.Topic

Jump to

Keyboard shortcuts

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