-
Notifications
You must be signed in to change notification settings - Fork 25
/
models.go
50 lines (43 loc) · 1.25 KB
/
models.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 iam
import (
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type PolicyModel struct {
DefaultServiceStrategy types.String `tfsdk:"default_service_strategy"`
Services types.Map `tfsdk:"services"`
}
func (m PolicyModel) Types() map[string]attr.Type {
return map[string]attr.Type{
"default_service_strategy": types.StringType,
"services": types.MapType{
ElemType: types.ObjectType{AttrTypes: PolicyServiceModel{}.Types()},
},
}
}
type PolicyServiceModel struct {
Type types.String `tfsdk:"type"`
Rules types.List `tfsdk:"rules"`
}
func (m PolicyServiceModel) Types() map[string]attr.Type {
return map[string]attr.Type{
"type": types.StringType,
"rules": types.ListType{
ElemType: types.ObjectType{AttrTypes: PolicyServiceRuleModel{}.Types()},
},
}
}
type PolicyServiceRuleModel struct {
Action types.String `tfsdk:"action"`
Expression types.String `tfsdk:"expression"`
Resources types.List `tfsdk:"resources"`
}
func (m PolicyServiceRuleModel) Types() map[string]attr.Type {
return map[string]attr.Type{
"action": types.StringType,
"expression": types.StringType,
"resources": types.ListType{
ElemType: types.StringType,
},
}
}