software.amazon.awssdk.services.cloudwatchlogs.model.PutRetentionPolicyRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logs Show documentation
Show all versions of logs Show documentation
The AWS Java SDK for Amazon CloudWatch Logs module holds the client classes that are used for
communicating with Amazon CloudWatch Logs Service
/*
* Copyright 2012-2017 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 software.amazon.awssdk.services.cloudwatchlogs.model;
import javax.annotation.Generated;
import software.amazon.awssdk.AmazonWebServiceRequest;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public class PutRetentionPolicyRequest extends AmazonWebServiceRequest implements
ToCopyableBuilder {
private final String logGroupName;
private final Integer retentionInDays;
private PutRetentionPolicyRequest(BuilderImpl builder) {
this.logGroupName = builder.logGroupName;
this.retentionInDays = builder.retentionInDays;
}
/**
*
* The name of the log group.
*
*
* @return The name of the log group.
*/
public String logGroupName() {
return logGroupName;
}
/**
* Returns the value of the RetentionInDays property for this object.
*
* @return The value of the RetentionInDays property for this object.
*/
public Integer retentionInDays() {
return retentionInDays;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + ((logGroupName() == null) ? 0 : logGroupName().hashCode());
hashCode = 31 * hashCode + ((retentionInDays() == null) ? 0 : retentionInDays().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PutRetentionPolicyRequest)) {
return false;
}
PutRetentionPolicyRequest other = (PutRetentionPolicyRequest) obj;
if (other.logGroupName() == null ^ this.logGroupName() == null) {
return false;
}
if (other.logGroupName() != null && !other.logGroupName().equals(this.logGroupName())) {
return false;
}
if (other.retentionInDays() == null ^ this.retentionInDays() == null) {
return false;
}
if (other.retentionInDays() != null && !other.retentionInDays().equals(this.retentionInDays())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (logGroupName() != null) {
sb.append("LogGroupName: ").append(logGroupName()).append(",");
}
if (retentionInDays() != null) {
sb.append("RetentionInDays: ").append(retentionInDays()).append(",");
}
sb.append("}");
return sb.toString();
}
public interface Builder extends CopyableBuilder {
/**
*
* The name of the log group.
*
*
* @param logGroupName
* The name of the log group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder logGroupName(String logGroupName);
/**
* Sets the value of the RetentionInDays property for this object.
*
* @param retentionInDays
* The new value for the RetentionInDays property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder retentionInDays(Integer retentionInDays);
}
private static final class BuilderImpl implements Builder {
private String logGroupName;
private Integer retentionInDays;
private BuilderImpl() {
}
private BuilderImpl(PutRetentionPolicyRequest model) {
setLogGroupName(model.logGroupName);
setRetentionInDays(model.retentionInDays);
}
public final String getLogGroupName() {
return logGroupName;
}
@Override
public final Builder logGroupName(String logGroupName) {
this.logGroupName = logGroupName;
return this;
}
public final void setLogGroupName(String logGroupName) {
this.logGroupName = logGroupName;
}
public final Integer getRetentionInDays() {
return retentionInDays;
}
@Override
public final Builder retentionInDays(Integer retentionInDays) {
this.retentionInDays = retentionInDays;
return this;
}
public final void setRetentionInDays(Integer retentionInDays) {
this.retentionInDays = retentionInDays;
}
@Override
public PutRetentionPolicyRequest build() {
return new PutRetentionPolicyRequest(this);
}
}
}