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

* A structure that contains Cedar policy validation settings for the policy store. The validation mode determines which * validation failures that Cedar considers serious enough to block acceptance of a new or edited static policy or * policy template. *

*

* This data type is used as a request parameter in the CreatePolicyStore and UpdatePolicyStore operations. *

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

* The validation mode currently configured for this policy store. The valid values are: *

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects all * static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

*
*/ private String mode; /** *

* The validation mode currently configured for this policy store. The valid values are: *

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects all * static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

*
* * @param mode * The validation mode currently configured for this policy store. The valid values are:

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects * all static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

* @see ValidationMode */ public void setMode(String mode) { this.mode = mode; } /** *

* The validation mode currently configured for this policy store. The valid values are: *

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects all * static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

*
* * @return The validation mode currently configured for this policy store. The valid values are:

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects * all static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

* @see ValidationMode */ public String getMode() { return this.mode; } /** *

* The validation mode currently configured for this policy store. The valid values are: *

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects all * static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

*
* * @param mode * The validation mode currently configured for this policy store. The valid values are:

* * *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects * all static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

* @return Returns a reference to this object so that method calls can be chained together. * @see ValidationMode */ public ValidationSettings withMode(String mode) { setMode(mode); return this; } /** *

* The validation mode currently configured for this policy store. The valid values are: *

*
    *
  • *

    * OFF – Neither Verified Permissions nor Cedar perform any validation on policies. No validation errors are * reported by either service. *

    *
  • *
  • *

    * STRICT – Requires a schema to be present in the policy store. Cedar performs validation on all submitted * new or updated static policies and policy templates. Any that fail validation are rejected and Cedar doesn't * store them in the policy store. *

    *
  • *
* *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects all * static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

*
* * @param mode * The validation mode currently configured for this policy store. The valid values are:

*
    *
  • *

    * OFF – Neither Verified Permissions nor Cedar perform any validation on policies. No validation * errors are reported by either service. *

    *
  • *
  • *

    * STRICT – Requires a schema to be present in the policy store. Cedar performs validation on all * submitted new or updated static policies and policy templates. Any that fail validation are rejected and * Cedar doesn't store them in the policy store. *

    *
  • *
* *

* If Mode=STRICT and the policy store doesn't contain a schema, Verified Permissions rejects * all static policies and policy templates because there is no schema to validate against. *

*

* To submit a static policy or policy template without a schema, you must turn off validation. *

* @return Returns a reference to this object so that method calls can be chained together. * @see ValidationMode */ public ValidationSettings withMode(ValidationMode mode) { this.mode = mode.toString(); 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 (getMode() != null) sb.append("Mode: ").append(getMode()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ValidationSettings == false) return false; ValidationSettings other = (ValidationSettings) obj; if (other.getMode() == null ^ this.getMode() == null) return false; if (other.getMode() != null && other.getMode().equals(this.getMode()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMode() == null) ? 0 : getMode().hashCode()); return hashCode; } @Override public ValidationSettings clone() { try { return (ValidationSettings) 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.verifiedpermissions.model.transform.ValidationSettingsMarshaller.getInstance().marshall(this, protocolMarshaller); } }