// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::update_guardrail::_update_guardrail_output::UpdateGuardrailOutputBuilder;
pub use crate::operation::update_guardrail::_update_guardrail_input::UpdateGuardrailInputBuilder;
impl crate::operation::update_guardrail::builders::UpdateGuardrailInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::update_guardrail::UpdateGuardrailOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_guardrail::UpdateGuardrailError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.update_guardrail();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `UpdateGuardrail`.
///
/// <p>Updates a guardrail with the values you specify.</p>
/// <ul>
/// <li>
/// <p>Specify a <code>name</code> and optional <code>description</code>.</p></li>
/// <li>
/// <p>Specify messages for when the guardrail successfully blocks a prompt or a model response in the <code>blockedInputMessaging</code> and <code>blockedOutputsMessaging</code> fields.</p></li>
/// <li>
/// <p>Specify topics for the guardrail to deny in the <code>topicPolicyConfig</code> object. Each <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GuardrailTopicConfig.html">GuardrailTopicConfig</a> object in the <code>topicsConfig</code> list pertains to one topic.</p>
/// <ul>
/// <li>
/// <p>Give a <code>name</code> and <code>description</code> so that the guardrail can properly identify the topic.</p></li>
/// <li>
/// <p>Specify <code>DENY</code> in the <code>type</code> field.</p></li>
/// <li>
/// <p>(Optional) Provide up to five prompts that you would categorize as belonging to the topic in the <code>examples</code> list.</p></li>
/// </ul></li>
/// <li>
/// <p>Specify filter strengths for the harmful categories defined in Amazon Bedrock in the <code>contentPolicyConfig</code> object. Each <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GuardrailContentFilterConfig.html">GuardrailContentFilterConfig</a> object in the <code>filtersConfig</code> list pertains to a harmful category. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-content-filters">Content filters</a>. For more information about the fields in a content filter, see <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GuardrailContentFilterConfig.html">GuardrailContentFilterConfig</a>.</p>
/// <ul>
/// <li>
/// <p>Specify the category in the <code>type</code> field.</p></li>
/// <li>
/// <p>Specify the strength of the filter for prompts in the <code>inputStrength</code> field and for model responses in the <code>strength</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GuardrailContentFilterConfig.html">GuardrailContentFilterConfig</a>.</p></li>
/// </ul></li>
/// <li>
/// <p>(Optional) For security, include the ARN of a KMS key in the <code>kmsKeyId</code> field.</p></li>
/// </ul>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct UpdateGuardrailFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::update_guardrail::builders::UpdateGuardrailInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::update_guardrail::UpdateGuardrailOutput,
crate::operation::update_guardrail::UpdateGuardrailError,
> for UpdateGuardrailFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::update_guardrail::UpdateGuardrailOutput,
crate::operation::update_guardrail::UpdateGuardrailError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl UpdateGuardrailFluentBuilder {
/// Creates a new `UpdateGuardrailFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the UpdateGuardrail as a reference.
pub fn as_input(&self) -> &crate::operation::update_guardrail::builders::UpdateGuardrailInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::update_guardrail::UpdateGuardrailOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_guardrail::UpdateGuardrailError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::update_guardrail::UpdateGuardrail::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::update_guardrail::UpdateGuardrail::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::update_guardrail::UpdateGuardrailOutput,
crate::operation::update_guardrail::UpdateGuardrailError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>The unique identifier of the guardrail. This can be an ID or the ARN.</p>
pub fn guardrail_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.guardrail_identifier(input.into());
self
}
/// <p>The unique identifier of the guardrail. This can be an ID or the ARN.</p>
pub fn set_guardrail_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_guardrail_identifier(input);
self
}
/// <p>The unique identifier of the guardrail. This can be an ID or the ARN.</p>
pub fn get_guardrail_identifier(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_guardrail_identifier()
}
/// <p>A name for the guardrail.</p>
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.name(input.into());
self
}
/// <p>A name for the guardrail.</p>
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>A name for the guardrail.</p>
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_name()
}
/// <p>A description of the guardrail.</p>
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.description(input.into());
self
}
/// <p>A description of the guardrail.</p>
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// <p>A description of the guardrail.</p>
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_description()
}
/// <p>The topic policy to configure for the guardrail.</p>
pub fn topic_policy_config(mut self, input: crate::types::GuardrailTopicPolicyConfig) -> Self {
self.inner = self.inner.topic_policy_config(input);
self
}
/// <p>The topic policy to configure for the guardrail.</p>
pub fn set_topic_policy_config(mut self, input: ::std::option::Option<crate::types::GuardrailTopicPolicyConfig>) -> Self {
self.inner = self.inner.set_topic_policy_config(input);
self
}
/// <p>The topic policy to configure for the guardrail.</p>
pub fn get_topic_policy_config(&self) -> &::std::option::Option<crate::types::GuardrailTopicPolicyConfig> {
self.inner.get_topic_policy_config()
}
/// <p>The content policy to configure for the guardrail.</p>
pub fn content_policy_config(mut self, input: crate::types::GuardrailContentPolicyConfig) -> Self {
self.inner = self.inner.content_policy_config(input);
self
}
/// <p>The content policy to configure for the guardrail.</p>
pub fn set_content_policy_config(mut self, input: ::std::option::Option<crate::types::GuardrailContentPolicyConfig>) -> Self {
self.inner = self.inner.set_content_policy_config(input);
self
}
/// <p>The content policy to configure for the guardrail.</p>
pub fn get_content_policy_config(&self) -> &::std::option::Option<crate::types::GuardrailContentPolicyConfig> {
self.inner.get_content_policy_config()
}
/// <p>The word policy to configure for the guardrail.</p>
pub fn word_policy_config(mut self, input: crate::types::GuardrailWordPolicyConfig) -> Self {
self.inner = self.inner.word_policy_config(input);
self
}
/// <p>The word policy to configure for the guardrail.</p>
pub fn set_word_policy_config(mut self, input: ::std::option::Option<crate::types::GuardrailWordPolicyConfig>) -> Self {
self.inner = self.inner.set_word_policy_config(input);
self
}
/// <p>The word policy to configure for the guardrail.</p>
pub fn get_word_policy_config(&self) -> &::std::option::Option<crate::types::GuardrailWordPolicyConfig> {
self.inner.get_word_policy_config()
}
/// <p>The sensitive information policy to configure for the guardrail.</p>
pub fn sensitive_information_policy_config(mut self, input: crate::types::GuardrailSensitiveInformationPolicyConfig) -> Self {
self.inner = self.inner.sensitive_information_policy_config(input);
self
}
/// <p>The sensitive information policy to configure for the guardrail.</p>
pub fn set_sensitive_information_policy_config(
mut self,
input: ::std::option::Option<crate::types::GuardrailSensitiveInformationPolicyConfig>,
) -> Self {
self.inner = self.inner.set_sensitive_information_policy_config(input);
self
}
/// <p>The sensitive information policy to configure for the guardrail.</p>
pub fn get_sensitive_information_policy_config(&self) -> &::std::option::Option<crate::types::GuardrailSensitiveInformationPolicyConfig> {
self.inner.get_sensitive_information_policy_config()
}
/// <p>The contextual grounding policy configuration used to update a guardrail.</p>
pub fn contextual_grounding_policy_config(mut self, input: crate::types::GuardrailContextualGroundingPolicyConfig) -> Self {
self.inner = self.inner.contextual_grounding_policy_config(input);
self
}
/// <p>The contextual grounding policy configuration used to update a guardrail.</p>
pub fn set_contextual_grounding_policy_config(
mut self,
input: ::std::option::Option<crate::types::GuardrailContextualGroundingPolicyConfig>,
) -> Self {
self.inner = self.inner.set_contextual_grounding_policy_config(input);
self
}
/// <p>The contextual grounding policy configuration used to update a guardrail.</p>
pub fn get_contextual_grounding_policy_config(&self) -> &::std::option::Option<crate::types::GuardrailContextualGroundingPolicyConfig> {
self.inner.get_contextual_grounding_policy_config()
}
/// <p>Updated configuration for Automated Reasoning policies associated with the guardrail.</p>
pub fn automated_reasoning_policy_config(mut self, input: crate::types::GuardrailAutomatedReasoningPolicyConfig) -> Self {
self.inner = self.inner.automated_reasoning_policy_config(input);
self
}
/// <p>Updated configuration for Automated Reasoning policies associated with the guardrail.</p>
pub fn set_automated_reasoning_policy_config(
mut self,
input: ::std::option::Option<crate::types::GuardrailAutomatedReasoningPolicyConfig>,
) -> Self {
self.inner = self.inner.set_automated_reasoning_policy_config(input);
self
}
/// <p>Updated configuration for Automated Reasoning policies associated with the guardrail.</p>
pub fn get_automated_reasoning_policy_config(&self) -> &::std::option::Option<crate::types::GuardrailAutomatedReasoningPolicyConfig> {
self.inner.get_automated_reasoning_policy_config()
}
/// <p>The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed.</p>
/// <p>For more information, see the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region.html">Amazon Bedrock User Guide</a>.</p>
pub fn cross_region_config(mut self, input: crate::types::GuardrailCrossRegionConfig) -> Self {
self.inner = self.inner.cross_region_config(input);
self
}
/// <p>The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed.</p>
/// <p>For more information, see the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region.html">Amazon Bedrock User Guide</a>.</p>
pub fn set_cross_region_config(mut self, input: ::std::option::Option<crate::types::GuardrailCrossRegionConfig>) -> Self {
self.inner = self.inner.set_cross_region_config(input);
self
}
/// <p>The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed.</p>
/// <p>For more information, see the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region.html">Amazon Bedrock User Guide</a>.</p>
pub fn get_cross_region_config(&self) -> &::std::option::Option<crate::types::GuardrailCrossRegionConfig> {
self.inner.get_cross_region_config()
}
/// <p>The message to return when the guardrail blocks a prompt.</p>
pub fn blocked_input_messaging(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.blocked_input_messaging(input.into());
self
}
/// <p>The message to return when the guardrail blocks a prompt.</p>
pub fn set_blocked_input_messaging(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_blocked_input_messaging(input);
self
}
/// <p>The message to return when the guardrail blocks a prompt.</p>
pub fn get_blocked_input_messaging(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_blocked_input_messaging()
}
/// <p>The message to return when the guardrail blocks a model response.</p>
pub fn blocked_outputs_messaging(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.blocked_outputs_messaging(input.into());
self
}
/// <p>The message to return when the guardrail blocks a model response.</p>
pub fn set_blocked_outputs_messaging(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_blocked_outputs_messaging(input);
self
}
/// <p>The message to return when the guardrail blocks a model response.</p>
pub fn get_blocked_outputs_messaging(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_blocked_outputs_messaging()
}
/// <p>The ARN of the KMS key with which to encrypt the guardrail.</p>
pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.kms_key_id(input.into());
self
}
/// <p>The ARN of the KMS key with which to encrypt the guardrail.</p>
pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_kms_key_id(input);
self
}
/// <p>The ARN of the KMS key with which to encrypt the guardrail.</p>
pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_kms_key_id()
}
}