@@ -176,12 +176,11 @@ def update_mute_rule(mute_config_name: str) -> None:
176
176
# [END securitycenter_update_mute_config]
177
177
178
178
179
- # [START securitycenter_set_mute_unmute ]
180
- def set_mute_unmute_finding (finding_path : str ) -> None :
179
+ # [START securitycenter_set_mute ]
180
+ def set_mute_finding (finding_path : str ) -> None :
181
181
"""
182
- Mute/unmute an individual finding.
182
+ Mute an individual finding.
183
183
If a finding is already muted, muting it again has no effect.
184
- Similarly, unmuting a finding that isn't muted has no effect.
185
184
Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
186
185
Args:
187
186
finding_path: The relative resource name of the finding. See:
@@ -203,7 +202,36 @@ def set_mute_unmute_finding(finding_path: str) -> None:
203
202
print (f"Mute value for the finding: { finding .mute .name } " )
204
203
205
204
206
- # [END securitycenter_set_mute_unmute]
205
+ # [END securitycenter_set_mute]
206
+
207
+
208
+ # [START securitycenter_set_unmute]
209
+ def set_unmute_finding (finding_path : str ) -> None :
210
+ """
211
+ Unmute an individual finding.
212
+ Unmuting a finding that isn't muted has no effect.
213
+ Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
214
+ Args:
215
+ finding_path: The relative resource name of the finding. See:
216
+ https://cloud.google.com/apis/design/resource_names#relative_resource_name
217
+ Use any one of the following formats:
218
+ - organizations/{organization_id}/sources/{source_id}/finding/{finding_id},
219
+ - folders/{folder_id}/sources/{source_id}/finding/{finding_id},
220
+ - projects/{project_id}/sources/{source_id}/finding/{finding_id}.
221
+ """
222
+ from google .cloud import securitycenter
223
+
224
+ client = securitycenter .SecurityCenterClient ()
225
+
226
+ request = securitycenter .SetMuteRequest ()
227
+ request .name = finding_path
228
+ request .mute = securitycenter .Finding .Mute .UNMUTED
229
+
230
+ finding = client .set_mute (request )
231
+ print (f"Mute value for the finding: { finding .mute .name } " )
232
+
233
+
234
+ # [END securitycenter_set_unmute]
207
235
208
236
209
237
# [START securitycenter_bulk_mute]
0 commit comments