client

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 22 Imported by: 34

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) http.Handler

func GenerateGoFileWithSwaggoCommentsForEmbededPermissionsClient added in v0.0.24

func GenerateGoFileWithSwaggoCommentsForEmbededPermissionsClient(packageName string, prefix string, location string) error

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) 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) 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)

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 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
JackTT - Gopher 🇻🇳