Skip to content

Commit

Permalink
add: WIP for smithy orchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
Velfi committed Mar 10, 2023
1 parent 2f60a5e commit 4753875
Show file tree
Hide file tree
Showing 26 changed files with 2,773 additions and 24 deletions.
1 change: 1 addition & 0 deletions aws/sdk/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ members = [
"sts",
"transcribestreaming",
"using-native-tls-instead-of-rustls",
"smithy_orchestrator"
]
26 changes: 26 additions & 0 deletions aws/sdk/integration-tests/smithy_orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "smithy_orchestrator"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] }
aws-config = { path = "../../build/aws-sdk/sdk/aws-config" }
aws-http = { path = "../../build/aws-sdk/sdk/aws-http" }
aws-sigv4 = { path = "../../build/aws-sdk/sdk/aws-sigv4" }
aws-sdk-s3 = { path = "../../build/aws-sdk/sdk/s3" }
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async", features = ["rt-tokio"] }
aws-smithy-client = { path = "../../build/aws-sdk/sdk/aws-smithy-client" }
aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" }
aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" }
aws-smithy-interceptor = { path = "../../build/aws-sdk/sdk/aws-smithy-interceptor" }
aws-smithy-orchestrator = { path = "../../build/aws-sdk/sdk/aws-smithy-orchestrator" }
aws-smithy-token-bucket = { path = "../../build/aws-sdk/sdk/aws-smithy-token-bucket" }
aws-types = { path = "../../build/aws-sdk/sdk/aws-types" }
tokio = { version = "1.8.4", features = ["macros", "test-util", "rt-multi-thread"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.15", features = ["env-filter", "json"] }
http = "0.2.3"
http-body = "0.4.5"
54 changes: 54 additions & 0 deletions aws/sdk/integration-tests/smithy_orchestrator/src/auth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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_orchestrator::{AuthOrchestrator, BoxErr, ConfigBag};

pub struct GetObjectAuthOrc {}

impl GetObjectAuthOrc {
pub fn new() -> Self {
Self {}
}
}

impl AuthOrchestrator<http::Request<SdkBody>> for GetObjectAuthOrc {
fn auth_request(
&self,
req: &mut http::Request<SdkBody>,
cfg: &ConfigBag,
) -> Result<(), BoxErr> {
todo!()
}
}

// signer: Arc::new(|req: &mut http::Request<SdkBody>, props: &PropertyBag| {
// use aws_smithy_orchestrator::auth::error::Error;
//
// let signer = SigV4Signer::new();
// let operation_config = props
// .get::<OperationSigningConfig>()
// .ok_or(Error::SignRequest("missing signing config".into()))?;
//
// let (operation_config, request_config, creds) = match &operation_config
// .signing_requirements
// {
// SigningRequirements::Disabled => return Ok(()),
// SigningRequirements::Optional => {
// match aws_sig_auth::middleware::signing_config(props) {
// Ok(parts) => parts,
// Err(_) => return Ok(()),
// }
// }
// SigningRequirements::Required => aws_sig_auth::middleware::signing_config(props)
// .map_err(|err| Error::SignRequest(Box::new(err)))?,
// };
//
// let _signature = signer
// .sign(&operation_config, &request_config, &creds, req)
// .expect("signing goes just fine");
//
// Ok(())
// }),
32 changes: 32 additions & 0 deletions aws/sdk/integration-tests/smithy_orchestrator/src/conn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

use aws_smithy_client::conns::Https;
use aws_smithy_client::hyper_ext::Adapter;
use aws_smithy_http::body::SdkBody;
use aws_smithy_orchestrator::{BoxFallibleFut, ConfigBag, Connection};

pub struct HyperConnection {
adapter: Adapter<Https>,
}

impl HyperConnection {
pub fn new() -> Self {
Self {
adapter: Adapter::builder().build(aws_smithy_client::conns::https()),
}
}
}

impl Connection<http::Request<SdkBody>, http::Response<SdkBody>> for HyperConnection {
fn call(
&self,
req: &mut http::Request<SdkBody>,
cfg: &ConfigBag,
) -> BoxFallibleFut<http::Response<SdkBody>> {
todo!("hyper's connector wants to take ownership of req");
// self.adapter.call(req)
}
}
Loading

0 comments on commit 4753875

Please sign in to comment.