Example usage for com.amazonaws.services.rds.model DBInstance getReadReplicaDBInstanceIdentifiers

List of usage examples for com.amazonaws.services.rds.model DBInstance getReadReplicaDBInstanceIdentifiers

Introduction

In this page you can find the example usage for com.amazonaws.services.rds.model DBInstance getReadReplicaDBInstanceIdentifiers.

Prototype


public java.util.List<String> getReadReplicaDBInstanceIdentifiers() 

Source Link

Document

Contains one or more identifiers of the Read Replicas associated with this DB instance.

Usage

From source file:com.airbnb.billow.RDSInstance.java

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 {//  w w  w .j  av a 2s.co  m
        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());
    }
}

From source file:com.msi.tough.rdsquery.RDSQueryUtil.java

public static void marshalDBInstance(XMLNode parent, DBInstance dbInstance) {
    XMLNode n = new XMLNode(RDS_Constants.NODE_DBINSTANCE);
    parent.addNode(n);//  w w w  .j  a  v a2  s .  c  o m

    QueryUtil.addNode(n, RDS_Constants.NODE_ALLOCATEDSTORAGE, "" + dbInstance.getAllocatedStorage());
    QueryUtil.addNode(n, RDS_Constants.NODE_AUTOMINORVERSIONUPGRADE, dbInstance.getAutoMinorVersionUpgrade());
    QueryUtil.addNode(n, RDS_Constants.NODE_AVAILABILITYZONE, dbInstance.getAvailabilityZone());
    QueryUtil.addNode(n, RDS_Constants.NODE_BACKUPRETENTIONPERIOD, dbInstance.getBackupRetentionPeriod());
    QueryUtil.addNode(n, RDS_Constants.NODE_DBINSTANCECLASS, dbInstance.getDBInstanceClass());
    QueryUtil.addNode(n, RDS_Constants.NODE_DBINSTANCEIDENTIFIER, dbInstance.getDBInstanceIdentifier());
    QueryUtil.addNode(n, RDS_Constants.NODE_DBNAME, dbInstance.getDBName());
    QueryUtil.addNode(n, RDS_Constants.NODE_DBINSTANCESTATUS, dbInstance.getDBInstanceStatus());

    RDSQueryUtil.marshalDBParameterGroupStatus(n, dbInstance);
    RDSQueryUtil.marshalDBSecurityGroups(n, dbInstance);
    RDSQueryUtil.marshalEndpoint(n, dbInstance);

    QueryUtil.addNode(n, RDS_Constants.NODE_ENGINE, dbInstance.getEngine().toLowerCase());
    QueryUtil.addNode(n, RDS_Constants.NODE_ENGINEVERSION, dbInstance.getEngineVersion());
    QueryUtil.addNode(n, RDS_Constants.INSTANCE_CREATETIME, dbInstance.getInstanceCreateTime());
    QueryUtil.addNode(n, RDS_Constants.NODE_LICENSEMODEL, dbInstance.getLicenseModel());
    QueryUtil.addNode(n, RDS_Constants.NODE_LATESTRESTORABLETIME, dbInstance.getLatestRestorableTime());
    QueryUtil.addNode(n, RDS_Constants.NODE_MULTIAZ, dbInstance.getMultiAZ());

    RDSQueryUtil.marshalPendingModifiedValues(n, dbInstance.getPendingModifiedValues());

    QueryUtil.addNode(n, RDS_Constants.PREFERREDBACKUPWINDOW, dbInstance.getPreferredBackupWindow());
    QueryUtil.addNode(n, RDS_Constants.NODE_PREFERREDMAINTENANCEWINDOW,
            dbInstance.getPreferredMaintenanceWindow());

    RDSQueryUtil.marshalReadReplicaDBInstanceIdentifiers(n, dbInstance.getReadReplicaDBInstanceIdentifiers());

    QueryUtil.addNode(n, RDS_Constants.NODE_READREPLICASOURCEDBINSTANCEIDENTIFIER,
            dbInstance.getReadReplicaSourceDBInstanceIdentifier());

    QueryUtil.addNode(n, RDS_Constants.NODE_MASTERUSERNAME, dbInstance.getMasterUsername());

}

From source file:org.springframework.cloud.aws.jdbc.rds.AmazonRdsReadReplicaAwareDataSourceFactoryBean.java

License:Apache License

/**
 * Constructs a {@link org.springframework.cloud.aws.jdbc.datasource.ReadOnlyRoutingDataSource} data source that contains the
 * regular data source as a default, and all read-replicas as additional data source. The {@link
 * org.springframework.cloud.aws.jdbc.datasource.ReadOnlyRoutingDataSource} is additionally wrapped with a {@link
 * org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy}, because the read-only flag is only available
 * after the transactional context has been established. This is only the case if the physical connection is
 * requested after the transaction start and not while starting a transaction.
 *
 * @return a ReadOnlyRoutingDataSource that is wrapped with a LazyConnectionDataSourceProxy
 * @throws Exception//from   w w w .  j  a  va 2 s  .c o m
 *       if the underlying data source setup throws any exception
 */
@Override
protected DataSource createInstance() throws Exception {
    DBInstance dbInstance = getDbInstance(getDbInstanceIdentifier());

    //If there is no read replica available, delegate to super class
    if (dbInstance.getReadReplicaDBInstanceIdentifiers().isEmpty()) {
        return super.createInstance();
    }

    HashMap<Object, Object> replicaMap = new HashMap<>(dbInstance.getReadReplicaDBInstanceIdentifiers().size());

    for (String replicaName : dbInstance.getReadReplicaDBInstanceIdentifiers()) {
        replicaMap.put(replicaName, createDataSourceInstance(replicaName));
    }

    //Create the data source
    ReadOnlyRoutingDataSource dataSource = new ReadOnlyRoutingDataSource();
    dataSource.setTargetDataSources(replicaMap);
    dataSource.setDefaultTargetDataSource(createDataSourceInstance(getDbInstanceIdentifier()));

    //Initialize the class
    dataSource.afterPropertiesSet();

    return new LazyConnectionDataSourceProxy(dataSource);
}