dynsec_clients.go 897 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package mq
  2. // MqClient - type for taking in an MQ client's data
  3. type MqClient struct {
  4. ID string
  5. Text string
  6. Password string
  7. Networks []string
  8. }
  9. // DeleteMqClient - removes a client from the DynSec system
  10. func DeleteMqClient(hostID string) error {
  11. event := MqDynsecPayload{
  12. Commands: []MqDynSecCmd{
  13. {
  14. Command: DeleteClientCmd,
  15. Username: hostID,
  16. },
  17. },
  18. }
  19. return publishEventToDynSecTopic(event)
  20. }
  21. // CreateMqClient - creates an MQ DynSec client
  22. func CreateMqClient(client *MqClient) error {
  23. event := MqDynsecPayload{
  24. Commands: []MqDynSecCmd{
  25. {
  26. Command: CreateClientCmd,
  27. Username: client.ID,
  28. Password: client.Password,
  29. Textname: client.Text,
  30. Roles: []MqDynSecRole{
  31. {
  32. Rolename: genericRole,
  33. Priority: -1,
  34. },
  35. },
  36. Groups: make([]MqDynSecGroup, 0),
  37. },
  38. },
  39. }
  40. return publishEventToDynSecTopic(event)
  41. }