@@ -670,9 +670,43 @@ is 1,024 characters.`,
670670 MaxItems : 1 ,
671671 Elem : & schema.Resource {
672672 Schema : map [string ]* schema.Schema {
673+ "output_schema" : {
674+ Type : schema .TypeString ,
675+ Optional : true ,
676+ ValidateFunc : verify .ValidateEnum ([]string {"BASIC_COLUMNS" , "GCS_COLUMNS" , "DATASTORE_COLUMNS" , "BIG_QUERY_COLUMNS" , "ALL_COLUMNS" , "" }),
677+ Description : `Schema used for writing the findings for Inspect jobs. This field is only used for
678+ Inspect and must be unspecified for Risk jobs. Columns are derived from the Finding
679+ object. If appending to an existing table, any columns from the predefined schema
680+ that are missing will be added. No columns in the existing table will be deleted.
681+
682+ If unspecified, then all available columns will be used for a new table or an (existing)
683+ table with no schema, and no changes will be made to an existing table that has a schema.
684+ Only for use with external storage. Possible values: ["BASIC_COLUMNS", "GCS_COLUMNS", "DATASTORE_COLUMNS", "BIG_QUERY_COLUMNS", "ALL_COLUMNS"]` ,
685+ },
686+ "storage_path" : {
687+ Type : schema .TypeList ,
688+ Optional : true ,
689+ Description : `Store findings in an existing Cloud Storage bucket. Files will be generated with the job ID and file part number
690+ as the filename, and will contain findings in textproto format as SaveToGcsFindingsOutput. The file name will use
691+ the naming convention <job_id>-<shard_number>, for example: my-job-id-2.
692+
693+ Supported for InspectJobs. The bucket must not be the same as the bucket being inspected. If storing findings to
694+ Cloud Storage, the output schema field should not be set. If set, it will be ignored.` ,
695+ MaxItems : 1 ,
696+ Elem : & schema.Resource {
697+ Schema : map [string ]* schema.Schema {
698+ "path" : {
699+ Type : schema .TypeString ,
700+ Required : true ,
701+ Description : `A URL representing a file or path (no wildcards) in Cloud Storage.
702+ Example: 'gs://[BUCKET_NAME]/dictionary.txt'` ,
703+ },
704+ },
705+ },
706+ },
673707 "table" : {
674708 Type : schema .TypeList ,
675- Required : true ,
709+ Optional : true ,
676710 Description : `Information on the location of the target BigQuery Table.` ,
677711 MaxItems : 1 ,
678712 Elem : & schema.Resource {
@@ -696,19 +730,6 @@ is 1,024 characters.`,
696730 },
697731 },
698732 },
699- "output_schema" : {
700- Type : schema .TypeString ,
701- Optional : true ,
702- ValidateFunc : verify .ValidateEnum ([]string {"BASIC_COLUMNS" , "GCS_COLUMNS" , "DATASTORE_COLUMNS" , "BIG_QUERY_COLUMNS" , "ALL_COLUMNS" , "" }),
703- Description : `Schema used for writing the findings for Inspect jobs. This field is only used for
704- Inspect and must be unspecified for Risk jobs. Columns are derived from the Finding
705- object. If appending to an existing table, any columns from the predefined schema
706- that are missing will be added. No columns in the existing table will be deleted.
707-
708- If unspecified, then all available columns will be used for a new table or an (existing)
709- table with no schema, and no changes will be made to an existing table that has a schema.
710- Only for use with external storage. Possible values: ["BASIC_COLUMNS", "GCS_COLUMNS", "DATASTORE_COLUMNS", "BIG_QUERY_COLUMNS", "ALL_COLUMNS"]` ,
711- },
712733 },
713734 },
714735 },
@@ -3245,6 +3266,8 @@ func flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfi
32453266 transformed := make (map [string ]interface {})
32463267 transformed ["table" ] =
32473268 flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigTable (original ["table" ], d , config )
3269+ transformed ["storage_path" ] =
3270+ flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePath (original ["storagePath" ], d , config )
32483271 transformed ["output_schema" ] =
32493272 flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigOutputSchema (original ["outputSchema" ], d , config )
32503273 return []interface {}{transformed }
@@ -3278,6 +3301,23 @@ func flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfi
32783301 return v
32793302}
32803303
3304+ func flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePath (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3305+ if v == nil {
3306+ return nil
3307+ }
3308+ original := v .(map [string ]interface {})
3309+ if len (original ) == 0 {
3310+ return nil
3311+ }
3312+ transformed := make (map [string ]interface {})
3313+ transformed ["path" ] =
3314+ flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePathPath (original ["path" ], d , config )
3315+ return []interface {}{transformed }
3316+ }
3317+ func flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePathPath (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3318+ return v
3319+ }
3320+
32813321func flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigOutputSchema (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
32823322 return v
32833323}
@@ -5686,6 +5726,13 @@ func expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfig
56865726 transformed ["table" ] = transformedTable
56875727 }
56885728
5729+ transformedStoragePath , err := expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePath (original ["storage_path" ], d , config )
5730+ if err != nil {
5731+ return nil , err
5732+ } else if val := reflect .ValueOf (transformedStoragePath ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
5733+ transformed ["storagePath" ] = transformedStoragePath
5734+ }
5735+
56895736 transformedOutputSchema , err := expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigOutputSchema (original ["output_schema" ], d , config )
56905737 if err != nil {
56915738 return nil , err
@@ -5744,6 +5791,32 @@ func expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfig
57445791 return v , nil
57455792}
57465793
5794+ func expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePath (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
5795+ if v == nil {
5796+ return nil , nil
5797+ }
5798+ l := v .([]interface {})
5799+ if len (l ) == 0 || l [0 ] == nil {
5800+ return nil , nil
5801+ }
5802+ raw := l [0 ]
5803+ original := raw .(map [string ]interface {})
5804+ transformed := make (map [string ]interface {})
5805+
5806+ transformedPath , err := expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePathPath (original ["path" ], d , config )
5807+ if err != nil {
5808+ return nil , err
5809+ } else if val := reflect .ValueOf (transformedPath ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
5810+ transformed ["path" ] = transformedPath
5811+ }
5812+
5813+ return transformed , nil
5814+ }
5815+
5816+ func expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigStoragePathPath (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
5817+ return v , nil
5818+ }
5819+
57475820func expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfigOutputSchema (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
57485821 return v , nil
57495822}
0 commit comments