lib

package
v0.0.0-...-2f76b7a Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpAddTopic

func OpAddTopic(info AddDeleteTopicJSON) error

OpAddTopic function adds topics to the particular user in the authorization configuration If any of the topics are present in the request JSON are available in the authorization configuration for that particular user, this functions returns false

func OpAddUser

func OpAddUser(user, password string) error

OpAddUser function puts new user to authorization configuration

func OpDeleteTopic

func OpDeleteTopic(info AddDeleteTopicJSON) error

OpDeleteTopic function deletes topics to the particular user in the authorization configuration If any of the topics are present in the request JSON are not available in the authorization configuration for that particular user, this functions returns false

func OpDeleteUser

func OpDeleteUser(user string) error

OpDeleteUser function deletes the user from authorization configuration

func OpDownloadConfiguration

func OpDownloadConfiguration() (string, error)

OpDownloadConfiguration function stores the authorization configuration to the file and reload the nats server

func OpShowTopics

func OpShowTopics() map[string]int

OpShowTopics function returns all the topics present in the authorization configuration

Types

type AddDeleteTopicJSON

type AddDeleteTopicJSON struct {
	User        string         `json:"user" binding:"required"`
	Permissions PermissionJSON `json:"permissions" binding:"required"`
}

AddDeleteTopicJSON maps and validate adding and deleting topics in authorization configuration

func OpShowUsers

func OpShowUsers() ([]AddDeleteTopicJSON, error)

OpShowUsers function returns current authorization configuration

type AddUserJSON

type AddUserJSON struct {
	User     string `json:"user" binding:"required"`
	Password string `json:"password" binding:"required"`
}

AddUserJSON maps and validate adding a user in authorization configuration

type AuthorizationJSON

type AuthorizationJSON struct {
	User        string         `json:"user"`
	Password    string         `json:"password"`
	Permissions PermissionJSON `json:"permissions"`
}

AuthorizationJSON stores info of each user in authorization configuration

type DeleteUserJSON

type DeleteUserJSON struct {
	User string `json:"user" binding:"required"`
}

DeleteUserJSON maps and validate deleting a user in authorization configuration

type DownloadConfigurationJSON

type DownloadConfigurationJSON struct {
	Authorization PreAuthorizationJSON `json:"authorization"`
}

DownloadConfigurationJSON stores JSON that as to be downloaded to configuration file

type PermissionJSON

type PermissionJSON struct {
	Publish   []string `json:"publish"`
	Subscribe []string `json:"subscribe"`
}

PermissionJSON stores permissions for each user in authorization configuration

type PreAuthorizationJSON

type PreAuthorizationJSON struct {
	Users []AuthorizationJSON `json:"users"`
}

PreAuthorizationJSON structure to store AuthorizationJSON

Jump to

Keyboard shortcuts

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