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


Java DBInstance类代码示例

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


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

示例1: getRDSInstances

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
private void getRDSInstances() {
	DescribeDBInstancesResult response = rdsClient.describeDBInstances(new DescribeDBInstancesRequest());
	
	List<PulseInstance> rds = new ArrayList<PulseInstance>();

	PulseInstance pulse = null;
	for (DBInstance instance : response.getDBInstances()) {
		ListTagsForResourceResult result = rdsClient.listTagsForResource(new ListTagsForResourceRequest().withResourceName(instance.getDBInstanceArn()));
		
		for (com.amazonaws.services.rds.model.Tag tag : result.getTagList()) {
			if (tag.getKey().equals(properties.getTag()) && (tag.getValue().equals("TRUE") || tag.getValue().equals("True") || tag.getValue().equals("true"))) {
				pulse = new PulseInstance();
				pulse.setId(instance.getDBInstanceIdentifier());
				pulse.setName(instance.getDBInstanceIdentifier());
				pulse.setAddress(instance.getEndpoint().getAddress());
				pulse.setType(instance.getDBInstanceClass());
				
				rds.add(pulse);
			}
		}
	}
	
	GetMonitoringInstances.rds = rds;
}
 
开发者ID:nices96,项目名称:scouter-pulse-aws-monitor,代码行数:25,代码来源:GetMonitoringInstances.java

示例2: makeDescribeDBInstancesResult

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Test helper - makes describe result with a named instance.
 */
private DescribeDBInstancesResult makeDescribeDBInstancesResult(String... instanceNames)
{
  DescribeDBInstancesResult result = new DescribeDBInstancesResult();
  List<DBInstance> dbInstances = new ArrayList<DBInstance>();
  if (ArrayUtils.isNotEmpty(instanceNames))
  {
    for (String instanceName : instanceNames)
    {
      DBInstance dbInstance = new DBInstance();
      dbInstance.setDBInstanceIdentifier(instanceName);
      dbInstances.add(dbInstance);
    }
  }
  result.setDBInstances(dbInstances);
  return result;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:20,代码来源:RdsClientTest.java

示例3: createOracle

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
public void createOracle(String dbInstanceIdentifier) throws Exception {
    // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withEngine("oracle-se2")
            //.withEngineVersion("12.1.0.2.v8")
            .withLicenseModel("license-included")
            .withAllocatedStorage(10)
            .withStorageType("gp2")  // SSD
            .withBackupRetentionPeriod(0)
            .withDBInstanceClass("db.t2.micro")
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            .withDBName("DBDEPLOY")
            .withMasterUsername("deploybuilddbo")
            .withMasterUserPassword("deploybuilddb0")
            ;
    DBInstance response = client.createDBInstance(request);
    System.out.println(response);

    describe(dbInstanceIdentifier);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:CreateDbInstance.java

示例4: createPostgresql

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
public void createPostgresql(String dbInstanceIdentifier) throws Exception {
    // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withEngine("postgres")
            .withEngineVersion("9.6.2")
            .withLicenseModel("postgresql-license")
            .withAllocatedStorage(5)
            .withStorageType("gp2")  // SSD
            .withBackupRetentionPeriod(0)
            .withDBInstanceClass("db.t2.micro")
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            .withDBName("DBDEPLOY")
            .withMasterUsername("deploybuilddbo")
            .withMasterUserPassword("deploybuilddb0")
            ;
    DBInstance response = client.createDBInstance(request);
    System.out.println(response);

    describe(dbInstanceIdentifier);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:CreateDbInstance.java

示例5: createSqlServer

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
public void createSqlServer(String dbInstanceIdentifier) throws Exception {
    // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
    CreateDBInstanceRequest request = new CreateDBInstanceRequest()
            .withEngine("sqlserver-ex")
            .withEngineVersion("13.00.2164.0.v1")
            .withLicenseModel("license-included")
            .withAllocatedStorage(20)
            .withStorageType("gp2")  // SSD
            .withBackupRetentionPeriod(0)
            .withDBInstanceClass("db.t2.micro")
            .withDBInstanceIdentifier(dbInstanceIdentifier)
            //.withDBName("DBDEPLOY")
            .withMasterUsername("deploybuilddbo")
            .withMasterUserPassword("deploybuilddb0")
            ;
    DBInstance response = client.createDBInstance(request);
    System.out.println(response);

    describe(dbInstanceIdentifier);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:CreateDbInstance.java

示例6: describe

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
public void describe(String dbInstanceIdentifier) throws Exception {
    while (true) {
        DescribeDBInstancesRequest request = new DescribeDBInstancesRequest()
                .withDBInstanceIdentifier(dbInstanceIdentifier);

        DescribeDBInstancesResult response = client.describeDBInstances(request);
        DBInstance dbInstance = response.getDBInstances().get(0);
        if (!dbInstance.getDBInstanceStatus().equalsIgnoreCase("creating")) {
            System.out.println("Done! " + response);
            System.out.println(dbInstance.getEndpoint().getAddress());
            System.out.println(dbInstance.getEndpoint().getPort());
            break;
        }

        System.out.println("Not done - will wait 10s: " + response);
        Thread.sleep(10000L);
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:CreateDbInstance.java

示例7: deleteParameterGroup

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Deletes the parameter group, if it appears to have been created solely for the deleted db instance.
 * <p/>
 * (The parameter group cannot be deleted until the dependent rdsInstance is fully deleted.)
 */
void deleteParameterGroup(DBInstance rdsInstance, boolean noop)
{
  if (noop)
  {
    //rdsInstance is null, don't try to analyze it
    LOGGER.info(context() + "Deleting parameter group" + noopRemark(noop));
  }
  else
  {
    String paramGroupName = rdsAnalyzer.findSelfNamedParamGroupName(rdsInstance);
    if (StringUtils.isBlank(paramGroupName))
    {
      LOGGER.info(context() + "Deleted database did not have its own special parameter group");
    }
    else
    {
      LOGGER.info(context() + "Deleting parameter group '" + paramGroupName + "', which was used only by the deleted database");
      rdsClient.deleteParameterGroup(paramGroupName);
    }
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:27,代码来源:RdsInstanceDeleteTask.java

示例8: followupCheck

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Communicates with RDS for updated instance progress and checks the status.
 * Concludes if error or if naturally done.
 */
@Override
public void followupCheck(int waitNum)
{
  try
  {
    DBInstance dbInstance = rdsClient.describeInstance(instanceId);
    checkInstanceId(dbInstance);
    logFollowupStatus(waitNum, dbInstance);
    checkInstanceStatus(dbInstance);
  }
  catch (DBInstanceNotFoundException e)
  {
    handleInstanceNotFound(waitNum, e);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:20,代码来源:RdsInstanceProgressChecker.java

示例9: checkInstanceStatus

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Checks if the instance is in an acceptable intermediate status, and flags done if at final state.
 */
protected void checkInstanceStatus(DBInstance dbInstance)
{
  final String status = dbInstance.getDBInstanceStatus();
  if (expectedFinalState.equalsString(status))
  {
    LOGGER.info("RDS " + getDescription() + " is done");
    done = true;
    result = dbInstance;
  }
  else if (isOneOfTheseStates(expectedIntermediateStates, status))
  {
    //Keep waiting.
  }
  else
  {
    LOGGER.error(logContext + getDescription() + ": Unexpected response status '" + status + "'");
    done = true;
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:23,代码来源:RdsInstanceProgressChecker.java

示例10: handleInstanceNotFound

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Amazon can't find the instance.  This is an allowed final state for a delete operation, otherwise is a bad error.
 */
private void handleInstanceNotFound(int waitNum, DBInstanceNotFoundException e)
{
  LOGGER.debug("RDS " + getDescription() + " status after wait#" + waitNum + ": " + e.getClass().getSimpleName()
      + ": " + e.getMessage());
  if (expectedFinalState.equals(DELETE_FINAL_STATE))
  {
    LOGGER.info("RDS " + getDescription() + " is done");
    result = new DBInstance(); //Just a stub, since result==null would be considered a progress error.
  }
  else
  {
    LOGGER.error(logContext + getDescription() + ": not found", e);
  }
  done = true;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:19,代码来源:RdsInstanceProgressChecker.java

示例11: copyParameterGroup

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Makes a copy of the live instance's parameter group.
 */
private DBParameterGroup copyParameterGroup(DBInstance liveInstance, boolean noop)
{
  String stagePhysicalInstanceName = dbMap.get(liveLogicalDatabase.getLogicalName());
  String liveParamGroupName = rdsAnalyzer.findSelfNamedOrDefaultParamGroupName(liveInstance);
  String stageParamGroupName = makeStageParamGroupName(liveParamGroupName,
      liveInstance.getDBInstanceIdentifier(), stagePhysicalInstanceName);
  LOGGER.info(liveContext() + "Copying live parameter group '" + liveParamGroupName
      + "' to stage parameter group '" + stageParamGroupName + "'" + noopRemark(noop));
  if (!noop)
  {
    return rdsClient.copyParameterGroup(liveParamGroupName, stageParamGroupName);
  }
  else
  {
    return null;
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:21,代码来源:RdsSnapshotRestoreTask.java

示例12: restoreStage

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Restores the live snapshot into the new staging environment.
 * Then makes a few small modifications that restore would not do automatically (paramgroup and security group).
 * Reboots the db so the paramgroup modification will take effect.
 * Returns the rebooted instance.
 */
DBInstance restoreStage(DBSnapshot dbSnapshot,
                        DBParameterGroup stageParamGroup,
                        DBInstance liveInstance,
                        boolean noop)
{
  LOGGER.info(liveContext() + "Restoring snapshot to new stage RDS instance" + noopRemark(noop));
  if (!noop)
  {
    String stagePhysicalInstanceName = dbMap.get(liveLogicalDatabase.getLogicalName());
    initModel(stagePhysicalInstanceName);
    String subnetGroupName = getSubnetGroupName(liveInstance);
    DBInstance stageInstance = rdsClient.restoreInstanceFromSnapshot(stagePhysicalInstanceName,
        dbSnapshot.getDBSnapshotIdentifier(), subnetGroupName);
    stageInstance = waitTilInstanceIsAvailable(stagePhysicalInstanceName, stageInstance, RdsInstanceStatus.CREATING);
    DBInstance modifiedInstance = modifyInstance(stageInstance, stageParamGroup, liveInstance);
    modifiedInstance = waitTilParamGroupIsPendingReboot(stagePhysicalInstanceName, modifiedInstance, stageParamGroup,
        RdsInstanceStatus.MODIFYING);
    DBInstance rebootedInstance = rebootInstance(modifiedInstance);
    rebootedInstance = waitTilInstanceIsAvailable(stagePhysicalInstanceName, rebootedInstance, RdsInstanceStatus.REBOOTING);
    return rebootedInstance;
  }
  return null;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:30,代码来源:RdsSnapshotRestoreTask.java

示例13: waitTilParamGroupIsPendingReboot

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Creates a Waiter using an instance paramgroup progress checker, and returns the final DBInstance when waiting is done.
 * In case of error - never returns null, throws instead.
 */
private DBInstance waitTilParamGroupIsPendingReboot(String instanceId, DBInstance initialInstance,
                                                    DBParameterGroup stageParamGroup,
                                                    RdsInstanceStatus expectedInitialState)
{
  LOGGER.info(liveContext() + "Waiting for instance to become available and instance paramgroup modification to be fully applied");
  RdsInstanceParamGroupProgressChecker progressChecker = new RdsInstanceParamGroupProgressChecker(instanceId,
      stageParamGroup.getDBParameterGroupName(), liveContext(), rdsClient, rdsAnalyzer, initialInstance, expectedInitialState);
  Waiter<DBInstance> waiter = new Waiter(waiterParameters, threadSleeper, progressChecker);
  DBInstance dbInstance = waiter.waitTilDone();
  if (dbInstance == null)
  {
    throw new RuntimeException(liveContext() + progressChecker.getDescription() + " did not become available, "
        + "or paramgroup failed to reach pending-reboot state");
  }
  return dbInstance;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:21,代码来源:RdsSnapshotRestoreTask.java

示例14: restoreInstanceFromSnapshot

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的package包/类
/**
 * Restores a snapshot to a brand new instance.
 * <p/>
 * New instance gets the default security group, otherwise should be same as snapshot.
 * <p/>
 * Caller must wait for status=available afterwards.
 */
public DBInstance restoreInstanceFromSnapshot(String instanceName, String snapshotId, String subnetGroupName)
{
  LOGGER.debug("restoreDBInstanceFromDBSnapshot(instanceName: " + instanceName + ", snapshotId: " + snapshotId
      + ", subnetGroupName: " + subnetGroupName + ")");
  StopWatch stopWatch = new StopWatch();
  try
  {
    stopWatch.start();
    RestoreDBInstanceFromDBSnapshotRequest request = new RestoreDBInstanceFromDBSnapshotRequest(
        instanceName, snapshotId);
    request.setDBSubnetGroupName(subnetGroupName);
    return awsRdsClient.restoreDBInstanceFromDBSnapshot(request);
  }
  finally
  {
    stopWatch.stop();
    LOGGER.debug("restoreDBInstanceFromDBSnapshot time elapsed: " + stopWatch);
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:27,代码来源:RdsClient.java

示例15: modifyInstanceWithSecgrpParamgrp

import com.amazonaws.services.rds.model.DBInstance; //导入依赖的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


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