
com.amazonaws.services.opsworks.model.CloudWatchLogsConfiguration Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Describes the Amazon CloudWatch logs configuration for a layer.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CloudWatchLogsConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
*
* Whether CloudWatch Logs is enabled for a layer.
*
*/
private Boolean enabled;
/**
*
* A list of configuration options for CloudWatch Logs.
*
*/
private com.amazonaws.internal.SdkInternalList logStreams;
/**
*
* Whether CloudWatch Logs is enabled for a layer.
*
*
* @param enabled
* Whether CloudWatch Logs is enabled for a layer.
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
*
* Whether CloudWatch Logs is enabled for a layer.
*
*
* @return Whether CloudWatch Logs is enabled for a layer.
*/
public Boolean getEnabled() {
return this.enabled;
}
/**
*
* Whether CloudWatch Logs is enabled for a layer.
*
*
* @param enabled
* Whether CloudWatch Logs is enabled for a layer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CloudWatchLogsConfiguration withEnabled(Boolean enabled) {
setEnabled(enabled);
return this;
}
/**
*
* Whether CloudWatch Logs is enabled for a layer.
*
*
* @return Whether CloudWatch Logs is enabled for a layer.
*/
public Boolean isEnabled() {
return this.enabled;
}
/**
*
* A list of configuration options for CloudWatch Logs.
*
*
* @return A list of configuration options for CloudWatch Logs.
*/
public java.util.List getLogStreams() {
if (logStreams == null) {
logStreams = new com.amazonaws.internal.SdkInternalList();
}
return logStreams;
}
/**
*
* A list of configuration options for CloudWatch Logs.
*
*
* @param logStreams
* A list of configuration options for CloudWatch Logs.
*/
public void setLogStreams(java.util.Collection logStreams) {
if (logStreams == null) {
this.logStreams = null;
return;
}
this.logStreams = new com.amazonaws.internal.SdkInternalList(logStreams);
}
/**
*
* A list of configuration options for CloudWatch Logs.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setLogStreams(java.util.Collection)} or {@link #withLogStreams(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param logStreams
* A list of configuration options for CloudWatch Logs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CloudWatchLogsConfiguration withLogStreams(CloudWatchLogsLogStream... logStreams) {
if (this.logStreams == null) {
setLogStreams(new com.amazonaws.internal.SdkInternalList(logStreams.length));
}
for (CloudWatchLogsLogStream ele : logStreams) {
this.logStreams.add(ele);
}
return this;
}
/**
*
* A list of configuration options for CloudWatch Logs.
*
*
* @param logStreams
* A list of configuration options for CloudWatch Logs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CloudWatchLogsConfiguration withLogStreams(java.util.Collection logStreams) {
setLogStreams(logStreams);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getEnabled() != null)
sb.append("Enabled: ").append(getEnabled()).append(",");
if (getLogStreams() != null)
sb.append("LogStreams: ").append(getLogStreams());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CloudWatchLogsConfiguration == false)
return false;
CloudWatchLogsConfiguration other = (CloudWatchLogsConfiguration) obj;
if (other.getEnabled() == null ^ this.getEnabled() == null)
return false;
if (other.getEnabled() != null && other.getEnabled().equals(this.getEnabled()) == false)
return false;
if (other.getLogStreams() == null ^ this.getLogStreams() == null)
return false;
if (other.getLogStreams() != null && other.getLogStreams().equals(this.getLogStreams()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
hashCode = prime * hashCode + ((getLogStreams() == null) ? 0 : getLogStreams().hashCode());
return hashCode;
}
@Override
public CloudWatchLogsConfiguration clone() {
try {
return (CloudWatchLogsConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.opsworks.model.transform.CloudWatchLogsConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}