-
Notifications
You must be signed in to change notification settings - Fork 221
/
schema_auth_config.go
50 lines (44 loc) · 1010 Bytes
/
schema_auth_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
package rancher2
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)
const authDefaultAccessMode = "unrestricted"
var (
authAccessModes = []string{"required", "restricted", "unrestricted"}
)
//Schemas
func authConfigFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"type": {
Type: schema.TypeString,
Computed: true,
},
"access_mode": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice(authAccessModes, true),
Default: authDefaultAccessMode,
},
"allowed_principal_ids": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"enabled": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
}
for k, v := range commonAnnotationLabelFields() {
s[k] = v
}
return s
}