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

* The caching configuration for a resolver that has caching activated. *

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

* The TTL in seconds for a resolver that has caching activated. *

*

* Valid values are 1–3,600 seconds. *

*/ private Long ttl; /** *

* The caching keys for a resolver that has caching activated. *

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. *

*/ private java.util.List cachingKeys; /** *

* The TTL in seconds for a resolver that has caching activated. *

*

* Valid values are 1–3,600 seconds. *

* * @param ttl * The TTL in seconds for a resolver that has caching activated.

*

* Valid values are 1–3,600 seconds. */ public void setTtl(Long ttl) { this.ttl = ttl; } /** *

* The TTL in seconds for a resolver that has caching activated. *

*

* Valid values are 1–3,600 seconds. *

* * @return The TTL in seconds for a resolver that has caching activated.

*

* Valid values are 1–3,600 seconds. */ public Long getTtl() { return this.ttl; } /** *

* The TTL in seconds for a resolver that has caching activated. *

*

* Valid values are 1–3,600 seconds. *

* * @param ttl * The TTL in seconds for a resolver that has caching activated.

*

* Valid values are 1–3,600 seconds. * @return Returns a reference to this object so that method calls can be chained together. */ public CachingConfig withTtl(Long ttl) { setTtl(ttl); return this; } /** *

* The caching keys for a resolver that has caching activated. *

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. *

* * @return The caching keys for a resolver that has caching activated.

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. */ public java.util.List getCachingKeys() { return cachingKeys; } /** *

* The caching keys for a resolver that has caching activated. *

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. *

* * @param cachingKeys * The caching keys for a resolver that has caching activated.

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. */ public void setCachingKeys(java.util.Collection cachingKeys) { if (cachingKeys == null) { this.cachingKeys = null; return; } this.cachingKeys = new java.util.ArrayList(cachingKeys); } /** *

* The caching keys for a resolver that has caching activated. *

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. *

*

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

* * @param cachingKeys * The caching keys for a resolver that has caching activated.

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. * @return Returns a reference to this object so that method calls can be chained together. */ public CachingConfig withCachingKeys(String... cachingKeys) { if (this.cachingKeys == null) { setCachingKeys(new java.util.ArrayList(cachingKeys.length)); } for (String ele : cachingKeys) { this.cachingKeys.add(ele); } return this; } /** *

* The caching keys for a resolver that has caching activated. *

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. *

* * @param cachingKeys * The caching keys for a resolver that has caching activated.

*

* Valid values are entries from the $context.arguments, $context.source, and * $context.identity maps. * @return Returns a reference to this object so that method calls can be chained together. */ public CachingConfig withCachingKeys(java.util.Collection cachingKeys) { setCachingKeys(cachingKeys); 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 (getTtl() != null) sb.append("Ttl: ").append(getTtl()).append(","); if (getCachingKeys() != null) sb.append("CachingKeys: ").append(getCachingKeys()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CachingConfig == false) return false; CachingConfig other = (CachingConfig) obj; if (other.getTtl() == null ^ this.getTtl() == null) return false; if (other.getTtl() != null && other.getTtl().equals(this.getTtl()) == false) return false; if (other.getCachingKeys() == null ^ this.getCachingKeys() == null) return false; if (other.getCachingKeys() != null && other.getCachingKeys().equals(this.getCachingKeys()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTtl() == null) ? 0 : getTtl().hashCode()); hashCode = prime * hashCode + ((getCachingKeys() == null) ? 0 : getCachingKeys().hashCode()); return hashCode; } @Override public CachingConfig clone() { try { return (CachingConfig) 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.appsync.model.transform.CachingConfigMarshaller.getInstance().marshall(this, protocolMarshaller); } }