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