1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + |
|
3 + | /// <p>Configuration information for a guardrail that you use with the <code>ConverseStream</code> action.</p>
|
4 + | #[non_exhaustive]
|
5 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 + | pub struct GuardrailStreamConfiguration {
|
7 + | /// <p>The identifier for the guardrail.</p>
|
8 + | pub guardrail_identifier: ::std::string::String,
|
9 + | /// <p>The version of the guardrail.</p>
|
10 + | pub guardrail_version: ::std::string::String,
|
11 + | /// <p>The trace behavior for the guardrail.</p>
|
12 + | pub trace: crate::types::GuardrailTrace,
|
13 + | /// <p>The processing mode.</p>
|
14 + | /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
|
15 + | pub stream_processing_mode: crate::types::GuardrailStreamProcessingMode,
|
16 + | }
|
17 + | impl GuardrailStreamConfiguration {
|
18 + | /// <p>The identifier for the guardrail.</p>
|
19 + | pub fn guardrail_identifier(&self) -> &str {
|
20 + | use std::ops::Deref;
|
21 + | self.guardrail_identifier.deref()
|
22 + | }
|
23 + | /// <p>The version of the guardrail.</p>
|
24 + | pub fn guardrail_version(&self) -> &str {
|
25 + | use std::ops::Deref;
|
26 + | self.guardrail_version.deref()
|
27 + | }
|
28 + | /// <p>The trace behavior for the guardrail.</p>
|
29 + | pub fn trace(&self) -> &crate::types::GuardrailTrace {
|
30 + | &self.trace
|
31 + | }
|
32 + | /// <p>The processing mode.</p>
|
33 + | /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
|
34 + | pub fn stream_processing_mode(&self) -> &crate::types::GuardrailStreamProcessingMode {
|
35 + | &self.stream_processing_mode
|
36 + | }
|
37 + | }
|
38 + | impl GuardrailStreamConfiguration {
|
39 + | /// Creates a new builder-style object to manufacture [`GuardrailStreamConfiguration`](crate::types::GuardrailStreamConfiguration).
|
40 + | pub fn builder() -> crate::types::builders::GuardrailStreamConfigurationBuilder {
|
41 + | crate::types::builders::GuardrailStreamConfigurationBuilder::default()
|
42 + | }
|
43 + | }
|
44 + |
|
45 + | /// A builder for [`GuardrailStreamConfiguration`](crate::types::GuardrailStreamConfiguration).
|
46 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
47 + | #[non_exhaustive]
|
48 + | pub struct GuardrailStreamConfigurationBuilder {
|
49 + | pub(crate) guardrail_identifier: ::std::option::Option<::std::string::String>,
|
50 + | pub(crate) guardrail_version: ::std::option::Option<::std::string::String>,
|
51 + | pub(crate) trace: ::std::option::Option<crate::types::GuardrailTrace>,
|
52 + | pub(crate) stream_processing_mode: ::std::option::Option<crate::types::GuardrailStreamProcessingMode>,
|
53 + | }
|
54 + | impl GuardrailStreamConfigurationBuilder {
|
55 + | /// <p>The identifier for the guardrail.</p>
|
56 + | /// This field is required.
|
57 + | pub fn guardrail_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
58 + | self.guardrail_identifier = ::std::option::Option::Some(input.into());
|
59 + | self
|
60 + | }
|
61 + | /// <p>The identifier for the guardrail.</p>
|
62 + | pub fn set_guardrail_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
63 + | self.guardrail_identifier = input;
|
64 + | self
|
65 + | }
|
66 + | /// <p>The identifier for the guardrail.</p>
|
67 + | pub fn get_guardrail_identifier(&self) -> &::std::option::Option<::std::string::String> {
|
68 + | &self.guardrail_identifier
|
69 + | }
|
70 + | /// <p>The version of the guardrail.</p>
|
71 + | /// This field is required.
|
72 + | pub fn guardrail_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
|
73 + | self.guardrail_version = ::std::option::Option::Some(input.into());
|
74 + | self
|
75 + | }
|
76 + | /// <p>The version of the guardrail.</p>
|
77 + | pub fn set_guardrail_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
78 + | self.guardrail_version = input;
|
79 + | self
|
80 + | }
|
81 + | /// <p>The version of the guardrail.</p>
|
82 + | pub fn get_guardrail_version(&self) -> &::std::option::Option<::std::string::String> {
|
83 + | &self.guardrail_version
|
84 + | }
|
85 + | /// <p>The trace behavior for the guardrail.</p>
|
86 + | pub fn trace(mut self, input: crate::types::GuardrailTrace) -> Self {
|
87 + | self.trace = ::std::option::Option::Some(input);
|
88 + | self
|
89 + | }
|
90 + | /// <p>The trace behavior for the guardrail.</p>
|
91 + | pub fn set_trace(mut self, input: ::std::option::Option<crate::types::GuardrailTrace>) -> Self {
|
92 + | self.trace = input;
|
93 + | self
|
94 + | }
|
95 + | /// <p>The trace behavior for the guardrail.</p>
|
96 + | pub fn get_trace(&self) -> &::std::option::Option<crate::types::GuardrailTrace> {
|
97 + | &self.trace
|
98 + | }
|
99 + | /// <p>The processing mode.</p>
|
100 + | /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
|
101 + | pub fn stream_processing_mode(mut self, input: crate::types::GuardrailStreamProcessingMode) -> Self {
|
102 + | self.stream_processing_mode = ::std::option::Option::Some(input);
|
103 + | self
|
104 + | }
|
105 + | /// <p>The processing mode.</p>
|
106 + | /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
|
107 + | pub fn set_stream_processing_mode(mut self, input: ::std::option::Option<crate::types::GuardrailStreamProcessingMode>) -> Self {
|
108 + | self.stream_processing_mode = input;
|
109 + | self
|
110 + | }
|
111 + | /// <p>The processing mode.</p>
|
112 + | /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
|
113 + | pub fn get_stream_processing_mode(&self) -> &::std::option::Option<crate::types::GuardrailStreamProcessingMode> {
|
114 + | &self.stream_processing_mode
|
115 + | }
|
116 + | /// Consumes the builder and constructs a [`GuardrailStreamConfiguration`](crate::types::GuardrailStreamConfiguration).
|
117 + | /// This method will fail if any of the following fields are not set:
|
118 + | /// - [`guardrail_identifier`](crate::types::builders::GuardrailStreamConfigurationBuilder::guardrail_identifier)
|
119 + | /// - [`guardrail_version`](crate::types::builders::GuardrailStreamConfigurationBuilder::guardrail_version)
|
120 + | pub fn build(self) -> ::std::result::Result<crate::types::GuardrailStreamConfiguration, ::aws_smithy_types::error::operation::BuildError> {
|
121 + | ::std::result::Result::Ok(crate::types::GuardrailStreamConfiguration {
|
122 + | guardrail_identifier: self.guardrail_identifier.ok_or_else(|| {
|
123 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
124 + | "guardrail_identifier",
|
125 + | "guardrail_identifier was not specified but it is required when building GuardrailStreamConfiguration",
|
126 + | )
|
127 + | })?,
|
128 + | guardrail_version: self.guardrail_version.ok_or_else(|| {
|
129 + | ::aws_smithy_types::error::operation::BuildError::missing_field(
|
130 + | "guardrail_version",
|
131 + | "guardrail_version was not specified but it is required when building GuardrailStreamConfiguration",
|
132 + | )
|
133 + | })?,
|
134 + | trace: self.trace.unwrap_or(
|
135 + | "disabled"
|
136 + | .parse::<crate::types::GuardrailTrace>()
|
137 + | .expect("static value validated to member"),
|
138 + | ),
|
139 + | stream_processing_mode: self.stream_processing_mode.unwrap_or(
|
140 + | "sync"
|
141 + | .parse::<crate::types::GuardrailStreamProcessingMode>()
|
142 + | .expect("static value validated to member"),
|
143 + | ),
|
144 + | })
|
145 + | }
|
146 + | }
|