Skip to content

Commit

Permalink
feat(upload): Attempt delegated tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Feb 9, 2024
1 parent e0e901d commit a17e3b6
Show file tree
Hide file tree
Showing 16 changed files with 519 additions and 1,165 deletions.
244 changes: 41 additions & 203 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ repository = "https://github.com/beyondessential/ops"
aws-config = "1.1.2"
aws-credential-types = { version = "1.1.2", features = ["hardcoded-credentials"] }
aws-sdk-s3 = "1.12.0"
aws-sdk-sts = "1.11.0"
base64ct = { version = "1.6.0", features = ["std"] }
boxcar = "0.2.4"
bytes = "1.5.0"
bytesize = "1.3.0"
chrono = "0.4.31"
clap = { version = "4.4.18", features = ["derive", "cargo", "wrap_help", "env", "unicode", "string"] }
clap_complete = "4.4.8"
clap_complete_nushell = "4.4.2"
dirs = "5.0.1"
duct = "0.13.7"
flate2 = "1.0.28"
glob = "0.3.1"
humantime = "2.1.0"
indicatif = { version = "0.17.7", features = ["tokio"] }
Expand All @@ -34,14 +33,13 @@ leon = "2.0.1"
leon-macros = "1.0.0"
miette = { version = "5.10.0", features = ["fancy"] }
mimalloc = "0.1.39"
minicbor = { version = "0.20.0", features = ["derive", "std"] }
node-semver = "2.1.0"
reqwest = { version = "0.11.23", default-features = false, features = ["rustls-tls-native-roots", "gzip", "json"] }
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
tokio = { version = "1.35.1", features = ["full"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
walkdir = "2.4.0"

[build-dependencies]
build-data = "0.1.5"
Expand Down
2 changes: 1 addition & 1 deletion src/actions/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use tracing::Metadata;
use tracing_subscriber::fmt::MakeWriter;

use super::upload::token::UploadId;
use super::upload::UploadId;

#[derive(Clone, Debug)]
pub struct Context<A = (), B = ()> {
Expand Down
29 changes: 13 additions & 16 deletions src/actions/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ use miette::Result;

use super::Context;

pub mod cancel;
pub mod confirm;
pub mod file;
pub mod delegate;
pub mod files;
pub mod list;
pub mod preauth;
pub mod status;
pub mod token;

/// Upload files to S3.
#[derive(Debug, Clone, Parser)]
Expand All @@ -21,21 +17,22 @@ pub struct UploadArgs {

#[derive(Debug, Clone, Subcommand)]
pub enum UploadAction {
Cancel(cancel::CancelArgs),
Confirm(confirm::ConfirmArgs),
File(file::FileArgs),
Files(files::FilesArgs),
List(list::ListArgs),
Preauth(preauth::PreauthArgs),
Status(status::StatusArgs),
Delegate(delegate::DelegateArgs),
}

pub async fn run(ctx: Context<UploadArgs>) -> Result<()> {
match ctx.args_top.action.clone() {
UploadAction::Cancel(subargs) => cancel::run(ctx.with_sub(subargs)).await,
UploadAction::Confirm(subargs) => confirm::run(ctx.with_sub(subargs)).await,
UploadAction::File(subargs) => file::run(ctx.with_sub(subargs)).await,
UploadAction::Files(subargs) => files::run(ctx.with_sub(subargs)).await,
UploadAction::List(subargs) => list::run(ctx.with_sub(subargs)).await,
UploadAction::Preauth(subargs) => preauth::run(ctx.with_sub(subargs)).await,
UploadAction::Status(subargs) => status::run(ctx.with_sub(subargs)).await,
UploadAction::Delegate(subargs) => delegate::run(ctx.with_sub(subargs)).await,
}
}

#[derive(Debug, Clone)]
pub struct UploadId {
pub bucket: String,
pub key: String,
pub id: String,
}
87 changes: 0 additions & 87 deletions src/actions/upload/cancel.rs

This file was deleted.

92 changes: 0 additions & 92 deletions src/actions/upload/confirm.rs

This file was deleted.

Loading

0 comments on commit a17e3b6

Please sign in to comment.