-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: runtime plugin placeholder code to Smithy Orchestrator #2465
Merged
Velfi
merged 6 commits into
main
from
update/add-runtime-plugins-placeholder-api-to-orchestrator
Mar 17, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
15fe1d9
update: add placeholder impl of runtime plugins
Velfi 931518c
add: stub endpoint orchestrator to integration test
Velfi 95c9dd8
add: endpoints runtime plugin to integration test
Velfi 0c89aed
fix: compilation issues
Velfi 3bb98ff
Merge branch 'main' into update/add-runtime-plugins-placeholder-api-t…
Velfi c2264c0
format: run cargo fmt
Velfi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't fully decided yet but we may need to define a separate struct
GetObjectEndpointPlugin
andimpl RuntimePlugin
on that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to get this merged and then assign you to that task.