robot.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package notify
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/pkg/tristate"
  18. "yunion.io/x/onecloud/pkg/apis"
  19. )
  20. const (
  21. WEBHOOK_SIGNATURE_HEADER = "X-Auth-Token"
  22. )
  23. type RobotCreateInput struct {
  24. apis.SharableVirtualResourceCreateInput
  25. apis.EnabledBaseResourceCreateInput
  26. // description: robot type
  27. // enum: ["feishu","dingtalk","workwx","webhook"]
  28. // example: webhook
  29. Type string `json:"type"`
  30. // description: address
  31. // example: http://helloworld.io/test/webhook
  32. Address string `json:"address"`
  33. // description: Language preference
  34. // example: zh_CN
  35. Lang string `json:"lang"`
  36. Header jsonutils.JSONObject `json:"header"`
  37. Body jsonutils.JSONObject `json:"body"`
  38. MsgKey string `json:"msg_key"`
  39. SecretKey string `json:"secret_key"`
  40. UseTemplate tristate.TriState `json:"use_template"`
  41. }
  42. type RobotDetails struct {
  43. apis.SharableVirtualResourceDetails
  44. }
  45. type RobotListInput struct {
  46. apis.SharableVirtualResourceListInput
  47. apis.EnabledResourceBaseListInput
  48. // description: robot type
  49. // enum: ["feishu","dingtalk","workwx","webhook"]
  50. // example: webhook
  51. Type string `json:"type"`
  52. // description: Language preference
  53. // example: en
  54. Lang string `json:"lang"`
  55. }
  56. type RobotUpdateInput struct {
  57. apis.SharableVirtualResourceBaseUpdateInput
  58. // description: address
  59. // example: http://helloworld.io/test/webhook
  60. Address string `json:"address"`
  61. // description: Language preference
  62. // example: en
  63. Lang string `json:"lang"`
  64. Header jsonutils.JSONObject `json:"header"`
  65. Body jsonutils.JSONObject `json:"body"`
  66. MsgKey string `json:"msg_key"`
  67. SecretKey string `json:"secret_key"`
  68. }