Skip to content
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

Feature: Add smithy orchestrator #2447

Merged
merged 21 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws/sdk/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# `./gradlew -Paws.fullsdk=true :aws:sdk:assemble` these tests are copied into their respective Service crates.
[workspace]
members = [
"aws-smithy-runtime-test",
"dynamodb",
"ec2",
"glacier",
Expand Down
25 changes: 25 additions & 0 deletions aws/sdk/integration-tests/aws-smithy-runtime-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "aws-smithy-runtime-test"
version = "0.1.0"
edition = "2021"
publish = false
# 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-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime" }
aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api" }
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"
55 changes: 55 additions & 0 deletions aws/sdk/integration-tests/aws-smithy-runtime-test/src/auth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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::{AuthOrchestrator, BoxError, ConfigBag};

#[derive(Debug)]
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<(), BoxError> {
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(())
// }),
33 changes: 33 additions & 0 deletions aws/sdk/integration-tests/aws-smithy-runtime-test/src/conn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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_runtime::{BoxFallibleFut, ConfigBag, Connection};

#[derive(Debug)]
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