@@ -55,6 +55,15 @@ or 'projects/{{project}}/locations/{{location}}'`,
55
55
Description : `What event needs to occur for a new job to be started.` ,
56
56
Elem : & schema.Resource {
57
57
Schema : map [string ]* schema.Schema {
58
+ "manual" : {
59
+ Type : schema .TypeList ,
60
+ Optional : true ,
61
+ Description : `For use with hybrid jobs. Jobs must be manually created and finished.` ,
62
+ MaxItems : 1 ,
63
+ Elem : & schema.Resource {
64
+ Schema : map [string ]* schema.Schema {},
65
+ },
66
+ },
58
67
"schedule" : {
59
68
Type : schema .TypeList ,
60
69
Optional : true ,
@@ -543,6 +552,76 @@ is always by project and namespace, however the namespace ID may be empty.`,
543
552
},
544
553
},
545
554
},
555
+ "hybrid_options" : {
556
+ Type : schema .TypeList ,
557
+ Optional : true ,
558
+ Description : `Configuration to control jobs where the content being inspected is outside of Google Cloud Platform.` ,
559
+ MaxItems : 1 ,
560
+ Elem : & schema.Resource {
561
+ Schema : map [string ]* schema.Schema {
562
+ "description" : {
563
+ Type : schema .TypeString ,
564
+ Optional : true ,
565
+ Description : `A short description of where the data is coming from. Will be stored once in the job. 256 max length.` ,
566
+ },
567
+ "labels" : {
568
+ Type : schema .TypeMap ,
569
+ Optional : true ,
570
+ Description : `To organize findings, these labels will be added to each finding.
571
+
572
+ Label keys must be between 1 and 63 characters long and must conform to the following regular expression: '[a-z]([-a-z0-9]*[a-z0-9])?'.
573
+
574
+ Label values must be between 0 and 63 characters long and must conform to the regular expression '([a-z]([-a-z0-9]*[a-z0-9])?)?'.
575
+
576
+ No more than 10 labels can be associated with a given finding.
577
+
578
+ Examples:
579
+ * '"environment" : "production"'
580
+ * '"pipeline" : "etl"'` ,
581
+ Elem : & schema.Schema {Type : schema .TypeString },
582
+ },
583
+ "required_finding_label_keys" : {
584
+ Type : schema .TypeList ,
585
+ Optional : true ,
586
+ Description : `These are labels that each inspection request must include within their 'finding_labels' map. Request
587
+ may contain others, but any missing one of these will be rejected.
588
+
589
+ Label keys must be between 1 and 63 characters long and must conform to the following regular expression: '[a-z]([-a-z0-9]*[a-z0-9])?'.
590
+
591
+ No more than 10 keys can be required.` ,
592
+ Elem : & schema.Schema {
593
+ Type : schema .TypeString ,
594
+ },
595
+ },
596
+ "table_options" : {
597
+ Type : schema .TypeList ,
598
+ Optional : true ,
599
+ Description : `If the container is a table, additional information to make findings meaningful such as the columns that are primary keys.` ,
600
+ MaxItems : 1 ,
601
+ Elem : & schema.Resource {
602
+ Schema : map [string ]* schema.Schema {
603
+ "identifying_fields" : {
604
+ Type : schema .TypeList ,
605
+ Optional : true ,
606
+ Description : `The columns that are the primary keys for table objects included in ContentItem. A copy of this
607
+ cell's value will stored alongside alongside each finding so that the finding can be traced to
608
+ the specific row it came from. No more than 3 may be provided.` ,
609
+ Elem : & schema.Resource {
610
+ Schema : map [string ]* schema.Schema {
611
+ "name" : {
612
+ Type : schema .TypeString ,
613
+ Required : true ,
614
+ Description : `Name describing the field.` ,
615
+ },
616
+ },
617
+ },
618
+ },
619
+ },
620
+ },
621
+ },
622
+ },
623
+ },
624
+ },
546
625
"timespan_config" : {
547
626
Type : schema .TypeList ,
548
627
Optional : true ,
@@ -947,6 +1026,7 @@ func flattenDataLossPreventionJobTriggerTriggers(v interface{}, d *schema.Resour
947
1026
}
948
1027
transformed = append (transformed , map [string ]interface {}{
949
1028
"schedule" : flattenDataLossPreventionJobTriggerTriggersSchedule (original ["schedule" ], d , config ),
1029
+ "manual" : flattenDataLossPreventionJobTriggerTriggersManual (original ["manual" ], d , config ),
950
1030
})
951
1031
}
952
1032
return transformed
@@ -968,6 +1048,14 @@ func flattenDataLossPreventionJobTriggerTriggersScheduleRecurrencePeriodDuration
968
1048
return v
969
1049
}
970
1050
1051
+ func flattenDataLossPreventionJobTriggerTriggersManual (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1052
+ if v == nil {
1053
+ return nil
1054
+ }
1055
+ transformed := make (map [string ]interface {})
1056
+ return []interface {}{transformed }
1057
+ }
1058
+
971
1059
func flattenDataLossPreventionJobTriggerInspectJob (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
972
1060
if v == nil {
973
1061
return nil
@@ -1006,6 +1094,8 @@ func flattenDataLossPreventionJobTriggerInspectJobStorageConfig(v interface{}, d
1006
1094
flattenDataLossPreventionJobTriggerInspectJobStorageConfigCloudStorageOptions (original ["cloudStorageOptions" ], d , config )
1007
1095
transformed ["big_query_options" ] =
1008
1096
flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptions (original ["bigQueryOptions" ], d , config )
1097
+ transformed ["hybrid_options" ] =
1098
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptions (original ["hybridOptions" ], d , config )
1009
1099
return []interface {}{transformed }
1010
1100
}
1011
1101
func flattenDataLossPreventionJobTriggerInspectJobStorageConfigTimespanConfig (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
@@ -1351,6 +1441,69 @@ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsId
1351
1441
return v
1352
1442
}
1353
1443
1444
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptions (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1445
+ if v == nil {
1446
+ return nil
1447
+ }
1448
+ original := v .(map [string ]interface {})
1449
+ transformed := make (map [string ]interface {})
1450
+ transformed ["description" ] =
1451
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsDescription (original ["description" ], d , config )
1452
+ transformed ["required_finding_label_keys" ] =
1453
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsRequiredFindingLabelKeys (original ["requiredFindingLabelKeys" ], d , config )
1454
+ transformed ["table_options" ] =
1455
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptions (original ["tableOptions" ], d , config )
1456
+ transformed ["labels" ] =
1457
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsLabels (original ["labels" ], d , config )
1458
+ return []interface {}{transformed }
1459
+ }
1460
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsDescription (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1461
+ return v
1462
+ }
1463
+
1464
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsRequiredFindingLabelKeys (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1465
+ return v
1466
+ }
1467
+
1468
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptions (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1469
+ if v == nil {
1470
+ return nil
1471
+ }
1472
+ original := v .(map [string ]interface {})
1473
+ if len (original ) == 0 {
1474
+ return nil
1475
+ }
1476
+ transformed := make (map [string ]interface {})
1477
+ transformed ["identifying_fields" ] =
1478
+ flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFields (original ["identifyingFields" ], d , config )
1479
+ return []interface {}{transformed }
1480
+ }
1481
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFields (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1482
+ if v == nil {
1483
+ return v
1484
+ }
1485
+ l := v .([]interface {})
1486
+ transformed := make ([]interface {}, 0 , len (l ))
1487
+ for _ , raw := range l {
1488
+ original := raw .(map [string ]interface {})
1489
+ if len (original ) < 1 {
1490
+ // Do not include empty json objects coming back from the api
1491
+ continue
1492
+ }
1493
+ transformed = append (transformed , map [string ]interface {}{
1494
+ "name" : flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldsName (original ["name" ], d , config ),
1495
+ })
1496
+ }
1497
+ return transformed
1498
+ }
1499
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldsName (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1500
+ return v
1501
+ }
1502
+
1503
+ func flattenDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsLabels (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1504
+ return v
1505
+ }
1506
+
1354
1507
func flattenDataLossPreventionJobTriggerInspectJobActions (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1355
1508
if v == nil {
1356
1509
return v
@@ -1603,6 +1756,13 @@ func expandDataLossPreventionJobTriggerTriggers(v interface{}, d TerraformResour
1603
1756
transformed ["schedule" ] = transformedSchedule
1604
1757
}
1605
1758
1759
+ transformedManual , err := expandDataLossPreventionJobTriggerTriggersManual (original ["manual" ], d , config )
1760
+ if err != nil {
1761
+ return nil , err
1762
+ } else {
1763
+ transformed ["manual" ] = transformedManual
1764
+ }
1765
+
1606
1766
req = append (req , transformed )
1607
1767
}
1608
1768
return req , nil
@@ -1631,6 +1791,21 @@ func expandDataLossPreventionJobTriggerTriggersScheduleRecurrencePeriodDuration(
1631
1791
return v , nil
1632
1792
}
1633
1793
1794
+ func expandDataLossPreventionJobTriggerTriggersManual (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1795
+ l := v .([]interface {})
1796
+ if len (l ) == 0 {
1797
+ return nil , nil
1798
+ }
1799
+
1800
+ if l [0 ] == nil {
1801
+ transformed := make (map [string ]interface {})
1802
+ return transformed , nil
1803
+ }
1804
+ transformed := make (map [string ]interface {})
1805
+
1806
+ return transformed , nil
1807
+ }
1808
+
1634
1809
func expandDataLossPreventionJobTriggerInspectJob (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1635
1810
l := v .([]interface {})
1636
1811
if len (l ) == 0 || l [0 ] == nil {
@@ -1705,6 +1880,13 @@ func expandDataLossPreventionJobTriggerInspectJobStorageConfig(v interface{}, d
1705
1880
transformed ["bigQueryOptions" ] = transformedBigQueryOptions
1706
1881
}
1707
1882
1883
+ transformedHybridOptions , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptions (original ["hybrid_options" ], d , config )
1884
+ if err != nil {
1885
+ return nil , err
1886
+ } else {
1887
+ transformed ["hybridOptions" ] = transformedHybridOptions
1888
+ }
1889
+
1708
1890
return transformed , nil
1709
1891
}
1710
1892
@@ -2145,6 +2327,115 @@ func expandDataLossPreventionJobTriggerInspectJobStorageConfigBigQueryOptionsIde
2145
2327
return v , nil
2146
2328
}
2147
2329
2330
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptions (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2331
+ l := v .([]interface {})
2332
+ if len (l ) == 0 {
2333
+ return nil , nil
2334
+ }
2335
+
2336
+ if l [0 ] == nil {
2337
+ transformed := make (map [string ]interface {})
2338
+ return transformed , nil
2339
+ }
2340
+ raw := l [0 ]
2341
+ original := raw .(map [string ]interface {})
2342
+ transformed := make (map [string ]interface {})
2343
+
2344
+ transformedDescription , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsDescription (original ["description" ], d , config )
2345
+ if err != nil {
2346
+ return nil , err
2347
+ } else if val := reflect .ValueOf (transformedDescription ); val .IsValid () && ! isEmptyValue (val ) {
2348
+ transformed ["description" ] = transformedDescription
2349
+ }
2350
+
2351
+ transformedRequiredFindingLabelKeys , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsRequiredFindingLabelKeys (original ["required_finding_label_keys" ], d , config )
2352
+ if err != nil {
2353
+ return nil , err
2354
+ } else if val := reflect .ValueOf (transformedRequiredFindingLabelKeys ); val .IsValid () && ! isEmptyValue (val ) {
2355
+ transformed ["requiredFindingLabelKeys" ] = transformedRequiredFindingLabelKeys
2356
+ }
2357
+
2358
+ transformedTableOptions , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptions (original ["table_options" ], d , config )
2359
+ if err != nil {
2360
+ return nil , err
2361
+ } else if val := reflect .ValueOf (transformedTableOptions ); val .IsValid () && ! isEmptyValue (val ) {
2362
+ transformed ["tableOptions" ] = transformedTableOptions
2363
+ }
2364
+
2365
+ transformedLabels , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsLabels (original ["labels" ], d , config )
2366
+ if err != nil {
2367
+ return nil , err
2368
+ } else if val := reflect .ValueOf (transformedLabels ); val .IsValid () && ! isEmptyValue (val ) {
2369
+ transformed ["labels" ] = transformedLabels
2370
+ }
2371
+
2372
+ return transformed , nil
2373
+ }
2374
+
2375
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsDescription (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2376
+ return v , nil
2377
+ }
2378
+
2379
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsRequiredFindingLabelKeys (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2380
+ return v , nil
2381
+ }
2382
+
2383
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptions (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2384
+ l := v .([]interface {})
2385
+ if len (l ) == 0 || l [0 ] == nil {
2386
+ return nil , nil
2387
+ }
2388
+ raw := l [0 ]
2389
+ original := raw .(map [string ]interface {})
2390
+ transformed := make (map [string ]interface {})
2391
+
2392
+ transformedIdentifyingFields , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFields (original ["identifying_fields" ], d , config )
2393
+ if err != nil {
2394
+ return nil , err
2395
+ } else if val := reflect .ValueOf (transformedIdentifyingFields ); val .IsValid () && ! isEmptyValue (val ) {
2396
+ transformed ["identifyingFields" ] = transformedIdentifyingFields
2397
+ }
2398
+
2399
+ return transformed , nil
2400
+ }
2401
+
2402
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFields (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2403
+ l := v .([]interface {})
2404
+ req := make ([]interface {}, 0 , len (l ))
2405
+ for _ , raw := range l {
2406
+ if raw == nil {
2407
+ continue
2408
+ }
2409
+ original := raw .(map [string ]interface {})
2410
+ transformed := make (map [string ]interface {})
2411
+
2412
+ transformedName , err := expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldsName (original ["name" ], d , config )
2413
+ if err != nil {
2414
+ return nil , err
2415
+ } else if val := reflect .ValueOf (transformedName ); val .IsValid () && ! isEmptyValue (val ) {
2416
+ transformed ["name" ] = transformedName
2417
+ }
2418
+
2419
+ req = append (req , transformed )
2420
+ }
2421
+ return req , nil
2422
+ }
2423
+
2424
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsTableOptionsIdentifyingFieldsName (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2425
+ return v , nil
2426
+ }
2427
+
2428
+ func expandDataLossPreventionJobTriggerInspectJobStorageConfigHybridOptionsLabels (v interface {}, d TerraformResourceData , config * Config ) (map [string ]string , error ) {
2429
+ if v == nil {
2430
+ return map [string ]string {}, nil
2431
+ }
2432
+ m := make (map [string ]string )
2433
+ for k , val := range v .(map [string ]interface {}) {
2434
+ m [k ] = val .(string )
2435
+ }
2436
+ return m , nil
2437
+ }
2438
+
2148
2439
func expandDataLossPreventionJobTriggerInspectJobActions (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
2149
2440
l := v .([]interface {})
2150
2441
req := make ([]interface {}, 0 , len (l ))
0 commit comments