add Docker credentials to app and CLI

This commit is contained in:
2024-09-19 11:14:34 -04:00
parent 12c97c4a7d
commit b88b32d0f1
8 changed files with 251 additions and 7 deletions

View File

@ -0,0 +1,10 @@
use std::io;
use crate::proto::DockerCredential;
pub fn docker_store() -> anyhow::Result<()> {
let input: DockerCredential = serde_json::from_reader(io::stdin())?;
dbg!(input);
Ok(())
}

View File

@ -22,6 +22,8 @@ use crate::proto::{
ShortcutAction,
};
mod docker;
#[derive(Debug, Parser)]
#[command(
@ -200,11 +202,11 @@ pub fn invoke_shortcut(args: InvokeArgs, global: GlobalArgs) -> anyhow::Result<(
pub fn docker_credential_helper(cmd: DockerCmd) -> anyhow::Result<()> {
let req = match cmd {
match cmd {
DockerCmd::Get => todo!(),
DockerCmd::Store => todo!(),
DockerCmd::Store => docker::docker_store(),
DockerCmd::Erase => todo!(),
};
}
}

View File

@ -41,6 +41,7 @@ impl Display for CliResponse {
match self {
CliResponse::Credential(CliCredential::AwsBase(_)) => write!(f, "Credential (AwsBase)"),
CliResponse::Credential(CliCredential::AwsSession(_)) => write!(f, "Credential (AwsSession)"),
CliResponse::Credential(CliCredential::Docker(_)) => write!(f, "Credential (Docker)"),
CliResponse::Empty => write!(f, "Empty"),
}
}
@ -84,7 +85,7 @@ fn default_aws_version() -> usize { 1 }
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DockerCredential {
#[serde(rename = "PascalCase")]
#[serde(rename = "ServerURL")]
pub server_url: String,
pub username: String,
pub secret: String,