#[non_exhaustive]
pub enum IpPreference {
    IPv4Only,
    IPv4Preferred,
    IPv6Only,
    IPv6Preferred,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against IpPreference, it is important to ensure your code is forward-compatible. That is, if a match arm handles a case for a feature that is supported by the service but has not been represented as an enum variant in a current version of SDK, your code should continue to work when you upgrade SDK to a future version in which the enum does include a variant for that feature.

Here is an example of how you can make a match expression forward-compatible:

# let ippreference = unimplemented!();
match ippreference {
    IpPreference::IPv4Only => { /* ... */ },
    IpPreference::IPv4Preferred => { /* ... */ },
    IpPreference::IPv6Only => { /* ... */ },
    IpPreference::IPv6Preferred => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when ippreference represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant IpPreference::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to IpPreference::Unknown(UnknownVariantValue("NewFeature".to_owned())) and calling as_str on it yields "NewFeature". This match expression is forward-compatible when executed with a newer version of SDK where the variant IpPreference::NewFeature is defined. Specifically, when ippreference represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on IpPreference::NewFeature also yielding "NewFeature".

Explicitly matching on the Unknown variant should be avoided for two reasons:

  • The inner data UnknownVariantValue is opaque, and no further information can be extracted.
  • It might inadvertently shadow other intended match arms.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

IPv4Only

§

IPv4Preferred

§

IPv6Only

§

IPv6Preferred

§

Unknown(UnknownVariantValue)

Unknown contains new variants that have been added since this code was generated.

Implementations§

Returns the &str value of the enum member.

Examples found in repository?
src/model.rs (line 819)
818
819
820
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 697)
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
pub fn serialize_structure_crate_model_mesh_service_discovery(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::MeshServiceDiscovery,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_144) = &input.ip_preference {
        object.key("ipPreference").string(var_144.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_route(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpRoute,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_145) = &input.r#match {
        #[allow(unused_mut)]
        let mut object_146 = object.key("match").start_object();
        crate::json_ser::serialize_structure_crate_model_http_route_match(
            &mut object_146,
            var_145,
        )?;
        object_146.finish();
    }
    if let Some(var_147) = &input.action {
        #[allow(unused_mut)]
        let mut object_148 = object.key("action").start_object();
        crate::json_ser::serialize_structure_crate_model_http_route_action(
            &mut object_148,
            var_147,
        )?;
        object_148.finish();
    }
    if let Some(var_149) = &input.retry_policy {
        #[allow(unused_mut)]
        let mut object_150 = object.key("retryPolicy").start_object();
        crate::json_ser::serialize_structure_crate_model_http_retry_policy(
            &mut object_150,
            var_149,
        )?;
        object_150.finish();
    }
    if let Some(var_151) = &input.timeout {
        #[allow(unused_mut)]
        let mut object_152 = object.key("timeout").start_object();
        crate::json_ser::serialize_structure_crate_model_http_timeout(&mut object_152, var_151)?;
        object_152.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_tcp_route(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TcpRoute,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_153) = &input.action {
        #[allow(unused_mut)]
        let mut object_154 = object.key("action").start_object();
        crate::json_ser::serialize_structure_crate_model_tcp_route_action(
            &mut object_154,
            var_153,
        )?;
        object_154.finish();
    }
    if let Some(var_155) = &input.timeout {
        #[allow(unused_mut)]
        let mut object_156 = object.key("timeout").start_object();
        crate::json_ser::serialize_structure_crate_model_tcp_timeout(&mut object_156, var_155)?;
        object_156.finish();
    }
    if let Some(var_157) = &input.r#match {
        #[allow(unused_mut)]
        let mut object_158 = object.key("match").start_object();
        crate::json_ser::serialize_structure_crate_model_tcp_route_match(&mut object_158, var_157)?;
        object_158.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_route(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcRoute,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_159) = &input.action {
        #[allow(unused_mut)]
        let mut object_160 = object.key("action").start_object();
        crate::json_ser::serialize_structure_crate_model_grpc_route_action(
            &mut object_160,
            var_159,
        )?;
        object_160.finish();
    }
    if let Some(var_161) = &input.r#match {
        #[allow(unused_mut)]
        let mut object_162 = object.key("match").start_object();
        crate::json_ser::serialize_structure_crate_model_grpc_route_match(
            &mut object_162,
            var_161,
        )?;
        object_162.finish();
    }
    if let Some(var_163) = &input.retry_policy {
        #[allow(unused_mut)]
        let mut object_164 = object.key("retryPolicy").start_object();
        crate::json_ser::serialize_structure_crate_model_grpc_retry_policy(
            &mut object_164,
            var_163,
        )?;
        object_164.finish();
    }
    if let Some(var_165) = &input.timeout {
        #[allow(unused_mut)]
        let mut object_166 = object.key("timeout").start_object();
        crate::json_ser::serialize_structure_crate_model_grpc_timeout(&mut object_166, var_165)?;
        object_166.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_backend_defaults(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayBackendDefaults,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_167) = &input.client_policy {
        #[allow(unused_mut)]
        let mut object_168 = object.key("clientPolicy").start_object();
        crate::json_ser::serialize_structure_crate_model_virtual_gateway_client_policy(
            &mut object_168,
            var_167,
        )?;
        object_168.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_listener(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayListener,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_169) = &input.health_check {
        #[allow(unused_mut)]
        let mut object_170 = object.key("healthCheck").start_object();
        crate::json_ser::serialize_structure_crate_model_virtual_gateway_health_check_policy(
            &mut object_170,
            var_169,
        )?;
        object_170.finish();
    }
    if let Some(var_171) = &input.port_mapping {
        #[allow(unused_mut)]
        let mut object_172 = object.key("portMapping").start_object();
        crate::json_ser::serialize_structure_crate_model_virtual_gateway_port_mapping(
            &mut object_172,
            var_171,
        )?;
        object_172.finish();
    }
    if let Some(var_173) = &input.tls {
        #[allow(unused_mut)]
        let mut object_174 = object.key("tls").start_object();
        crate::json_ser::serialize_structure_crate_model_virtual_gateway_listener_tls(
            &mut object_174,
            var_173,
        )?;
        object_174.finish();
    }
    if let Some(var_175) = &input.connection_pool {
        #[allow(unused_mut)]
        let mut object_176 = object.key("connectionPool").start_object();
        crate::json_ser::serialize_union_crate_model_virtual_gateway_connection_pool(
            &mut object_176,
            var_175,
        )?;
        object_176.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_logging(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayLogging,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_177) = &input.access_log {
        #[allow(unused_mut)]
        let mut object_178 = object.key("accessLog").start_object();
        crate::json_ser::serialize_union_crate_model_virtual_gateway_access_log(
            &mut object_178,
            var_177,
        )?;
        object_178.finish();
    }
    Ok(())
}

pub fn serialize_union_crate_model_service_discovery(
    object_116: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ServiceDiscovery,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    match input {
        crate::model::ServiceDiscovery::Dns(inner) => {
            #[allow(unused_mut)]
            let mut object_179 = object_116.key("dns").start_object();
            crate::json_ser::serialize_structure_crate_model_dns_service_discovery(
                &mut object_179,
                inner,
            )?;
            object_179.finish();
        }
        crate::model::ServiceDiscovery::AwsCloudMap(inner) => {
            #[allow(unused_mut)]
            let mut object_180 = object_116.key("awsCloudMap").start_object();
            crate::json_ser::serialize_structure_crate_model_aws_cloud_map_service_discovery(
                &mut object_180,
                inner,
            )?;
            object_180.finish();
        }
        crate::model::ServiceDiscovery::Unknown => {
            return Err(
                aws_smithy_http::operation::error::SerializationError::unknown_variant(
                    "ServiceDiscovery",
                ),
            )
        }
    }
    Ok(())
}

pub fn serialize_structure_crate_model_listener(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Listener,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_181) = &input.port_mapping {
        #[allow(unused_mut)]
        let mut object_182 = object.key("portMapping").start_object();
        crate::json_ser::serialize_structure_crate_model_port_mapping(&mut object_182, var_181)?;
        object_182.finish();
    }
    if let Some(var_183) = &input.tls {
        #[allow(unused_mut)]
        let mut object_184 = object.key("tls").start_object();
        crate::json_ser::serialize_structure_crate_model_listener_tls(&mut object_184, var_183)?;
        object_184.finish();
    }
    if let Some(var_185) = &input.health_check {
        #[allow(unused_mut)]
        let mut object_186 = object.key("healthCheck").start_object();
        crate::json_ser::serialize_structure_crate_model_health_check_policy(
            &mut object_186,
            var_185,
        )?;
        object_186.finish();
    }
    if let Some(var_187) = &input.timeout {
        #[allow(unused_mut)]
        let mut object_188 = object.key("timeout").start_object();
        crate::json_ser::serialize_union_crate_model_listener_timeout(&mut object_188, var_187)?;
        object_188.finish();
    }
    if let Some(var_189) = &input.outlier_detection {
        #[allow(unused_mut)]
        let mut object_190 = object.key("outlierDetection").start_object();
        crate::json_ser::serialize_structure_crate_model_outlier_detection(
            &mut object_190,
            var_189,
        )?;
        object_190.finish();
    }
    if let Some(var_191) = &input.connection_pool {
        #[allow(unused_mut)]
        let mut object_192 = object.key("connectionPool").start_object();
        crate::json_ser::serialize_union_crate_model_virtual_node_connection_pool(
            &mut object_192,
            var_191,
        )?;
        object_192.finish();
    }
    Ok(())
}

pub fn serialize_union_crate_model_backend(
    object_124: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Backend,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    match input {
        crate::model::Backend::VirtualService(inner) => {
            #[allow(unused_mut)]
            let mut object_193 = object_124.key("virtualService").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_service_backend(
                &mut object_193,
                inner,
            )?;
            object_193.finish();
        }
        crate::model::Backend::Unknown => {
            return Err(
                aws_smithy_http::operation::error::SerializationError::unknown_variant("Backend"),
            )
        }
    }
    Ok(())
}

pub fn serialize_structure_crate_model_backend_defaults(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::BackendDefaults,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_194) = &input.client_policy {
        #[allow(unused_mut)]
        let mut object_195 = object.key("clientPolicy").start_object();
        crate::json_ser::serialize_structure_crate_model_client_policy(&mut object_195, var_194)?;
        object_195.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_logging(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Logging,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_196) = &input.access_log {
        #[allow(unused_mut)]
        let mut object_197 = object.key("accessLog").start_object();
        crate::json_ser::serialize_union_crate_model_access_log(&mut object_197, var_196)?;
        object_197.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_router_listener(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualRouterListener,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_198) = &input.port_mapping {
        #[allow(unused_mut)]
        let mut object_199 = object.key("portMapping").start_object();
        crate::json_ser::serialize_structure_crate_model_port_mapping(&mut object_199, var_198)?;
        object_199.finish();
    }
    Ok(())
}

pub fn serialize_union_crate_model_virtual_service_provider(
    object_134: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualServiceProvider,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    match input {
        crate::model::VirtualServiceProvider::VirtualNode(inner) => {
            #[allow(unused_mut)]
            let mut object_200 = object_134.key("virtualNode").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_node_service_provider(
                &mut object_200,
                inner,
            )?;
            object_200.finish();
        }
        crate::model::VirtualServiceProvider::VirtualRouter(inner) => {
            #[allow(unused_mut)]
            let mut object_201 = object_134.key("virtualRouter").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_router_service_provider(
                &mut object_201,
                inner,
            )?;
            object_201.finish();
        }
        crate::model::VirtualServiceProvider::Unknown => {
            return Err(
                aws_smithy_http::operation::error::SerializationError::unknown_variant(
                    "VirtualServiceProvider",
                ),
            )
        }
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_gateway_route_match(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpGatewayRouteMatch,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_202) = &input.prefix {
        object.key("prefix").string(var_202.as_str());
    }
    if let Some(var_203) = &input.path {
        #[allow(unused_mut)]
        let mut object_204 = object.key("path").start_object();
        crate::json_ser::serialize_structure_crate_model_http_path_match(&mut object_204, var_203)?;
        object_204.finish();
    }
    if let Some(var_205) = &input.query_parameters {
        let mut array_206 = object.key("queryParameters").start_array();
        for item_207 in var_205 {
            {
                #[allow(unused_mut)]
                let mut object_208 = array_206.value().start_object();
                crate::json_ser::serialize_structure_crate_model_http_query_parameter(
                    &mut object_208,
                    item_207,
                )?;
                object_208.finish();
            }
        }
        array_206.finish();
    }
    if let Some(var_209) = &input.method {
        object.key("method").string(var_209.as_str());
    }
    if let Some(var_210) = &input.hostname {
        #[allow(unused_mut)]
        let mut object_211 = object.key("hostname").start_object();
        crate::json_ser::serialize_structure_crate_model_gateway_route_hostname_match(
            &mut object_211,
            var_210,
        )?;
        object_211.finish();
    }
    if let Some(var_212) = &input.headers {
        let mut array_213 = object.key("headers").start_array();
        for item_214 in var_212 {
            {
                #[allow(unused_mut)]
                let mut object_215 = array_213.value().start_object();
                crate::json_ser::serialize_structure_crate_model_http_gateway_route_header(
                    &mut object_215,
                    item_214,
                )?;
                object_215.finish();
            }
        }
        array_213.finish();
    }
    if let Some(var_216) = &input.port {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_216).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_gateway_route_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpGatewayRouteAction,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_217) = &input.target {
        #[allow(unused_mut)]
        let mut object_218 = object.key("target").start_object();
        crate::json_ser::serialize_structure_crate_model_gateway_route_target(
            &mut object_218,
            var_217,
        )?;
        object_218.finish();
    }
    if let Some(var_219) = &input.rewrite {
        #[allow(unused_mut)]
        let mut object_220 = object.key("rewrite").start_object();
        crate::json_ser::serialize_structure_crate_model_http_gateway_route_rewrite(
            &mut object_220,
            var_219,
        )?;
        object_220.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_gateway_route_match(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcGatewayRouteMatch,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_221) = &input.service_name {
        object.key("serviceName").string(var_221.as_str());
    }
    if let Some(var_222) = &input.hostname {
        #[allow(unused_mut)]
        let mut object_223 = object.key("hostname").start_object();
        crate::json_ser::serialize_structure_crate_model_gateway_route_hostname_match(
            &mut object_223,
            var_222,
        )?;
        object_223.finish();
    }
    if let Some(var_224) = &input.metadata {
        let mut array_225 = object.key("metadata").start_array();
        for item_226 in var_224 {
            {
                #[allow(unused_mut)]
                let mut object_227 = array_225.value().start_object();
                crate::json_ser::serialize_structure_crate_model_grpc_gateway_route_metadata(
                    &mut object_227,
                    item_226,
                )?;
                object_227.finish();
            }
        }
        array_225.finish();
    }
    if let Some(var_228) = &input.port {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_228).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_gateway_route_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcGatewayRouteAction,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_229) = &input.target {
        #[allow(unused_mut)]
        let mut object_230 = object.key("target").start_object();
        crate::json_ser::serialize_structure_crate_model_gateway_route_target(
            &mut object_230,
            var_229,
        )?;
        object_230.finish();
    }
    if let Some(var_231) = &input.rewrite {
        #[allow(unused_mut)]
        let mut object_232 = object.key("rewrite").start_object();
        crate::json_ser::serialize_structure_crate_model_grpc_gateway_route_rewrite(
            &mut object_232,
            var_231,
        )?;
        object_232.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_route_match(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpRouteMatch,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_233) = &input.prefix {
        object.key("prefix").string(var_233.as_str());
    }
    if let Some(var_234) = &input.path {
        #[allow(unused_mut)]
        let mut object_235 = object.key("path").start_object();
        crate::json_ser::serialize_structure_crate_model_http_path_match(&mut object_235, var_234)?;
        object_235.finish();
    }
    if let Some(var_236) = &input.query_parameters {
        let mut array_237 = object.key("queryParameters").start_array();
        for item_238 in var_236 {
            {
                #[allow(unused_mut)]
                let mut object_239 = array_237.value().start_object();
                crate::json_ser::serialize_structure_crate_model_http_query_parameter(
                    &mut object_239,
                    item_238,
                )?;
                object_239.finish();
            }
        }
        array_237.finish();
    }
    if let Some(var_240) = &input.method {
        object.key("method").string(var_240.as_str());
    }
    if let Some(var_241) = &input.scheme {
        object.key("scheme").string(var_241.as_str());
    }
    if let Some(var_242) = &input.headers {
        let mut array_243 = object.key("headers").start_array();
        for item_244 in var_242 {
            {
                #[allow(unused_mut)]
                let mut object_245 = array_243.value().start_object();
                crate::json_ser::serialize_structure_crate_model_http_route_header(
                    &mut object_245,
                    item_244,
                )?;
                object_245.finish();
            }
        }
        array_243.finish();
    }
    if let Some(var_246) = &input.port {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_246).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_route_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpRouteAction,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_247) = &input.weighted_targets {
        let mut array_248 = object.key("weightedTargets").start_array();
        for item_249 in var_247 {
            {
                #[allow(unused_mut)]
                let mut object_250 = array_248.value().start_object();
                crate::json_ser::serialize_structure_crate_model_weighted_target(
                    &mut object_250,
                    item_249,
                )?;
                object_250.finish();
            }
        }
        array_248.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_retry_policy(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpRetryPolicy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_251) = &input.per_retry_timeout {
        #[allow(unused_mut)]
        let mut object_252 = object.key("perRetryTimeout").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_252, var_251)?;
        object_252.finish();
    }
    if let Some(var_253) = &input.max_retries {
        object.key("maxRetries").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_253).into()),
        );
    }
    if let Some(var_254) = &input.http_retry_events {
        let mut array_255 = object.key("httpRetryEvents").start_array();
        for item_256 in var_254 {
            {
                array_255.value().string(item_256.as_str());
            }
        }
        array_255.finish();
    }
    if let Some(var_257) = &input.tcp_retry_events {
        let mut array_258 = object.key("tcpRetryEvents").start_array();
        for item_259 in var_257 {
            {
                array_258.value().string(item_259.as_str());
            }
        }
        array_258.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_http_timeout(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::HttpTimeout,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_260) = &input.per_request {
        #[allow(unused_mut)]
        let mut object_261 = object.key("perRequest").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_261, var_260)?;
        object_261.finish();
    }
    if let Some(var_262) = &input.idle {
        #[allow(unused_mut)]
        let mut object_263 = object.key("idle").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_263, var_262)?;
        object_263.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_tcp_route_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TcpRouteAction,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_264) = &input.weighted_targets {
        let mut array_265 = object.key("weightedTargets").start_array();
        for item_266 in var_264 {
            {
                #[allow(unused_mut)]
                let mut object_267 = array_265.value().start_object();
                crate::json_ser::serialize_structure_crate_model_weighted_target(
                    &mut object_267,
                    item_266,
                )?;
                object_267.finish();
            }
        }
        array_265.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_tcp_timeout(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TcpTimeout,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_268) = &input.idle {
        #[allow(unused_mut)]
        let mut object_269 = object.key("idle").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_269, var_268)?;
        object_269.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_tcp_route_match(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TcpRouteMatch,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_270) = &input.port {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_270).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_route_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcRouteAction,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_271) = &input.weighted_targets {
        let mut array_272 = object.key("weightedTargets").start_array();
        for item_273 in var_271 {
            {
                #[allow(unused_mut)]
                let mut object_274 = array_272.value().start_object();
                crate::json_ser::serialize_structure_crate_model_weighted_target(
                    &mut object_274,
                    item_273,
                )?;
                object_274.finish();
            }
        }
        array_272.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_route_match(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcRouteMatch,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_275) = &input.service_name {
        object.key("serviceName").string(var_275.as_str());
    }
    if let Some(var_276) = &input.method_name {
        object.key("methodName").string(var_276.as_str());
    }
    if let Some(var_277) = &input.metadata {
        let mut array_278 = object.key("metadata").start_array();
        for item_279 in var_277 {
            {
                #[allow(unused_mut)]
                let mut object_280 = array_278.value().start_object();
                crate::json_ser::serialize_structure_crate_model_grpc_route_metadata(
                    &mut object_280,
                    item_279,
                )?;
                object_280.finish();
            }
        }
        array_278.finish();
    }
    if let Some(var_281) = &input.port {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_281).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_retry_policy(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcRetryPolicy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_282) = &input.per_retry_timeout {
        #[allow(unused_mut)]
        let mut object_283 = object.key("perRetryTimeout").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_283, var_282)?;
        object_283.finish();
    }
    if let Some(var_284) = &input.max_retries {
        object.key("maxRetries").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_284).into()),
        );
    }
    if let Some(var_285) = &input.http_retry_events {
        let mut array_286 = object.key("httpRetryEvents").start_array();
        for item_287 in var_285 {
            {
                array_286.value().string(item_287.as_str());
            }
        }
        array_286.finish();
    }
    if let Some(var_288) = &input.tcp_retry_events {
        let mut array_289 = object.key("tcpRetryEvents").start_array();
        for item_290 in var_288 {
            {
                array_289.value().string(item_290.as_str());
            }
        }
        array_289.finish();
    }
    if let Some(var_291) = &input.grpc_retry_events {
        let mut array_292 = object.key("grpcRetryEvents").start_array();
        for item_293 in var_291 {
            {
                array_292.value().string(item_293.as_str());
            }
        }
        array_292.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_grpc_timeout(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GrpcTimeout,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_294) = &input.per_request {
        #[allow(unused_mut)]
        let mut object_295 = object.key("perRequest").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_295, var_294)?;
        object_295.finish();
    }
    if let Some(var_296) = &input.idle {
        #[allow(unused_mut)]
        let mut object_297 = object.key("idle").start_object();
        crate::json_ser::serialize_structure_crate_model_duration(&mut object_297, var_296)?;
        object_297.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_client_policy(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayClientPolicy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_298) = &input.tls {
        #[allow(unused_mut)]
        let mut object_299 = object.key("tls").start_object();
        crate::json_ser::serialize_structure_crate_model_virtual_gateway_client_policy_tls(
            &mut object_299,
            var_298,
        )?;
        object_299.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_health_check_policy(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayHealthCheckPolicy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_300) = &input.timeout_millis {
        object.key("timeoutMillis").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_300).into()),
        );
    }
    if let Some(var_301) = &input.interval_millis {
        object.key("intervalMillis").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_301).into()),
        );
    }
    if let Some(var_302) = &input.protocol {
        object.key("protocol").string(var_302.as_str());
    }
    if input.port != 0 {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.port).into()),
        );
    }
    if let Some(var_303) = &input.path {
        object.key("path").string(var_303.as_str());
    }
    {
        object.key("healthyThreshold").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.healthy_threshold).into()),
        );
    }
    {
        object.key("unhealthyThreshold").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.unhealthy_threshold).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_port_mapping(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayPortMapping,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    {
        object.key("port").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.port).into()),
        );
    }
    if let Some(var_304) = &input.protocol {
        object.key("protocol").string(var_304.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_virtual_gateway_listener_tls(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayListenerTls,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_305) = &input.mode {
        object.key("mode").string(var_305.as_str());
    }
    if let Some(var_306) = &input.validation {
        #[allow(unused_mut)]
        let mut object_307 = object.key("validation").start_object();
        crate::json_ser::serialize_structure_crate_model_virtual_gateway_listener_tls_validation_context(&mut object_307, var_306)?;
        object_307.finish();
    }
    if let Some(var_308) = &input.certificate {
        #[allow(unused_mut)]
        let mut object_309 = object.key("certificate").start_object();
        crate::json_ser::serialize_union_crate_model_virtual_gateway_listener_tls_certificate(
            &mut object_309,
            var_308,
        )?;
        object_309.finish();
    }
    Ok(())
}

pub fn serialize_union_crate_model_virtual_gateway_connection_pool(
    object_176: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayConnectionPool,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    match input {
        crate::model::VirtualGatewayConnectionPool::Http(inner) => {
            #[allow(unused_mut)]
            let mut object_310 = object_176.key("http").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_gateway_http_connection_pool(
                &mut object_310,
                inner,
            )?;
            object_310.finish();
        }
        crate::model::VirtualGatewayConnectionPool::Http2(inner) => {
            #[allow(unused_mut)]
            let mut object_311 = object_176.key("http2").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_gateway_http2_connection_pool(
                &mut object_311,
                inner,
            )?;
            object_311.finish();
        }
        crate::model::VirtualGatewayConnectionPool::Grpc(inner) => {
            #[allow(unused_mut)]
            let mut object_312 = object_176.key("grpc").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_gateway_grpc_connection_pool(
                &mut object_312,
                inner,
            )?;
            object_312.finish();
        }
        crate::model::VirtualGatewayConnectionPool::Unknown => {
            return Err(
                aws_smithy_http::operation::error::SerializationError::unknown_variant(
                    "VirtualGatewayConnectionPool",
                ),
            )
        }
    }
    Ok(())
}

pub fn serialize_union_crate_model_virtual_gateway_access_log(
    object_178: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::VirtualGatewayAccessLog,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    match input {
        crate::model::VirtualGatewayAccessLog::File(inner) => {
            #[allow(unused_mut)]
            let mut object_313 = object_178.key("file").start_object();
            crate::json_ser::serialize_structure_crate_model_virtual_gateway_file_access_log(
                &mut object_313,
                inner,
            )?;
            object_313.finish();
        }
        crate::model::VirtualGatewayAccessLog::Unknown => {
            return Err(
                aws_smithy_http::operation::error::SerializationError::unknown_variant(
                    "VirtualGatewayAccessLog",
                ),
            )
        }
    }
    Ok(())
}

pub fn serialize_structure_crate_model_dns_service_discovery(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::DnsServiceDiscovery,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_314) = &input.hostname {
        object.key("hostname").string(var_314.as_str());
    }
    if let Some(var_315) = &input.response_type {
        object.key("responseType").string(var_315.as_str());
    }
    if let Some(var_316) = &input.ip_preference {
        object.key("ipPreference").string(var_316.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_aws_cloud_map_service_discovery(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::AwsCloudMapServiceDiscovery,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_317) = &input.namespace_name {
        object.key("namespaceName").string(var_317.as_str());
    }
    if let Some(var_318) = &input.service_name {
        object.key("serviceName").string(var_318.as_str());
    }
    if let Some(var_319) = &input.attributes {
        let mut array_320 = object.key("attributes").start_array();
        for item_321 in var_319 {
            {
                #[allow(unused_mut)]
                let mut object_322 = array_320.value().start_object();
                crate::json_ser::serialize_structure_crate_model_aws_cloud_map_instance_attribute(
                    &mut object_322,
                    item_321,
                )?;
                object_322.finish();
            }
        }
        array_320.finish();
    }
    if let Some(var_323) = &input.ip_preference {
        object.key("ipPreference").string(var_323.as_str());
    }
    Ok(())
}

Returns all the &str values of the enum members.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more