Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to jclouds, Inc. (jclouds) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. jclouds licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.jclouds.elb.domain;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
the current state of an instance in a loadbalancer.

Author(s):
Adrian Cole
See also:
doc
 
 public class InstanceHealth {
 
    public static Builder builder() {
       return new Builder();
    }
 
    public Builder toBuilder() {
       return new Builder().fromAttributeMetadata(this);
    }
 
    public static class Builder {
 
       protected String description;
       protected String instanceId;
       protected Optional<StringreasonCode = Optional.absent();
       protected String state;

      
 
       public Builder description(String description) {
          this. = description;
          return this;
       }

      
 
       public Builder instanceId(String instanceId) {
          this. = instanceId;
          return this;
       }

      
 
       public Builder reasonCode(String reasonCode) {
          this. = Optional.fromNullable(reasonCode);
          return this;
       }

      
 
       public Builder state(String state) {
          this. = state;
          return this;
       }
 
       public InstanceHealth build() {
          return new InstanceHealth();
       }
 
       public Builder fromAttributeMetadata(InstanceHealth in) {
          return this.description(in.getDescription()).instanceId(in.getInstanceId())
                   .reasonCode(in.getReasonCode().orNull()).state(in.getState());
       }
    }
 
    protected final String description;
    protected final String instanceId;
    protected final Optional<StringreasonCode;
    protected final String state;
 
    protected InstanceHealth(String descriptionString instanceIdOptional<StringreasonCodeString state) {
      this. = checkNotNull(description"description");
      this. = checkNotNull(instanceId"instanceId");
      this. = checkNotNull(reasonCode"reasonCode");
      this. = checkNotNull(state"state");
   }

   
Provides a description of the instance.
   public String getDescription() {
      return ;
   }

   
Provides an EC2 instance ID.
   public String getInstanceId() {
      return ;
   }

   
Provides information about the cause of OutOfService instances. Specifically, it indicates whether the cause is Elastic Load Balancing or the instance behind the LoadBalancer.
   public Optional<StringgetReasonCode() {
      return ;
   }

   
Specifies the current status of the instance.
   public String getState() {
      return ;
   }

   
   public int hashCode() {
      return Objects.hashCode();
   }

   
   public boolean equals(Object obj) {
      if (this == obj)
         return true;
      if (obj == null)
         return false;
      if (getClass() != obj.getClass())
         return false;
      InstanceHealth other = InstanceHealth.class.cast(obj);
      return Objects.equal(this.other.description) && Objects.equal(this.other.instanceId)
               && Objects.equal(this.other.reasonCode) && Objects.equal(this.other.state);
   }

   
   public String toString() {
      return Objects.toStringHelper(this).omitNullValues().add("description")
               .add("instanceId").add("reasonCode".orNull()).add("state").toString();
   }
New to GrepCode? Check out our FAQ X