io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Guardrail Maven / Gradle / Ivy
Show all versions of generative-ai-cdk-constructs Show documentation
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
* (experimental) Deploy bedrock guardrail .
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-23T18:35:37.389Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.Guardrail")
public class Guardrail extends software.constructs.Construct {
protected Guardrail(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Guardrail(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Guardrail(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addContextualGroundingPolicyConfig(final @org.jetbrains.annotations.NotNull java.util.List props) {
software.amazon.jsii.Kernel.call(this, "addContextualGroundingPolicyConfig", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* @param props This parameter is required.
* @param guardrailRegexesConfig This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addSensitiveInformationPolicyConfig(final @org.jetbrains.annotations.NotNull java.util.List props, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.bedrock.CfnGuardrail.RegexConfigProperty guardrailRegexesConfig) {
software.amazon.jsii.Kernel.call(this, "addSensitiveInformationPolicyConfig", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(props, "props is required"), java.util.Objects.requireNonNull(guardrailRegexesConfig, "guardrailRegexesConfig is required") });
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addTags(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailProps props) {
software.amazon.jsii.Kernel.call(this, "addTags", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* @param topic This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addTopicPolicyConfig(final @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Topic topic) {
software.amazon.jsii.Kernel.call(this, "addTopicPolicyConfig", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(topic, "topic is required") });
}
/**
* (experimental) Creates a version of the guardrail.
*
* @param id This parameter is required.
* @param description
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailVersion addVersion(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable java.lang.String description) {
return software.amazon.jsii.Kernel.call(this, "addVersion", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), description });
}
/**
* (experimental) Creates a version of the guardrail.
*
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailVersion addVersion(final @org.jetbrains.annotations.NotNull java.lang.String id) {
return software.amazon.jsii.Kernel.call(this, "addVersion", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* @param wordsFilter
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addWordPolicyConfig(final @org.jetbrains.annotations.Nullable java.util.List wordsFilter) {
software.amazon.jsii.Kernel.call(this, "addWordPolicyConfig", software.amazon.jsii.NativeType.VOID, new Object[] { wordsFilter });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addWordPolicyConfig() {
software.amazon.jsii.Kernel.call(this, "addWordPolicyConfig", software.amazon.jsii.NativeType.VOID);
}
/**
* @param filePath This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void uploadWordPolicyFromFile(final @org.jetbrains.annotations.NotNull java.lang.String filePath) {
software.amazon.jsii.Kernel.asyncCall(this, "uploadWordPolicyFromFile", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(filePath, "filePath is required") });
}
/**
* (experimental) guardrail Id.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getGuardrailId() {
return software.amazon.jsii.Kernel.get(this, "guardrailId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) Instance of guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.bedrock.CfnGuardrail getGuardrailInstance() {
return software.amazon.jsii.Kernel.get(this, "guardrailInstance", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.bedrock.CfnGuardrail.class));
}
/**
* (experimental) guardrail version.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getGuardrailVersion() {
return software.amazon.jsii.Kernel.get(this, "guardrailVersion", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The ARN of the AWS KMS key used to encrypt the guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getKmsKeyArn() {
return software.amazon.jsii.Kernel.get(this, "kmsKeyArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The name of the guardrail.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getName() {
return software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Guardrail}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new io.github.cdklabs.generative_ai_cdk_constructs.bedrock.GuardrailProps.Builder();
}
/**
* (experimental) The message to return when the guardrail blocks a prompt.
*
* @return {@code this}
* @param blockedInputMessaging The message to return when the guardrail blocks a prompt. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder blockedInputMessaging(final java.lang.String blockedInputMessaging) {
this.props.blockedInputMessaging(blockedInputMessaging);
return this;
}
/**
* (experimental) The message to return when the guardrail blocks a model response.
*
* @return {@code this}
* @param blockedOutputsMessaging The message to return when the guardrail blocks a model response. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder blockedOutputsMessaging(final java.lang.String blockedOutputsMessaging) {
this.props.blockedOutputsMessaging(blockedOutputsMessaging);
return this;
}
/**
* (experimental) Contextual grounding policy config for a guardrail.
*
* @return {@code this}
* @param contextualGroundingfiltersConfig Contextual grounding policy config for a guardrail. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder contextualGroundingfiltersConfig(final java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ContextualGroundingPolicyConfigProps> contextualGroundingfiltersConfig) {
this.props.contextualGroundingfiltersConfig(contextualGroundingfiltersConfig);
return this;
}
/**
* (experimental) The description of the guardrail.
*
* @return {@code this}
* @param description The description of the guardrail. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder description(final java.lang.String description) {
this.props.description(description);
return this;
}
/**
* (experimental) List of content filter configs in content policy.
*
* @return {@code this}
* @param filtersConfig List of content filter configs in content policy. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder filtersConfig(final java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ContentPolicyConfigProps> filtersConfig) {
this.props.filtersConfig(filtersConfig);
return this;
}
/**
* (experimental) The ARN of the AWS KMS key used to encrypt the guardrail.
*
* @return {@code this}
* @param kmsKeyArn The ARN of the AWS KMS key used to encrypt the guardrail. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder kmsKeyArn(final java.lang.String kmsKeyArn) {
this.props.kmsKeyArn(kmsKeyArn);
return this;
}
/**
* (experimental) The name of the guardrail.
*
* @return {@code this}
* @param name The name of the guardrail. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder name(final java.lang.String name) {
this.props.name(name);
return this;
}
/**
* (experimental) PII fields which needs to be masked.
*
* @return {@code this}
* @param piiConfig PII fields which needs to be masked. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder piiConfig(final java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.SensitiveInformationPolicyConfigProps> piiConfig) {
this.props.piiConfig(piiConfig);
return this;
}
/**
* (experimental) Metadata that you can assign to a guardrail as key-value pairs.
*
* @return {@code this}
* @param tags Metadata that you can assign to a guardrail as key-value pairs. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder tags(final java.util.List extends software.amazon.awscdk.CfnTag> tags) {
this.props.tags(tags);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Guardrail}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Guardrail build() {
return new io.github.cdklabs.generative_ai_cdk_constructs.bedrock.Guardrail(
this.scope,
this.id,
this.props.build()
);
}
}
}