AWS code-library documentation change
Summary
Added Swift SDK code example for DeleteSecurityGroup API including error handling
Security assessment
The change adds documentation for security group deletion functionality but does not address any specific security vulnerability. Security group management is a security feature, but there's no evidence of patching vulnerabilities or addressing exploits.
Diff
diff --git a/code-library/latest/ug/ec2_example_ec2_DeleteSecurityGroup_section.md b/code-library/latest/ug/ec2_example_ec2_DeleteSecurityGroup_section.md index 910b9cb39..a2bdfd8dc 100644 --- a//code-library/latest/ug/ec2_example_ec2_DeleteSecurityGroup_section.md +++ b//code-library/latest/ug/ec2_example_ec2_DeleteSecurityGroup_section.md @@ -564,0 +565,40 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +Swift + + +**SDK for Swift** + + +###### Note + +There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift/example_code/ec2#code-examples). + + + import AWSEC2 + + /// Delete a security group. + /// + /// - Parameter groupId: The ID of the security group to delete. + /// + /// - Returns: `true` on successful deletion; `false` on error. + func deleteSecurityGroup(groupId: String) async -> Bool { + do { + _ = try await ec2Client.deleteSecurityGroup( + input: DeleteSecurityGroupInput( + groupId: groupId + ) + ) + + return true + } catch { + print("*** Error deleting the security group: \(error.localizedDescription)") + return false + } + } + + + + * For API details, see [DeleteSecurityGroup](https://sdk.amazonaws.com/swift/api/awsec2/latest/documentation/awsec2/ec2client/deletesecuritygroup\(input:\)) in _AWS SDK for Swift API reference_. + + + +