com.amazonaws.services.bedrock.model.CreateGuardrailRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-bedrock Show documentation
/*
* Copyright 2019-2024 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.bedrock.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateGuardrailRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The name to give the guardrail.
*
*/
private String name;
/**
*
* A description of the guardrail.
*
*/
private String description;
/**
*
* The topic policies to configure for the guardrail.
*
*/
private GuardrailTopicPolicyConfig topicPolicyConfig;
/**
*
* The content filter policies to configure for the guardrail.
*
*/
private GuardrailContentPolicyConfig contentPolicyConfig;
/**
*
* The word policy you configure for the guardrail.
*
*/
private GuardrailWordPolicyConfig wordPolicyConfig;
/**
*
* The sensitive information policy to configure for the guardrail.
*
*/
private GuardrailSensitiveInformationPolicyConfig sensitiveInformationPolicyConfig;
/**
*
* The contextual grounding policy configuration used to create a guardrail.
*
*/
private GuardrailContextualGroundingPolicyConfig contextualGroundingPolicyConfig;
/**
*
* The message to return when the guardrail blocks a prompt.
*
*/
private String blockedInputMessaging;
/**
*
* The message to return when the guardrail blocks a model response.
*
*/
private String blockedOutputsMessaging;
/**
*
* The ARN of the KMS key that you use to encrypt the guardrail.
*
*/
private String kmsKeyId;
/**
*
* The tags that you want to attach to the guardrail.
*
*/
private java.util.List tags;
/**
*
* A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token
* matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
* information, see Ensuring
* idempotency in the Amazon S3 User Guide.
*
*/
private String clientRequestToken;
/**
*
* The name to give the guardrail.
*
*
* @param name
* The name to give the guardrail.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name to give the guardrail.
*
*
* @return The name to give the guardrail.
*/
public String getName() {
return this.name;
}
/**
*
* The name to give the guardrail.
*
*
* @param name
* The name to give the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withName(String name) {
setName(name);
return this;
}
/**
*
* A description of the guardrail.
*
*
* @param description
* A description of the guardrail.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* A description of the guardrail.
*
*
* @return A description of the guardrail.
*/
public String getDescription() {
return this.description;
}
/**
*
* A description of the guardrail.
*
*
* @param description
* A description of the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* The topic policies to configure for the guardrail.
*
*
* @param topicPolicyConfig
* The topic policies to configure for the guardrail.
*/
public void setTopicPolicyConfig(GuardrailTopicPolicyConfig topicPolicyConfig) {
this.topicPolicyConfig = topicPolicyConfig;
}
/**
*
* The topic policies to configure for the guardrail.
*
*
* @return The topic policies to configure for the guardrail.
*/
public GuardrailTopicPolicyConfig getTopicPolicyConfig() {
return this.topicPolicyConfig;
}
/**
*
* The topic policies to configure for the guardrail.
*
*
* @param topicPolicyConfig
* The topic policies to configure for the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withTopicPolicyConfig(GuardrailTopicPolicyConfig topicPolicyConfig) {
setTopicPolicyConfig(topicPolicyConfig);
return this;
}
/**
*
* The content filter policies to configure for the guardrail.
*
*
* @param contentPolicyConfig
* The content filter policies to configure for the guardrail.
*/
public void setContentPolicyConfig(GuardrailContentPolicyConfig contentPolicyConfig) {
this.contentPolicyConfig = contentPolicyConfig;
}
/**
*
* The content filter policies to configure for the guardrail.
*
*
* @return The content filter policies to configure for the guardrail.
*/
public GuardrailContentPolicyConfig getContentPolicyConfig() {
return this.contentPolicyConfig;
}
/**
*
* The content filter policies to configure for the guardrail.
*
*
* @param contentPolicyConfig
* The content filter policies to configure for the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withContentPolicyConfig(GuardrailContentPolicyConfig contentPolicyConfig) {
setContentPolicyConfig(contentPolicyConfig);
return this;
}
/**
*
* The word policy you configure for the guardrail.
*
*
* @param wordPolicyConfig
* The word policy you configure for the guardrail.
*/
public void setWordPolicyConfig(GuardrailWordPolicyConfig wordPolicyConfig) {
this.wordPolicyConfig = wordPolicyConfig;
}
/**
*
* The word policy you configure for the guardrail.
*
*
* @return The word policy you configure for the guardrail.
*/
public GuardrailWordPolicyConfig getWordPolicyConfig() {
return this.wordPolicyConfig;
}
/**
*
* The word policy you configure for the guardrail.
*
*
* @param wordPolicyConfig
* The word policy you configure for the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withWordPolicyConfig(GuardrailWordPolicyConfig wordPolicyConfig) {
setWordPolicyConfig(wordPolicyConfig);
return this;
}
/**
*
* The sensitive information policy to configure for the guardrail.
*
*
* @param sensitiveInformationPolicyConfig
* The sensitive information policy to configure for the guardrail.
*/
public void setSensitiveInformationPolicyConfig(GuardrailSensitiveInformationPolicyConfig sensitiveInformationPolicyConfig) {
this.sensitiveInformationPolicyConfig = sensitiveInformationPolicyConfig;
}
/**
*
* The sensitive information policy to configure for the guardrail.
*
*
* @return The sensitive information policy to configure for the guardrail.
*/
public GuardrailSensitiveInformationPolicyConfig getSensitiveInformationPolicyConfig() {
return this.sensitiveInformationPolicyConfig;
}
/**
*
* The sensitive information policy to configure for the guardrail.
*
*
* @param sensitiveInformationPolicyConfig
* The sensitive information policy to configure for the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withSensitiveInformationPolicyConfig(GuardrailSensitiveInformationPolicyConfig sensitiveInformationPolicyConfig) {
setSensitiveInformationPolicyConfig(sensitiveInformationPolicyConfig);
return this;
}
/**
*
* The contextual grounding policy configuration used to create a guardrail.
*
*
* @param contextualGroundingPolicyConfig
* The contextual grounding policy configuration used to create a guardrail.
*/
public void setContextualGroundingPolicyConfig(GuardrailContextualGroundingPolicyConfig contextualGroundingPolicyConfig) {
this.contextualGroundingPolicyConfig = contextualGroundingPolicyConfig;
}
/**
*
* The contextual grounding policy configuration used to create a guardrail.
*
*
* @return The contextual grounding policy configuration used to create a guardrail.
*/
public GuardrailContextualGroundingPolicyConfig getContextualGroundingPolicyConfig() {
return this.contextualGroundingPolicyConfig;
}
/**
*
* The contextual grounding policy configuration used to create a guardrail.
*
*
* @param contextualGroundingPolicyConfig
* The contextual grounding policy configuration used to create a guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withContextualGroundingPolicyConfig(GuardrailContextualGroundingPolicyConfig contextualGroundingPolicyConfig) {
setContextualGroundingPolicyConfig(contextualGroundingPolicyConfig);
return this;
}
/**
*
* The message to return when the guardrail blocks a prompt.
*
*
* @param blockedInputMessaging
* The message to return when the guardrail blocks a prompt.
*/
public void setBlockedInputMessaging(String blockedInputMessaging) {
this.blockedInputMessaging = blockedInputMessaging;
}
/**
*
* The message to return when the guardrail blocks a prompt.
*
*
* @return The message to return when the guardrail blocks a prompt.
*/
public String getBlockedInputMessaging() {
return this.blockedInputMessaging;
}
/**
*
* The message to return when the guardrail blocks a prompt.
*
*
* @param blockedInputMessaging
* The message to return when the guardrail blocks a prompt.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withBlockedInputMessaging(String blockedInputMessaging) {
setBlockedInputMessaging(blockedInputMessaging);
return this;
}
/**
*
* The message to return when the guardrail blocks a model response.
*
*
* @param blockedOutputsMessaging
* The message to return when the guardrail blocks a model response.
*/
public void setBlockedOutputsMessaging(String blockedOutputsMessaging) {
this.blockedOutputsMessaging = blockedOutputsMessaging;
}
/**
*
* The message to return when the guardrail blocks a model response.
*
*
* @return The message to return when the guardrail blocks a model response.
*/
public String getBlockedOutputsMessaging() {
return this.blockedOutputsMessaging;
}
/**
*
* The message to return when the guardrail blocks a model response.
*
*
* @param blockedOutputsMessaging
* The message to return when the guardrail blocks a model response.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withBlockedOutputsMessaging(String blockedOutputsMessaging) {
setBlockedOutputsMessaging(blockedOutputsMessaging);
return this;
}
/**
*
* The ARN of the KMS key that you use to encrypt the guardrail.
*
*
* @param kmsKeyId
* The ARN of the KMS key that you use to encrypt the guardrail.
*/
public void setKmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
}
/**
*
* The ARN of the KMS key that you use to encrypt the guardrail.
*
*
* @return The ARN of the KMS key that you use to encrypt the guardrail.
*/
public String getKmsKeyId() {
return this.kmsKeyId;
}
/**
*
* The ARN of the KMS key that you use to encrypt the guardrail.
*
*
* @param kmsKeyId
* The ARN of the KMS key that you use to encrypt the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withKmsKeyId(String kmsKeyId) {
setKmsKeyId(kmsKeyId);
return this;
}
/**
*
* The tags that you want to attach to the guardrail.
*
*
* @return The tags that you want to attach to the guardrail.
*/
public java.util.List getTags() {
return tags;
}
/**
*
* The tags that you want to attach to the guardrail.
*
*
* @param tags
* The tags that you want to attach to the guardrail.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList(tags);
}
/**
*
* The tags that you want to attach to the guardrail.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* The tags that you want to attach to the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withTags(Tag... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* The tags that you want to attach to the guardrail.
*
*
* @param tags
* The tags that you want to attach to the guardrail.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withTags(java.util.Collection tags) {
setTags(tags);
return this;
}
/**
*
* A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token
* matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
* information, see Ensuring
* idempotency in the Amazon S3 User Guide.
*
*
* @param clientRequestToken
* A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this
* token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For
* more information, see Ensuring
* idempotency in the Amazon S3 User Guide.
*/
public void setClientRequestToken(String clientRequestToken) {
this.clientRequestToken = clientRequestToken;
}
/**
*
* A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token
* matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
* information, see Ensuring
* idempotency in the Amazon S3 User Guide.
*
*
* @return A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this
* token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For
* more information, see Ensuring
* idempotency in the Amazon S3 User Guide.
*/
public String getClientRequestToken() {
return this.clientRequestToken;
}
/**
*
* A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token
* matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
* information, see Ensuring
* idempotency in the Amazon S3 User Guide.
*
*
* @param clientRequestToken
* A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this
* token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For
* more information, see Ensuring
* idempotency in the Amazon S3 User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateGuardrailRequest withClientRequestToken(String clientRequestToken) {
setClientRequestToken(clientRequestToken);
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 (getName() != null)
sb.append("Name: ").append("***Sensitive Data Redacted***").append(",");
if (getDescription() != null)
sb.append("Description: ").append("***Sensitive Data Redacted***").append(",");
if (getTopicPolicyConfig() != null)
sb.append("TopicPolicyConfig: ").append(getTopicPolicyConfig()).append(",");
if (getContentPolicyConfig() != null)
sb.append("ContentPolicyConfig: ").append(getContentPolicyConfig()).append(",");
if (getWordPolicyConfig() != null)
sb.append("WordPolicyConfig: ").append(getWordPolicyConfig()).append(",");
if (getSensitiveInformationPolicyConfig() != null)
sb.append("SensitiveInformationPolicyConfig: ").append(getSensitiveInformationPolicyConfig()).append(",");
if (getContextualGroundingPolicyConfig() != null)
sb.append("ContextualGroundingPolicyConfig: ").append(getContextualGroundingPolicyConfig()).append(",");
if (getBlockedInputMessaging() != null)
sb.append("BlockedInputMessaging: ").append("***Sensitive Data Redacted***").append(",");
if (getBlockedOutputsMessaging() != null)
sb.append("BlockedOutputsMessaging: ").append("***Sensitive Data Redacted***").append(",");
if (getKmsKeyId() != null)
sb.append("KmsKeyId: ").append(getKmsKeyId()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getClientRequestToken() != null)
sb.append("ClientRequestToken: ").append(getClientRequestToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateGuardrailRequest == false)
return false;
CreateGuardrailRequest other = (CreateGuardrailRequest) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getTopicPolicyConfig() == null ^ this.getTopicPolicyConfig() == null)
return false;
if (other.getTopicPolicyConfig() != null && other.getTopicPolicyConfig().equals(this.getTopicPolicyConfig()) == false)
return false;
if (other.getContentPolicyConfig() == null ^ this.getContentPolicyConfig() == null)
return false;
if (other.getContentPolicyConfig() != null && other.getContentPolicyConfig().equals(this.getContentPolicyConfig()) == false)
return false;
if (other.getWordPolicyConfig() == null ^ this.getWordPolicyConfig() == null)
return false;
if (other.getWordPolicyConfig() != null && other.getWordPolicyConfig().equals(this.getWordPolicyConfig()) == false)
return false;
if (other.getSensitiveInformationPolicyConfig() == null ^ this.getSensitiveInformationPolicyConfig() == null)
return false;
if (other.getSensitiveInformationPolicyConfig() != null
&& other.getSensitiveInformationPolicyConfig().equals(this.getSensitiveInformationPolicyConfig()) == false)
return false;
if (other.getContextualGroundingPolicyConfig() == null ^ this.getContextualGroundingPolicyConfig() == null)
return false;
if (other.getContextualGroundingPolicyConfig() != null
&& other.getContextualGroundingPolicyConfig().equals(this.getContextualGroundingPolicyConfig()) == false)
return false;
if (other.getBlockedInputMessaging() == null ^ this.getBlockedInputMessaging() == null)
return false;
if (other.getBlockedInputMessaging() != null && other.getBlockedInputMessaging().equals(this.getBlockedInputMessaging()) == false)
return false;
if (other.getBlockedOutputsMessaging() == null ^ this.getBlockedOutputsMessaging() == null)
return false;
if (other.getBlockedOutputsMessaging() != null && other.getBlockedOutputsMessaging().equals(this.getBlockedOutputsMessaging()) == false)
return false;
if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null)
return false;
if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null)
return false;
if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getTopicPolicyConfig() == null) ? 0 : getTopicPolicyConfig().hashCode());
hashCode = prime * hashCode + ((getContentPolicyConfig() == null) ? 0 : getContentPolicyConfig().hashCode());
hashCode = prime * hashCode + ((getWordPolicyConfig() == null) ? 0 : getWordPolicyConfig().hashCode());
hashCode = prime * hashCode + ((getSensitiveInformationPolicyConfig() == null) ? 0 : getSensitiveInformationPolicyConfig().hashCode());
hashCode = prime * hashCode + ((getContextualGroundingPolicyConfig() == null) ? 0 : getContextualGroundingPolicyConfig().hashCode());
hashCode = prime * hashCode + ((getBlockedInputMessaging() == null) ? 0 : getBlockedInputMessaging().hashCode());
hashCode = prime * hashCode + ((getBlockedOutputsMessaging() == null) ? 0 : getBlockedOutputsMessaging().hashCode());
hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode());
return hashCode;
}
@Override
public CreateGuardrailRequest clone() {
return (CreateGuardrailRequest) super.clone();
}
}