Skip to content

Commit

Permalink
chore(core): Remove Rusoto SDK (#12012)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchsnj authored Apr 1, 2022
1 parent 3568d6a commit baf1afc
Show file tree
Hide file tree
Showing 40 changed files with 190 additions and 1,392 deletions.
126 changes: 1 addition & 125 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,6 @@ tracing-tower = { git = "https://github.com/tokio-rs/tracing", default-features
metrics = { version = "0.17.1", default-features = false, features = ["std"] }
metrics-tracing-context = { version = "0.9.0", default-features = false }

# AWS - Rusoto
rusoto_core = { version = "0.47.0", features = ["encoding"], optional = true }
rusoto_credential = { version = "0.47.0", optional = true }
rusoto_s3 = { version = "0.47.0", optional = true }
rusoto_signature = { version = "0.47.0", optional = true }
rusoto_sqs = { version = "0.47.0", optional = true }
rusoto_sts = { version = "0.47.0", optional = true }

# AWS - Official SDK
aws-config = { version = "0.9.0", optional = true }
aws-types = { version = "0.9.0", optional = true, features = ["hardcoded-credentials"]}
Expand Down Expand Up @@ -373,7 +365,6 @@ target-powerpc64le-unknown-linux-gnu = ["api", "api-client", "enrichment-tables"
# currently doesn't build due to lack of support for 64-bit atomics
target-powerpc-unknown-linux-gnu = ["api", "api-client", "enrichment-tables", "rdkafka/cmake_build", "sinks", "sources", "sources-dnstap", "transforms", "unix", "openssl/vendored", "vrl-cli", "datadog-pipelines"]

rusoto = ["rusoto_core", "rusoto_credential", "rusoto_signature", "rusoto_sts"]
# Enables features that work only on systems providing `cfg(unix)`
unix = ["tikv-jemallocator"]

Expand Down
39 changes: 39 additions & 0 deletions src/aws/auth.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use aws_config::{default_provider::credentials::default_provider, sts::AssumeRoleProviderBuilder};
use aws_types::{credentials::SharedCredentialsProvider, Credentials};
use serde::{Deserialize, Serialize};

/// Configuration for configuring authentication strategy for AWS.
Expand Down Expand Up @@ -25,6 +27,43 @@ pub enum AwsAuthentication {
Default {},
}

impl AwsAuthentication {
pub async fn credentials_provider(&self) -> crate::Result<SharedCredentialsProvider> {
match self {
Self::Static {
access_key_id,
secret_access_key,
} => Ok(SharedCredentialsProvider::new(Credentials::from_keys(
access_key_id,
secret_access_key,
None,
))),
AwsAuthentication::File { .. } => {
Err("Overriding the credentials file is not supported.".into())
}
AwsAuthentication::Role { assume_role } => Ok(SharedCredentialsProvider::new(
AssumeRoleProviderBuilder::new(assume_role)
.build(default_credentials_provider().await),
)),
AwsAuthentication::Default {} => Ok(SharedCredentialsProvider::new(
default_credentials_provider().await,
)),
}
}

#[cfg(test)]
pub fn test_auth() -> AwsAuthentication {
AwsAuthentication::Static {
access_key_id: "dummy".to_string(),
secret_access_key: "dummy".to_string(),
}
}
}

async fn default_credentials_provider() -> SharedCredentialsProvider {
SharedCredentialsProvider::new(default_provider().await)
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
41 changes: 0 additions & 41 deletions src/aws/aws_sdk/auth.rs

This file was deleted.

107 changes: 0 additions & 107 deletions src/aws/aws_sdk/mod.rs

This file was deleted.

20 changes: 0 additions & 20 deletions src/aws/aws_sdk/region.rs

This file was deleted.

Loading

0 comments on commit baf1afc

Please sign in to comment.