stackless_integrations/providers/sentry/
seer.rs1use std::collections::BTreeMap;
7
8use serde::Serialize;
9use stackless_stripe_projects::catalog::verify::CatalogService;
10use stackless_stripe_projects::provision::ProvisionContext;
11
12use super::FamilyResource;
13use crate::error::IntegrationError;
14use crate::hostable::{ConfigScope, Hostable, IntegrationHosting};
15
16pub const RESOURCE_KIND: &str = "integration-sentry-seer";
17
18#[derive(Debug, Serialize)]
19pub struct SentrySeerConfig {}
20
21impl CatalogService for SentrySeerConfig {
22 const REFERENCE: &'static str = "sentry/seer";
23}
24
25#[derive(Debug)]
26pub struct SentrySeer;
27
28impl Hostable for SentrySeer {
29 const PROVIDER: &'static str = "sentry-seer";
30 const HOSTING: IntegrationHosting = IntegrationHosting::Managed;
31 const CONFIG_SCOPE: ConfigScope = ConfigScope::GlobalOnly;
32 const RESOURCE_KIND: &'static str = RESOURCE_KIND;
33 const OUTPUTS: &'static [&'static str] = &[];
34}
35
36impl FamilyResource for SentrySeer {
37 type Config = SentrySeerConfig;
38 const PROVIDER_PREFIX: &'static str = "SENTRY";
39 const OUTPUT_FIELDS: &'static [(&'static str, &'static str, bool)] = &[];
41
42 fn build_config(ctx: &ProvisionContext<'_>) -> Result<SentrySeerConfig, IntegrationError> {
43 let _ = super::integration_config(ctx)?;
44 Ok(SentrySeerConfig {})
45 }
46}
47
48pub fn validate_config(
49 name: &str,
50 config: &BTreeMap<String, toml::Value>,
51) -> Result<(), IntegrationError> {
52 let _ = (name, config);
53 Ok(())
54}
55
56#[cfg(test)]
57mod tests {
58 use super::*;
59 use crate::ProviderOps;
60 use crate::resource::ResourcePayload;
61 use stackless_core::def::StackDef;
62 use stackless_stripe_projects::stripe::StripeProjects;
63 use stackless_stripe_projects::test_support;
64
65 #[test]
66 fn config_matches_catalog() {
67 const FIXTURE: &str = include_str!(concat!(
68 env!("CARGO_MANIFEST_DIR"),
69 "/../stackless-stripe-projects/tests/fixtures/catalog.json"
70 ));
71 let catalog = stackless_stripe_projects::Catalog::from_json_envelope(FIXTURE).unwrap();
72 let failures = stackless_stripe_projects::verify_service(&catalog, &SentrySeerConfig {});
73 assert!(
74 failures.is_empty(),
75 "sentry/seer catalog gaps:\n{}",
76 failures.join("\n")
77 );
78 }
79
80 const CATALOG_ENVELOPE: &str = r##"{"ok":true,"command":"projects catalog","data":{"last_updated":"2026-07-11T00:00:00Z","services":[{"id":"prvsvc_seer","object":"v2.provisioning.provider_service_detail","provider_id":"prvdr_sentry","provider_name":"Sentry","service_id":"seer","categories":["database"],"kind":"deployable","scope":"project","availability":"available","development":false,"livemode":true,"pricing":{"type":"component"},"configuration_schema":{"type":"object","required":[],"additionalProperties":false,"properties":{}}}]}}"##;
81
82 fn test_def() -> StackDef {
83 StackDef::parse(
84 r#"
85[stack]
86name = "atto"
87[stack.projects.stripe]
88project = "project_1"
89[integrations.res]
90provider = "sentry-seer"
91[services.api]
92source = { repo = "r", ref = "main" }
93env = { OUT = "ok" }
94health = { path = "/health" }
95[services.api.local]
96run = "true"
97"#,
98 )
99 .unwrap()
100 }
101
102 #[tokio::test]
103 async fn provision_records_outputs() {
104 let runner = test_support::provision_script(CATALOG_ENVELOPE, serde_json::json!({}), 0);
105 let dir = tempfile::tempdir().unwrap();
106 std::fs::write(
107 dir.path().join("stackless.toml"),
108 "[stack]\nname=\"atto\"\n",
109 )
110 .unwrap();
111 let stripe = StripeProjects::new(&runner, dir.path());
112
113 let resource = SentrySeer
114 .provision(
115 &stripe.as_dyn(),
116 &test_def(),
117 dir.path(),
118 "demo",
119 "res",
120 "local",
121 false,
122 )
123 .await
124 .unwrap();
125 assert_eq!(resource.resource_kind, "integration-sentry-seer");
126 let payload: ResourcePayload = serde_json::from_str(&resource.payload).unwrap();
127 assert!(payload.outputs.is_empty());
128 }
129}