Delete the OpsItem.
(self)
| 72 | |
| 73 | # snippet-start:[python.example_code.ssm.DeleteOpsItem] |
| 74 | def delete(self): |
| 75 | """ |
| 76 | Delete the OpsItem. |
| 77 | """ |
| 78 | if self.id is None: |
| 79 | return |
| 80 | try: |
| 81 | self.ssm_client.delete_ops_item(OpsItemId=self.id) |
| 82 | print(f"Deleted ops item with id {self.id}") |
| 83 | self.id = None |
| 84 | except ClientError as err: |
| 85 | logger.error( |
| 86 | "Couldn't delete ops item %s. Here's why: %s: %s", |
| 87 | self.id, |
| 88 | err.response["Error"]["Code"], |
| 89 | err.response["Error"]["Message"], |
| 90 | ) |
| 91 | raise |
| 92 | |
| 93 | # snippet-end:[python.example_code.ssm.DeleteOpsItem] |
| 94 |
no outgoing calls