Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file 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 com.amazonaws.services.opsworks.model;
 

Describes a time-based instance's auto scaling schedule. The schedule consists of a set of key-value pairs.

  • The key is the time period (a UTC hour) and must be an integer from 0 - 23.
  • The value indicates whether the instance should be online or offline for the specified period, and must be set to "on" or "off"

The default setting for all time periods is off, so you use the following parameters primarily to specify the online periods. You don't have to explicitly specify offline periods unless you want to change an online period to an offline period.

The following example specifies that the instance should be online for four hours, from UTC 1200 - 1600. It will be off for the remainder of the day.

{ "12":"on", "13":"on", "14":"on", "15":"on" }

 
 public class WeeklyAutoScalingSchedule implements SerializableCloneable {

    
The schedule for Monday.
 
     private java.util.Map<String,Stringmonday;

    
The schedule for Tuesday.
 
     private java.util.Map<String,Stringtuesday;

    
The schedule for Wednesday.
 
     private java.util.Map<String,Stringwednesday;

    
The schedule for Thursday.
 
     private java.util.Map<String,Stringthursday;

    
The schedule for Friday.
 
     private java.util.Map<String,Stringfriday;

    
The schedule for Saturday.
 
     private java.util.Map<String,Stringsaturday;

    
The schedule for Sunday.
 
     private java.util.Map<String,Stringsunday;

    
The schedule for Monday.

Returns:
The schedule for Monday.
 
     public java.util.Map<String,StringgetMonday() {
         
         if ( == null) {
              = new java.util.HashMap<String,String>();
         }
         return ;
     }
    
    
The schedule for Monday.

Parameters:
monday The schedule for Monday.
    public void setMonday(java.util.Map<String,Stringmonday) {
        this. = monday;
    }
    
    
The schedule for Monday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
monday The schedule for Monday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setMonday(monday);
        return this;
    }

    
The schedule for Monday.

The method adds a new key-value pair into Monday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Monday.
value The corresponding value of the entry to be added into Monday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Monday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The schedule for Tuesday.

Returns:
The schedule for Tuesday.
    public java.util.Map<String,StringgetTuesday() {
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The schedule for Tuesday.

Parameters:
tuesday The schedule for Tuesday.
    public void setTuesday(java.util.Map<String,Stringtuesday) {
        this. = tuesday;
    }
    
    
The schedule for Tuesday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
tuesday The schedule for Tuesday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setTuesday(tuesday);
        return this;
    }

    
The schedule for Tuesday.

The method adds a new key-value pair into Tuesday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Tuesday.
value The corresponding value of the entry to be added into Tuesday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Tuesday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The schedule for Wednesday.

Returns:
The schedule for Wednesday.
    public java.util.Map<String,StringgetWednesday() {
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The schedule for Wednesday.

Parameters:
wednesday The schedule for Wednesday.
    public void setWednesday(java.util.Map<String,Stringwednesday) {
        this. = wednesday;
    }
    
    
The schedule for Wednesday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
wednesday The schedule for Wednesday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setWednesday(wednesday);
        return this;
    }

    
The schedule for Wednesday.

The method adds a new key-value pair into Wednesday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Wednesday.
value The corresponding value of the entry to be added into Wednesday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Wednesday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The schedule for Thursday.

Returns:
The schedule for Thursday.
    public java.util.Map<String,StringgetThursday() {
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The schedule for Thursday.

Parameters:
thursday The schedule for Thursday.
    public void setThursday(java.util.Map<String,Stringthursday) {
        this. = thursday;
    }
    
    
The schedule for Thursday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
thursday The schedule for Thursday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setThursday(thursday);
        return this;
    }

    
The schedule for Thursday.

The method adds a new key-value pair into Thursday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Thursday.
value The corresponding value of the entry to be added into Thursday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Thursday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The schedule for Friday.

Returns:
The schedule for Friday.
    public java.util.Map<String,StringgetFriday() {
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The schedule for Friday.

Parameters:
friday The schedule for Friday.
    public void setFriday(java.util.Map<String,Stringfriday) {
        this. = friday;
    }
    
    
The schedule for Friday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
friday The schedule for Friday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setFriday(friday);
        return this;
    }

    
The schedule for Friday.

The method adds a new key-value pair into Friday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Friday.
value The corresponding value of the entry to be added into Friday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Friday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The schedule for Saturday.

Returns:
The schedule for Saturday.
    public java.util.Map<String,StringgetSaturday() {
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The schedule for Saturday.

Parameters:
saturday The schedule for Saturday.
    public void setSaturday(java.util.Map<String,Stringsaturday) {
        this. = saturday;
    }
    
    
The schedule for Saturday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
saturday The schedule for Saturday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setSaturday(saturday);
        return this;
    }

    
The schedule for Saturday.

The method adds a new key-value pair into Saturday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Saturday.
value The corresponding value of the entry to be added into Saturday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Saturday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The schedule for Sunday.

Returns:
The schedule for Sunday.
    public java.util.Map<String,StringgetSunday() {
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The schedule for Sunday.

Parameters:
sunday The schedule for Sunday.
    public void setSunday(java.util.Map<String,Stringsunday) {
        this. = sunday;
    }
    
    
The schedule for Sunday.

Returns a reference to this object so that method calls can be chained together.

Parameters:
sunday The schedule for Sunday.
Returns:
A reference to this updated object so that method calls can be chained together.
        setSunday(sunday);
        return this;
    }

    
The schedule for Sunday.

The method adds a new key-value pair into Sunday parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Sunday.
value The corresponding value of the entry to be added into Sunday.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Sunday.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getMonday() != nullsb.append("Monday: " + getMonday() + ",");
        if (getTuesday() != nullsb.append("Tuesday: " + getTuesday() + ",");
        if (getWednesday() != nullsb.append("Wednesday: " + getWednesday() + ",");
        if (getThursday() != nullsb.append("Thursday: " + getThursday() + ",");
        if (getFriday() != nullsb.append("Friday: " + getFriday() + ",");
        if (getSaturday() != nullsb.append("Saturday: " + getSaturday() + ",");
        if (getSunday() != nullsb.append("Sunday: " + getSunday() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getMonday() == null) ? 0 : getMonday().hashCode()); 
        hashCode = prime * hashCode + ((getTuesday() == null) ? 0 : getTuesday().hashCode()); 
        hashCode = prime * hashCode + ((getWednesday() == null) ? 0 : getWednesday().hashCode()); 
        hashCode = prime * hashCode + ((getThursday() == null) ? 0 : getThursday().hashCode()); 
        hashCode = prime * hashCode + ((getFriday() == null) ? 0 : getFriday().hashCode()); 
        hashCode = prime * hashCode + ((getSaturday() == null) ? 0 : getSaturday().hashCode()); 
        hashCode = prime * hashCode + ((getSunday() == null) ? 0 : getSunday().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof WeeklyAutoScalingSchedule == falsereturn false;
        
        if (other.getMonday() == null ^ this.getMonday() == nullreturn false;
        if (other.getMonday() != null && other.getMonday().equals(this.getMonday()) == falsereturn false
        if (other.getTuesday() == null ^ this.getTuesday() == nullreturn false;
        if (other.getTuesday() != null && other.getTuesday().equals(this.getTuesday()) == falsereturn false
        if (other.getWednesday() == null ^ this.getWednesday() == nullreturn false;
        if (other.getWednesday() != null && other.getWednesday().equals(this.getWednesday()) == falsereturn false
        if (other.getThursday() == null ^ this.getThursday() == nullreturn false;
        if (other.getThursday() != null && other.getThursday().equals(this.getThursday()) == falsereturn false
        if (other.getFriday() == null ^ this.getFriday() == nullreturn false;
        if (other.getFriday() != null && other.getFriday().equals(this.getFriday()) == falsereturn false
        if (other.getSaturday() == null ^ this.getSaturday() == nullreturn false;
        if (other.getSaturday() != null && other.getSaturday().equals(this.getSaturday()) == falsereturn false
        if (other.getSunday() == null ^ this.getSunday() == nullreturn false;
        if (other.getSunday() != null && other.getSunday().equals(this.getSunday()) == falsereturn false
        return true;
    }
    
    @Override
    public WeeklyAutoScalingSchedule clone() {
        try {
            return (WeeklyAutoScalingSchedulesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X