/* * 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.securityhub.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* The container element for S3 Object Lock configuration parameters. In Amazon S3, Object Lock can help prevent objects * from being deleted or overwritten for a fixed amount of time or indefinitely. *
* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AwsS3BucketObjectLockConfiguration implements Serializable, Cloneable, StructuredPojo { /** ** Indicates whether the bucket has an Object Lock configuration enabled. *
*/ private String objectLockEnabled; /** ** Specifies the Object Lock rule for the specified object. *
*/ private AwsS3BucketObjectLockConfigurationRuleDetails rule; /** ** Indicates whether the bucket has an Object Lock configuration enabled. *
* * @param objectLockEnabled * Indicates whether the bucket has an Object Lock configuration enabled. */ public void setObjectLockEnabled(String objectLockEnabled) { this.objectLockEnabled = objectLockEnabled; } /** ** Indicates whether the bucket has an Object Lock configuration enabled. *
* * @return Indicates whether the bucket has an Object Lock configuration enabled. */ public String getObjectLockEnabled() { return this.objectLockEnabled; } /** ** Indicates whether the bucket has an Object Lock configuration enabled. *
* * @param objectLockEnabled * Indicates whether the bucket has an Object Lock configuration enabled. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsS3BucketObjectLockConfiguration withObjectLockEnabled(String objectLockEnabled) { setObjectLockEnabled(objectLockEnabled); return this; } /** ** Specifies the Object Lock rule for the specified object. *
* * @param rule * Specifies the Object Lock rule for the specified object. */ public void setRule(AwsS3BucketObjectLockConfigurationRuleDetails rule) { this.rule = rule; } /** ** Specifies the Object Lock rule for the specified object. *
* * @return Specifies the Object Lock rule for the specified object. */ public AwsS3BucketObjectLockConfigurationRuleDetails getRule() { return this.rule; } /** ** Specifies the Object Lock rule for the specified object. *
* * @param rule * Specifies the Object Lock rule for the specified object. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsS3BucketObjectLockConfiguration withRule(AwsS3BucketObjectLockConfigurationRuleDetails rule) { setRule(rule); 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 (getObjectLockEnabled() != null) sb.append("ObjectLockEnabled: ").append(getObjectLockEnabled()).append(","); if (getRule() != null) sb.append("Rule: ").append(getRule()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AwsS3BucketObjectLockConfiguration == false) return false; AwsS3BucketObjectLockConfiguration other = (AwsS3BucketObjectLockConfiguration) obj; if (other.getObjectLockEnabled() == null ^ this.getObjectLockEnabled() == null) return false; if (other.getObjectLockEnabled() != null && other.getObjectLockEnabled().equals(this.getObjectLockEnabled()) == false) return false; if (other.getRule() == null ^ this.getRule() == null) return false; if (other.getRule() != null && other.getRule().equals(this.getRule()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getObjectLockEnabled() == null) ? 0 : getObjectLockEnabled().hashCode()); hashCode = prime * hashCode + ((getRule() == null) ? 0 : getRule().hashCode()); return hashCode; } @Override public AwsS3BucketObjectLockConfiguration clone() { try { return (AwsS3BucketObjectLockConfiguration) 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.securityhub.model.transform.AwsS3BucketObjectLockConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }