mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-11 18:32:08 +08:00
47 lines
897 B
Go
47 lines
897 B
Go
package mq
|
|
|
|
// MqClient - type for taking in an MQ client's data
|
|
type MqClient struct {
|
|
ID string
|
|
Text string
|
|
Password string
|
|
Networks []string
|
|
}
|
|
|
|
// DeleteMqClient - removes a client from the DynSec system
|
|
func DeleteMqClient(hostID string) error {
|
|
|
|
event := MqDynsecPayload{
|
|
Commands: []MqDynSecCmd{
|
|
{
|
|
Command: DeleteClientCmd,
|
|
Username: hostID,
|
|
},
|
|
},
|
|
}
|
|
return publishEventToDynSecTopic(event)
|
|
}
|
|
|
|
// CreateMqClient - creates an MQ DynSec client
|
|
func CreateMqClient(client *MqClient) error {
|
|
|
|
event := MqDynsecPayload{
|
|
Commands: []MqDynSecCmd{
|
|
{
|
|
Command: CreateClientCmd,
|
|
Username: client.ID,
|
|
Password: client.Password,
|
|
Textname: client.Text,
|
|
Roles: []MqDynSecRole{
|
|
{
|
|
Rolename: genericRole,
|
|
Priority: -1,
|
|
},
|
|
},
|
|
Groups: make([]MqDynSecGroup, 0),
|
|
},
|
|
},
|
|
}
|
|
|
|
return publishEventToDynSecTopic(event)
|
|
}
|