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

chore: update aws-sdk to v1 #177

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ default-run = "buffrs-registry"

[dependencies]
async-trait = "0.1.74"
aws-config = { version = "0.56.1", optional = true }
aws-sdk-s3 = { version = "0.34.0", optional = true }
aws-config = { version = "1.0.1", optional = true }
aws-sdk-s3 = { version = "1.4.0", optional = true }
axum_tonic = "0.1.0"
buffrs = { path = "../", version = "0.7.1" }
bytes = "1.5.0"
Expand All @@ -36,7 +36,7 @@ default = ["storage-s3"]
storage-s3 = ["dep:aws-config", "dep:aws-sdk-s3"]

[dev-dependencies]
aws-credential-types = { version = "0.56.1", features = ["hardcoded-credentials"] }
aws-credential-types = { version = "1.0.1", features = ["hardcoded-credentials"] }
proptest = "1.3.1"
rand = "0.8.5"
tempfile = "3.8.1"
Expand Down
15 changes: 11 additions & 4 deletions registry/tests/storage/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! run at most one method under test, and verify the outputs and the bucket side effects.

use super::*;
use aws_config::BehaviorVersion;
use aws_credential_types::Credentials;
use aws_sdk_s3::{
primitives::{ByteStream, SdkBody},
Expand All @@ -25,7 +26,7 @@ fn random_bucket() -> String {
/// Generate a client with test credentials.
async fn minio_client() -> Client {
let credentials = Credentials::from_keys("buffrs", "password", None);
let config = aws_config::from_env()
let config = aws_config::defaults(BehaviorVersion::latest())
.endpoint_url("http://localhost:9000")
.region("us-east-1")
.credentials_provider(credentials)
Expand All @@ -45,18 +46,24 @@ async fn delete_bucket(client: Client, bucket: String) {
.unwrap();

let mut delete_objects: Vec<ObjectIdentifier> = vec![];
for obj in objects.contents().iter().flat_map(|i| i.iter()) {
for obj in objects.contents().iter() {
let obj_id = ObjectIdentifier::builder()
.set_key(Some(obj.key().unwrap().to_string()))
.build();
.build()
.unwrap();
delete_objects.push(obj_id);
}

if !delete_objects.is_empty() {
client
.delete_objects()
.bucket(&bucket)
.delete(Delete::builder().set_objects(Some(delete_objects)).build())
.delete(
Delete::builder()
.set_objects(Some(delete_objects))
.build()
.unwrap(),
)
.send()
.await
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub async fn install() -> miette::Result<()> {
resolved.registry.clone(),
resolved.repository.clone(),
resolved.dependants.len(),
)?);
));

for (index, dependency) in resolved.depends_on.iter().enumerate() {
let tree_char = if index + 1 == resolved.depends_on.len() {
Expand Down
6 changes: 3 additions & 3 deletions src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ impl LockedPackage {
registry: RegistryUri,
repository: String,
dependants: usize,
) -> miette::Result<Self> {
Ok(Self {
) -> Self {
Self {
name: package.name().to_owned(),
registry,
repository,
Expand All @@ -79,7 +79,7 @@ impl LockedPackage {
.map(|d| d.package.clone())
.collect(),
dependants,
})
}
}

/// Validates if another LockedPackage matches this one
Expand Down
4 changes: 1 addition & 3 deletions src/package/compressed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,12 @@ impl Package {
}

/// Lock this package
///
/// Note that despite returning a Result this function never fails
pub fn lock(
&self,
registry: RegistryUri,
repository: String,
dependants: usize,
) -> miette::Result<LockedPackage> {
) -> LockedPackage {
LockedPackage::lock(self, registry, repository, dependants)
}
}
Expand Down