• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DeleteSecurityGroupRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest的典型用法代码示例。如果您正苦于以下问题:Java DeleteSecurityGroupRequest类的具体用法?Java DeleteSecurityGroupRequest怎么用?Java DeleteSecurityGroupRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DeleteSecurityGroupRequest类属于com.amazonaws.services.ec2.model包,在下文中一共展示了DeleteSecurityGroupRequest类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的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);
}
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:DeleteSecurityGroup.java


示例2: execute

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
@Override
public void execute(AmazonEC2 client, Pool pool, DelegateExecution execution) {
    final String groupName = SecurityGroups.formatNameFromBusinessKey(execution.getProcessBusinessKey());
    try {
        LOG.info(">> Deleting Security Group {}", groupName);

        client.deleteSecurityGroup(new DeleteSecurityGroupRequest().withGroupName(groupName));

    } catch (AmazonServiceException e) {
        if (e.getErrorCode().equals(ErrorCodes.SECURITY_GROUP_NOT_FOUND)) {
            LOG.info("<< Security Group {} not found. Ignoring this error.", groupName);
        } else {
            throw Throwables.propagate(e);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:17,代码来源:DeleteSecurityGroup.java


示例3: deleteSecurityGroupAsync

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的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);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:14,代码来源:AWSSecurityGroupClient.java


示例4: deleteSecurityGroupUsingEC2Client

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
public static void deleteSecurityGroupUsingEC2Client(AmazonEC2AsyncClient client,
        VerificationHost host, String awsGroupId) {
    host.log(Level.INFO, "Starting to delete aws Security group with id %s", awsGroupId);
    if (awsGroupId == null) {
        return;
    }

    try {
        DeleteSecurityGroupRequest deleteSecurityGroupRequest = new DeleteSecurityGroupRequest()
                .withGroupId(awsGroupId);
        client.deleteSecurityGroup(deleteSecurityGroupRequest);

        host.waitFor(
                "Timeout waiting for AWS to delete a SecurityGroup with name " + awsGroupId,
                () -> {
                    // Check if the SG is actually not present on AWS after the delete operation
                    SecurityGroup discoveredSGOnAWS = getSecurityGroupsIdUsingEC2Client(client, awsGroupId);

                    if (discoveredSGOnAWS != null) {
                        // Requested SG was not deleted from AWS
                        return false;
                    }

                    host.log("Deleted SG with id: %s", awsGroupId);
                    return true;
                });
    } catch (Exception e) {
        String message = e.getMessage();
        if (!message.contains("The security group '" + awsGroupId + "' already exists")) {
            throw e;
        }
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:34,代码来源:TestAWSSetupUtils.java


示例5: quietlyDeleteSecurityGroupIfExists

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
protected void quietlyDeleteSecurityGroupIfExists(String groupName) {
    try {
        client.deleteSecurityGroup(new DeleteSecurityGroupRequest().withGroupName(groupName));

    } catch (AmazonServiceException e) {
        if (!e.getErrorCode().equals("InvalidGroup.NotFound")) {
            throw Throwables.propagate(e);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:11,代码来源:AmazonActivityLiveTest.java


示例6: deleteGroupIfPresent

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
private static void deleteGroupIfPresent() {
	try {	
		DescribeSecurityGroupsRequest describeSecurityGroupsRequest = new DescribeSecurityGroupsRequest().withGroupNames(GROUP_NAME);
		DescribeSecurityGroupsResult existing = ec2Client.describeSecurityGroups(describeSecurityGroupsRequest);
		if (existing.getSecurityGroups().size()>0) {
			DeleteSecurityGroupRequest deleteGroup = new DeleteSecurityGroupRequest().withGroupName(GROUP_NAME);
			ec2Client.deleteSecurityGroup(deleteGroup);	
		}
	} catch (AmazonServiceException exception) {
		// no op
	}
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:13,代码来源:TestManageSecGroups.java


示例7: deleteRuleSet

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
@Override
public boolean deleteRuleSet( final String name ) {
    try {
        DeleteSecurityGroupRequest request = new DeleteSecurityGroupRequest().withGroupName( name );
        client.deleteSecurityGroup( request );
        return true;
    }
    catch ( AmazonServiceException e ) {
        LOG.warn( "Error while trying to delete security group", e );
        return false;
    }
}
 
开发者ID:apache,项目名称:usergrid,代码行数:13,代码来源:AmazonIpRuleManager.java


示例8: deleteSecurityGroup

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的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;
}
 
开发者ID:treelogic-swe,项目名称:aws-mock,代码行数:21,代码来源:BaseTest.java


示例9: deleteSecurityGroup

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
@Override
public void deleteSecurityGroup(DeleteSecurityGroupRequest deleteSecurityGroupRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonEC2Mock.java


示例10: deleteSecurityGroup

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
public void deleteSecurityGroup(String securityGroupId) {
    DeleteSecurityGroupRequest req = new DeleteSecurityGroupRequest()
            .withGroupId(securityGroupId);

    this.client.deleteSecurityGroup(req);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:AWSSecurityGroupClient.java


示例11: deleteSecurityGroup

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
public void deleteSecurityGroup(String securityGroupId) {
    logger.info("delete security group, securityGroupId={}", securityGroupId);
    ec2.deleteSecurityGroup(new DeleteSecurityGroupRequest().withGroupId(securityGroupId));
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:5,代码来源:EC2.java


示例12: delete

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
@Override
public void delete(DeleteSecurityGroupRequest request) {
    delete(request, null);
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:SecurityGroupImpl.java


示例13: delete

import com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest; //导入依赖的package包/类
/**
 * Performs the <code>Delete</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>SecurityGroup</code> resource, and any conflicting parameter value
 * set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>GroupId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see DeleteSecurityGroupRequest
 */
void delete(DeleteSecurityGroupRequest request);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:20,代码来源:SecurityGroup.java



注:本文中的com.amazonaws.services.ec2.model.DeleteSecurityGroupRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultResourceCalculator类代码示例发布时间:2022-05-22
下一篇:
Java NSConf类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap