aws_sdk_databrew/config/endpoint/
internals.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(
3    clippy::collapsible_if,
4    clippy::bool_comparison,
5    clippy::nonminimal_bool,
6    clippy::comparison_to_empty,
7    clippy::redundant_pattern_matching,
8    clippy::useless_asref
9)]
10pub(super) fn resolve_endpoint(
11    _params: &crate::config::endpoint::Params,
12    _diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector,
13    partition_resolver: &crate::endpoint_lib::partition::PartitionResolver,
14) -> ::aws_smithy_http::endpoint::Result {
15    #[allow(unused_variables)]
16    let region = &_params.region;
17    #[allow(unused_variables)]
18    let use_dual_stack = &_params.use_dual_stack;
19    #[allow(unused_variables)]
20    let use_fips = &_params.use_fips;
21    #[allow(unused_variables)]
22    let endpoint = &_params.endpoint;
23    #[allow(unused_variables)]
24    if let Some(endpoint) = endpoint {
25        if (*use_fips) == (true) {
26            return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(
27                "Invalid Configuration: FIPS and custom endpoint are not supported".to_string(),
28            ));
29        }
30        if (*use_dual_stack) == (true) {
31            return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(
32                "Invalid Configuration: Dualstack and custom endpoint are not supported".to_string(),
33            ));
34        }
35        return Ok(::aws_smithy_types::endpoint::Endpoint::builder().url(endpoint.to_owned()).build());
36    }
37    #[allow(unused_variables)]
38    if let Some(region) = region {
39        #[allow(unused_variables)]
40        if let Some(partition_result) = partition_resolver.resolve_partition(region.as_ref() as &str, _diagnostic_collector) {
41            if (*use_fips) == (true) {
42                if (*use_dual_stack) == (true) {
43                    if (true) == (partition_result.supports_fips()) {
44                        if (true) == (partition_result.supports_dual_stack()) {
45                            return Ok(::aws_smithy_types::endpoint::Endpoint::builder()
46                                .url({
47                                    let mut out = String::new();
48                                    out.push_str("https://databrew-fips.");
49                                    #[allow(clippy::needless_borrow)]
50                                    out.push_str(&region.as_ref() as &str);
51                                    out.push('.');
52                                    #[allow(clippy::needless_borrow)]
53                                    out.push_str(&partition_result.dual_stack_dns_suffix());
54                                    out
55                                })
56                                .build());
57                        }
58                    }
59                    return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(
60                        "FIPS and DualStack are enabled, but this partition does not support one or both".to_string(),
61                    ));
62                }
63            }
64            if (*use_fips) == (true) {
65                if (partition_result.supports_fips()) == (true) {
66                    if (region.as_ref() as &str) == ("us-gov-west-1") {
67                        return Ok(::aws_smithy_types::endpoint::Endpoint::builder()
68                            .url("https://databrew.us-gov-west-1.amazonaws.com".to_string())
69                            .build());
70                    }
71                    return Ok(::aws_smithy_types::endpoint::Endpoint::builder()
72                        .url({
73                            let mut out = String::new();
74                            out.push_str("https://databrew-fips.");
75                            #[allow(clippy::needless_borrow)]
76                            out.push_str(&region.as_ref() as &str);
77                            out.push('.');
78                            #[allow(clippy::needless_borrow)]
79                            out.push_str(&partition_result.dns_suffix());
80                            out
81                        })
82                        .build());
83                }
84                return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(
85                    "FIPS is enabled but this partition does not support FIPS".to_string(),
86                ));
87            }
88            if (*use_dual_stack) == (true) {
89                if (true) == (partition_result.supports_dual_stack()) {
90                    return Ok(::aws_smithy_types::endpoint::Endpoint::builder()
91                        .url({
92                            let mut out = String::new();
93                            out.push_str("https://databrew.");
94                            #[allow(clippy::needless_borrow)]
95                            out.push_str(&region.as_ref() as &str);
96                            out.push('.');
97                            #[allow(clippy::needless_borrow)]
98                            out.push_str(&partition_result.dual_stack_dns_suffix());
99                            out
100                        })
101                        .build());
102                }
103                return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(
104                    "DualStack is enabled but this partition does not support DualStack".to_string(),
105                ));
106            }
107            return Ok(::aws_smithy_types::endpoint::Endpoint::builder()
108                .url({
109                    let mut out = String::new();
110                    out.push_str("https://databrew.");
111                    #[allow(clippy::needless_borrow)]
112                    out.push_str(&region.as_ref() as &str);
113                    out.push('.');
114                    #[allow(clippy::needless_borrow)]
115                    out.push_str(&partition_result.dns_suffix());
116                    out
117                })
118                .build());
119        }
120        #[allow(unreachable_code)]
121        return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(format!(
122            "No rules matched these parameters. This is a bug. {:?}",
123            _params
124        )));
125    }
126    return Err(::aws_smithy_http::endpoint::ResolveEndpointError::message(
127        "Invalid Configuration: Missing Region".to_string(),
128    ));
129}