io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailProps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of generative-ai-cdk-constructs Show documentation
Show all versions of generative-ai-cdk-constructs Show documentation
AWS Generative AI CDK Constructs is a library for well-architected generative AI patterns.
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
* (experimental) Bedrock guardrail props.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-23T22:27:31.963Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.GuardrailProps")
@software.amazon.jsii.Jsii.Proxy(GuardrailProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface GuardrailProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The message to return when the guardrail blocks a prompt.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getBlockedInputMessaging() {
return null;
}
/**
* (experimental) The message to return when the guardrail blocks a model response.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getBlockedOutputsMessaging() {
return null;
}
/**
* (experimental) Contextual grounding policy config for a guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getContextualGroundingfiltersConfig() {
return null;
}
/**
* (experimental) The description of the guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getDescription() {
return null;
}
/**
* (experimental) List of content filter configs in content policy.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getFiltersConfig() {
return null;
}
/**
* (experimental) The ARN of the AWS KMS key used to encrypt the guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getKmsKeyArn() {
return null;
}
/**
* (experimental) The name of the guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getName() {
return null;
}
/**
* (experimental) PII fields which needs to be anonymized.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getPiiConfig() {
return null;
}
/**
* (experimental) Metadata that you can assign to a guardrail as key-value pairs.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getTags() {
return null;
}
/**
* @return a {@link Builder} of {@link GuardrailProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link GuardrailProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String blockedInputMessaging;
java.lang.String blockedOutputsMessaging;
java.util.List contextualGroundingfiltersConfig;
java.lang.String description;
java.util.List filtersConfig;
java.lang.String kmsKeyArn;
java.lang.String name;
java.util.List piiConfig;
java.util.List tags;
/**
* Sets the value of {@link GuardrailProps#getBlockedInputMessaging}
* @param blockedInputMessaging The message to return when the guardrail blocks a prompt.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder blockedInputMessaging(java.lang.String blockedInputMessaging) {
this.blockedInputMessaging = blockedInputMessaging;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getBlockedOutputsMessaging}
* @param blockedOutputsMessaging The message to return when the guardrail blocks a model response.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder blockedOutputsMessaging(java.lang.String blockedOutputsMessaging) {
this.blockedOutputsMessaging = blockedOutputsMessaging;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getContextualGroundingfiltersConfig}
* @param contextualGroundingfiltersConfig Contextual grounding policy config for a guardrail.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder contextualGroundingfiltersConfig(java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ContextualGroundingPolicyConfigProps> contextualGroundingfiltersConfig) {
this.contextualGroundingfiltersConfig = (java.util.List)contextualGroundingfiltersConfig;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getDescription}
* @param description The description of the guardrail.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder description(java.lang.String description) {
this.description = description;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getFiltersConfig}
* @param filtersConfig List of content filter configs in content policy.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder filtersConfig(java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ContentPolicyConfigProps> filtersConfig) {
this.filtersConfig = (java.util.List)filtersConfig;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getKmsKeyArn}
* @param kmsKeyArn The ARN of the AWS KMS key used to encrypt the guardrail.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder kmsKeyArn(java.lang.String kmsKeyArn) {
this.kmsKeyArn = kmsKeyArn;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getName}
* @param name The name of the guardrail.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder name(java.lang.String name) {
this.name = name;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getPiiConfig}
* @param piiConfig PII fields which needs to be anonymized.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder piiConfig(java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SensitiveInformationPolicyConfigProps> piiConfig) {
this.piiConfig = (java.util.List)piiConfig;
return this;
}
/**
* Sets the value of {@link GuardrailProps#getTags}
* @param tags Metadata that you can assign to a guardrail as key-value pairs.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder tags(java.util.List extends software.amazon.awscdk.CfnTag> tags) {
this.tags = (java.util.List)tags;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link GuardrailProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public GuardrailProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link GuardrailProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements GuardrailProps {
private final java.lang.String blockedInputMessaging;
private final java.lang.String blockedOutputsMessaging;
private final java.util.List contextualGroundingfiltersConfig;
private final java.lang.String description;
private final java.util.List filtersConfig;
private final java.lang.String kmsKeyArn;
private final java.lang.String name;
private final java.util.List piiConfig;
private final java.util.List tags;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.blockedInputMessaging = software.amazon.jsii.Kernel.get(this, "blockedInputMessaging", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.blockedOutputsMessaging = software.amazon.jsii.Kernel.get(this, "blockedOutputsMessaging", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.contextualGroundingfiltersConfig = software.amazon.jsii.Kernel.get(this, "contextualGroundingfiltersConfig", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ContextualGroundingPolicyConfigProps.class)));
this.description = software.amazon.jsii.Kernel.get(this, "description", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.filtersConfig = software.amazon.jsii.Kernel.get(this, "filtersConfig", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ContentPolicyConfigProps.class)));
this.kmsKeyArn = software.amazon.jsii.Kernel.get(this, "kmsKeyArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.piiConfig = software.amazon.jsii.Kernel.get(this, "piiConfig", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SensitiveInformationPolicyConfigProps.class)));
this.tags = software.amazon.jsii.Kernel.get(this, "tags", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.CfnTag.class)));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.blockedInputMessaging = builder.blockedInputMessaging;
this.blockedOutputsMessaging = builder.blockedOutputsMessaging;
this.contextualGroundingfiltersConfig = (java.util.List)builder.contextualGroundingfiltersConfig;
this.description = builder.description;
this.filtersConfig = (java.util.List)builder.filtersConfig;
this.kmsKeyArn = builder.kmsKeyArn;
this.name = builder.name;
this.piiConfig = (java.util.List)builder.piiConfig;
this.tags = (java.util.List)builder.tags;
}
@Override
public final java.lang.String getBlockedInputMessaging() {
return this.blockedInputMessaging;
}
@Override
public final java.lang.String getBlockedOutputsMessaging() {
return this.blockedOutputsMessaging;
}
@Override
public final java.util.List getContextualGroundingfiltersConfig() {
return this.contextualGroundingfiltersConfig;
}
@Override
public final java.lang.String getDescription() {
return this.description;
}
@Override
public final java.util.List getFiltersConfig() {
return this.filtersConfig;
}
@Override
public final java.lang.String getKmsKeyArn() {
return this.kmsKeyArn;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final java.util.List getPiiConfig() {
return this.piiConfig;
}
@Override
public final java.util.List getTags() {
return this.tags;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getBlockedInputMessaging() != null) {
data.set("blockedInputMessaging", om.valueToTree(this.getBlockedInputMessaging()));
}
if (this.getBlockedOutputsMessaging() != null) {
data.set("blockedOutputsMessaging", om.valueToTree(this.getBlockedOutputsMessaging()));
}
if (this.getContextualGroundingfiltersConfig() != null) {
data.set("contextualGroundingfiltersConfig", om.valueToTree(this.getContextualGroundingfiltersConfig()));
}
if (this.getDescription() != null) {
data.set("description", om.valueToTree(this.getDescription()));
}
if (this.getFiltersConfig() != null) {
data.set("filtersConfig", om.valueToTree(this.getFiltersConfig()));
}
if (this.getKmsKeyArn() != null) {
data.set("kmsKeyArn", om.valueToTree(this.getKmsKeyArn()));
}
if (this.getName() != null) {
data.set("name", om.valueToTree(this.getName()));
}
if (this.getPiiConfig() != null) {
data.set("piiConfig", om.valueToTree(this.getPiiConfig()));
}
if (this.getTags() != null) {
data.set("tags", om.valueToTree(this.getTags()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@cdklabs/generative-ai-cdk-constructs.bedrock.GuardrailProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GuardrailProps.Jsii$Proxy that = (GuardrailProps.Jsii$Proxy) o;
if (this.blockedInputMessaging != null ? !this.blockedInputMessaging.equals(that.blockedInputMessaging) : that.blockedInputMessaging != null) return false;
if (this.blockedOutputsMessaging != null ? !this.blockedOutputsMessaging.equals(that.blockedOutputsMessaging) : that.blockedOutputsMessaging != null) return false;
if (this.contextualGroundingfiltersConfig != null ? !this.contextualGroundingfiltersConfig.equals(that.contextualGroundingfiltersConfig) : that.contextualGroundingfiltersConfig != null) return false;
if (this.description != null ? !this.description.equals(that.description) : that.description != null) return false;
if (this.filtersConfig != null ? !this.filtersConfig.equals(that.filtersConfig) : that.filtersConfig != null) return false;
if (this.kmsKeyArn != null ? !this.kmsKeyArn.equals(that.kmsKeyArn) : that.kmsKeyArn != null) return false;
if (this.name != null ? !this.name.equals(that.name) : that.name != null) return false;
if (this.piiConfig != null ? !this.piiConfig.equals(that.piiConfig) : that.piiConfig != null) return false;
return this.tags != null ? this.tags.equals(that.tags) : that.tags == null;
}
@Override
public final int hashCode() {
int result = this.blockedInputMessaging != null ? this.blockedInputMessaging.hashCode() : 0;
result = 31 * result + (this.blockedOutputsMessaging != null ? this.blockedOutputsMessaging.hashCode() : 0);
result = 31 * result + (this.contextualGroundingfiltersConfig != null ? this.contextualGroundingfiltersConfig.hashCode() : 0);
result = 31 * result + (this.description != null ? this.description.hashCode() : 0);
result = 31 * result + (this.filtersConfig != null ? this.filtersConfig.hashCode() : 0);
result = 31 * result + (this.kmsKeyArn != null ? this.kmsKeyArn.hashCode() : 0);
result = 31 * result + (this.name != null ? this.name.hashCode() : 0);
result = 31 * result + (this.piiConfig != null ? this.piiConfig.hashCode() : 0);
result = 31 * result + (this.tags != null ? this.tags.hashCode() : 0);
return result;
}
}
}