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


Java DBInstance.getEndpoint方法代码示例

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


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

示例1: getPrivateIpAddress

import com.amazonaws.services.rds.model.DBInstance; //导入方法依赖的package包/类
/**
 * Returns the private IP address of the specified RDS instance.
 *
 * @param dbInstance the RDS instance
 * @return the private IP address of the specified RDS instance
 */
private static InetAddress getPrivateIpAddress(DBInstance dbInstance) {
  Preconditions.checkNotNull(dbInstance, "dbInstance is null");
  InetAddress privateIpAddress = null;
  try {
    Endpoint endpoint = dbInstance.getEndpoint();
    if (endpoint != null) {
      String endpointAddress = endpoint.getAddress();
      if (endpointAddress != null) {
        privateIpAddress = InetAddress.getByName(endpointAddress);
      }
    }
  } catch (UnknownHostException e) {
    throw new IllegalArgumentException("Invalid private IP address", e);
  }
  return privateIpAddress;
}
 
开发者ID:cloudera,项目名称:director-aws-plugin,代码行数:23,代码来源:RDSInstance.java

示例2: toDatabaseInstance

import com.amazonaws.services.rds.model.DBInstance; //导入方法依赖的package包/类
private static DatabaseInstance toDatabaseInstance( DBInstance dbInstance )
{
    DatabaseInstance i = new DatabaseInstance();
    i.setAllocatedStorage( dbInstance.getAllocatedStorage() );
    i.setAvailabilityZone( dbInstance.getAvailabilityZone() );
    i.setInstanceId( dbInstance.getDBInstanceIdentifier() );
    i.setInstanceStatus( dbInstance.getDBInstanceStatus() );
    i.setInstanceType( dbInstance.getDBInstanceClass() );
    i.setMasterUser( dbInstance.getMasterUsername() );
    if ( dbInstance.getEndpoint() != null )
    {
        i.setPort( dbInstance.getEndpoint().getPort() );
        i.setPublicHostName( dbInstance.getEndpoint().getAddress() );
    }
    if ( dbInstance.getDBSubnetGroup() != null )
    {
        i.setSubnetGroupName( dbInstance.getDBSubnetGroup().getDBSubnetGroupName() );
    }
    return i;
}
 
开发者ID:jiaqi,项目名称:datamung,代码行数:21,代码来源:RdsActivitiesImpl.java

示例3: runSetup

import com.amazonaws.services.rds.model.DBInstance; //导入方法依赖的package包/类
/**
 * Runs the given database configuration (~setup) on an AWS database instance. Make sure the setup
 * fits the database (e.g. a MSSQL setup for a MSSQL database).
 */
private void runSetup(DBInstance dbInstance, Database database) {
  String setup = database.getSetup();
  String buildFilePath = new LocaleRepository().getLocation() + SLASH + setup + "/build.xml";
  Endpoint endpoint = dbInstance.getEndpoint();
  File buildFile = new File(buildFilePath);

  this.console.write("Run database setup " + buildFilePath);
  this.console.write("Endpoint " + endpoint);

  Project project = new Project();
  project.setUserProperty(Variable.ANT_FILE, buildFile.getAbsolutePath());
  project.setUserProperty(Variable.DEST_ROOT_LOCAL, new LocaleRepository().getLocation() + SLASH
      + "tmp");
  project.setUserProperty(Variable.DB_SERVER, endpoint.getAddress());
  project.setUserProperty(Variable.DB_PORT, endpoint.getPort().toString());
  project.setUserProperty(Variable.DB_USER, database.getUsername());
  project.setUserProperty(Variable.DB_PASSWORD, database.getPassword());
  project.setUserProperty(Variable.ENV_NLS_LANG, "American_America.UTF8");
  project.setUserProperty(Variable.HEADLESS, "true");
  project.init();

  DefaultLogger consoleLogger = createConsoleLogger();
  project.addBuildListener(consoleLogger);

  ProjectHelper helper = ProjectHelper.getProjectHelper();
  project.addReference("ant.projectHelper", helper);
  helper.parse(project, buildFile);
  project.executeTarget(project.getDefaultTarget());

  this.console.newLine();
}
 
开发者ID:tuhrig,项目名称:DeployMan,代码行数:36,代码来源:Launcher.java

示例4: RDSInstance

import com.amazonaws.services.rds.model.DBInstance; //导入方法依赖的package包/类
public RDSInstance(DBInstance instance, DBCluster cluster, List<Tag> tagList) {
    this.allocatedStorage = instance.getAllocatedStorage();
    this.autoMinorVersionUpgrade = instance.getAutoMinorVersionUpgrade();
    this.availabilityZone = instance.getAvailabilityZone();
    this.backupRetentionPeriod = instance.getBackupRetentionPeriod();
    this.characterSetName = instance.getCharacterSetName();
    this.dBInstanceClass = instance.getDBInstanceClass();
    this.dBInstanceIdentifier = instance.getDBInstanceIdentifier();
    this.dBInstanceStatus = instance.getDBInstanceStatus();
    this.dBClusterIdentifier = instance.getDBClusterIdentifier();
    this.dBName = instance.getDBName();
    this.dBParameterGroups = instance.getDBParameterGroups();
    this.dBSecurityGroups = instance.getDBSecurityGroups();
    this.dBSubnetGroup = instance.getDBSubnetGroup();
    this.endpoint = instance.getEndpoint();
    if(this.endpoint != null) {
      this.hostname = endpoint.getAddress();
      this.privateIP = getPrivateIp(hostname);
    } else {
      this.hostname = null;
      this.privateIP = null;
    }
    this.engine = instance.getEngine();
    this.engineVersion = instance.getEngineVersion();
    this.instanceCreateTime = instance.getInstanceCreateTime();
    this.iops = instance.getIops();
    this.latestRestorableTime = instance.getLatestRestorableTime();
    this.licenseModel = instance.getLicenseModel();
    this.masterUsername = instance.getMasterUsername();
    this.multiAZ = instance.getMultiAZ();
    this.optionGroupMemberships = instance.getOptionGroupMemberships();
    this.pendingModifiedValues = instance.getPendingModifiedValues();
    this.preferredBackupWindow = instance.getPreferredBackupWindow();
    this.preferredMaintenanceWindow = instance.getPreferredMaintenanceWindow();
    this.publiclyAccessible = instance.getPubliclyAccessible();
    this.readReplicaDBInstanceIdentifiers = instance.getReadReplicaDBInstanceIdentifiers();
    this.readReplicaSourceDBInstanceIdentifier = instance.getReadReplicaSourceDBInstanceIdentifier();
    this.secondaryAvailabilityZone = instance.getSecondaryAvailabilityZone();
    this.statusInfos = instance.getStatusInfos();
    this.vpcSecurityGroups = instance.getVpcSecurityGroups();
    this.isMaster = checkIfMaster(instance, cluster);

    this.tags = new HashMap<>(tagList.size());
    for(Tag tag : tagList) {
        this.tags.put(tag.getKey(), tag.getValue());
    }
}
 
开发者ID:airbnb,项目名称:billow,代码行数:48,代码来源:RDSInstance.java

示例5: restoreSnapshot

import com.amazonaws.services.rds.model.DBInstance; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public DatabaseInstance restoreSnapshot( String snapshotName,
                                         String instanceName,
                                         String subnetGroupName,
                                         Identity identity )
{
    AmazonRDS rds =
        ActivityUtils.createClient( AmazonRDSClient.class, identity );
    try
    {
        DescribeDBInstancesResult results =
            rds.describeDBInstances( new DescribeDBInstancesRequest().withDBInstanceIdentifier( instanceName ) );
        return toDatabaseInstance( results.getDBInstances().get( 0 ) );
    }
    catch ( DBInstanceNotFoundException e )
    {
    }

    DescribeDBSnapshotsResult result =
        rds.describeDBSnapshots( new DescribeDBSnapshotsRequest().withDBSnapshotIdentifier( snapshotName ) );
    if ( result.getDBSnapshots().isEmpty() )
    {
        throw new IllegalArgumentException( "Snapshot  " + snapshotName
            + " is not found" );
    }
    DBSnapshot snapshot = result.getDBSnapshots().get( 0 );

    RestoreDBInstanceFromDBSnapshotRequest request =
        new RestoreDBInstanceFromDBSnapshotRequest( instanceName,
                                                    snapshotName );

    if ( snapshot.getVpcId() == null )
    {
        request.setPubliclyAccessible( true );
    }
    else
    {
        request.setDBSubnetGroupName( subnetGroupName );
    }

    DBInstance ins = rds.restoreDBInstanceFromDBSnapshot( request );
    DatabaseInstance desc = new DatabaseInstance();
    desc.setAllocatedStorage( ins.getAllocatedStorage() );
    desc.setAvailabilityZone( ins.getAvailabilityZone() );
    desc.setInstanceId( ins.getDBInstanceIdentifier() );
    desc.setInstanceType( ins.getDBInstanceClass() );
    if ( ins.getEndpoint() != null )
    {
        desc.setPublicHostName( ins.getEndpoint().getAddress() );
        desc.setPort( ins.getEndpoint().getPort() );
    }
    desc.setMasterUser( ins.getMasterUsername() );
    return desc;
}
 
开发者ID:jiaqi,项目名称:datamung,代码行数:58,代码来源:RdsActivitiesImpl.java

示例6: getPort

import com.amazonaws.services.rds.model.DBInstance; //导入方法依赖的package包/类
/**
 * Returns the port used for administrative database connections on the specified RDS instance.
 *
 * @param dbInstance the RDS instance
 * @return the port used for administrative database connections on the specified RDS instance
 */
private static Integer getPort(DBInstance dbInstance) {
  Preconditions.checkNotNull(dbInstance, "dbInstance is null");
  Endpoint endpoint = dbInstance.getEndpoint();
  return (endpoint == null) ? null : endpoint.getPort();
}
 
开发者ID:cloudera,项目名称:director-aws-plugin,代码行数:12,代码来源:RDSInstance.java


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