@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); hashCode = prime * hashCode + ((getCacheClusters() == null) ? 0 : getCacheClusters().hashCode()); return hashCode; }
/** * <p> * A list of clusters. Each item in the list contains detailed information about one cluster. * </p> * * @param cacheClusters * A list of clusters. Each item in the list contains detailed information about one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeCacheClustersResult withCacheClusters(java.util.Collection<CacheCluster> cacheClusters) { setCacheClusters(cacheClusters); return this; }
/** * <p> * Provides an identifier to allow retrieval of paginated results. * </p> * * @param marker * Provides an identifier to allow retrieval of paginated results. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeCacheClustersResult withMarker(String marker) { setMarker(marker); return this; }
@Override protected Cache createInstance() throws Exception { DescribeCacheClustersRequest describeCacheClustersRequest = new DescribeCacheClustersRequest().withCacheClusterId(getCacheClusterName()); describeCacheClustersRequest.setShowCacheNodeInfo(true); DescribeCacheClustersResult describeCacheClustersResult = this.amazonElastiCache.describeCacheClusters(describeCacheClustersRequest); CacheCluster cacheCluster = describeCacheClustersResult.getCacheClusters().get(0); if (!"available".equals(cacheCluster.getCacheClusterStatus())) { LOGGER.warn("Cache cluster is not available now. Connection may fail during cache access. Current status is {}", cacheCluster.getCacheClusterStatus()); } Endpoint configurationEndpoint = getEndpointForCache(cacheCluster); for (CacheFactory cacheFactory : this.cacheFactories) { if (cacheFactory.isSupportingCacheArchitecture(cacheCluster.getEngine())) { return cacheFactory.createCache(this.cacheClusterId, configurationEndpoint.getAddress(), configurationEndpoint.getPort()); } } throw new IllegalArgumentException("No CacheFactory configured for engine: " + cacheCluster.getEngine()); }
public DescribeCacheClustersResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeCacheClustersResult describeCacheClustersResult = new DescribeCacheClustersResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeCacheClustersResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Marker", targetDepth)) { describeCacheClustersResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("CacheClusters", targetDepth)) { describeCacheClustersResult.withCacheClusters(new ArrayList<CacheCluster>()); continue; } if (context.testExpression("CacheClusters/CacheCluster", targetDepth)) { describeCacheClustersResult.withCacheClusters(CacheClusterStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeCacheClustersResult; } } } }
@Override protected Cache createInstance() throws Exception { DescribeCacheClustersRequest describeCacheClustersRequest = new DescribeCacheClustersRequest().withCacheClusterId(getCacheClusterName()); describeCacheClustersRequest.setShowCacheNodeInfo(true); DescribeCacheClustersResult describeCacheClustersResult = this.amazonElastiCache.describeCacheClusters(describeCacheClustersRequest); CacheCluster cacheCluster = describeCacheClustersResult.getCacheClusters().get(0); if (!"available".equals(cacheCluster.getCacheClusterStatus())) { LOGGER.warn("Cache cluster is not available now. Connection may fail during cache access. Current status is {}", cacheCluster.getCacheClusterStatus()); } Endpoint configurationEndpoint = getEndpointForCache(cacheCluster); for (CacheFactory cacheFactory : this.cacheFactories) { if (cacheFactory.isSupportingCacheArchitecture(cacheCluster.getEngine())) { return cacheFactory.createCache(this.cacheClusterId, configurationEndpoint.getAddress(), configurationEndpoint.getPort()); } } throw new IllegalArgumentException("No CacheFactory configured for engine: " + cacheCluster.getEngine()); }
public DescribeCacheClustersResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeCacheClustersResult describeCacheClustersResult = new DescribeCacheClustersResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeCacheClustersResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Marker", targetDepth)) { describeCacheClustersResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("CacheClusters", targetDepth)) { describeCacheClustersResult.withCacheClusters(new ArrayList<CacheCluster>()); continue; } if (context.testExpression("CacheClusters/CacheCluster", targetDepth)) { describeCacheClustersResult.withCacheClusters(CacheClusterStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeCacheClustersResult; } } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeCacheClustersResult == false) return false; DescribeCacheClustersResult other = (DescribeCacheClustersResult) obj; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; if (other.getCacheClusters() == null ^ this.getCacheClusters() == null) return false; if (other.getCacheClusters() != null && other.getCacheClusters().equals(this.getCacheClusters()) == false) return false; return true; }
/** * <p> * A list of clusters. Each item in the list contains detailed information about one cluster. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setCacheClusters(java.util.Collection)} or {@link #withCacheClusters(java.util.Collection)} if you want * to override the existing values. * </p> * * @param cacheClusters * A list of clusters. Each item in the list contains detailed information about one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeCacheClustersResult withCacheClusters(CacheCluster... cacheClusters) { if (this.cacheClusters == null) { setCacheClusters(new com.amazonaws.internal.SdkInternalList<CacheCluster>(cacheClusters.length)); } for (CacheCluster ele : cacheClusters) { this.cacheClusters.add(ele); } return this; }
/** * <p> * Provides an identifier to allow retrieval of paginated results. * </p> * * @param marker * Provides an identifier to allow retrieval of paginated results. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeCacheClustersResult withMarker(String marker) { setMarker(marker); return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMarker() != null) sb.append("Marker: ").append(getMarker()).append(","); if (getCacheClusters() != null) sb.append("CacheClusters: ").append(getCacheClusters()); sb.append("}"); return sb.toString(); }
/** * <p> * A list of clusters. Each item in the list contains detailed information about one cluster. * </p> * * @param cacheClusters * A list of clusters. Each item in the list contains detailed information about one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeCacheClustersResult withCacheClusters(java.util.Collection<CacheCluster> cacheClusters) { setCacheClusters(cacheClusters); return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); hashCode = prime * hashCode + ((getCacheClusters() == null) ? 0 : getCacheClusters().hashCode()); return hashCode; }
/** * <p> * A list of clusters. Each item in the list contains detailed information about one cluster. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setCacheClusters(java.util.Collection)} or {@link #withCacheClusters(java.util.Collection)} if you want * to override the existing values. * </p> * * @param cacheClusters * A list of clusters. Each item in the list contains detailed information about one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeCacheClustersResult withCacheClusters(CacheCluster... cacheClusters) { if (this.cacheClusters == null) { setCacheClusters(new com.amazonaws.internal.SdkInternalList<CacheCluster>(cacheClusters.length)); } for (CacheCluster ele : cacheClusters) { this.cacheClusters.add(ele); } return this; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeCacheClustersResult == false) return false; DescribeCacheClustersResult other = (DescribeCacheClustersResult) obj; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; if (other.getCacheClusters() == null ^ this.getCacheClusters() == null) return false; if (other.getCacheClusters() != null && other.getCacheClusters().equals(this.getCacheClusters()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMarker() != null) sb.append("Marker: ").append(getMarker()).append(","); if (getCacheClusters() != null) sb.append("CacheClusters: ").append(getCacheClusters()); sb.append("}"); return sb.toString(); }
rqst.setShowCacheNodeInfo(true); describeResult = amazonElastiCache.describeCacheClusters(rqst); cacheClusterList.addAll(describeResult.getCacheClusters()); marker = describeResult.getMarker(); describeRGResult = amazonElastiCache.describeReplicationGroups(rgRqst); replicationGroupList.addAll(describeRGResult.getReplicationGroups()); marker = describeResult.getMarker();
int cntClusters = 0; for (CacheCluster cluster : describeCacheClustersResult.getCacheClusters()) { elasticacheClusterBuilder.putAll(regionName, new ElasticacheCluster(cluster, clusterIdToNodeGroupMember.get(cluster.getCacheClusterId()))); cntClusters++; describeCacheClustersRequest.setMarker(describeCacheClustersResult.getMarker()); } while (describeCacheClustersResult.getMarker() != null);