@@ -102,9 +102,25 @@ A duration in seconds with up to nine fractional digits, terminated by 's'. Exam
102
102
Description : `A task to execute on the completion of a job.` ,
103
103
Elem : & schema.Resource {
104
104
Schema : map [string ]* schema.Schema {
105
+ "pub_sub" : {
106
+ Type : schema .TypeList ,
107
+ Optional : true ,
108
+ Description : `Publish a message into a given Pub/Sub topic when the job completes.` ,
109
+ MaxItems : 1 ,
110
+ Elem : & schema.Resource {
111
+ Schema : map [string ]* schema.Schema {
112
+ "topic" : {
113
+ Type : schema .TypeString ,
114
+ Required : true ,
115
+ Description : `Cloud Pub/Sub topic to send notifications to.` ,
116
+ },
117
+ },
118
+ },
119
+ ExactlyOneOf : []string {},
120
+ },
105
121
"save_findings" : {
106
122
Type : schema .TypeList ,
107
- Required : true ,
123
+ Optional : true ,
108
124
Description : `Schedule for triggered jobs` ,
109
125
MaxItems : 1 ,
110
126
Elem : & schema.Resource {
@@ -160,6 +176,7 @@ Only for use with external storage. Possible values: ["BASIC_COLUMNS", "GCS_COLU
160
176
},
161
177
},
162
178
},
179
+ ExactlyOneOf : []string {},
163
180
},
164
181
},
165
182
},
@@ -1114,6 +1131,7 @@ func flattenDataLossPreventionJobTriggerInspectJobActions(v interface{}, d *sche
1114
1131
}
1115
1132
transformed = append (transformed , map [string ]interface {}{
1116
1133
"save_findings" : flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindings (original ["saveFindings" ], d , config ),
1134
+ "pub_sub" : flattenDataLossPreventionJobTriggerInspectJobActionsPubSub (original ["pubSub" ], d , config ),
1117
1135
})
1118
1136
}
1119
1137
return transformed
@@ -1179,6 +1197,23 @@ func flattenDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfi
1179
1197
return v
1180
1198
}
1181
1199
1200
+ func flattenDataLossPreventionJobTriggerInspectJobActionsPubSub (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1201
+ if v == nil {
1202
+ return nil
1203
+ }
1204
+ original := v .(map [string ]interface {})
1205
+ if len (original ) == 0 {
1206
+ return nil
1207
+ }
1208
+ transformed := make (map [string ]interface {})
1209
+ transformed ["topic" ] =
1210
+ flattenDataLossPreventionJobTriggerInspectJobActionsPubSubTopic (original ["topic" ], d , config )
1211
+ return []interface {}{transformed }
1212
+ }
1213
+ func flattenDataLossPreventionJobTriggerInspectJobActionsPubSubTopic (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1214
+ return v
1215
+ }
1216
+
1182
1217
func expandDataLossPreventionJobTriggerDescription (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1183
1218
return v , nil
1184
1219
}
@@ -1701,6 +1736,13 @@ func expandDataLossPreventionJobTriggerInspectJobActions(v interface{}, d Terraf
1701
1736
transformed ["saveFindings" ] = transformedSaveFindings
1702
1737
}
1703
1738
1739
+ transformedPubSub , err := expandDataLossPreventionJobTriggerInspectJobActionsPubSub (original ["pub_sub" ], d , config )
1740
+ if err != nil {
1741
+ return nil , err
1742
+ } else if val := reflect .ValueOf (transformedPubSub ); val .IsValid () && ! isEmptyValue (val ) {
1743
+ transformed ["pubSub" ] = transformedPubSub
1744
+ }
1745
+
1704
1746
req = append (req , transformed )
1705
1747
}
1706
1748
return req , nil
@@ -1800,6 +1842,29 @@ func expandDataLossPreventionJobTriggerInspectJobActionsSaveFindingsOutputConfig
1800
1842
return v , nil
1801
1843
}
1802
1844
1845
+ func expandDataLossPreventionJobTriggerInspectJobActionsPubSub (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1846
+ l := v .([]interface {})
1847
+ if len (l ) == 0 || l [0 ] == nil {
1848
+ return nil , nil
1849
+ }
1850
+ raw := l [0 ]
1851
+ original := raw .(map [string ]interface {})
1852
+ transformed := make (map [string ]interface {})
1853
+
1854
+ transformedTopic , err := expandDataLossPreventionJobTriggerInspectJobActionsPubSubTopic (original ["topic" ], d , config )
1855
+ if err != nil {
1856
+ return nil , err
1857
+ } else if val := reflect .ValueOf (transformedTopic ); val .IsValid () && ! isEmptyValue (val ) {
1858
+ transformed ["topic" ] = transformedTopic
1859
+ }
1860
+
1861
+ return transformed , nil
1862
+ }
1863
+
1864
+ func expandDataLossPreventionJobTriggerInspectJobActionsPubSubTopic (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1865
+ return v , nil
1866
+ }
1867
+
1803
1868
func resourceDataLossPreventionJobTriggerEncoder (d * schema.ResourceData , meta interface {}, obj map [string ]interface {}) (map [string ]interface {}, error ) {
1804
1869
newObj := make (map [string ]interface {})
1805
1870
newObj ["jobTrigger" ] = obj
0 commit comments