-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: runtime plugin placeholder code to Smithy Orchestrator (#2465)
* update: add placeholder impl of runtime plugins update: separate client and operation interceptors * add: stub endpoint orchestrator to integration test * add: endpoints runtime plugin to integration test * fix: compilation issues * format: run cargo fmt
- Loading branch information
Showing
14 changed files
with
465 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
aws/sdk/integration-tests/aws-smithy-runtime-test/src/endpoints.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
use aws_smithy_http::body::SdkBody; | ||
use aws_smithy_runtime::{BoxError, EndpointOrchestrator}; | ||
use aws_smithy_runtime_api::config_bag::ConfigBag; | ||
use aws_smithy_runtime_api::runtime_plugin::RuntimePlugin; | ||
|
||
#[derive(Debug)] | ||
pub struct GetObjectEndpointOrc {} | ||
|
||
impl GetObjectEndpointOrc { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl RuntimePlugin for GetObjectEndpointOrc { | ||
fn configure(&self, _cfg: &mut ConfigBag) -> Result<(), BoxError> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl EndpointOrchestrator<http::Request<SdkBody>> for GetObjectEndpointOrc { | ||
fn resolve_and_apply_endpoint( | ||
&self, | ||
_req: &mut http::Request<SdkBody>, | ||
_cfg: &ConfigBag, | ||
) -> Result<(), BoxError> { | ||
todo!() | ||
// let endpoint = endpoint_resolver.resolve_endpoint(&endpoint_parameters)?; | ||
// let (tx_req, props) = ctx | ||
// .tx_request_mut() | ||
// .expect("We call this after setting the tx request"); | ||
// | ||
// // Apply the endpoint | ||
// let uri: Uri = endpoint.url().parse().map_err(|err| { | ||
// ResolveEndpointError::from_source("endpoint did not have a valid uri", err) | ||
// })?; | ||
// apply_endpoint(tx_req.uri_mut(), &uri, props.get::<EndpointPrefix>()).map_err(|err| { | ||
// ResolveEndpointError::message(format!( | ||
// "failed to apply endpoint `{:?}` to request `{:?}`", | ||
// uri, tx_req | ||
// )) | ||
// .with_source(Some(err.into())) | ||
// })?; | ||
// for (header_name, header_values) in endpoint.headers() { | ||
// tx_req.headers_mut().remove(header_name); | ||
// for value in header_values { | ||
// tx_req.headers_mut().insert( | ||
// HeaderName::from_str(header_name).map_err(|err| { | ||
// ResolveEndpointError::message("invalid header name") | ||
// .with_source(Some(err.into())) | ||
// })?, | ||
// HeaderValue::from_str(value).map_err(|err| { | ||
// ResolveEndpointError::message("invalid header value") | ||
// .with_source(Some(err.into())) | ||
// })?, | ||
// ); | ||
// } | ||
// } | ||
} | ||
|
||
fn resolve_auth_schemes(&self) -> Result<Vec<String>, BoxError> { | ||
todo!() | ||
|
||
// let endpoint = endpoint_resolver | ||
// .resolve_endpoint(params) | ||
// .map_err(SdkError::construction_failure)?; | ||
// let auth_schemes = match endpoint.properties().get("authSchemes") { | ||
// Some(Document::Array(schemes)) => schemes, | ||
// None => { | ||
// return Ok(vec![]); | ||
// } | ||
// _other => { | ||
// return Err(SdkError::construction_failure( | ||
// "expected bad things".to_string(), | ||
// )); | ||
// } | ||
// }; | ||
// let auth_schemes = auth_schemes | ||
// .iter() | ||
// .flat_map(|doc| match doc { | ||
// Document::Object(map) => Some(map), | ||
// _ => None, | ||
// }) | ||
// .map(|it| { | ||
// let name = match it.get("name") { | ||
// Some(Document::String(s)) => Some(s.as_str()), | ||
// _ => None, | ||
// }; | ||
// AuthSchemeOptions::new( | ||
// name.unwrap().to_string(), | ||
// /* there are no identity properties yet */ | ||
// None, | ||
// Some(Document::Object(it.clone())), | ||
// ) | ||
// }) | ||
// .collect::<Vec<_>>(); | ||
// Ok(auth_schemes) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.