ephemeris_forge_github/operation/
variables.rs1use std::fmt;
2
3use crate::api::request::VariableScope;
4
5#[derive(Clone, Debug, Eq, PartialEq)]
7pub enum Operation {
8 Create {
10 scope: VariableScope,
12 name: String,
14 value: String,
16 },
17 Update {
19 scope: VariableScope,
21 name: String,
23 value: String,
25 },
26 Delete {
28 scope: VariableScope,
30 name: String,
32 },
33}
34
35impl fmt::Display for Operation {
36 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37 let (Self::Create {
38 scope,
39 name,
40 value: _,
41 }
42 | Self::Update {
43 scope,
44 name,
45 value: _,
46 }
47 | Self::Delete { scope, name }) = self;
48 match scope {
49 VariableScope::Repository => write!(f, "variable {name}"),
50 VariableScope::Environment(environment) => {
51 write!(f, "environment {environment} variable {name}")
52 }
53 }
54 }
55}