当前位置: 首页>>代码示例>>Java>>正文


Java ModifyDBInstanceRequest类代码示例

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


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

示例1: modifyInstanceWithSecgrpParamgrp

import com.amazonaws.services.rds.model.ModifyDBInstanceRequest; //导入依赖的package包/类
/**
 * Modifies the instance by applying new security groups and new parameter group.
 * <p/>
 * Caller must wait for status=available afterwards.
 */
public DBInstance modifyInstanceWithSecgrpParamgrp(String instanceName,
                                                   Collection<String> vpcSecurityGroupIds,
                                                   String paramGroupName)
{
  LOGGER.debug("modifyDBInstance(instanceName: " + instanceName + ", vpcSecurityGroupIds: ("
      + StringUtils.join(vpcSecurityGroupIds, ", ") + "), paramGroupName: " + paramGroupName + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    ModifyDBInstanceRequest request = new ModifyDBInstanceRequest(instanceName);
    request.setVpcSecurityGroupIds(vpcSecurityGroupIds);
    request.setDBParameterGroupName(paramGroupName);
    return awsRdsClient.modifyDBInstance(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("modifyDBInstance time elapsed: " + stopWatch);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:27,代码来源:RdsClient.java

示例2: setSecuretGroup

import com.amazonaws.services.rds.model.ModifyDBInstanceRequest; //导入依赖的package包/类
/**
 * Not used yet!
 *
 * @param dbInstanceIdentifier
 * @param group
 * @param owner
 */
public void setSecuretGroup(String dbInstanceIdentifier, String group, String owner) {

    String groupName = dbInstanceIdentifier + "-security-group";
    CreateDBSecurityGroupRequest csg = new CreateDBSecurityGroupRequest();
    csg.setDBSecurityGroupName(groupName);
    csg.setDBSecurityGroupDescription(groupName);
    rdsClient.createDBSecurityGroup(csg);

    RevokeDBSecurityGroupIngressRequest rsgi = new RevokeDBSecurityGroupIngressRequest();
    rsgi.setDBSecurityGroupName(groupName);
    rsgi.setEC2SecurityGroupId(group);
    rsgi.setEC2SecurityGroupOwnerId(owner);
    rsgi.setRequestCredentials(awsCredentials);
    //rsgi.set
    rdsClient.revokeDBSecurityGroupIngress(rsgi);

    ModifyDBInstanceRequest request = new ModifyDBInstanceRequest();
    Collection<String> groups = new ArrayList();
    groups.add(groupName);
    request.setDBSecurityGroups(groups);
    request.setDBInstanceIdentifier(dbInstanceIdentifier);
    rdsClient.modifyDBInstance(request);

}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:32,代码来源:BeanstalkConnector.java

示例3: testModifyInstanceWithSecgrpParamgrp

import com.amazonaws.services.rds.model.ModifyDBInstanceRequest; //导入依赖的package包/类
/**
 * Tests that modifyInstanceWithSecgrpParamgrp returns its rds result object.
 */
@Test
public void testModifyInstanceWithSecgrpParamgrp()
{
  DBInstance mockInstance = mock(DBInstance.class);
  when(mockRdsClient.modifyDBInstance(any(ModifyDBInstanceRequest.class))).thenReturn(mockInstance);
  Collection<String> securityGroups = new ArrayList<String>();
  securityGroups.add(SECURITY_GROUP);

  assertEquals(mockInstance, rdsClient.modifyInstanceWithSecgrpParamgrp(INSTANCE_NAME, securityGroups, PARAM_GROUP));
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:14,代码来源:RdsClientTest.java

示例4: openDBForIps

import com.amazonaws.services.rds.model.ModifyDBInstanceRequest; //导入依赖的package包/类
public void openDBForIps(String dbInstanceIdentifier, Collection<String> ips, int timeout) {
    String groupName = dbInstanceIdentifier + "-security-group";
    for (String ip : ips) {
        AuthorizeDBSecurityGroupIngressRequest audbgi = new AuthorizeDBSecurityGroupIngressRequest()
                .withCIDRIP(ip + "/32")
                .withDBSecurityGroupName(groupName);
        audbgi.setRequestCredentials(awsCredentials);
        rdsClient.authorizeDBSecurityGroupIngress(audbgi);

    }
    rdsClient.authorizeDBSecurityGroupIngress(new AuthorizeDBSecurityGroupIngressRequest()
            .withCIDRIP("0.0.0.0/0")
            .withDBSecurityGroupName(groupName)
    );
    ModifyDBInstanceRequest request = new ModifyDBInstanceRequest();
    Collection<String> groups = new ArrayList();
    groups.add(groupName);
    request.setDBSecurityGroups(groups);
    request.setDBInstanceIdentifier(dbInstanceIdentifier);
    System.out.print("Modifying security group");
    while(timeout-->0){
        System.out.print("-");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            Logger.getLogger(BeanstalkConnector.class.getName()).log(Level.SEVERE, null, ex);
        }

        try{
            rdsClient.modifyDBInstance(request);
            break;
        }catch(Exception e){
            continue;
        }


    }

}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:40,代码来源:BeanstalkConnector.java


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