greentic_setup/webhook/
instructions.rs1use serde_json::Value;
7
8#[derive(Debug, Clone, serde::Serialize)]
10pub struct ProviderInstruction {
11 pub provider_name: String,
12 pub steps: Vec<String>,
13}
14
15pub fn collect_post_setup_instructions(
20 providers: &[(String, Value)],
21 tenant: &str,
22 team: &str,
23) -> Vec<ProviderInstruction> {
24 let _ = (providers, tenant, team);
25 Vec::new()
26}
27
28pub fn print_post_setup_instructions(providers: &[(String, Value)], tenant: &str, team: &str) {
30 let instructions = collect_post_setup_instructions(providers, tenant, team);
31
32 if instructions.is_empty() {
33 return;
34 }
35
36 println!();
37 println!("──────────────────────────────────────────────────────────");
38 println!(" Manual steps required:");
39 println!("──────────────────────────────────────────────────────────");
40 for instr in &instructions {
41 println!();
42 println!(" [{}]", instr.provider_name);
43 for step in &instr.steps {
44 println!(" {step}");
45 }
46 }
47 println!();
48 println!("──────────────────────────────────────────────────────────");
49}
50
51#[cfg(test)]
52mod tests {
53 use super::collect_post_setup_instructions;
54 use serde_json::json;
55
56 #[test]
57 fn slack_does_not_emit_legacy_manual_app_creation_steps() {
58 let providers = vec![(
59 "messaging-slack".to_string(),
60 json!({
61 "public_base_url": "https://setup.trycloudflare.com",
62 "slack_configuration_access_token": "xoxe-access",
63 "slack_configuration_refresh_token": "xoxe-refresh"
64 }),
65 )];
66
67 let instructions = collect_post_setup_instructions(&providers, "demo", "default");
68
69 assert!(instructions.is_empty());
70 }
71
72 #[test]
73 fn teams_does_not_emit_hardcoded_manual_steps() {
74 let providers = vec![(
75 "messaging-teams".to_string(),
76 json!({
77 "public_base_url": "https://setup.trycloudflare.com",
78 "client_id": "public-client-id"
79 }),
80 )];
81
82 let instructions = collect_post_setup_instructions(&providers, "demo", "default");
83
84 assert!(instructions.is_empty());
85 }
86}