Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Wells <[email protected]>
  • Loading branch information
andrewmwells-amazon committed Nov 21, 2024
1 parent 630c3aa commit 3ce65ee
Showing 1 changed file with 3 additions and 47 deletions.
50 changes: 3 additions & 47 deletions cedar-policy-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ pub enum Commands {
New(NewArgs),
/// Partially evaluate an authorization request
PartiallyAuthorize(PartiallyAuthorizeArgs),
/// Ouput JSON file for consumption by Lean
/// Ouput a JSON file for consumption by Lean
#[command(subcommand)]
WriteDRTJson(serialization::AnalysisCommands),
/// Output protobuf binary file for consuption by Lean
/// Output a protobuf binary file for consumption by Lean
#[cfg(feature = "protobufs")]
#[command(subcommand)]
WriteDRTProto(serialization::AnalysisCommands),
/// Output protobuf binary file for consuption by Lean
/// Output a protobuf binary file for consumption by Lean
#[cfg(feature = "protobufs")]
#[command(subcommand)]
WriteDRTProtoFromJSON(serialization::AnalyzeCommandsFromJson),
Expand Down Expand Up @@ -1627,54 +1627,10 @@ pub mod serialization {
/// Policy id we failed to find
id: cedar_policy_core::ast::PolicyID,
},

/// Error we can't report to avoid logging PII
#[error("Anonymous error: {s}")]
Anonymous { s: String },
}

type Result<T> = std::result::Result<T, CliError>;

/// This represents multiple ways to specify a pair of policies.
#[derive(Args, Debug)]
pub struct PolicyPairArgs {
/// File containing the first policy (and no other policies)
#[arg(
long = "policy1",
value_name = "FILE",
conflicts_with = "policies",
requires = "policy2"
)]
policy1_file: Option<PathBuf>,
/// File containing the second policy (and no other policies)
#[arg(
long = "policy2",
value_name = "FILE",
conflicts_with = "policies",
requires = "policy1"
)]
policy2_file: Option<PathBuf>,
/// File containing policies to analyze. Use with --id1 and --id2
#[clap(short, long = "policies", value_name = "FILE", requires = "id1")]
policies_file: Option<PathBuf>,
/// id of the first policy
#[arg(
long = "id1",
value_name = "ID",
conflicts_with = "policy1",
requires = "id2"
)]
id1: Option<String>,
/// id of the second policy
#[arg(
long = "id2",
value_name = "ID",
conflicts_with = "policy2",
requires = "id1"
)]
id2: Option<String>,
}

#[derive(Args, Debug)]
pub struct AnalyzeCommandsFromJsonArgs {
#[arg(short, long = "json", value_name = "String")]
Expand Down

0 comments on commit 3ce65ee

Please sign in to comment.