aws_sdk_redshift/protocol_serde/
shape_service_integrations_union.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_service_integrations_union(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::ServiceIntegrationsUnion,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    match input {
8        crate::types::ServiceIntegrationsUnion::LakeFormation(inner) => {
9            let mut list_2 = writer.start_list(false, None);
10            for item_1 in inner {
11                #[allow(unused_mut)]
12                let mut entry_3 = list_2.entry();
13                #[allow(unused_mut)]
14                let mut scope_4 = entry_3.prefix("member");
15                crate::protocol_serde::shape_lake_formation_scope_union::ser_lake_formation_scope_union(scope_4, item_1)?;
16            }
17            list_2.finish();
18        }
19        crate::types::ServiceIntegrationsUnion::S3AccessGrants(inner) => {
20            let mut list_6 = writer.start_list(false, None);
21            for item_5 in inner {
22                #[allow(unused_mut)]
23                let mut entry_7 = list_6.entry();
24                #[allow(unused_mut)]
25                let mut scope_8 = entry_7.prefix("member");
26                crate::protocol_serde::shape_s3_access_grants_scope_union::ser_s3_access_grants_scope_union(scope_8, item_5)?;
27            }
28            list_6.finish();
29        }
30        crate::types::ServiceIntegrationsUnion::Unknown => {
31            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
32                "ServiceIntegrationsUnion",
33            ))
34        }
35    }
36    Ok(())
37}
38
39pub fn de_service_integrations_union(
40    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
41) -> ::std::result::Result<crate::types::ServiceIntegrationsUnion, ::aws_smithy_xml::decode::XmlDecodeError> {
42    let mut base: Option<crate::types::ServiceIntegrationsUnion> = None;
43    while let Some(mut tag) = decoder.next_tag() {
44        match tag.start_el() {
45            s if s.matches("LakeFormation") /* LakeFormation com.amazonaws.redshift#ServiceIntegrationsUnion$LakeFormation */ =>  {
46                let tmp =
47                    crate::protocol_serde::shape_lake_formation_service_integrations::de_lake_formation_service_integrations(&mut tag)
48                    ?
49                ;
50                base = Some(crate::types::ServiceIntegrationsUnion::LakeFormation(tmp));
51            }
52            ,
53            s if s.matches("S3AccessGrants") /* S3AccessGrants com.amazonaws.redshift#ServiceIntegrationsUnion$S3AccessGrants */ =>  {
54                let tmp =
55                    crate::protocol_serde::shape_s3_access_grants_service_integrations::de_s3_access_grants_service_integrations(&mut tag)
56                    ?
57                ;
58                base = Some(crate::types::ServiceIntegrationsUnion::S3AccessGrants(tmp));
59            }
60            ,
61            _unknown => base = Some(crate::types::ServiceIntegrationsUnion::Unknown),
62        }
63    }
64    base.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("expected union, got nothing"))
65}