stackless_provider_sdk/
lib.rs1use std::path::Path;
8
9use async_trait::async_trait;
10use stackless_core::def::StackDef;
11use stackless_core::substrate::StepResource;
12use stackless_stripe_projects::stripe::{CommandRunner, StripeProjects};
13
14pub mod config;
15pub mod error;
16pub mod hostable;
17pub mod observation;
18pub mod resource;
19
20pub use config::{config_bool, config_optional_string, config_string};
21pub use error::IntegrationError;
22pub use hostable::{
23 BlockedSetting, ConfigScope, Hostable, IntegrationHosting, host_bound_hosts,
24 host_bound_supports,
25};
26pub use observation::{Drift, IntegrationObservation};
27pub use resource::{CatalogResource, ResourcePayload};
28
29#[async_trait]
36pub trait ProviderOps: Send + Sync {
37 #[allow(clippy::too_many_arguments)]
40 async fn provision(
41 &self,
42 stripe: &StripeProjects<&dyn CommandRunner>,
43 def: &StackDef,
44 definition_dir: &Path,
45 instance: &str,
46 name: &str,
47 substrate: &str,
48 skip_stripe_instance_context: bool,
49 ) -> Result<StepResource, IntegrationError>;
50
51 #[allow(clippy::too_many_arguments)]
54 async fn apply(
55 &self,
56 _stripe: &StripeProjects<&dyn CommandRunner>,
57 _def: &StackDef,
58 _name: &str,
59 _substrate: &str,
60 _provisioned: &StepResource,
61 ) -> Result<(), IntegrationError> {
62 Ok(())
63 }
64
65 async fn observe(
66 &self,
67 stripe: &StripeProjects<&dyn CommandRunner>,
68 checkpoint_payload: &str,
69 fallback_resource: &str,
70 ) -> Result<IntegrationObservation, IntegrationError>;
71
72 async fn destroy(
73 &self,
74 stripe: &StripeProjects<&dyn CommandRunner>,
75 checkpoint_payload: &str,
76 fallback_resource: &str,
77 ) -> Result<(), IntegrationError>;
78}