Search in sources :

Example 1 with DeleteSecurityGroupResult

use of com.amazonaws.services.ec2.model.DeleteSecurityGroupResult in project aws-doc-sdk-examples by awsdocs.

the class DeleteSecurityGroup method main.

public static void main(String[] args) {
    final String USAGE = "To run this example, supply a security group id\n" + "Ex: DeleteSecurityGroup <security-group-id>\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String group_id = args[0];
    final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
    DeleteSecurityGroupRequest request = new DeleteSecurityGroupRequest().withGroupId(group_id);
    DeleteSecurityGroupResult response = ec2.deleteSecurityGroup(request);
    System.out.printf("Successfully deleted security group with id %s", group_id);
}
Also used : DeleteSecurityGroupRequest(com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest) DeleteSecurityGroupResult(com.amazonaws.services.ec2.model.DeleteSecurityGroupResult) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2)

Aggregations

AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)1 DeleteSecurityGroupRequest (com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest)1 DeleteSecurityGroupResult (com.amazonaws.services.ec2.model.DeleteSecurityGroupResult)1