/
schema_notifier_wechat_config.go
58 lines (52 loc) · 1.41 KB
/
schema_notifier_wechat_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package rancher2
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)
const (
notifierWechatRecipientTypeParty = "party"
notifierWechatRecipientTypeTag = "tag"
notifierWechatRecipientTypeUser = "user"
)
var (
notifierWechatRecipientTypes = []string{notifierWechatRecipientTypeParty, notifierWechatRecipientTypeTag, notifierWechatRecipientTypeUser}
)
// Schemas
func notifierWechatConfigFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"agent": {
Type: schema.TypeString,
Required: true,
Description: "Wechat application agent ID",
},
"corp": {
Type: schema.TypeString,
Required: true,
Description: "Wechat corporation ID",
},
"default_recipient": {
Type: schema.TypeString,
Required: true,
Description: "Wechat default channel",
},
"secret": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
Description: "Wechat application secret",
},
"proxy_url": {
Type: schema.TypeString,
Optional: true,
Description: "Wechat proxy URL",
},
"recipient_type": {
Type: schema.TypeString,
Optional: true,
Default: notifierWechatRecipientTypeParty,
Description: "Wechat recipient type",
ValidateFunc: validation.StringInSlice(notifierWechatRecipientTypes, true),
},
}
return s
}