public String getHealthCheckSelfUrl(String healthCheckName) { for (HealthCheck healthCheck : healthChecks) { if (healthCheck.getName().equals(healthCheckName)) { return healthCheck.getSelfLink(); } } return null; }
/** * Configure health check. * * @param loadBalancerName the name of the load balancer * @param healthCheck the details of the healthcheck * @throws LoadBalancingException wraps checked exceptions */ public HealthCheck configureHealthCheck(String loadBalancerName, HealthCheck healthCheck) throws LoadBalancingException { Map<String, String> params = new HashMap<String, String>(); params.put("LoadBalancerName", loadBalancerName); params.put("HealthCheck.Target", "" + healthCheck.getTarget()); params.put("HealthCheck.Interval", "" + healthCheck.getInterval()); params.put("HealthCheck.Timeout", "" + healthCheck.getTimeout()); params.put("HealthCheck.UnhealthyThreshold", "" + healthCheck.getUnhealthyThreshold()); params.put("HealthCheck.HealthyThreshold", "" + healthCheck.getHealthyThreshold()); HttpGet method = new HttpGet(); ConfigureHealthCheckResponse response = makeRequestInt(method, "ConfigureHealthCheck", params, ConfigureHealthCheckResponse.class); com.xerox.amazonws.typica.loadbalance.jaxb.HealthCheck hc = response.getConfigureHealthCheckResult().getHealthCheck(); return new HealthCheck( hc.getTarget(), hc.getInterval().intValue(), hc.getTimeout().intValue(), hc.getUnhealthyThreshold().intValue(), hc.getHealthyThreshold().intValue()); }
public HealthCheck unmarshall(StaxUnmarshallerContext context) throws Exception { HealthCheck healthCheck = new HealthCheck(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return healthCheck; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Id", targetDepth)) { healthCheck.setId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("CallerReference", targetDepth)) { healthCheck.setCallerReference(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("HealthCheckConfig", targetDepth)) { healthCheck.setHealthCheckConfig( HealthCheckConfigStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("HealthCheckVersion", targetDepth)) { healthCheck.setHealthCheckVersion(LongStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return healthCheck; } } } }
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (image != null ? image.hashCode() : 0); result = 31 * result + (hostname != null ? hostname.hashCode() : 0); result = 31 * result + (expires != null ? expires.hashCode() : 0); result = 31 * result + (command != null ? command.hashCode() : 0); result = 31 * result + (env != null ? env.hashCode() : 0); result = 31 * result + (resources != null ? resources.hashCode() : 0); result = 31 * result + (ports != null ? ports.hashCode() : 0); result = 31 * result + (registration != null ? registration.hashCode() : 0); result = 31 * result + (registrationDomain != null ? registrationDomain.hashCode() : 0); result = 31 * result + (gracePeriod != null ? gracePeriod.hashCode() : 0); result = 31 * result + (volumes != null ? volumes.hashCode() : 0); result = 31 * result + (creatingUser != null ? creatingUser.hashCode() : 0); result = 31 * result + token.hashCode(); result = 31 * result + (healthCheck != null ? healthCheck.hashCode() : 0); result = 31 * result + (securityOpt != null ? securityOpt.hashCode() : 0); result = 31 * result + (networkMode != null ? networkMode.hashCode() : 0); return result; }
public Request<ConfigureHealthCheckRequest> marshall( ConfigureHealthCheckRequest configureHealthCheckRequest) { Request<ConfigureHealthCheckRequest> request = new DefaultRequest<ConfigureHealthCheckRequest>( configureHealthCheckRequest, "AmazonElasticLoadBalancing"); request.addParameter("Action", "ConfigureHealthCheck"); request.addParameter("Version", "2010-07-01"); if (configureHealthCheckRequest != null) { if (configureHealthCheckRequest.getLoadBalancerName() != null) { request.addParameter( "LoadBalancerName", StringUtils.fromString(configureHealthCheckRequest.getLoadBalancerName())); } } if (configureHealthCheckRequest != null) { HealthCheck healthCheck = configureHealthCheckRequest.getHealthCheck(); if (healthCheck != null) { if (healthCheck.getTarget() != null) { request.addParameter( "HealthCheck.Target", StringUtils.fromString(healthCheck.getTarget())); } } if (healthCheck != null) { if (healthCheck.getInterval() != null) { request.addParameter( "HealthCheck.Interval", StringUtils.fromInteger(healthCheck.getInterval())); } } if (healthCheck != null) { if (healthCheck.getTimeout() != null) { request.addParameter( "HealthCheck.Timeout", StringUtils.fromInteger(healthCheck.getTimeout())); } } if (healthCheck != null) { if (healthCheck.getUnhealthyThreshold() != null) { request.addParameter( "HealthCheck.UnhealthyThreshold", StringUtils.fromInteger(healthCheck.getUnhealthyThreshold())); } } if (healthCheck != null) { if (healthCheck.getHealthyThreshold() != null) { request.addParameter( "HealthCheck.HealthyThreshold", StringUtils.fromInteger(healthCheck.getHealthyThreshold())); } } } return request; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Job job = (Job) o; if (command != null ? !command.equals(job.command) : job.command != null) { return false; } if (env != null ? !env.equals(job.env) : job.env != null) { return false; } if (resources != null ? !resources.equals(job.resources) : job.resources != null) { return false; } if (expires != null ? !expires.equals(job.expires) : job.expires != null) { return false; } if (id != null ? !id.equals(job.id) : job.id != null) { return false; } if (image != null ? !image.equals(job.image) : job.image != null) { return false; } if (hostname != null ? !hostname.equals(job.hostname) : job.hostname != null) { return false; } if (ports != null ? !ports.equals(job.ports) : job.ports != null) { return false; } if (registration != null ? !registration.equals(job.registration) : job.registration != null) { return false; } if (registrationDomain != null ? !registrationDomain.equals(job.registrationDomain) : job.registrationDomain != null) { return false; } if (gracePeriod != null ? !gracePeriod.equals(job.gracePeriod) : job.gracePeriod != null) { return false; } if (volumes != null ? !volumes.equals(job.volumes) : job.volumes != null) { return false; } if (creatingUser != null ? !creatingUser.equals(job.creatingUser) : job.creatingUser != null) { return false; } if (!token.equals(job.token)) { return false; } if (healthCheck != null ? !healthCheck.equals(job.healthCheck) : job.healthCheck != null) { return false; } if (securityOpt != null ? !securityOpt.equals(job.securityOpt) : job.securityOpt != null) { return false; } if (networkMode != null ? !networkMode.equals(job.networkMode) : job.networkMode != null) { return false; } return true; }