@Test public void testChangeSecurityGroupId(){ elastiCacheRaider.changeSecurityGroupId("cacheCluster", "sg-123", "sg-456"); }
@Override public void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId) { List<String> securityGroupIds = this.getSecurityGroups(clusterName); securityGroupIds.add(toSecurityGroupId); securityGroupIds.remove(fromSecurityGroupId); ModifyCacheClusterRequest modifyCacheClusterRequest = new ModifyCacheClusterRequest() .withCacheClusterId(clusterName) .withSecurityGroupIds(securityGroupIds) .withApplyImmediately(true); try { elastiCacheDelegator.getAmazonElastiCache().modifyCacheCluster(modifyCacheClusterRequest); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } }
ElastiCacheRaiderImpl implements ElastiCacheRaider { @Override public void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId) { List<String> securityGroupIds = this.getSecurityGroups(clusterName); securityGroupIds.add(toSecurityGroupId); securityGroupIds.remove(fromSecurityGroupId); ModifyCacheClusterRequest modifyCacheClusterRequest = new ModifyCacheClusterRequest() .withCacheClusterId(clusterName) .withSecurityGroupIds(securityGroupIds) .withApplyImmediately(true); try { elastiCacheDelegator.getAmazonElastiCache().modifyCacheCluster(modifyCacheClusterRequest); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } }
ElastiCacheRaiderImpl implements ElastiCacheRaider { @Override public void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId) { List<String> securityGroupIds = this.getSecurityGroups(clusterName); securityGroupIds.add(toSecurityGroupId); securityGroupIds.remove(fromSecurityGroupId); ModifyCacheClusterRequest modifyCacheClusterRequest = new ModifyCacheClusterRequest() .withCacheClusterId(clusterName) .withSecurityGroupIds(securityGroupIds) .withApplyImmediately(true); try { elastiCacheDelegator.getAmazonElastiCache().modifyCacheCluster(modifyCacheClusterRequest); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } ElastiCacheRaiderImpl(); }
ElastiCacheRaiderImpl implements ElastiCacheRaider { @Override public void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId) { List<String> securityGroupIds = this.getSecurityGroups(clusterName); securityGroupIds.add(toSecurityGroupId); securityGroupIds.remove(fromSecurityGroupId); ModifyCacheClusterRequest modifyCacheClusterRequest = new ModifyCacheClusterRequest() .withCacheClusterId(clusterName) .withSecurityGroupIds(securityGroupIds) .withApplyImmediately(true); try { elastiCacheDelegator.getAmazonElastiCache().modifyCacheCluster(modifyCacheClusterRequest); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } ElastiCacheRaiderImpl(); @Override void rebootElastiCacheCluster(String clusterName, Integer numNodes); @Override void detachSubnet(String clusterName, String subnetId); @Override void attachSubnet(String clusterName, String subnetId); @Override String getElastiCacheClusterStatus(String clusterName); @Override void addNodesToCluster(String clusterName, Integer numNodes); Integer getNumNodes(String clusterName); @Override void removeNodesFromCluster(String clusterName, Integer numNodes); List<String> getSubnetIds(String clusterName); @Override void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId); @Override List<String> getSecurityGroups(String clusterName); List<CacheNode> getAllElasticCacheNodes(); List<CacheNode> getAllElasticCacheNodesForGivenCluster(String clusterName); @Override List<String> getAllElastiCacheNodeNames(); @Override List<String> getAllElastiCacheNodeNames(String clusterName); @Override String getElastiCacheNodeStatus(String nodeName); @Override void rebootElasticCacheNode(String nodeName); }
ElastiCacheRaiderImpl implements ElastiCacheRaider { @Override public void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId) { List<String> securityGroupIds = this.getSecurityGroups(clusterName); securityGroupIds.add(toSecurityGroupId); securityGroupIds.remove(fromSecurityGroupId); ModifyCacheClusterRequest modifyCacheClusterRequest = new ModifyCacheClusterRequest() .withCacheClusterId(clusterName) .withSecurityGroupIds(securityGroupIds) .withApplyImmediately(true); try { elastiCacheDelegator.getAmazonElastiCache().modifyCacheCluster(modifyCacheClusterRequest); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } ElastiCacheRaiderImpl(); @Override void rebootElastiCacheCluster(String clusterName, Integer numNodes); @Override void detachSubnet(String clusterName, String subnetId); @Override void attachSubnet(String clusterName, String subnetId); @Override String getElastiCacheClusterStatus(String clusterName); @Override void addNodesToCluster(String clusterName, Integer numNodes); Integer getNumNodes(String clusterName); @Override void removeNodesFromCluster(String clusterName, Integer numNodes); List<String> getSubnetIds(String clusterName); @Override void changeSecurityGroupId(String clusterName, String fromSecurityGroupId, String toSecurityGroupId); @Override List<String> getSecurityGroups(String clusterName); List<CacheNode> getAllElasticCacheNodes(); List<CacheNode> getAllElasticCacheNodesForGivenCluster(String clusterName); @Override List<String> getAllElastiCacheNodeNames(); @Override List<String> getAllElastiCacheNodeNames(String clusterName); @Override String getElastiCacheNodeStatus(String nodeName); @Override void rebootElasticCacheNode(String nodeName);  }