pub enum ExecApprovalRequirement {
Skip {
bypass_sandbox: bool,
proposed_execpolicy_amendment: Option<ExecPolicyAmendment>,
},
NeedsApproval {
reason: Option<String>,
proposed_execpolicy_amendment: Option<ExecPolicyAmendment>,
},
Forbidden {
reason: String,
},
}Expand description
Requirement for approval before executing a command.
This enum represents the outcome of evaluating a command against the execution policy, indicating whether the command can proceed, needs approval, or is forbidden.
Variants§
Skip
Command can be executed without approval.
Fields
proposed_execpolicy_amendment: Option<ExecPolicyAmendment>Proposed policy amendment if the user wants to trust this command.
NeedsApproval
Command requires user approval before execution.
Fields
proposed_execpolicy_amendment: Option<ExecPolicyAmendment>Proposed policy amendment to skip future approvals.
Forbidden
Command is forbidden by policy and cannot be executed.
Implementations§
Source§impl ExecApprovalRequirement
impl ExecApprovalRequirement
Sourcepub fn skip_with_bypass() -> Self
pub fn skip_with_bypass() -> Self
Create a skip requirement with sandbox bypass.
Sourcepub fn needs_approval(reason: impl Into<String>) -> Self
pub fn needs_approval(reason: impl Into<String>) -> Self
Create an approval requirement.
Sourcepub fn needs_approval_with_amendment(
reason: Option<String>,
amendment: ExecPolicyAmendment,
) -> Self
pub fn needs_approval_with_amendment( reason: Option<String>, amendment: ExecPolicyAmendment, ) -> Self
Create a needs approval requirement with an amendment.
Sourcepub fn requires_approval(&self) -> bool
pub fn requires_approval(&self) -> bool
Check if approval is needed.
Sourcepub fn is_forbidden(&self) -> bool
pub fn is_forbidden(&self) -> bool
Check if the command is forbidden.
Sourcepub fn can_proceed(&self) -> bool
pub fn can_proceed(&self) -> bool
Check if the command can proceed (skip or approved).
Sourcepub fn get_amendment(&self) -> Option<&ExecPolicyAmendment>
pub fn get_amendment(&self) -> Option<&ExecPolicyAmendment>
Get the proposed amendment, if any.
Sourcepub fn proposed_execpolicy_amendment(&self) -> Option<&ExecPolicyAmendment>
pub fn proposed_execpolicy_amendment(&self) -> Option<&ExecPolicyAmendment>
Get the proposed exec policy amendment if any (Codex-compatible name).
Trait Implementations§
Source§impl Clone for ExecApprovalRequirement
impl Clone for ExecApprovalRequirement
Source§fn clone(&self) -> ExecApprovalRequirement
fn clone(&self) -> ExecApprovalRequirement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecApprovalRequirement
impl Debug for ExecApprovalRequirement
impl Eq for ExecApprovalRequirement
Source§impl PartialEq for ExecApprovalRequirement
impl PartialEq for ExecApprovalRequirement
impl StructuralPartialEq for ExecApprovalRequirement
Auto Trait Implementations§
impl Freeze for ExecApprovalRequirement
impl RefUnwindSafe for ExecApprovalRequirement
impl Send for ExecApprovalRequirement
impl Sync for ExecApprovalRequirement
impl Unpin for ExecApprovalRequirement
impl UnsafeUnpin for ExecApprovalRequirement
impl UnwindSafe for ExecApprovalRequirement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.