Skip to content

Commit

Permalink
Feature: Add smithy orchestrator (#2447)
Browse files Browse the repository at this point in the history
* add: WIP for smithy orchestrator

* add: publish = false to the new, unreleased crates

* undo: more extraneous changes

* fix: correctly declare `publish = false`

* feature: add layered config bag

* Update aws/sdk/integration-tests/smithy_orchestrator/Cargo.toml

Co-authored-by: John DiSanti <[email protected]>

* add: READMEs to new crates
add: external-types.toml to new crates
add: LICENSEs to new crates
update: crate organization and naming
update: interceptor errors per RFC 22
update: token bucket errors per RFC 22

* fix: bad imports in integration test

* fix: error struct naming

* fix: err source issue

* fix: clippy lints
fix: TODOs with no subject

* fix: broken token bucket test
add: docs.rs metadata to cargo toml of new crates

* update: crate naming

* fix: broken test import

* fix: cargo doc issues

* update: aws-smithy-runtime external-types.toml

* remove: unused deps
fix: move allowed external types to correct crate

* add: exception for aws_smithy_types

---------

Co-authored-by: Russell Cohen <[email protected]>
Co-authored-by: John DiSanti <[email protected]>
  • Loading branch information
3 people authored Mar 14, 2023
1 parent c3c747a commit bde362e
Show file tree
Hide file tree
Showing 31 changed files with 3,322 additions and 4 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 @@ -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

0 comments on commit bde362e

Please sign in to comment.