183 183 | ContentBlock::Image(val) => f.debug_tuple("Image").field(&val).finish(),
|
184 184 | ContentBlock::ReasoningContent(_) => f.debug_tuple("*** Sensitive Data Redacted ***").finish(),
|
185 185 | ContentBlock::Text(val) => f.debug_tuple("Text").field(&val).finish(),
|
186 186 | ContentBlock::ToolResult(val) => f.debug_tuple("ToolResult").field(&val).finish(),
|
187 187 | ContentBlock::ToolUse(val) => f.debug_tuple("ToolUse").field(&val).finish(),
|
188 188 | ContentBlock::Video(val) => f.debug_tuple("Video").field(&val).finish(),
|
189 189 | ContentBlock::Unknown => f.debug_tuple("Unknown").finish(),
|
190 190 | }
|
191 191 | }
|
192 192 | }
|
193 + | static CONTENTBLOCK_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
|
194 + | "com.amazonaws.bedrockruntime#ContentBlock",
|
195 + | "com.amazonaws.bedrockruntime",
|
196 + | "ContentBlock",
|
197 + | );
|
198 + | static CONTENTBLOCK_MEMBER_TEXT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
199 + | ::aws_smithy_schema::ShapeId::from_static(
|
200 + | "com.amazonaws.bedrockruntime#ContentBlock$text",
|
201 + | "com.amazonaws.bedrockruntime",
|
202 + | "ContentBlock",
|
203 + | ),
|
204 + | ::aws_smithy_schema::ShapeType::String,
|
205 + | "text",
|
206 + | 0,
|
207 + | );
|
208 + | static CONTENTBLOCK_MEMBER_IMAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
209 + | ::aws_smithy_schema::ShapeId::from_static(
|
210 + | "com.amazonaws.bedrockruntime#ContentBlock$image",
|
211 + | "com.amazonaws.bedrockruntime",
|
212 + | "ContentBlock",
|
213 + | ),
|
214 + | ::aws_smithy_schema::ShapeType::Structure,
|
215 + | "image",
|
216 + | 1,
|
217 + | );
|
218 + | static CONTENTBLOCK_MEMBER_DOCUMENT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
219 + | ::aws_smithy_schema::ShapeId::from_static(
|
220 + | "com.amazonaws.bedrockruntime#ContentBlock$document",
|
221 + | "com.amazonaws.bedrockruntime",
|
222 + | "ContentBlock",
|
223 + | ),
|
224 + | ::aws_smithy_schema::ShapeType::Structure,
|
225 + | "document",
|
226 + | 2,
|
227 + | );
|
228 + | static CONTENTBLOCK_MEMBER_VIDEO: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
229 + | ::aws_smithy_schema::ShapeId::from_static(
|
230 + | "com.amazonaws.bedrockruntime#ContentBlock$video",
|
231 + | "com.amazonaws.bedrockruntime",
|
232 + | "ContentBlock",
|
233 + | ),
|
234 + | ::aws_smithy_schema::ShapeType::Structure,
|
235 + | "video",
|
236 + | 3,
|
237 + | );
|
238 + | static CONTENTBLOCK_MEMBER_TOOLUSE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
239 + | ::aws_smithy_schema::ShapeId::from_static(
|
240 + | "com.amazonaws.bedrockruntime#ContentBlock$toolUse",
|
241 + | "com.amazonaws.bedrockruntime",
|
242 + | "ContentBlock",
|
243 + | ),
|
244 + | ::aws_smithy_schema::ShapeType::Structure,
|
245 + | "toolUse",
|
246 + | 4,
|
247 + | );
|
248 + | static CONTENTBLOCK_MEMBER_TOOLRESULT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
249 + | ::aws_smithy_schema::ShapeId::from_static(
|
250 + | "com.amazonaws.bedrockruntime#ContentBlock$toolResult",
|
251 + | "com.amazonaws.bedrockruntime",
|
252 + | "ContentBlock",
|
253 + | ),
|
254 + | ::aws_smithy_schema::ShapeType::Structure,
|
255 + | "toolResult",
|
256 + | 5,
|
257 + | );
|
258 + | static CONTENTBLOCK_MEMBER_GUARDCONTENT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
259 + | ::aws_smithy_schema::ShapeId::from_static(
|
260 + | "com.amazonaws.bedrockruntime#ContentBlock$guardContent",
|
261 + | "com.amazonaws.bedrockruntime",
|
262 + | "ContentBlock",
|
263 + | ),
|
264 + | ::aws_smithy_schema::ShapeType::Union,
|
265 + | "guardContent",
|
266 + | 6,
|
267 + | );
|
268 + | static CONTENTBLOCK_MEMBER_CACHEPOINT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
269 + | ::aws_smithy_schema::ShapeId::from_static(
|
270 + | "com.amazonaws.bedrockruntime#ContentBlock$cachePoint",
|
271 + | "com.amazonaws.bedrockruntime",
|
272 + | "ContentBlock",
|
273 + | ),
|
274 + | ::aws_smithy_schema::ShapeType::Structure,
|
275 + | "cachePoint",
|
276 + | 7,
|
277 + | );
|
278 + | static CONTENTBLOCK_MEMBER_REASONINGCONTENT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
279 + | ::aws_smithy_schema::ShapeId::from_static(
|
280 + | "com.amazonaws.bedrockruntime#ContentBlock$reasoningContent",
|
281 + | "com.amazonaws.bedrockruntime",
|
282 + | "ContentBlock",
|
283 + | ),
|
284 + | ::aws_smithy_schema::ShapeType::Union,
|
285 + | "reasoningContent",
|
286 + | 8,
|
287 + | );
|
288 + | static CONTENTBLOCK_MEMBER_CITATIONSCONTENT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
289 + | ::aws_smithy_schema::ShapeId::from_static(
|
290 + | "com.amazonaws.bedrockruntime#ContentBlock$citationsContent",
|
291 + | "com.amazonaws.bedrockruntime",
|
292 + | "ContentBlock",
|
293 + | ),
|
294 + | ::aws_smithy_schema::ShapeType::Structure,
|
295 + | "citationsContent",
|
296 + | 9,
|
297 + | );
|
298 + | static CONTENTBLOCK_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
299 + | CONTENTBLOCK_SCHEMA_ID,
|
300 + | ::aws_smithy_schema::ShapeType::Union,
|
301 + | &[
|
302 + | &CONTENTBLOCK_MEMBER_TEXT,
|
303 + | &CONTENTBLOCK_MEMBER_IMAGE,
|
304 + | &CONTENTBLOCK_MEMBER_DOCUMENT,
|
305 + | &CONTENTBLOCK_MEMBER_VIDEO,
|
306 + | &CONTENTBLOCK_MEMBER_TOOLUSE,
|
307 + | &CONTENTBLOCK_MEMBER_TOOLRESULT,
|
308 + | &CONTENTBLOCK_MEMBER_GUARDCONTENT,
|
309 + | &CONTENTBLOCK_MEMBER_CACHEPOINT,
|
310 + | &CONTENTBLOCK_MEMBER_REASONINGCONTENT,
|
311 + | &CONTENTBLOCK_MEMBER_CITATIONSCONTENT,
|
312 + | ],
|
313 + | );
|
314 + | impl ContentBlock {
|
315 + | /// The schema for this shape.
|
316 + | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CONTENTBLOCK_SCHEMA;
|
317 + | }
|
318 + | impl ::aws_smithy_schema::serde::SerializableStruct for ContentBlock {
|
319 + | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
320 + | fn serialize_members(
|
321 + | &self,
|
322 + | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
323 + | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
324 + | match self {
|
325 + | Self::Text(val) => {
|
326 + | ser.write_string(&CONTENTBLOCK_MEMBER_TEXT, val)?;
|
327 + | }
|
328 + | Self::Image(val) => {
|
329 + | ser.write_struct(&CONTENTBLOCK_MEMBER_IMAGE, val)?;
|
330 + | }
|
331 + | Self::Document(val) => {
|
332 + | ser.write_struct(&CONTENTBLOCK_MEMBER_DOCUMENT, val)?;
|
333 + | }
|
334 + | Self::Video(val) => {
|
335 + | ser.write_struct(&CONTENTBLOCK_MEMBER_VIDEO, val)?;
|
336 + | }
|
337 + | Self::ToolUse(val) => {
|
338 + | ser.write_struct(&CONTENTBLOCK_MEMBER_TOOLUSE, val)?;
|
339 + | }
|
340 + | Self::ToolResult(val) => {
|
341 + | ser.write_struct(&CONTENTBLOCK_MEMBER_TOOLRESULT, val)?;
|
342 + | }
|
343 + | Self::GuardContent(val) => {
|
344 + | ser.write_struct(&CONTENTBLOCK_MEMBER_GUARDCONTENT, val)?;
|
345 + | }
|
346 + | Self::CachePoint(val) => {
|
347 + | ser.write_struct(&CONTENTBLOCK_MEMBER_CACHEPOINT, val)?;
|
348 + | }
|
349 + | Self::ReasoningContent(val) => {
|
350 + | ser.write_struct(&CONTENTBLOCK_MEMBER_REASONINGCONTENT, val)?;
|
351 + | }
|
352 + | Self::CitationsContent(val) => {
|
353 + | ser.write_struct(&CONTENTBLOCK_MEMBER_CITATIONSCONTENT, val)?;
|
354 + | }
|
355 + | Self::Unknown => return Err(::aws_smithy_schema::serde::SerdeError::custom("cannot serialize unknown union variant")),
|
356 + | }
|
357 + | Ok(())
|
358 + | }
|
359 + | }
|
360 + | impl ContentBlock {
|
361 + | /// Deserializes this union from a [`ShapeDeserializer`].
|
362 + | pub fn deserialize(
|
363 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
364 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
365 + | let mut result: ::std::option::Option<Self> = ::std::option::Option::None;
|
366 + | #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding)]
|
367 + | deserializer.read_struct(&CONTENTBLOCK_SCHEMA, &mut |member, deser| {
|
368 + | result = ::std::option::Option::Some(match member.member_index() {
|
369 + | Some(0) => Self::Text(deser.read_string(member)?),
|
370 + | Some(1) => Self::Image(crate::types::ImageBlock::deserialize(deser)?),
|
371 + | Some(2) => Self::Document(crate::types::DocumentBlock::deserialize(deser)?),
|
372 + | Some(3) => Self::Video(crate::types::VideoBlock::deserialize(deser)?),
|
373 + | Some(4) => Self::ToolUse(crate::types::ToolUseBlock::deserialize(deser)?),
|
374 + | Some(5) => Self::ToolResult(crate::types::ToolResultBlock::deserialize(deser)?),
|
375 + | Some(6) => Self::GuardContent(crate::types::GuardrailConverseContentBlock::deserialize(deser)?),
|
376 + | Some(7) => Self::CachePoint(crate::types::CachePointBlock::deserialize(deser)?),
|
377 + | Some(8) => Self::ReasoningContent(crate::types::ReasoningContentBlock::deserialize(deser)?),
|
378 + | Some(9) => Self::CitationsContent(crate::types::CitationsContentBlock::deserialize(deser)?),
|
379 + | _ => Self::Unknown,
|
380 + | });
|
381 + | Ok(())
|
382 + | })?;
|
383 + | result.ok_or_else(|| ::aws_smithy_schema::serde::SerdeError::custom("expected a union variant"))
|
384 + | }
|
385 + | }
|