@Test (expected = InvalidInputDataException.class) public void testDetachMissingSecurityGroup() { rdsRaider.detachSecurityGroup("Test-DB", ""); }
@Deprecated public void detachSecurityGroup(String dbName, String securityGroup) { if (dbName.isEmpty() || dbName == null) { throw new InvalidInputDataException("Empty/Null dbName provided in request"); } else if (securityGroup.isEmpty() || securityGroup == null) { throw new InvalidInputDataException("Empty/Null securityGroup provided in request"); } List<String> securityGroups = this.getSecurityGroups(dbName); if (securityGroups != null && securityGroups.contains(securityGroup)) { securityGroups.remove(securityGroup); rdsDelegator.getAmazonRds().modifyDBInstance(new ModifyDBInstanceRequest().withDBInstanceIdentifier(dbName).withVpcSecurityGroupIds(securityGroups).withApplyImmediately(true)); } else { throw new com.intuit.cloudraider.exceptions.ResourceNotFoundException("Unable to detach SG: " + securityGroup); } }
RDSRaiderImpl implements RDSRaider { @Deprecated public void detachSecurityGroup(String dbName, String securityGroup) { if (dbName.isEmpty() || dbName == null) { throw new InvalidInputDataException("Empty/Null dbName provided in request"); } else if (securityGroup.isEmpty() || securityGroup == null) { throw new InvalidInputDataException("Empty/Null securityGroup provided in request"); } List<String> securityGroups = this.getSecurityGroups(dbName); if (securityGroups != null && securityGroups.contains(securityGroup)) { securityGroups.remove(securityGroup); rdsDelegator.getAmazonRds().modifyDBInstance(new ModifyDBInstanceRequest().withDBInstanceIdentifier(dbName).withVpcSecurityGroupIds(securityGroups).withApplyImmediately(true)); } else { throw new com.intuit.cloudraider.exceptions.ResourceNotFoundException("Unable to detach SG: " + securityGroup); } } }
RDSRaiderImpl implements RDSRaider { @Deprecated public void detachSecurityGroup(String dbName, String securityGroup) { if (dbName.isEmpty() || dbName == null) { throw new InvalidInputDataException("Empty/Null dbName provided in request"); } else if (securityGroup.isEmpty() || securityGroup == null) { throw new InvalidInputDataException("Empty/Null securityGroup provided in request"); } List<String> securityGroups = this.getSecurityGroups(dbName); if (securityGroups != null && securityGroups.contains(securityGroup)) { securityGroups.remove(securityGroup); rdsDelegator.getAmazonRds().modifyDBInstance(new ModifyDBInstanceRequest().withDBInstanceIdentifier(dbName).withVpcSecurityGroupIds(securityGroups).withApplyImmediately(true)); } else { throw new com.intuit.cloudraider.exceptions.ResourceNotFoundException("Unable to detach SG: " + securityGroup); } } RDSRaiderImpl(); }
RDSRaiderImpl implements RDSRaider { @Deprecated public void detachSecurityGroup(String dbName, String securityGroup) { if (dbName.isEmpty() || dbName == null) { throw new InvalidInputDataException("Empty/Null dbName provided in request"); } else if (securityGroup.isEmpty() || securityGroup == null) { throw new InvalidInputDataException("Empty/Null securityGroup provided in request"); } List<String> securityGroups = this.getSecurityGroups(dbName); if (securityGroups != null && securityGroups.contains(securityGroup)) { securityGroups.remove(securityGroup); rdsDelegator.getAmazonRds().modifyDBInstance(new ModifyDBInstanceRequest().withDBInstanceIdentifier(dbName).withVpcSecurityGroupIds(securityGroups).withApplyImmediately(true)); } else { throw new com.intuit.cloudraider.exceptions.ResourceNotFoundException("Unable to detach SG: " + securityGroup); } } RDSRaiderImpl(); @Override List<DBInstance> getAllDbInstances(); @Override List<DBInstance> getInstanceIdsForAvailabilityZone(String availabilityZone, List<String> dbInstanceIdsToIgnore); @Override List<DBStatus> getInstancesStatus(List<String> dbInstanceIds); @Override void stopInstances(List<String> dbNames); @Override void startInstances(List<String> dbNames); @Override List<String> getAllDbInstanceNames(); @Override List<String> getDBInstancesStatus(); @Override String getDBInstanceStatus(String dbName); @Override void rebootDbInstances(List<String> dbNames); @Override void rebootDbInstance(String dbName); @Override void rebootDbInstanceWithForceFailover(String dbName); @Deprecated void detachSecurityGroup(String dbName, String securityGroup); @Deprecated void attachSecurityGroup(String dbName, String securityGroup); @Override List<String> getSecurityGroups(String dbName); @Override List<String> getSubnetIds(String dbName); @Override void detachSecurityGroups(String dbName, String... securityGroups); @Override void attachSecurityGroups(String dbName, String... securityGroups); @Override void detachSubnet(String dbName, String subnetId); @Override void attachSubnet(String dbName, String subnetId); @Override void restoreDBInstanceFromSnapshot(String dbName, String snapshotId); @Override void modifyDbStorageSize(String dbName, int newSize); @Override void modifyDbInstanceClass(String dbName, String dbInstanceClass); @Override void modifyDbIops(String dbName, Integer iops); @Override String getDBInstanceClass(String dbName); @Override Integer getDBStorageSize(String dbName); @Override Integer getIops(String dbName); @Override void generateSnapshot(String dbName, String snapshotName); }
RDSRaiderImpl implements RDSRaider { @Deprecated public void detachSecurityGroup(String dbName, String securityGroup) { if (dbName.isEmpty() || dbName == null) { throw new InvalidInputDataException("Empty/Null dbName provided in request"); } else if (securityGroup.isEmpty() || securityGroup == null) { throw new InvalidInputDataException("Empty/Null securityGroup provided in request"); } List<String> securityGroups = this.getSecurityGroups(dbName); if (securityGroups != null && securityGroups.contains(securityGroup)) { securityGroups.remove(securityGroup); rdsDelegator.getAmazonRds().modifyDBInstance(new ModifyDBInstanceRequest().withDBInstanceIdentifier(dbName).withVpcSecurityGroupIds(securityGroups).withApplyImmediately(true)); } else { throw new com.intuit.cloudraider.exceptions.ResourceNotFoundException("Unable to detach SG: " + securityGroup); } } RDSRaiderImpl(); @Override List<DBInstance> getAllDbInstances(); @Override List<DBInstance> getInstanceIdsForAvailabilityZone(String availabilityZone, List<String> dbInstanceIdsToIgnore); @Override List<DBStatus> getInstancesStatus(List<String> dbInstanceIds); @Override void stopInstances(List<String> dbNames); @Override void startInstances(List<String> dbNames); @Override List<String> getAllDbInstanceNames(); @Override List<String> getDBInstancesStatus(); @Override String getDBInstanceStatus(String dbName); @Override void rebootDbInstances(List<String> dbNames); @Override void rebootDbInstance(String dbName); @Override void rebootDbInstanceWithForceFailover(String dbName); @Deprecated void detachSecurityGroup(String dbName, String securityGroup); @Deprecated void attachSecurityGroup(String dbName, String securityGroup); @Override List<String> getSecurityGroups(String dbName); @Override List<String> getSubnetIds(String dbName); @Override void detachSecurityGroups(String dbName, String... securityGroups); @Override void attachSecurityGroups(String dbName, String... securityGroups); @Override void detachSubnet(String dbName, String subnetId); @Override void attachSubnet(String dbName, String subnetId); @Override void restoreDBInstanceFromSnapshot(String dbName, String snapshotId); @Override void modifyDbStorageSize(String dbName, int newSize); @Override void modifyDbInstanceClass(String dbName, String dbInstanceClass); @Override void modifyDbIops(String dbName, Integer iops); @Override String getDBInstanceClass(String dbName); @Override Integer getDBStorageSize(String dbName); @Override Integer getIops(String dbName); @Override void generateSnapshot(String dbName, String snapshotName);  }