Documentation ¶
Index ¶
- func OpAddTopic(info AddDeleteTopicJSON) error
- func OpAddUser(user, password string) error
- func OpDeleteTopic(info AddDeleteTopicJSON) error
- func OpDeleteUser(user string) error
- func OpDownloadConfiguration() (string, error)
- func OpShowTopics() map[string]int
- type AddDeleteTopicJSON
- type AddUserJSON
- type AuthorizationJSON
- type DeleteUserJSON
- type DownloadConfigurationJSON
- type PermissionJSON
- type PreAuthorizationJSON
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 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 ¶
OpDeleteUser function deletes the user from authorization configuration
func OpDownloadConfiguration ¶
OpDownloadConfiguration function stores the authorization configuration to the file and reload the nats server
func OpShowTopics ¶
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