Skip to content

Commit a920319

Browse files
make exactly and at least one of work, fix places where its broken (#5341) (#10371)
* make exactly and at least one of work, fix places where its broken * fix a few more * fix rake issue * update no nodes test (should error now) and add comment * fix errors * fix one more TOC listing Signed-off-by: Modular Magician <[email protected]>
1 parent cb0ed82 commit a920319

12 files changed

+249
-67
lines changed

.changelog/5341.txt

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
```release-note:breaking-change
2+
bigquery: Exactly one of `query`, `load`, `copy` or `extract` is required on `google_bigquery_job`
3+
```
4+
```release-note:breaking-change
5+
bigquery: At least one of `statement_timeout_ms`, `statement_byte_budget`, or `key_result_statement` is required on `google_bigquery_job.query.script_options.`
6+
```
7+
```release-note:breaking-change
8+
bigquery: Exactly one of `source_table` or `source_model` is required on `google_bigquery_job.extract`
9+
```
10+
```release-note:breaking-change
11+
cloudbuild: Exactly one of `branch_name`, `commit_sha` or `tag_name` is required on `google_cloudbuild_trigger.build.source.repo_source`
12+
```
13+
```release-note:breaking-change
14+
compute: At least one of `max_scaled_down_replicas` or `time_window_sec` is required on `google_compute_autoscaler.autoscaling_policy.scale_down_control`
15+
```
16+
```release-note:breaking-change
17+
compute: At least one of `fixed` or `percent` is required on `google_compute_autoscaler.autoscaling_policy.scale_down_control.max_scaled_down_replicas`
18+
```
19+
```release-note:breaking-change
20+
compute: At least one of `max_scaled_in_replicas` or `time_window_sec` is required on `google_compute_autoscaler.autoscaling_policy.scale_in_control.0.`
21+
```
22+
```release-note:breaking-change
23+
compute: At least one of `fixed` or `percent` is required on `google_compute_autoscaler.autoscaling_policy.scale_in_control.max_scaled_in_replicas`
24+
```
25+
```release-note:breaking-change
26+
compute: At least one of `max_scaled_down_replicas` or `time_window_sec` is required on `google_compute_region_autoscaler.autoscaling_policy.scale_down_control`
27+
```
28+
```release-note:breaking-change
29+
compute: At least one of `fixed` or `percent` is required on `google_compute_region_autoscaler.autoscaling_policy.scale_down_control.max_scaled_down_replicas`
30+
```
31+
```release-note:breaking-change
32+
compute: At least one of `max_scaled_in_replicas` or `time_window_sec` is required on `google_compute_region_autoscaler.autoscaling_policy.scale_in_control.0.`
33+
```
34+
```release-note:breaking-change
35+
compute: At least one of `fixed` or `percent` is required on `google_compute_region_autoscaler.autoscaling_policy.scale_in_control.max_scaled_in_replicas`
36+
```
37+
```release-note:breaking-change
38+
compute: At least one of `fixed_delay` or `percentage` is required on `google_compute_url_map.default_route_action.fault_injection_policy.delay`
39+
```
40+
```release-note:breaking-change
41+
dlp: Exactly one of `url` or `regex_file_set` is required on `google_data_loss_prevention_trigger.inspect_job.storage_config.cloud_storage_options.file_set`
42+
```
43+
```release-note:breaking-change
44+
dlp: At least one of `start_time` or `end_time` is required on `google_data_loss_prevention_trigger.inspect_job.storage_config.timespan_config`
45+
```
46+
```release-note:breaking-change
47+
osconfig: At least one of `reboot_config`, `apt`, `yum`, `goo` `zypper`, `windows_update`, `pre_step` or `pre_step` is required on `google_os_config_patch_deployment.patch_config`
48+
```
49+
```release-note:breaking-change
50+
osconfig: At least one of `type`, `excludes` or `exclusive_packages` is required on `google_os_config_patch_deployment.patch_config.apt`
51+
```
52+
```release-note:breaking-change
53+
osconfig: At least one of `security`, `minimal`, `excludes` or `exclusive_packages` is required on `google_os_config_patch_deployment.patch_config.yum`
54+
```
55+
```release-note:breaking-change
56+
osconfig: At least one of `with_optional`, `with_update`, `categories`, `severities`, `excludes` or `exclusive_patches` is required on `google_os_config_patch_deployment.patch_config.zypper`
57+
```
58+
```release-note:breaking-change
59+
osconfig: Exactly one of `classifications`, `excludes` or `exclusive_patches` is required on `google_os_config_patch_deployment.inspect_job.patch_config.windows_update`
60+
```
61+
```release-note:breaking-change
62+
osconfig: At least one of `linux_exec_step_config` or `windows_exec_step_config` is required on `google_os_config_patch_deployment.patch_config.pre_step`
63+
```
64+
```release-note:breaking-change
65+
osconfig: At least one of `linux_exec_step_config` or `windows_exec_step_config` is required on `google_os_config_patch_deployment.patch_config.post_step`
66+
```
67+
```release-note:breaking-change
68+
spanner: At least one of `num_nodes` or `processing_units` is required on `google_spanner_instance`
69+
```

google/resource_bigquery_job.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Creation, truncation and append actions occur as one atomic update upon job comp
170170
},
171171
},
172172
},
173-
ExactlyOneOf: []string{},
173+
ExactlyOneOf: []string{"query", "load", "copy", "extract"},
174174
},
175175
"extract": {
176176
Type: schema.TypeList,
@@ -249,7 +249,7 @@ Default is ','`,
249249
},
250250
},
251251
},
252-
ExactlyOneOf: []string{},
252+
ExactlyOneOf: []string{"extract.0.source_table", "extract.0.source_model"},
253253
},
254254
"source_table": {
255255
Type: schema.TypeList,
@@ -283,7 +283,7 @@ or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}
283283
},
284284
},
285285
},
286-
ExactlyOneOf: []string{},
286+
ExactlyOneOf: []string{"extract.0.source_table", "extract.0.source_model"},
287287
},
288288
"use_avro_logical_types": {
289289
Type: schema.TypeBool,
@@ -293,7 +293,7 @@ or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}
293293
},
294294
},
295295
},
296-
ExactlyOneOf: []string{},
296+
ExactlyOneOf: []string{"query", "load", "copy", "extract"},
297297
},
298298
"job_timeout_ms": {
299299
Type: schema.TypeString,
@@ -577,7 +577,7 @@ Creation, truncation and append actions occur as one atomic update upon job comp
577577
},
578578
},
579579
},
580-
ExactlyOneOf: []string{},
580+
ExactlyOneOf: []string{"query", "load", "copy", "extract"},
581581
},
582582
"query": {
583583
Type: schema.TypeList,
@@ -763,21 +763,21 @@ ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema t
763763
ValidateFunc: validation.StringInSlice([]string{"LAST", "FIRST_SELECT", ""}, false),
764764
Description: `Determines which statement in the script represents the "key result",
765765
used to populate the schema and query results of the script job. Possible values: ["LAST", "FIRST_SELECT"]`,
766-
AtLeastOneOf: []string{},
766+
AtLeastOneOf: []string{"query.0.script_options.0.statement_timeout_ms", "query.0.script_options.0.statement_byte_budget", "query.0.script_options.0.key_result_statement"},
767767
},
768768
"statement_byte_budget": {
769769
Type: schema.TypeString,
770770
Optional: true,
771771
ForceNew: true,
772772
Description: `Limit on the number of bytes billed per statement. Exceeding this budget results in an error.`,
773-
AtLeastOneOf: []string{},
773+
AtLeastOneOf: []string{"query.0.script_options.0.statement_timeout_ms", "query.0.script_options.0.statement_byte_budget", "query.0.script_options.0.key_result_statement"},
774774
},
775775
"statement_timeout_ms": {
776776
Type: schema.TypeString,
777777
Optional: true,
778778
ForceNew: true,
779779
Description: `Timeout period for each statement in a script.`,
780-
AtLeastOneOf: []string{},
780+
AtLeastOneOf: []string{"query.0.script_options.0.statement_timeout_ms", "query.0.script_options.0.statement_byte_budget", "query.0.script_options.0.key_result_statement"},
781781
},
782782
},
783783
},
@@ -836,7 +836,7 @@ Creation, truncation and append actions occur as one atomic update upon job comp
836836
},
837837
},
838838
},
839-
ExactlyOneOf: []string{},
839+
ExactlyOneOf: []string{"query", "load", "copy", "extract"},
840840
},
841841
"job_type": {
842842
Type: schema.TypeString,

google/resource_cloudbuild_trigger.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,13 @@ One of 'storageSource' or 'repoSource' must be provided.`,
529529
Description: `Regex matching branches to build. Exactly one a of branch name, tag, or commit SHA must be provided.
530530
The syntax of the regular expressions accepted is the syntax accepted by RE2 and
531531
described at https://github.com/google/re2/wiki/Syntax`,
532-
ExactlyOneOf: []string{},
532+
ExactlyOneOf: []string{"build.0.source.0.repo_source.0.branch_name", "build.0.source.0.repo_source.0.commit_sha", "build.0.source.0.repo_source.0.tag_name"},
533533
},
534534
"commit_sha": {
535535
Type: schema.TypeString,
536536
Optional: true,
537537
Description: `Explicit commit SHA to build. Exactly one a of branch name, tag, or commit SHA must be provided.`,
538-
ExactlyOneOf: []string{},
538+
ExactlyOneOf: []string{"build.0.source.0.repo_source.0.branch_name", "build.0.source.0.repo_source.0.commit_sha", "build.0.source.0.repo_source.0.tag_name"},
539539
},
540540
"dir": {
541541
Type: schema.TypeString,
@@ -567,7 +567,7 @@ If omitted, the project ID requesting the build is assumed.`,
567567
Description: `Regex matching tags to build. Exactly one a of branch name, tag, or commit SHA must be provided.
568568
The syntax of the regular expressions accepted is the syntax accepted by RE2 and
569569
described at https://github.com/google/re2/wiki/Syntax`,
570-
ExactlyOneOf: []string{},
570+
ExactlyOneOf: []string{"build.0.source.0.repo_source.0.branch_name", "build.0.source.0.repo_source.0.commit_sha", "build.0.source.0.repo_source.0.tag_name"},
571571
},
572572
},
573573
},

google/resource_compute_autoscaler.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -207,26 +207,28 @@ and outages due to abrupt scale-in events`,
207207
Optional: true,
208208
Description: `Specifies a fixed number of VM instances. This must be a positive
209209
integer.`,
210+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.fixed", "autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.percent"},
210211
},
211212
"percent": {
212213
Type: schema.TypeInt,
213214
Optional: true,
214215
Description: `Specifies a percentage of instances between 0 to 100%, inclusive.
215216
For example, specify 80 for 80%.`,
217+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.fixed", "autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.percent"},
216218
},
217219
},
218220
},
219-
AtLeastOneOf: []string{},
221+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas", "autoscaling_policy.0.scale_in_control.0.time_window_sec"},
220222
},
221223
"time_window_sec": {
222224
Type: schema.TypeInt,
223225
Optional: true,
224226
Description: `How long back autoscaling should look when computing recommendations
225227
to include directives regarding slower scale down, as described above.`,
228+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas", "autoscaling_policy.0.scale_in_control.0.time_window_sec"},
226229
},
227230
},
228231
},
229-
AtLeastOneOf: []string{},
230232
},
231233
"scaling_schedules": {
232234
Type: schema.TypeSet,

google/resource_compute_region_autoscaler.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -207,26 +207,28 @@ and outages due to abrupt scale-in events`,
207207
Optional: true,
208208
Description: `Specifies a fixed number of VM instances. This must be a positive
209209
integer.`,
210+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.fixed", "autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.percent"},
210211
},
211212
"percent": {
212213
Type: schema.TypeInt,
213214
Optional: true,
214215
Description: `Specifies a percentage of instances between 0 to 100%, inclusive.
215216
For example, specify 80 for 80%.`,
217+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.fixed", "autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas.0.percent"},
216218
},
217219
},
218220
},
219-
AtLeastOneOf: []string{},
221+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas", "autoscaling_policy.0.scale_in_control.0.time_window_sec"},
220222
},
221223
"time_window_sec": {
222224
Type: schema.TypeInt,
223225
Optional: true,
224226
Description: `How long back autoscaling should look when computing recommendations
225227
to include directives regarding slower scale down, as described above.`,
228+
AtLeastOneOf: []string{"autoscaling_policy.0.scale_in_control.0.max_scaled_in_replicas", "autoscaling_policy.0.scale_in_control.0.time_window_sec"},
226229
},
227230
},
228231
},
229-
AtLeastOneOf: []string{},
230232
},
231233
"scaling_schedules": {
232234
Type: schema.TypeSet,

google/resource_compute_region_url_map.go

-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ you create the resource.`,
171171
Description: `A reference to a RegionBackendService resource. This will be used if
172172
none of the pathRules defined by this PathMatcher is matched by
173173
the URL's path portion.`,
174-
ExactlyOneOf: []string{},
175174
},
176175
"default_url_redirect": {
177176
Type: schema.TypeList,
@@ -243,7 +242,6 @@ the request method will be retained. Possible values: ["FOUND", "MOVED_PERMANENT
243242
},
244243
},
245244
},
246-
ExactlyOneOf: []string{},
247245
},
248246
"description": {
249247
Type: schema.TypeString,

google/resource_compute_url_map.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.2
218218
},
219219
},
220220
},
221-
AtLeastOneOf: []string{"default_route_action.0.fault_injection_policy.0.delay.0.percentage"},
221+
AtLeastOneOf: []string{"default_route_action.0.fault_injection_policy.0.delay.0.fixed_delay", "default_route_action.0.fault_injection_policy.0.delay.0.percentage"},
222222
},
223223
"percentage": {
224224
Type: schema.TypeFloat,
225225
Optional: true,
226226
ValidateFunc: validation.FloatBetween(0, 100),
227227
Description: `The percentage of traffic (connections/operations/requests) on which delay will be introduced as part of fault injection.
228228
The value must be between 0.0 and 100.0 inclusive.`,
229-
AtLeastOneOf: []string{"default_route_action.0.fault_injection_policy.0.delay.0.percentage"},
229+
AtLeastOneOf: []string{"default_route_action.0.fault_injection_policy.0.delay.0.fixed_delay", "default_route_action.0.fault_injection_policy.0.delay.0.percentage"},
230230
},
231231
},
232232
},

google/resource_data_loss_prevention_job_trigger.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ match all files by default (this is equivalent to including .* in the list)`,
261261
},
262262
},
263263
},
264-
ExactlyOneOf: []string{},
264+
ExactlyOneOf: []string{"inspect_job.0.storage_config.0.cloud_storage_options.0.file_set.0.url", "inspect_job.0.storage_config.0.cloud_storage_options.0.file_set.0.regex_file_set"},
265265
},
266266
"url": {
267267
Type: schema.TypeString,
@@ -272,7 +272,7 @@ in the path is allowed.
272272
If the url ends in a trailing slash, the bucket or directory represented by the url will be scanned
273273
non-recursively (content in sub-directories will not be scanned). This means that 'gs://mybucket/' is
274274
equivalent to 'gs://mybucket/*', and 'gs://mybucket/directory/' is equivalent to 'gs://mybucket/directory/*'.`,
275-
ExactlyOneOf: []string{},
275+
ExactlyOneOf: []string{"inspect_job.0.storage_config.0.cloud_storage_options.0.file_set.0.url", "inspect_job.0.storage_config.0.cloud_storage_options.0.file_set.0.regex_file_set"},
276276
},
277277
},
278278
},
@@ -397,17 +397,18 @@ timestamp property does not exist or its value is empty or invalid.`,
397397
Description: `When the job is started by a JobTrigger we will automatically figure out a valid startTime to avoid
398398
scanning files that have not been modified since the last time the JobTrigger executed. This will
399399
be based on the time of the execution of the last run of the JobTrigger.`,
400-
AtLeastOneOf: []string{},
401400
},
402401
"end_time": {
403-
Type: schema.TypeString,
404-
Optional: true,
405-
Description: `Exclude files or rows newer than this value. If set to zero, no upper time limit is applied.`,
402+
Type: schema.TypeString,
403+
Optional: true,
404+
Description: `Exclude files or rows newer than this value. If set to zero, no upper time limit is applied.`,
405+
AtLeastOneOf: []string{"inspect_job.0.storage_config.0.timespan_config.0.start_time", "inspect_job.0.storage_config.0.timespan_config.0.end_time"},
406406
},
407407
"start_time": {
408-
Type: schema.TypeString,
409-
Optional: true,
410-
Description: `Exclude files or rows older than this value.`,
408+
Type: schema.TypeString,
409+
Optional: true,
410+
Description: `Exclude files or rows older than this value.`,
411+
AtLeastOneOf: []string{"inspect_job.0.storage_config.0.timespan_config.0.start_time", "inspect_job.0.storage_config.0.timespan_config.0.end_time"},
411412
},
412413
},
413414
},

0 commit comments

Comments
 (0)