本文整理匯總了Java中com.amazonaws.services.ec2.model.DeleteSecurityGroupResult類的典型用法代碼示例。如果您正苦於以下問題:Java DeleteSecurityGroupResult類的具體用法?Java DeleteSecurityGroupResult怎麽用?Java DeleteSecurityGroupResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DeleteSecurityGroupResult類屬於com.amazonaws.services.ec2.model包,在下文中一共展示了DeleteSecurityGroupResult類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import com.amazonaws.services.ec2.model.DeleteSecurityGroupResult; //導入依賴的package包/類
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);
}
示例2: deleteSecurityGroupAsync
import com.amazonaws.services.ec2.model.DeleteSecurityGroupResult; //導入依賴的package包/類
public DeferredResult<Void> deleteSecurityGroupAsync(String securityGroupId) {
DeleteSecurityGroupRequest req = new DeleteSecurityGroupRequest()
.withGroupId(securityGroupId);
String message = "Delete AWS Security Group with id [" + securityGroupId + "].";
AWSDeferredResultAsyncHandler<DeleteSecurityGroupRequest, DeleteSecurityGroupResult>
handler = new AWSDeferredResultAsyncHandler<>(this.service, message);
this.client.deleteSecurityGroupAsync(req, handler);
return handler.toDeferredResult()
.thenApply(result -> (Void) null);
}
示例3: deleteSecurityGroup
import com.amazonaws.services.ec2.model.DeleteSecurityGroupResult; //導入依賴的package包/類
/**
* Delete SecurityGroup.
*
* @param groupId the group id
* @return true if deleted, otherwise false.
*/
protected final boolean deleteSecurityGroup(final String groupId) {
DeleteSecurityGroupRequest req = new DeleteSecurityGroupRequest();
req.setGroupId(groupId);
DeleteSecurityGroupResult result = amazonEC2Client.deleteSecurityGroup(req);
if (result != null) {
return true;
}
/*CreateSecurityGroupRequest createSecurityGroupRequest = new CreateSecurityGroupRequest();
AuthorizeSecurityGroupEgressRequest authorizeSecurityGroupEgressRequest = new AuthorizeSecurityGroupEgressRequest();
authorizeSecurityGroupEgressRequest.setIpProtocol(ipProtocol);
CreateSecurityGroupResult result = amazonEC2Client.authorizeSecurityGroupEgress(authorizeSecurityGroupEgressRequest);*/
return false;
}