aws_sdk_bedrockruntime/operation/apply_guardrail/
_apply_guardrail_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ApplyGuardrailInput {
6    /// <p>The guardrail identifier used in the request to apply the guardrail.</p>
7    pub guardrail_identifier: ::std::option::Option<::std::string::String>,
8    /// <p>The guardrail version used in the request to apply the guardrail.</p>
9    pub guardrail_version: ::std::option::Option<::std::string::String>,
10    /// <p>The source of data used in the request to apply the guardrail.</p>
11    pub source: ::std::option::Option<crate::types::GuardrailContentSource>,
12    /// <p>The content details used in the request to apply the guardrail.</p>
13    pub content: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentBlock>>,
14    /// <p>Specifies the scope of the output that you get in the response. Set to <code>FULL</code> to return the entire output, including any detected and non-detected entries in the response for enhanced debugging.</p>
15    /// <p>Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII).</p>
16    pub output_scope: ::std::option::Option<crate::types::GuardrailOutputScope>,
17}
18impl ApplyGuardrailInput {
19    /// <p>The guardrail identifier used in the request to apply the guardrail.</p>
20    pub fn guardrail_identifier(&self) -> ::std::option::Option<&str> {
21        self.guardrail_identifier.as_deref()
22    }
23    /// <p>The guardrail version used in the request to apply the guardrail.</p>
24    pub fn guardrail_version(&self) -> ::std::option::Option<&str> {
25        self.guardrail_version.as_deref()
26    }
27    /// <p>The source of data used in the request to apply the guardrail.</p>
28    pub fn source(&self) -> ::std::option::Option<&crate::types::GuardrailContentSource> {
29        self.source.as_ref()
30    }
31    /// <p>The content details used in the request to apply the guardrail.</p>
32    ///
33    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.content.is_none()`.
34    pub fn content(&self) -> &[crate::types::GuardrailContentBlock] {
35        self.content.as_deref().unwrap_or_default()
36    }
37    /// <p>Specifies the scope of the output that you get in the response. Set to <code>FULL</code> to return the entire output, including any detected and non-detected entries in the response for enhanced debugging.</p>
38    /// <p>Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII).</p>
39    pub fn output_scope(&self) -> ::std::option::Option<&crate::types::GuardrailOutputScope> {
40        self.output_scope.as_ref()
41    }
42}
43impl ApplyGuardrailInput {
44    /// Creates a new builder-style object to manufacture [`ApplyGuardrailInput`](crate::operation::apply_guardrail::ApplyGuardrailInput).
45    pub fn builder() -> crate::operation::apply_guardrail::builders::ApplyGuardrailInputBuilder {
46        crate::operation::apply_guardrail::builders::ApplyGuardrailInputBuilder::default()
47    }
48}
49
50/// A builder for [`ApplyGuardrailInput`](crate::operation::apply_guardrail::ApplyGuardrailInput).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct ApplyGuardrailInputBuilder {
54    pub(crate) guardrail_identifier: ::std::option::Option<::std::string::String>,
55    pub(crate) guardrail_version: ::std::option::Option<::std::string::String>,
56    pub(crate) source: ::std::option::Option<crate::types::GuardrailContentSource>,
57    pub(crate) content: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentBlock>>,
58    pub(crate) output_scope: ::std::option::Option<crate::types::GuardrailOutputScope>,
59}
60impl ApplyGuardrailInputBuilder {
61    /// <p>The guardrail identifier used in the request to apply the guardrail.</p>
62    /// This field is required.
63    pub fn guardrail_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.guardrail_identifier = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The guardrail identifier used in the request to apply the guardrail.</p>
68    pub fn set_guardrail_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.guardrail_identifier = input;
70        self
71    }
72    /// <p>The guardrail identifier used in the request to apply the guardrail.</p>
73    pub fn get_guardrail_identifier(&self) -> &::std::option::Option<::std::string::String> {
74        &self.guardrail_identifier
75    }
76    /// <p>The guardrail version used in the request to apply the guardrail.</p>
77    /// This field is required.
78    pub fn guardrail_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79        self.guardrail_version = ::std::option::Option::Some(input.into());
80        self
81    }
82    /// <p>The guardrail version used in the request to apply the guardrail.</p>
83    pub fn set_guardrail_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84        self.guardrail_version = input;
85        self
86    }
87    /// <p>The guardrail version used in the request to apply the guardrail.</p>
88    pub fn get_guardrail_version(&self) -> &::std::option::Option<::std::string::String> {
89        &self.guardrail_version
90    }
91    /// <p>The source of data used in the request to apply the guardrail.</p>
92    /// This field is required.
93    pub fn source(mut self, input: crate::types::GuardrailContentSource) -> Self {
94        self.source = ::std::option::Option::Some(input);
95        self
96    }
97    /// <p>The source of data used in the request to apply the guardrail.</p>
98    pub fn set_source(mut self, input: ::std::option::Option<crate::types::GuardrailContentSource>) -> Self {
99        self.source = input;
100        self
101    }
102    /// <p>The source of data used in the request to apply the guardrail.</p>
103    pub fn get_source(&self) -> &::std::option::Option<crate::types::GuardrailContentSource> {
104        &self.source
105    }
106    /// Appends an item to `content`.
107    ///
108    /// To override the contents of this collection use [`set_content`](Self::set_content).
109    ///
110    /// <p>The content details used in the request to apply the guardrail.</p>
111    pub fn content(mut self, input: crate::types::GuardrailContentBlock) -> Self {
112        let mut v = self.content.unwrap_or_default();
113        v.push(input);
114        self.content = ::std::option::Option::Some(v);
115        self
116    }
117    /// <p>The content details used in the request to apply the guardrail.</p>
118    pub fn set_content(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentBlock>>) -> Self {
119        self.content = input;
120        self
121    }
122    /// <p>The content details used in the request to apply the guardrail.</p>
123    pub fn get_content(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentBlock>> {
124        &self.content
125    }
126    /// <p>Specifies the scope of the output that you get in the response. Set to <code>FULL</code> to return the entire output, including any detected and non-detected entries in the response for enhanced debugging.</p>
127    /// <p>Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII).</p>
128    pub fn output_scope(mut self, input: crate::types::GuardrailOutputScope) -> Self {
129        self.output_scope = ::std::option::Option::Some(input);
130        self
131    }
132    /// <p>Specifies the scope of the output that you get in the response. Set to <code>FULL</code> to return the entire output, including any detected and non-detected entries in the response for enhanced debugging.</p>
133    /// <p>Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII).</p>
134    pub fn set_output_scope(mut self, input: ::std::option::Option<crate::types::GuardrailOutputScope>) -> Self {
135        self.output_scope = input;
136        self
137    }
138    /// <p>Specifies the scope of the output that you get in the response. Set to <code>FULL</code> to return the entire output, including any detected and non-detected entries in the response for enhanced debugging.</p>
139    /// <p>Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII).</p>
140    pub fn get_output_scope(&self) -> &::std::option::Option<crate::types::GuardrailOutputScope> {
141        &self.output_scope
142    }
143    /// Consumes the builder and constructs a [`ApplyGuardrailInput`](crate::operation::apply_guardrail::ApplyGuardrailInput).
144    pub fn build(
145        self,
146    ) -> ::std::result::Result<crate::operation::apply_guardrail::ApplyGuardrailInput, ::aws_smithy_types::error::operation::BuildError> {
147        ::std::result::Result::Ok(crate::operation::apply_guardrail::ApplyGuardrailInput {
148            guardrail_identifier: self.guardrail_identifier,
149            guardrail_version: self.guardrail_version,
150            source: self.source,
151            content: self.content,
152            output_scope: self.output_scope,
153        })
154    }
155}