@@ -225,6 +225,28 @@ Only for use with external storage. Possible values: ["BASIC_COLUMNS", "GCS_COLU
225
225
},
226
226
},
227
227
},
228
+ "rows_limit" : {
229
+ Type : schema .TypeInt ,
230
+ Optional : true ,
231
+ Description : `Max number of rows to scan. If the table has more rows than this value, the rest of the rows are omitted.
232
+ If not set, or if set to 0, all rows will be scanned. Only one of rowsLimit and rowsLimitPercent can be
233
+ specified. Cannot be used in conjunction with TimespanConfig.` ,
234
+ },
235
+ "rows_limit_percent" : {
236
+ Type : schema .TypeInt ,
237
+ Optional : true ,
238
+ Description : `Max percentage of rows to scan. The rest are omitted. The number of rows scanned is rounded down.
239
+ Must be between 0 and 100, inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one of
240
+ rowsLimit and rowsLimitPercent can be specified. Cannot be used in conjunction with TimespanConfig.` ,
241
+ },
242
+ "sample_method" : {
243
+ Type : schema .TypeString ,
244
+ Optional : true ,
245
+ ValidateFunc : validateEnum ([]string {"TOP" , "RANDOM_START" , "" }),
246
+ Description : `How to sample rows if not all rows are scanned. Meaningful only when used in conjunction with either
247
+ rowsLimit or rowsLimitPercent. If not specified, rows are scanned in the order BigQuery reads them. Default value: "TOP" Possible values: ["TOP", "RANDOM_START"]` ,
248
+ Default : "TOP" ,
249
+ },
228
250
},
229
251
},
230
252
},
@@ -1086,6 +1108,12 @@ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptions(v
1086
1108
transformed := make (map [string ]interface {})
1087
1109
transformed ["table_reference" ] =
1088
1110
flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsTableReference (original ["tableReference" ], d , config )
1111
+ transformed ["rows_limit" ] =
1112
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimit (original ["rowsLimit" ], d , config )
1113
+ transformed ["rows_limit_percent" ] =
1114
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimitPercent (original ["rowsLimitPercent" ], d , config )
1115
+ transformed ["sample_method" ] =
1116
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsSampleMethod (original ["sampleMethod" ], d , config )
1089
1117
return []interface {}{transformed }
1090
1118
}
1091
1119
func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsTableReference (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
@@ -1117,6 +1145,44 @@ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsTa
1117
1145
return v
1118
1146
}
1119
1147
1148
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimit (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1149
+ // Handles the string fixed64 format
1150
+ if strVal , ok := v .(string ); ok {
1151
+ if intVal , err := stringToFixed64 (strVal ); err == nil {
1152
+ return intVal
1153
+ }
1154
+ }
1155
+
1156
+ // number values are represented as float64
1157
+ if floatVal , ok := v .(float64 ); ok {
1158
+ intVal := int (floatVal )
1159
+ return intVal
1160
+ }
1161
+
1162
+ return v // let terraform core handle it otherwise
1163
+ }
1164
+
1165
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimitPercent (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1166
+ // Handles the string fixed64 format
1167
+ if strVal , ok := v .(string ); ok {
1168
+ if intVal , err := stringToFixed64 (strVal ); err == nil {
1169
+ return intVal
1170
+ }
1171
+ }
1172
+
1173
+ // number values are represented as float64
1174
+ if floatVal , ok := v .(float64 ); ok {
1175
+ intVal := int (floatVal )
1176
+ return intVal
1177
+ }
1178
+
1179
+ return v // let terraform core handle it otherwise
1180
+ }
1181
+
1182
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsSampleMethod (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1183
+ return v
1184
+ }
1185
+
1120
1186
func flattenDataLossPreventionJobTriggerInspectJobActions (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1121
1187
if v == nil {
1122
1188
return v
@@ -1671,6 +1737,27 @@ func expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptions(v
1671
1737
transformed ["tableReference" ] = transformedTableReference
1672
1738
}
1673
1739
1740
+ transformedRowsLimit , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimit (original ["rows_limit" ], d , config )
1741
+ if err != nil {
1742
+ return nil , err
1743
+ } else if val := reflect .ValueOf (transformedRowsLimit ); val .IsValid () && ! isEmptyValue (val ) {
1744
+ transformed ["rowsLimit" ] = transformedRowsLimit
1745
+ }
1746
+
1747
+ transformedRowsLimitPercent , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimitPercent (original ["rows_limit_percent" ], d , config )
1748
+ if err != nil {
1749
+ return nil , err
1750
+ } else if val := reflect .ValueOf (transformedRowsLimitPercent ); val .IsValid () && ! isEmptyValue (val ) {
1751
+ transformed ["rowsLimitPercent" ] = transformedRowsLimitPercent
1752
+ }
1753
+
1754
+ transformedSampleMethod , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsSampleMethod (original ["sample_method" ], d , config )
1755
+ if err != nil {
1756
+ return nil , err
1757
+ } else if val := reflect .ValueOf (transformedSampleMethod ); val .IsValid () && ! isEmptyValue (val ) {
1758
+ transformed ["sampleMethod" ] = transformedSampleMethod
1759
+ }
1760
+
1674
1761
return transformed , nil
1675
1762
}
1676
1763
@@ -1719,6 +1806,18 @@ func expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsTab
1719
1806
return v , nil
1720
1807
}
1721
1808
1809
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimit (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1810
+ return v , nil
1811
+ }
1812
+
1813
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsRowsLimitPercent (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1814
+ return v , nil
1815
+ }
1816
+
1817
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsSampleMethod (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1818
+ return v , nil
1819
+ }
1820
+
1722
1821
func expandDataLossPreventionJobTriggerInspectJobActions (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1723
1822
l := v .([]interface {})
1724
1823
req := make ([]interface {}, 0 , len (l ))
0 commit comments