#[cfg(test)]
mod test {
#[test]
fn test_1() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.ap-east-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-east-1.amazonaws.com")
.build()
);
}
#[test]
fn test_2() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-northeast-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.ap-northeast-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-northeast-1.amazonaws.com")
.build()
);
}
#[test]
fn test_3() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-northeast-2".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.ap-northeast-2.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-northeast-2.amazonaws.com")
.build()
);
}
#[test]
fn test_4() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-northeast-3".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.ap-northeast-3.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-northeast-3.amazonaws.com")
.build()
);
}
#[test]
fn test_5() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-south-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.ap-south-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-south-1.amazonaws.com")
.build()
);
}
#[test]
fn test_6() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-southeast-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.ap-southeast-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-southeast-1.amazonaws.com")
.build()
);
}
#[test]
fn test_7() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ap-southeast-2".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.ap-southeast-2.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ap-southeast-2.amazonaws.com")
.build()
);
}
#[test]
fn test_8() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("ca-central-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.ca-central-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.ca-central-1.amazonaws.com")
.build()
);
}
#[test]
fn test_9() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("eu-central-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.eu-central-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.eu-central-1.amazonaws.com")
.build()
);
}
#[test]
fn test_10() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("eu-north-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.eu-north-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.eu-north-1.amazonaws.com")
.build()
);
}
#[test]
fn test_11() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("eu-south-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.eu-south-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.eu-south-1.amazonaws.com")
.build()
);
}
#[test]
fn test_12() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("eu-west-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.eu-west-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.eu-west-1.amazonaws.com")
.build()
);
}
#[test]
fn test_13() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("eu-west-2".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.eu-west-2.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.eu-west-2.amazonaws.com")
.build()
);
}
#[test]
fn test_14() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("eu-west-3".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.eu-west-3.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.eu-west-3.amazonaws.com")
.build()
);
}
#[test]
fn test_15() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("me-south-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.me-south-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.me-south-1.amazonaws.com")
.build()
);
}
#[test]
fn test_16() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("sa-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.sa-east-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.sa-east-1.amazonaws.com")
.build()
);
}
#[test]
fn test_17() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.us-east-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-east-1.amazonaws.com")
.build()
);
}
#[test]
fn test_18() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-2".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.us-east-2.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-east-2.amazonaws.com")
.build()
);
}
#[test]
fn test_19() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-west-2".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.us-west-2.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-west-2.amazonaws.com")
.build()
);
}
#[test]
fn test_20() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(true)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso-fips.us-east-1.api.aws");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.us-east-1.api.aws")
.build()
);
}
#[test]
fn test_21() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(true)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso-fips.us-east-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.us-east-1.amazonaws.com")
.build()
);
}
#[test]
fn test_22() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(false)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.us-east-1.api.aws");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-east-1.api.aws")
.build()
);
}
#[test]
fn test_23() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("cn-north-1".to_string())
.use_fips(true)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint.expect("Expected valid endpoint: https://portal.sso-fips.cn-north-1.api.amazonwebservices.com.cn");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.cn-north-1.api.amazonwebservices.com.cn")
.build()
);
}
#[test]
fn test_24() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("cn-north-1".to_string())
.use_fips(true)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso-fips.cn-north-1.amazonaws.com.cn");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.cn-north-1.amazonaws.com.cn")
.build()
);
}
#[test]
fn test_25() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("cn-north-1".to_string())
.use_fips(false)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint.expect(
"Expected valid endpoint: https://portal.sso.cn-north-1.api.amazonwebservices.com.cn",
);
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.cn-north-1.api.amazonwebservices.com.cn")
.build()
);
}
#[test]
fn test_26() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("cn-north-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.cn-north-1.amazonaws.com.cn");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.cn-north-1.amazonaws.com.cn")
.build()
);
}
#[test]
fn test_27() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-gov-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.us-gov-east-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-gov-east-1.amazonaws.com")
.build()
);
}
#[test]
fn test_28() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-gov-west-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.us-gov-west-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-gov-west-1.amazonaws.com")
.build()
);
}
#[test]
fn test_29() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-gov-east-1".to_string())
.use_fips(true)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso-fips.us-gov-east-1.api.aws");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.us-gov-east-1.api.aws")
.build()
);
}
#[test]
fn test_30() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-gov-east-1".to_string())
.use_fips(true)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso-fips.us-gov-east-1.amazonaws.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.us-gov-east-1.amazonaws.com")
.build()
);
}
#[test]
fn test_31() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-gov-east-1".to_string())
.use_fips(false)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.us-gov-east-1.api.aws");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-gov-east-1.api.aws")
.build()
);
}
#[test]
fn test_32() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-iso-east-1".to_string())
.use_fips(true)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint.expect_err("expected error: FIPS and DualStack are enabled, but this partition does not support one or both [For region us-iso-east-1 with FIPS enabled and DualStack enabled]");
assert_eq!(
format!("{}", error),
"FIPS and DualStack are enabled, but this partition does not support one or both"
)
}
#[test]
fn test_33() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-iso-east-1".to_string())
.use_fips(true)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso-fips.us-iso-east-1.c2s.ic.gov");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.us-iso-east-1.c2s.ic.gov")
.build()
);
}
#[test]
fn test_34() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-iso-east-1".to_string())
.use_fips(false)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint.expect_err("expected error: DualStack is enabled but this partition does not support DualStack [For region us-iso-east-1 with FIPS disabled and DualStack enabled]");
assert_eq!(
format!("{}", error),
"DualStack is enabled but this partition does not support DualStack"
)
}
#[test]
fn test_35() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-iso-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint =
endpoint.expect("Expected valid endpoint: https://portal.sso.us-iso-east-1.c2s.ic.gov");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-iso-east-1.c2s.ic.gov")
.build()
);
}
#[test]
fn test_36() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-isob-east-1".to_string())
.use_fips(true)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint.expect_err("expected error: FIPS and DualStack are enabled, but this partition does not support one or both [For region us-isob-east-1 with FIPS enabled and DualStack enabled]");
assert_eq!(
format!("{}", error),
"FIPS and DualStack are enabled, but this partition does not support one or both"
)
}
#[test]
fn test_37() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-isob-east-1".to_string())
.use_fips(true)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint.expect(
"Expected valid endpoint: https://portal.sso-fips.us-isob-east-1.sc2s.sgov.gov",
);
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso-fips.us-isob-east-1.sc2s.sgov.gov")
.build()
);
}
#[test]
fn test_38() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-isob-east-1".to_string())
.use_fips(false)
.use_dual_stack(true)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint.expect_err("expected error: DualStack is enabled but this partition does not support DualStack [For region us-isob-east-1 with FIPS disabled and DualStack enabled]");
assert_eq!(
format!("{}", error),
"DualStack is enabled but this partition does not support DualStack"
)
}
#[test]
fn test_39() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-isob-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint
.expect("Expected valid endpoint: https://portal.sso.us-isob-east-1.sc2s.sgov.gov");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://portal.sso.us-isob-east-1.sc2s.sgov.gov")
.build()
);
}
#[test]
fn test_40() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(false)
.use_dual_stack(false)
.endpoint("https://example.com".to_string())
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://example.com")
.build()
);
}
#[test]
fn test_41() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.use_fips(false)
.use_dual_stack(false)
.endpoint("https://example.com".to_string())
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
assert_eq!(
endpoint,
aws_smithy_types::endpoint::Endpoint::builder()
.url("https://example.com")
.build()
);
}
#[test]
fn test_42() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(true)
.use_dual_stack(false)
.endpoint("https://example.com".to_string())
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint.expect_err("expected error: Invalid Configuration: FIPS and custom endpoint are not supported [For custom endpoint with fips enabled and dualstack disabled]");
assert_eq!(
format!("{}", error),
"Invalid Configuration: FIPS and custom endpoint are not supported"
)
}
#[test]
fn test_43() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.region("us-east-1".to_string())
.use_fips(false)
.use_dual_stack(true)
.endpoint("https://example.com".to_string())
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint.expect_err("expected error: Invalid Configuration: Dualstack and custom endpoint are not supported [For custom endpoint with fips disabled and dualstack enabled]");
assert_eq!(
format!("{}", error),
"Invalid Configuration: Dualstack and custom endpoint are not supported"
)
}
#[test]
fn test_44() {
use aws_smithy_http::endpoint::ResolveEndpoint;
let params = crate::endpoint::Params::builder()
.build()
.expect("invalid params");
let resolver = crate::endpoint::DefaultResolver::new();
let endpoint = resolver.resolve_endpoint(¶ms);
let error = endpoint
.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
assert_eq!(
format!("{}", error),
"Invalid Configuration: Missing Region"
)
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Params {
pub(crate) region: std::option::Option<std::string::String>,
pub(crate) use_dual_stack: bool,
pub(crate) use_fips: bool,
pub(crate) endpoint: std::option::Option<std::string::String>,
}
impl Params {
pub fn builder() -> crate::endpoint::ParamsBuilder {
crate::endpoint::ParamsBuilder::default()
}
pub fn region(&self) -> std::option::Option<&str> {
self.region.as_deref()
}
pub fn use_dual_stack(&self) -> std::option::Option<bool> {
Some(self.use_dual_stack)
}
pub fn use_fips(&self) -> std::option::Option<bool> {
Some(self.use_fips)
}
pub fn endpoint(&self) -> std::option::Option<&str> {
self.endpoint.as_deref()
}
}
#[derive(Default)]
pub struct DefaultResolver {
partition_resolver: crate::endpoint_lib::partition::PartitionResolver,
}
impl DefaultResolver {
pub fn new() -> Self {
Self { partition_resolver: crate::endpoint_lib::partition::PartitionResolver::new_from_json(b"{\"version\":\"1.1\",\"partitions\":[{\"id\":\"aws\",\"regionRegex\":\"^(us|eu|ap|sa|ca|me|af)-\\\\w+-\\\\d+$\",\"regions\":{\"af-south-1\":{},\"ap-east-1\":{},\"ap-northeast-1\":{},\"ap-northeast-2\":{},\"ap-northeast-3\":{},\"ap-south-1\":{},\"ap-southeast-1\":{},\"ap-southeast-2\":{},\"ap-southeast-3\":{},\"ca-central-1\":{},\"eu-central-1\":{},\"eu-north-1\":{},\"eu-south-1\":{},\"eu-west-1\":{},\"eu-west-2\":{},\"eu-west-3\":{},\"me-central-1\":{},\"me-south-1\":{},\"sa-east-1\":{},\"us-east-1\":{},\"us-east-2\":{},\"us-west-1\":{},\"us-west-2\":{},\"aws-global\":{}},\"outputs\":{\"name\":\"aws\",\"dnsSuffix\":\"amazonaws.com\",\"dualStackDnsSuffix\":\"api.aws\",\"supportsFIPS\":true,\"supportsDualStack\":true}},{\"id\":\"aws-us-gov\",\"regionRegex\":\"^us\\\\-gov\\\\-\\\\w+\\\\-\\\\d+$\",\"regions\":{\"us-gov-west-1\":{},\"us-gov-east-1\":{},\"aws-us-gov-global\":{}},\"outputs\":{\"name\":\"aws-us-gov\",\"dnsSuffix\":\"amazonaws.com\",\"dualStackDnsSuffix\":\"api.aws\",\"supportsFIPS\":true,\"supportsDualStack\":true}},{\"id\":\"aws-cn\",\"regionRegex\":\"^cn\\\\-\\\\w+\\\\-\\\\d+$\",\"regions\":{\"cn-north-1\":{},\"cn-northwest-1\":{},\"aws-cn-global\":{}},\"outputs\":{\"name\":\"aws-cn\",\"dnsSuffix\":\"amazonaws.com.cn\",\"dualStackDnsSuffix\":\"api.amazonwebservices.com.cn\",\"supportsFIPS\":true,\"supportsDualStack\":true}},{\"id\":\"aws-iso\",\"regionRegex\":\"^us\\\\-iso\\\\-\\\\w+\\\\-\\\\d+$\",\"outputs\":{\"name\":\"aws-iso\",\"dnsSuffix\":\"c2s.ic.gov\",\"supportsFIPS\":true,\"supportsDualStack\":false,\"dualStackDnsSuffix\":\"c2s.ic.gov\"},\"regions\":{\"us-iso-east-1\":{},\"us-iso-west-1\":{},\"aws-iso-global\":{}}},{\"id\":\"aws-iso-b\",\"regionRegex\":\"^us\\\\-isob\\\\-\\\\w+\\\\-\\\\d+$\",\"outputs\":{\"name\":\"aws-iso-b\",\"dnsSuffix\":\"sc2s.sgov.gov\",\"supportsFIPS\":true,\"supportsDualStack\":false,\"dualStackDnsSuffix\":\"sc2s.sgov.gov\"},\"regions\":{\"us-isob-east-1\":{},\"aws-iso-b-global\":{}}}]}").expect("valid JSON") }
}
}
impl aws_smithy_http::endpoint::ResolveEndpoint<crate::endpoint::Params> for DefaultResolver {
fn resolve_endpoint(&self, params: &Params) -> aws_smithy_http::endpoint::Result {
let mut diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
crate::endpoint::internals::resolve_endpoint(
params,
&mut diagnostic_collector,
&self.partition_resolver,
)
.map_err(|err| err.with_source(diagnostic_collector.take_last_error()))
}
}
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct ParamsBuilder {
region: std::option::Option<std::string::String>,
use_dual_stack: std::option::Option<bool>,
use_fips: std::option::Option<bool>,
endpoint: std::option::Option<std::string::String>,
}
impl ParamsBuilder {
pub fn build(self) -> Result<crate::endpoint::Params, crate::endpoint::InvalidParams> {
Ok(
#[allow(clippy::unnecessary_lazy_evaluations)]
crate::endpoint::Params {
region: self.region,
use_dual_stack: self
.use_dual_stack
.or_else(|| Some(false))
.ok_or_else(|| crate::endpoint::InvalidParams::missing("use_dual_stack"))?,
use_fips: self
.use_fips
.or_else(|| Some(false))
.ok_or_else(|| crate::endpoint::InvalidParams::missing("use_fips"))?,
endpoint: self.endpoint,
},
)
}
pub fn region(mut self, value: impl Into<std::string::String>) -> Self {
self.region = Some(value.into());
self
}
pub fn set_region(mut self, param: Option<std::string::String>) -> Self {
self.region = param;
self
}
pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
self.use_dual_stack = Some(value.into());
self
}
pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
self.use_dual_stack = param;
self
}
pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
self.use_fips = Some(value.into());
self
}
pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
self.use_fips = param;
self
}
pub fn endpoint(mut self, value: impl Into<std::string::String>) -> Self {
self.endpoint = Some(value.into());
self
}
pub fn set_endpoint(mut self, param: Option<std::string::String>) -> Self {
self.endpoint = param;
self
}
}
#[derive(Debug)]
pub struct InvalidParams {
field: std::borrow::Cow<'static, str>,
}
impl InvalidParams {
#[allow(dead_code)]
fn missing(field: &'static str) -> Self {
Self {
field: field.into(),
}
}
}
impl std::fmt::Display for InvalidParams {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "a required field was missing: `{}`", self.field)
}
}
impl std::error::Error for InvalidParams {}
mod internals;