Skip to content

Commit e601179

Browse files
committed
chore: update
1 parent 65addce commit e601179

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

provider/data_source_policy.go

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,35 @@ func getMaskingExceptionPolicySchema(computed bool) *schema.Schema {
8686
Elem: &schema.Resource{
8787
Schema: map[string]*schema.Schema{
8888
"database": {
89-
Type: schema.TypeString,
90-
Computed: computed,
91-
Optional: true,
92-
Description: "The database full name in instances/{instance resource id}/databases/{database name} format",
89+
Type: schema.TypeString,
90+
Computed: computed,
91+
Optional: true,
92+
ValidateFunc: validation.StringIsNotEmpty,
93+
Description: "The database full name in instances/{instance resource id}/databases/{database name} format",
9394
},
9495
"schema": {
9596
Type: schema.TypeString,
9697
Computed: computed,
9798
Optional: true,
9899
},
99100
"table": {
100-
Type: schema.TypeString,
101-
Computed: computed,
102-
Optional: true,
101+
Type: schema.TypeString,
102+
Computed: computed,
103+
Optional: true,
104+
ValidateFunc: validation.StringIsNotEmpty,
103105
},
104106
"column": {
105-
Type: schema.TypeString,
106-
Computed: computed,
107-
Optional: true,
107+
Type: schema.TypeString,
108+
Computed: computed,
109+
Optional: true,
110+
ValidateFunc: validation.StringIsNotEmpty,
108111
},
109112
"member": {
110-
Type: schema.TypeString,
111-
Computed: computed,
112-
Optional: true,
113+
Type: schema.TypeString,
114+
Computed: computed,
115+
Optional: true,
116+
ValidateFunc: validation.StringIsNotEmpty,
117+
Description: "The member in user:{email} format.",
113118
},
114119
"masking_level": {
115120
Type: schema.TypeString,
@@ -133,7 +138,7 @@ func getMaskingExceptionPolicySchema(computed bool) *schema.Schema {
133138
Type: schema.TypeString,
134139
Computed: computed,
135140
Optional: true,
136-
Description: "The exception expire timestamp",
141+
Description: "The expiration timestamp in YYYY-MM-DDThh:mm:ss.000Z format",
137142
},
138143
},
139144
},
@@ -164,14 +169,16 @@ func getMaskingPolicySchema(computed bool) *schema.Schema {
164169
Optional: true,
165170
},
166171
"table": {
167-
Type: schema.TypeString,
168-
Computed: computed,
169-
Optional: true,
172+
Type: schema.TypeString,
173+
Computed: computed,
174+
Optional: true,
175+
ValidateFunc: validation.StringIsNotEmpty,
170176
},
171177
"column": {
172-
Type: schema.TypeString,
173-
Computed: computed,
174-
Optional: true,
178+
Type: schema.TypeString,
179+
Computed: computed,
180+
Optional: true,
181+
ValidateFunc: validation.StringIsNotEmpty,
175182
},
176183
"full_masking_algorithm_id": {
177184
Type: schema.TypeString,

provider/resource_policy.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ func convertToMaskingExceptionPolicy(d *schema.ResourceData) (*v1pb.MaskingExcep
266266
if expire, ok := rawException["expire_timestamp"].(string); ok && expire != "" {
267267
expressions = append(expressions, fmt.Sprintf(`request.time < timestamp("%s")`, expire))
268268
}
269+
member := rawException["member"].(string)
270+
if !strings.HasPrefix(member, "user:") {
271+
return nil, errors.Errorf("member should in user:{email} format")
272+
}
269273
policy.MaskingExceptions = append(policy.MaskingExceptions, &v1pb.MaskingExceptionPolicy_MaskingException{
270274
Member: rawException["member"].(string),
271275
Action: v1pb.MaskingExceptionPolicy_MaskingException_Action(

0 commit comments

Comments
 (0)