本文整理汇总了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);
}
}
示例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);
}
示例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));
}
示例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;
}
}
}