/* * Copyright 2018-2023 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.logs.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Represents a log group. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class LogGroup implements Serializable, Cloneable, StructuredPojo { /** *

* The name of the log group. *

*/ private String logGroupName; /** *

* The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. *

*/ private Long creationTime; private Integer retentionInDays; /** *

* The number of metric filters. *

*/ private Integer metricFilterCount; /** *

* The Amazon Resource Name (ARN) of the log group. *

*/ private String arn; /** *

* The number of bytes stored. *

*/ private Long storedBytes; /** *

* The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. *

*/ private String kmsKeyId; /** *

* Displays whether this log group has a protection policy, or whether it had one in the past. For more information, * see PutDataProtectionPolicy. *

*/ private String dataProtectionStatus; /** *

* Displays all the properties that this log group has inherited from account-level settings. *

*/ private com.amazonaws.internal.SdkInternalList inheritedProperties; /** *

* The name of the log group. *

* * @param logGroupName * The name of the log group. */ public void setLogGroupName(String logGroupName) { this.logGroupName = logGroupName; } /** *

* The name of the log group. *

* * @return The name of the log group. */ public String getLogGroupName() { return this.logGroupName; } /** *

* 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. */ public LogGroup withLogGroupName(String logGroupName) { setLogGroupName(logGroupName); return this; } /** *

* The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. *

* * @param creationTime * The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 * UTC. */ public void setCreationTime(Long creationTime) { this.creationTime = creationTime; } /** *

* The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. *

* * @return The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 * UTC. */ public Long getCreationTime() { return this.creationTime; } /** *

* The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. *

* * @param creationTime * The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 * UTC. * @return Returns a reference to this object so that method calls can be chained together. */ public LogGroup withCreationTime(Long creationTime) { setCreationTime(creationTime); return this; } /** * @param retentionInDays */ public void setRetentionInDays(Integer retentionInDays) { this.retentionInDays = retentionInDays; } /** * @return */ public Integer getRetentionInDays() { return this.retentionInDays; } /** * @param retentionInDays * @return Returns a reference to this object so that method calls can be chained together. */ public LogGroup withRetentionInDays(Integer retentionInDays) { setRetentionInDays(retentionInDays); return this; } /** *

* The number of metric filters. *

* * @param metricFilterCount * The number of metric filters. */ public void setMetricFilterCount(Integer metricFilterCount) { this.metricFilterCount = metricFilterCount; } /** *

* The number of metric filters. *

* * @return The number of metric filters. */ public Integer getMetricFilterCount() { return this.metricFilterCount; } /** *

* The number of metric filters. *

* * @param metricFilterCount * The number of metric filters. * @return Returns a reference to this object so that method calls can be chained together. */ public LogGroup withMetricFilterCount(Integer metricFilterCount) { setMetricFilterCount(metricFilterCount); return this; } /** *

* The Amazon Resource Name (ARN) of the log group. *

* * @param arn * The Amazon Resource Name (ARN) of the log group. */ public void setArn(String arn) { this.arn = arn; } /** *

* The Amazon Resource Name (ARN) of the log group. *

* * @return The Amazon Resource Name (ARN) of the log group. */ public String getArn() { return this.arn; } /** *

* The Amazon Resource Name (ARN) of the log group. *

* * @param arn * The Amazon Resource Name (ARN) of the log group. * @return Returns a reference to this object so that method calls can be chained together. */ public LogGroup withArn(String arn) { setArn(arn); return this; } /** *

* The number of bytes stored. *

* * @param storedBytes * The number of bytes stored. */ public void setStoredBytes(Long storedBytes) { this.storedBytes = storedBytes; } /** *

* The number of bytes stored. *

* * @return The number of bytes stored. */ public Long getStoredBytes() { return this.storedBytes; } /** *

* The number of bytes stored. *

* * @param storedBytes * The number of bytes stored. * @return Returns a reference to this object so that method calls can be chained together. */ public LogGroup withStoredBytes(Long storedBytes) { setStoredBytes(storedBytes); return this; } /** *

* The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. *

* * @param kmsKeyId * The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. */ public void setKmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; } /** *

* The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. *

* * @return The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. */ public String getKmsKeyId() { return this.kmsKeyId; } /** *

* The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. *

* * @param kmsKeyId * The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. * @return Returns a reference to this object so that method calls can be chained together. */ public LogGroup withKmsKeyId(String kmsKeyId) { setKmsKeyId(kmsKeyId); return this; } /** *

* Displays whether this log group has a protection policy, or whether it had one in the past. For more information, * see PutDataProtectionPolicy. *

* * @param dataProtectionStatus * Displays whether this log group has a protection policy, or whether it had one in the past. For more * information, see PutDataProtectionPolicy. * @see DataProtectionStatus */ public void setDataProtectionStatus(String dataProtectionStatus) { this.dataProtectionStatus = dataProtectionStatus; } /** *

* Displays whether this log group has a protection policy, or whether it had one in the past. For more information, * see PutDataProtectionPolicy. *

* * @return Displays whether this log group has a protection policy, or whether it had one in the past. For more * information, see PutDataProtectionPolicy. * @see DataProtectionStatus */ public String getDataProtectionStatus() { return this.dataProtectionStatus; } /** *

* Displays whether this log group has a protection policy, or whether it had one in the past. For more information, * see PutDataProtectionPolicy. *

* * @param dataProtectionStatus * Displays whether this log group has a protection policy, or whether it had one in the past. For more * information, see PutDataProtectionPolicy. * @return Returns a reference to this object so that method calls can be chained together. * @see DataProtectionStatus */ public LogGroup withDataProtectionStatus(String dataProtectionStatus) { setDataProtectionStatus(dataProtectionStatus); return this; } /** *

* Displays whether this log group has a protection policy, or whether it had one in the past. For more information, * see PutDataProtectionPolicy. *

* * @param dataProtectionStatus * Displays whether this log group has a protection policy, or whether it had one in the past. For more * information, see PutDataProtectionPolicy. * @return Returns a reference to this object so that method calls can be chained together. * @see DataProtectionStatus */ public LogGroup withDataProtectionStatus(DataProtectionStatus dataProtectionStatus) { this.dataProtectionStatus = dataProtectionStatus.toString(); return this; } /** *

* Displays all the properties that this log group has inherited from account-level settings. *

* * @return Displays all the properties that this log group has inherited from account-level settings. * @see InheritedProperty */ public java.util.List getInheritedProperties() { if (inheritedProperties == null) { inheritedProperties = new com.amazonaws.internal.SdkInternalList(); } return inheritedProperties; } /** *

* Displays all the properties that this log group has inherited from account-level settings. *

* * @param inheritedProperties * Displays all the properties that this log group has inherited from account-level settings. * @see InheritedProperty */ public void setInheritedProperties(java.util.Collection inheritedProperties) { if (inheritedProperties == null) { this.inheritedProperties = null; return; } this.inheritedProperties = new com.amazonaws.internal.SdkInternalList(inheritedProperties); } /** *

* Displays all the properties that this log group has inherited from account-level settings. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setInheritedProperties(java.util.Collection)} or {@link #withInheritedProperties(java.util.Collection)} * if you want to override the existing values. *

* * @param inheritedProperties * Displays all the properties that this log group has inherited from account-level settings. * @return Returns a reference to this object so that method calls can be chained together. * @see InheritedProperty */ public LogGroup withInheritedProperties(String... inheritedProperties) { if (this.inheritedProperties == null) { setInheritedProperties(new com.amazonaws.internal.SdkInternalList(inheritedProperties.length)); } for (String ele : inheritedProperties) { this.inheritedProperties.add(ele); } return this; } /** *

* Displays all the properties that this log group has inherited from account-level settings. *

* * @param inheritedProperties * Displays all the properties that this log group has inherited from account-level settings. * @return Returns a reference to this object so that method calls can be chained together. * @see InheritedProperty */ public LogGroup withInheritedProperties(java.util.Collection inheritedProperties) { setInheritedProperties(inheritedProperties); return this; } /** *

* Displays all the properties that this log group has inherited from account-level settings. *

* * @param inheritedProperties * Displays all the properties that this log group has inherited from account-level settings. * @return Returns a reference to this object so that method calls can be chained together. * @see InheritedProperty */ public LogGroup withInheritedProperties(InheritedProperty... inheritedProperties) { com.amazonaws.internal.SdkInternalList inheritedPropertiesCopy = new com.amazonaws.internal.SdkInternalList(inheritedProperties.length); for (InheritedProperty value : inheritedProperties) { inheritedPropertiesCopy.add(value.toString()); } if (getInheritedProperties() == null) { setInheritedProperties(inheritedPropertiesCopy); } else { getInheritedProperties().addAll(inheritedPropertiesCopy); } return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getLogGroupName() != null) sb.append("LogGroupName: ").append(getLogGroupName()).append(","); if (getCreationTime() != null) sb.append("CreationTime: ").append(getCreationTime()).append(","); if (getRetentionInDays() != null) sb.append("RetentionInDays: ").append(getRetentionInDays()).append(","); if (getMetricFilterCount() != null) sb.append("MetricFilterCount: ").append(getMetricFilterCount()).append(","); if (getArn() != null) sb.append("Arn: ").append(getArn()).append(","); if (getStoredBytes() != null) sb.append("StoredBytes: ").append(getStoredBytes()).append(","); if (getKmsKeyId() != null) sb.append("KmsKeyId: ").append(getKmsKeyId()).append(","); if (getDataProtectionStatus() != null) sb.append("DataProtectionStatus: ").append(getDataProtectionStatus()).append(","); if (getInheritedProperties() != null) sb.append("InheritedProperties: ").append(getInheritedProperties()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof LogGroup == false) return false; LogGroup other = (LogGroup) obj; if (other.getLogGroupName() == null ^ this.getLogGroupName() == null) return false; if (other.getLogGroupName() != null && other.getLogGroupName().equals(this.getLogGroupName()) == false) return false; if (other.getCreationTime() == null ^ this.getCreationTime() == null) return false; if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == false) return false; if (other.getRetentionInDays() == null ^ this.getRetentionInDays() == null) return false; if (other.getRetentionInDays() != null && other.getRetentionInDays().equals(this.getRetentionInDays()) == false) return false; if (other.getMetricFilterCount() == null ^ this.getMetricFilterCount() == null) return false; if (other.getMetricFilterCount() != null && other.getMetricFilterCount().equals(this.getMetricFilterCount()) == false) return false; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getStoredBytes() == null ^ this.getStoredBytes() == null) return false; if (other.getStoredBytes() != null && other.getStoredBytes().equals(this.getStoredBytes()) == false) return false; if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null) return false; if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false) return false; if (other.getDataProtectionStatus() == null ^ this.getDataProtectionStatus() == null) return false; if (other.getDataProtectionStatus() != null && other.getDataProtectionStatus().equals(this.getDataProtectionStatus()) == false) return false; if (other.getInheritedProperties() == null ^ this.getInheritedProperties() == null) return false; if (other.getInheritedProperties() != null && other.getInheritedProperties().equals(this.getInheritedProperties()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLogGroupName() == null) ? 0 : getLogGroupName().hashCode()); hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode()); hashCode = prime * hashCode + ((getRetentionInDays() == null) ? 0 : getRetentionInDays().hashCode()); hashCode = prime * hashCode + ((getMetricFilterCount() == null) ? 0 : getMetricFilterCount().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getStoredBytes() == null) ? 0 : getStoredBytes().hashCode()); hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode()); hashCode = prime * hashCode + ((getDataProtectionStatus() == null) ? 0 : getDataProtectionStatus().hashCode()); hashCode = prime * hashCode + ((getInheritedProperties() == null) ? 0 : getInheritedProperties().hashCode()); return hashCode; } @Override public LogGroup clone() { try { return (LogGroup) 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.logs.model.transform.LogGroupMarshaller.getInstance().marshall(this, protocolMarshaller); } }