if (getEngine() != null) sb.append("Engine: ").append(getEngine()).append(","); if (getDBInstanceStatus() != null) sb.append("DBInstanceStatus: ").append(getDBInstanceStatus()).append(","); if (getMasterUsername() != null) sb.append("MasterUsername: ").append(getMasterUsername()).append(",");
hashCode = prime * hashCode + ((getDBInstanceClass() == null) ? 0 : getDBInstanceClass().hashCode()); hashCode = prime * hashCode + ((getEngine() == null) ? 0 : getEngine().hashCode()); hashCode = prime * hashCode + ((getDBInstanceStatus() == null) ? 0 : getDBInstanceStatus().hashCode()); hashCode = prime * hashCode + ((getMasterUsername() == null) ? 0 : getMasterUsername().hashCode()); hashCode = prime * hashCode + ((getDBName() == null) ? 0 : getDBName().hashCode());
if (other.getEngine() != null && other.getEngine().equals(this.getEngine()) == false) return false; if (other.getDBInstanceStatus() == null ^ this.getDBInstanceStatus() == null) return false; if (other.getDBInstanceStatus() != null && other.getDBInstanceStatus().equals(this.getDBInstanceStatus()) == false) return false; if (other.getMasterUsername() == null ^ this.getMasterUsername() == null)
private boolean isDatabaseAvailable(RetryContext context) { DescribeDBInstancesResult describeDBInstancesResult; try { describeDBInstancesResult = this.amazonRDS.describeDBInstances(new DescribeDBInstancesRequest().withDBInstanceIdentifier((String) context.getAttribute(DB_INSTANCE_ATTRIBUTE_NAME))); } catch (DBInstanceNotFoundException e) { LOGGER.warn("Database Instance with name {} has been removed or is not configured correctly, no retry possible", getDbInstanceIdentifier()); //Database has been deleted while operating, hence we can not retry return false; } if (describeDBInstancesResult.getDBInstances().size() == 1) { DBInstance dbInstance = describeDBInstancesResult.getDBInstances().get(0); InstanceStatus instanceStatus = InstanceStatus.fromDatabaseStatus(dbInstance.getDBInstanceStatus()); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Status of database to be retried is {}", instanceStatus); } return instanceStatus.isRetryable(); } else { throw new IllegalStateException("Multiple databases found for same identifier, this is likely an incompatibility with the Amazon SDK"); } }
private boolean isDatabaseAvailable(RetryContext context) { DescribeDBInstancesResult describeDBInstancesResult; try { describeDBInstancesResult = this.amazonRDS.describeDBInstances(new DescribeDBInstancesRequest().withDBInstanceIdentifier((String) context.getAttribute(DB_INSTANCE_ATTRIBUTE_NAME))); } catch (DBInstanceNotFoundException e) { LOGGER.warn("Database Instance with name {} has been removed or is not configured correctly, no retry possible", getDbInstanceIdentifier()); //Database has been deleted while operating, hence we can not retry return false; } if (describeDBInstancesResult.getDBInstances().size() == 1) { DBInstance dbInstance = describeDBInstancesResult.getDBInstances().get(0); InstanceStatus instanceStatus = InstanceStatus.fromDatabaseStatus(dbInstance.getDBInstanceStatus()); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Status of database to be retried is {}", instanceStatus); } return instanceStatus.isRetryable(); } else { throw new IllegalStateException("Multiple databases found for same identifier, this is likely an incompatibility with the Amazon SDK"); } }
@TaskAction public void createOrUpdateDBInstance() throws InterruptedException { AmazonRDSPluginExtension ext = getProject().getExtensions().getByType(AmazonRDSPluginExtension.class); AmazonRDS rds = ext.getClient(); try { DescribeDBInstancesResult describeDBInstancesResult = rds.describeDBInstances(new DescribeDBInstancesRequest() .withDBInstanceIdentifier(dbInstanceIdentifier)); DBInstance dbInstance = describeDBInstancesResult.getDBInstances().get(0); if (stableStatuses.contains(dbInstance.getDBInstanceStatus())) { modifyDBInstance(rds); } else { throw new GradleException("Invalid status for update: " + dbInstance.getDBInstanceStatus()); } } catch (DBInstanceNotFoundException e) { getLogger().info(e.getMessage()); createDBInstance(rds); } }
dbInstance = dir.getDBInstances().get(0); found = true; lastStatus = dbInstance.getDBInstanceStatus(); if (successStatuses.contains(lastStatus)) { getLogger().info("Description of DB instance {} is now {}.", dbInstanceIdentifier, lastStatus);
lastStatus = dbInstance.getDBInstanceStatus(); if (successStatuses.contains(lastStatus)) { getLogger().info("Status of DB instance {} is now {}.", dbInstanceIdentifier, lastStatus);
if (getEngine() != null) sb.append("Engine: ").append(getEngine()).append(","); if (getDBInstanceStatus() != null) sb.append("DBInstanceStatus: ").append(getDBInstanceStatus()).append(","); if (getMasterUsername() != null) sb.append("MasterUsername: ").append(getMasterUsername()).append(",");
private 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); } }
hashCode = prime * hashCode + ((getDBInstanceClass() == null) ? 0 : getDBInstanceClass().hashCode()); hashCode = prime * hashCode + ((getEngine() == null) ? 0 : getEngine().hashCode()); hashCode = prime * hashCode + ((getDBInstanceStatus() == null) ? 0 : getDBInstanceStatus().hashCode()); hashCode = prime * hashCode + ((getMasterUsername() == null) ? 0 : getMasterUsername().hashCode()); hashCode = prime * hashCode + ((getDBName() == null) ? 0 : getDBName().hashCode());
this.dBInstanceClass = instance.getDBInstanceClass(); this.dBInstanceIdentifier = instance.getDBInstanceIdentifier(); this.dBInstanceStatus = instance.getDBInstanceStatus(); this.dBClusterIdentifier = instance.getDBClusterIdentifier(); this.dBName = instance.getDBName();
if (other.getEngine() != null && other.getEngine().equals(this.getEngine()) == false) return false; if (other.getDBInstanceStatus() == null ^ this.getDBInstanceStatus() == null) return false; if (other.getDBInstanceStatus() != null && other.getDBInstanceStatus().equals(this.getDBInstanceStatus()) == false) return false; if (other.getMasterUsername() == null ^ this.getMasterUsername() == null)