diff --git a/Cargo.lock b/Cargo.lock index a86e4a9348..d313bb1444 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1501,6 +1501,19 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "control-plane-api" +version = "0.0.0" +dependencies = [ + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serde_with", + "url", + "uuid 1.10.0", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -5287,6 +5300,7 @@ dependencies = [ "js-sys", "log", "mime", + "mime_guess", "once_cell", "percent-encoding", "pin-project-lite", @@ -5864,6 +5878,30 @@ dependencies = [ "thiserror", ] +[[package]] +name = "serde_qs" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd34f36fe4c5ba9654417139a9b3a20d2e1de6012ee678ad14d240c22c78d8d6" +dependencies = [ + "axum", + "futures", + "percent-encoding", + "serde", + "thiserror", +] + +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -5876,6 +5914,36 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.3.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time 0.3.36", +] + +[[package]] +name = "serde_with_macros" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +dependencies = [ + "darling 0.20.10", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "serde_yaml" version = "0.8.26" @@ -6944,7 +7012,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ca2384932803823dd024a68d84019666577f4b373d78eb7ccafd5aa2548d615" dependencies = [ - "darling", + "darling 0.13.4", "proc-macro2", "quote", "syn 1.0.109", diff --git a/Cargo.toml b/Cargo.toml index 4e9c7767b2..145d211b06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,6 +111,7 @@ reqwest = { version = "0.11", default-features = false, features = [ "json", "rustls-tls", "stream", + "multipart", ] } rocksdb = { version = "0.22", default-features = false, features = [ "snappy", @@ -131,6 +132,12 @@ schemars = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", features = ["raw_value", "float_roundtrip"] } serde_yaml = "0.8" +serde_with = { version = "^3.8", default-features = false, features = [ + "base64", + "std", + "macros", +] } +serde_repr = "^0.1" serde-transcode = "1.1" serde-wasm-bindgen = "0.4" size = "0.4" diff --git a/crates/control-plane-api/.openapi-generator-ignore b/crates/control-plane-api/.openapi-generator-ignore new file mode 100644 index 0000000000..832807d294 --- /dev/null +++ b/crates/control-plane-api/.openapi-generator-ignore @@ -0,0 +1,12 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +Cargo.toml +docs/* +README.md +.gitignore +.travis.yml +git_push.sh diff --git a/crates/control-plane-api/.openapi-generator/FILES b/crates/control-plane-api/.openapi-generator/FILES new file mode 100644 index 0000000000..2d34fc3010 --- /dev/null +++ b/crates/control-plane-api/.openapi-generator/FILES @@ -0,0 +1,39 @@ +src/apis/configuration.rs +src/apis/default_api.rs +src/apis/mod.rs +src/lib.rs +src/models/activation_status.rs +src/models/affected_consumer.rs +src/models/api_error.rs +src/models/auto_discover_failure.rs +src/models/auto_discover_outcome.rs +src/models/auto_discover_status.rs +src/models/catalog_type.rs +src/models/discover_change.rs +src/models/error.rs +src/models/evolved_collection.rs +src/models/incompatible_collection.rs +src/models/inferred_schema_status.rs +src/models/job_status.rs +src/models/job_status_one_of.rs +src/models/job_status_one_of_1.rs +src/models/job_status_one_of_2.rs +src/models/job_status_one_of_3.rs +src/models/job_status_one_of_4.rs +src/models/job_status_one_of_5.rs +src/models/job_status_one_of_6.rs +src/models/job_status_one_of_7.rs +src/models/job_status_one_of_8.rs +src/models/lock_failure.rs +src/models/mod.rs +src/models/publication_info.rs +src/models/publication_status.rs +src/models/re_create_reason.rs +src/models/rejected_field.rs +src/models/source_capture_status.rs +src/models/status_response.rs +src/models/status_response_controller_status.rs +src/models/status_response_controller_status_one_of.rs +src/models/status_response_controller_status_one_of_1.rs +src/models/status_response_controller_status_one_of_2.rs +src/models/status_response_controller_status_one_of_3.rs diff --git a/crates/control-plane-api/.openapi-generator/VERSION b/crates/control-plane-api/.openapi-generator/VERSION new file mode 100644 index 0000000000..758bb9c821 --- /dev/null +++ b/crates/control-plane-api/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0 diff --git a/crates/control-plane-api/Cargo.toml b/crates/control-plane-api/Cargo.toml new file mode 100644 index 0000000000..4989e17d5c --- /dev/null +++ b/crates/control-plane-api/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "control-plane-api" +version.workspace = true +rust-version.workspace = true +edition.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true + +[dependencies] +serde = { workspace = true } +serde_with = { workspace = true } +serde_json = { workspace = true } +serde_repr = { workspace = true } +url = { workspace = true } +uuid = { workspace = true } +reqwest = { workspace = true } diff --git a/crates/control-plane-api/README.md b/crates/control-plane-api/README.md new file mode 100644 index 0000000000..625d1460cb --- /dev/null +++ b/crates/control-plane-api/README.md @@ -0,0 +1,8 @@ +# Control-plane-api + +All of the sources in this crate were generated by `openapi-generator` using the command: + +`openapi-generator -i -g rust -o . --additional-properties library=reqwest-trait` + +The openapi spec was downloaded from a running agent instance. +I think this is probably not worth using. diff --git a/crates/control-plane-api/src/apis/configuration.rs b/crates/control-plane-api/src/apis/configuration.rs new file mode 100644 index 0000000000..73a63ae019 --- /dev/null +++ b/crates/control-plane-api/src/apis/configuration.rs @@ -0,0 +1,51 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + + + +#[derive(Debug, Clone)] +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub bearer_access_token: Option, + pub api_key: Option, +} + +pub type BasicAuth = (String, Option); + +#[derive(Debug, Clone)] +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "http://localhost".to_owned(), + user_agent: Some("OpenAPI-Generator//rust".to_owned()), + client: reqwest::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + } + } +} diff --git a/crates/control-plane-api/src/apis/default_api.rs b/crates/control-plane-api/src/apis/default_api.rs new file mode 100644 index 0000000000..3c41119004 --- /dev/null +++ b/crates/control-plane-api/src/apis/default_api.rs @@ -0,0 +1,148 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + + +use async_trait::async_trait; +use reqwest; +use std::sync::Arc; +use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + +#[async_trait] +pub trait DefaultApi: Send + Sync { + async fn redoc_get<>(&self, ) -> Result>; + async fn root_get<>(&self, ) -> Result>; + async fn status_catalog_name_get<>(&self, ) -> Result>; +} + +pub struct DefaultApiClient { + configuration: Arc +} + +impl DefaultApiClient { + pub fn new(configuration: Arc) -> Self { + Self { configuration } + } +} + + + +#[async_trait] +impl DefaultApi for DefaultApiClient { + /// This documentation page. + async fn redoc_get<>(&self, ) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/redoc", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// This documentation page. + async fn root_get<>(&self, ) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + async fn status_catalog_name_get<>(&self, ) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/status/*catalog_name", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + +} + +/// struct for typed errors of method [`redoc_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RedocGetError { + DefaultResponse(models::ApiError), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`root_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RootGetError { + DefaultResponse(models::ApiError), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`status_catalog_name_get`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StatusCatalogNameGetError { + DefaultResponse(models::ApiError), + UnknownValue(serde_json::Value), +} + diff --git a/crates/control-plane-api/src/apis/mod.rs b/crates/control-plane-api/src/apis/mod.rs new file mode 100644 index 0000000000..3a3ce28668 --- /dev/null +++ b/crates/control-plane-api/src/apis/mod.rs @@ -0,0 +1,96 @@ +use std::error; +use std::fmt; + +#[derive(Debug, Clone)] +pub struct ResponseContent { + pub status: reqwest::StatusCode, + pub content: String, + pub entity: Option, +} + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), + Io(std::io::Error), + ResponseError(ResponseContent), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let (module, e) = match self { + Error::Reqwest(e) => ("reqwest", e.to_string()), + Error::Serde(e) => ("serde", e.to_string()), + Error::Io(e) => ("IO", e.to_string()), + Error::ResponseError(e) => ("response", format!("status code {}", e.status)), + }; + write!(f, "error in {}: {}", module, e) + } +} + +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(match self { + Error::Reqwest(e) => e, + Error::Serde(e) => e, + Error::Io(e) => e, + Error::ResponseError(_) => return None, + }) + } +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Serde(e) + } +} + +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::Io(e) + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { + if let serde_json::Value::Object(object) = value { + let mut params = vec![]; + + for (key, value) in object { + match value { + serde_json::Value::Object(_) => params.append(&mut parse_deep_object( + &format!("{}[{}]", prefix, key), + value, + )), + serde_json::Value::Array(array) => { + for (i, value) in array.iter().enumerate() { + params.append(&mut parse_deep_object( + &format!("{}[{}][{}]", prefix, key, i), + value, + )); + } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), + } + } + + return params; + } + + unimplemented!("Only objects are supported with style=deepObject") +} + +pub mod default_api; + +pub mod configuration; + diff --git a/crates/control-plane-api/src/lib.rs b/crates/control-plane-api/src/lib.rs new file mode 100644 index 0000000000..edc482e8f2 --- /dev/null +++ b/crates/control-plane-api/src/lib.rs @@ -0,0 +1,10 @@ +#![allow(unused_imports)] +#![allow(clippy::too_many_arguments)] + +extern crate serde_repr; +extern crate serde; +extern crate serde_json; +extern crate url; + +pub mod apis; +pub mod models; diff --git a/crates/control-plane-api/src/models/activation_status.rs b/crates/control-plane-api/src/models/activation_status.rs new file mode 100644 index 0000000000..6531921796 --- /dev/null +++ b/crates/control-plane-api/src/models/activation_status.rs @@ -0,0 +1,29 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActivationStatus : Status of the activation of the task in the data-plane +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivationStatus { + #[serde(rename = "last_activated", skip_serializing_if = "Option::is_none")] + pub last_activated: Option, +} + +impl ActivationStatus { + /// Status of the activation of the task in the data-plane + pub fn new() -> ActivationStatus { + ActivationStatus { + last_activated: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/affected_consumer.rs b/crates/control-plane-api/src/models/affected_consumer.rs new file mode 100644 index 0000000000..40b6f2ccf4 --- /dev/null +++ b/crates/control-plane-api/src/models/affected_consumer.rs @@ -0,0 +1,34 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AffectedConsumer { + #[serde(rename = "fields")] + pub fields: Vec, + #[serde(rename = "name")] + pub name: String, + /// Identifies the specific binding that is affected. This can be used to differentiate in cases there are multiple bindings with the same source. + #[serde(rename = "resource_path", skip_serializing_if = "Option::is_none")] + pub resource_path: Option>, +} + +impl AffectedConsumer { + pub fn new(fields: Vec, name: String) -> AffectedConsumer { + AffectedConsumer { + fields, + name, + resource_path: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/api_error.rs b/crates/control-plane-api/src/models/api_error.rs new file mode 100644 index 0000000000..7c5aab96c3 --- /dev/null +++ b/crates/control-plane-api/src/models/api_error.rs @@ -0,0 +1,32 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApiError : An error that can be returned from an API handler, which specifies an HTTP status code and wraps an `anyhow::Error`. It implements `IntoResponse`, allowing handlers to return a `Result, ApiError>`. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiError { + #[serde(rename = "error")] + pub error: String, + #[serde(rename = "status")] + pub status: i32, +} + +impl ApiError { + /// An error that can be returned from an API handler, which specifies an HTTP status code and wraps an `anyhow::Error`. It implements `IntoResponse`, allowing handlers to return a `Result, ApiError>`. + pub fn new(error: String, status: i32) -> ApiError { + ApiError { + error, + status, + } + } +} + diff --git a/crates/control-plane-api/src/models/auto_discover_failure.rs b/crates/control-plane-api/src/models/auto_discover_failure.rs new file mode 100644 index 0000000000..d22a1f6b1f --- /dev/null +++ b/crates/control-plane-api/src/models/auto_discover_failure.rs @@ -0,0 +1,36 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoDiscoverFailure { + /// The number of consecutive failures that have been observed. + #[serde(rename = "count")] + pub count: i32, + /// The timestamp of the first failure in the current sequence. + #[serde(rename = "first_ts")] + pub first_ts: String, + /// The discover outcome corresponding to the most recent failure. This will be updated with the results of each retry until an auto-discover succeeds. + #[serde(rename = "last_outcome")] + pub last_outcome: Box, +} + +impl AutoDiscoverFailure { + pub fn new(count: i32, first_ts: String, last_outcome: models::AutoDiscoverOutcome) -> AutoDiscoverFailure { + AutoDiscoverFailure { + count, + first_ts, + last_outcome: Box::new(last_outcome), + } + } +} + diff --git a/crates/control-plane-api/src/models/auto_discover_outcome.rs b/crates/control-plane-api/src/models/auto_discover_outcome.rs new file mode 100644 index 0000000000..7339823600 --- /dev/null +++ b/crates/control-plane-api/src/models/auto_discover_outcome.rs @@ -0,0 +1,51 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoDiscoverOutcome { + /// Bindings that were added to the capture. + #[serde(rename = "added", skip_serializing_if = "Option::is_none")] + pub added: Option>, + /// Errors that occurred during the discovery or evolution process. + #[serde(rename = "errors", skip_serializing_if = "Option::is_none")] + pub errors: Option>, + /// Bindings that were modified, either to change the schema or the collection key. + #[serde(rename = "modified", skip_serializing_if = "Option::is_none")] + pub modified: Option>, + #[serde(rename = "publish_result", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub publish_result: Option>>, + /// Collections that were re-created due to the collection key having changed. + #[serde(rename = "re_created_collections", skip_serializing_if = "Option::is_none")] + pub re_created_collections: Option>, + /// Bindings that were removed because they no longer appear in the source system. + #[serde(rename = "removed", skip_serializing_if = "Option::is_none")] + pub removed: Option>, + /// Time at which the disocver was attempted + #[serde(rename = "ts")] + pub ts: String, +} + +impl AutoDiscoverOutcome { + pub fn new(ts: String) -> AutoDiscoverOutcome { + AutoDiscoverOutcome { + added: None, + errors: None, + modified: None, + publish_result: None, + re_created_collections: None, + removed: None, + ts, + } + } +} + diff --git a/crates/control-plane-api/src/models/auto_discover_status.rs b/crates/control-plane-api/src/models/auto_discover_status.rs new file mode 100644 index 0000000000..0cd10f6983 --- /dev/null +++ b/crates/control-plane-api/src/models/auto_discover_status.rs @@ -0,0 +1,41 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoDiscoverStatus { + #[serde(rename = "failure", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub failure: Option>>, + /// The interval at which auto-discovery is run. This is normally unset, which uses the default interval. + #[serde(rename = "interval", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub interval: Option>, + #[serde(rename = "last_success", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_success: Option>>, + /// Time at which the next auto-discover should be run. + #[serde(rename = "next_at", skip_serializing_if = "Option::is_none")] + pub next_at: Option, + #[serde(rename = "pending_publish", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub pending_publish: Option>>, +} + +impl AutoDiscoverStatus { + pub fn new() -> AutoDiscoverStatus { + AutoDiscoverStatus { + failure: None, + interval: None, + last_success: None, + next_at: None, + pending_publish: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/catalog_type.rs b/crates/control-plane-api/src/models/catalog_type.rs new file mode 100644 index 0000000000..9ba2cb834c --- /dev/null +++ b/crates/control-plane-api/src/models/catalog_type.rs @@ -0,0 +1,44 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum CatalogType { + #[serde(rename = "capture")] + Capture, + #[serde(rename = "collection")] + Collection, + #[serde(rename = "materialization")] + Materialization, + #[serde(rename = "test")] + Test, + +} + +impl std::fmt::Display for CatalogType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Capture => write!(f, "capture"), + Self::Collection => write!(f, "collection"), + Self::Materialization => write!(f, "materialization"), + Self::Test => write!(f, "test"), + } + } +} + +impl Default for CatalogType { + fn default() -> CatalogType { + Self::Capture + } +} + diff --git a/crates/control-plane-api/src/models/discover_change.rs b/crates/control-plane-api/src/models/discover_change.rs new file mode 100644 index 0000000000..e93d9f9895 --- /dev/null +++ b/crates/control-plane-api/src/models/discover_change.rs @@ -0,0 +1,36 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiscoverChange { + /// Whether the capture binding is disabled. + #[serde(rename = "disable")] + pub disable: bool, + /// Identifies the resource in the source system that this change pertains to. + #[serde(rename = "resource_path")] + pub resource_path: Vec, + /// Collection names are paths of Unicode letters, numbers, '-', '_', or '.'. Each path component is separated by a slash '/', and a name may not begin or end in a '/'. + #[serde(rename = "target")] + pub target: String, +} + +impl DiscoverChange { + pub fn new(disable: bool, resource_path: Vec, target: String) -> DiscoverChange { + DiscoverChange { + disable, + resource_path, + target, + } + } +} + diff --git a/crates/control-plane-api/src/models/error.rs b/crates/control-plane-api/src/models/error.rs new file mode 100644 index 0000000000..958341b539 --- /dev/null +++ b/crates/control-plane-api/src/models/error.rs @@ -0,0 +1,33 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Error { + #[serde(rename = "catalog_name", skip_serializing_if = "Option::is_none")] + pub catalog_name: Option, + #[serde(rename = "detail")] + pub detail: String, + #[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub scope: Option>, +} + +impl Error { + pub fn new(detail: String) -> Error { + Error { + catalog_name: None, + detail, + scope: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/evolved_collection.rs b/crates/control-plane-api/src/models/evolved_collection.rs new file mode 100644 index 0000000000..8ae5c19bb2 --- /dev/null +++ b/crates/control-plane-api/src/models/evolved_collection.rs @@ -0,0 +1,40 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EvolvedCollection { + /// The new name of the collection, which may be the same as the original name if only materialization bindings were updated + #[serde(rename = "new_name")] + pub new_name: String, + /// Original name of the collection + #[serde(rename = "old_name")] + pub old_name: String, + /// The names of any captures that were updated as a result of evolving this collection + #[serde(rename = "updated_captures")] + pub updated_captures: Vec, + /// The names of any materializations that were updated as a result of evolving this collection + #[serde(rename = "updated_materializations")] + pub updated_materializations: Vec, +} + +impl EvolvedCollection { + pub fn new(new_name: String, old_name: String, updated_captures: Vec, updated_materializations: Vec) -> EvolvedCollection { + EvolvedCollection { + new_name, + old_name, + updated_captures, + updated_materializations, + } + } +} + diff --git a/crates/control-plane-api/src/models/incompatible_collection.rs b/crates/control-plane-api/src/models/incompatible_collection.rs new file mode 100644 index 0000000000..46373ea2a6 --- /dev/null +++ b/crates/control-plane-api/src/models/incompatible_collection.rs @@ -0,0 +1,34 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct IncompatibleCollection { + #[serde(rename = "affected_materializations", skip_serializing_if = "Option::is_none")] + pub affected_materializations: Option>, + #[serde(rename = "collection")] + pub collection: String, + /// Reasons why the collection would need to be re-created in order for a publication of the draft spec to succeed. + #[serde(rename = "requires_recreation", skip_serializing_if = "Option::is_none")] + pub requires_recreation: Option>, +} + +impl IncompatibleCollection { + pub fn new(collection: String) -> IncompatibleCollection { + IncompatibleCollection { + affected_materializations: None, + collection, + requires_recreation: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/inferred_schema_status.rs b/crates/control-plane-api/src/models/inferred_schema_status.rs new file mode 100644 index 0000000000..e89a20a169 --- /dev/null +++ b/crates/control-plane-api/src/models/inferred_schema_status.rs @@ -0,0 +1,34 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// InferredSchemaStatus : Status of the inferred schema +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct InferredSchemaStatus { + /// The time at which the inferred schema was last published. This will only be present if the inferred schema was published at least once. + #[serde(rename = "schema_last_updated", skip_serializing_if = "Option::is_none")] + pub schema_last_updated: Option, + /// The md5 sum of the inferred schema that was last published. Because the publications handler updates the model instead of the controller, it's technically possible for the published inferred schema to be more recent than the one corresponding to this hash. If that happens, we would expect a subsequent publication on the next controller run, which would update the hash but not actually modify the schema. + #[serde(rename = "schema_md5", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub schema_md5: Option>, +} + +impl InferredSchemaStatus { + /// Status of the inferred schema + pub fn new() -> InferredSchemaStatus { + InferredSchemaStatus { + schema_last_updated: None, + schema_md5: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/job_status.rs b/crates/control-plane-api/src/models/job_status.rs new file mode 100644 index 0000000000..e97c60ae62 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status.rs @@ -0,0 +1,63 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// JobStatus : JobStatus is the possible outcomes of a handled publication. +/// JobStatus is the possible outcomes of a handled publication. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum JobStatus { + JobStatusOneOf(Box), + JobStatusOneOf1(Box), + JobStatusOneOf2(Box), + JobStatusOneOf3(Box), + JobStatusOneOf4(Box), + JobStatusOneOf5(Box), + JobStatusOneOf6(Box), + JobStatusOneOf7(Box), + JobStatusOneOf8(Box), +} + +impl Default for JobStatus { + fn default() -> Self { + Self::JobStatusOneOf(Default::default()) + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "queued")] + Queued, + #[serde(rename = "buildFailed")] + BuildFailed, + #[serde(rename = "testFailed")] + TestFailed, + #[serde(rename = "publishFailed")] + PublishFailed, + #[serde(rename = "success")] + Success, + #[serde(rename = "emptyDraft")] + EmptyDraft, + #[serde(rename = "expectPubIdMismatch")] + ExpectPubIdMismatch, + #[serde(rename = "buildIdLockFailure")] + BuildIdLockFailure, + #[serde(rename = "deprecatedBackground")] + DeprecatedBackground, +} + +impl Default for Type { + fn default() -> Type { + Self::Queued + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of.rs b/crates/control-plane-api/src/models/job_status_one_of.rs new file mode 100644 index 0000000000..a391eb0235 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of.rs @@ -0,0 +1,39 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf { + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf { + pub fn new(r#type: Type) -> JobStatusOneOf { + JobStatusOneOf { + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "queued")] + Queued, +} + +impl Default for Type { + fn default() -> Type { + Self::Queued + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_1.rs b/crates/control-plane-api/src/models/job_status_one_of_1.rs new file mode 100644 index 0000000000..65523461cf --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_1.rs @@ -0,0 +1,45 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf1 { + #[serde(rename = "evolution_id", skip_serializing_if = "Option::is_none")] + pub evolution_id: Option, + #[serde(rename = "incompatible_collections", skip_serializing_if = "Option::is_none")] + pub incompatible_collections: Option>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf1 { + pub fn new(r#type: Type) -> JobStatusOneOf1 { + JobStatusOneOf1 { + evolution_id: None, + incompatible_collections: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "buildFailed")] + BuildFailed, +} + +impl Default for Type { + fn default() -> Type { + Self::BuildFailed + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_2.rs b/crates/control-plane-api/src/models/job_status_one_of_2.rs new file mode 100644 index 0000000000..29dbd4abdf --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_2.rs @@ -0,0 +1,39 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf2 { + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf2 { + pub fn new(r#type: Type) -> JobStatusOneOf2 { + JobStatusOneOf2 { + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "testFailed")] + TestFailed, +} + +impl Default for Type { + fn default() -> Type { + Self::TestFailed + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_3.rs b/crates/control-plane-api/src/models/job_status_one_of_3.rs new file mode 100644 index 0000000000..6db61db140 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_3.rs @@ -0,0 +1,39 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf3 { + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf3 { + pub fn new(r#type: Type) -> JobStatusOneOf3 { + JobStatusOneOf3 { + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "publishFailed")] + PublishFailed, +} + +impl Default for Type { + fn default() -> Type { + Self::PublishFailed + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_4.rs b/crates/control-plane-api/src/models/job_status_one_of_4.rs new file mode 100644 index 0000000000..1e72d19fac --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_4.rs @@ -0,0 +1,39 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf4 { + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf4 { + pub fn new(r#type: Type) -> JobStatusOneOf4 { + JobStatusOneOf4 { + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "success")] + Success, +} + +impl Default for Type { + fn default() -> Type { + Self::Success + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_5.rs b/crates/control-plane-api/src/models/job_status_one_of_5.rs new file mode 100644 index 0000000000..058c5e7822 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_5.rs @@ -0,0 +1,41 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// JobStatusOneOf5 : Returned when there are no draft specs (after pruning unbound collections). There will not be any `draft_errors` in this case, because there's no `catalog_name` to associate with an error. And it may not be desirable to treat this as an error, depending on the scenario. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf5 { + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf5 { + /// Returned when there are no draft specs (after pruning unbound collections). There will not be any `draft_errors` in this case, because there's no `catalog_name` to associate with an error. And it may not be desirable to treat this as an error, depending on the scenario. + pub fn new(r#type: Type) -> JobStatusOneOf5 { + JobStatusOneOf5 { + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "emptyDraft")] + EmptyDraft, +} + +impl Default for Type { + fn default() -> Type { + Self::EmptyDraft + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_6.rs b/crates/control-plane-api/src/models/job_status_one_of_6.rs new file mode 100644 index 0000000000..b5e0225164 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_6.rs @@ -0,0 +1,44 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// JobStatusOneOf6 : One or more expected `last_pub_id`s did not match the actual `last_pub_id`, indicating that specs have been changed since the draft was created. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf6 { + #[serde(rename = "failures", skip_serializing_if = "Option::is_none")] + pub failures: Option>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf6 { + /// One or more expected `last_pub_id`s did not match the actual `last_pub_id`, indicating that specs have been changed since the draft was created. + pub fn new(r#type: Type) -> JobStatusOneOf6 { + JobStatusOneOf6 { + failures: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "expectPubIdMismatch")] + ExpectPubIdMismatch, +} + +impl Default for Type { + fn default() -> Type { + Self::ExpectPubIdMismatch + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_7.rs b/crates/control-plane-api/src/models/job_status_one_of_7.rs new file mode 100644 index 0000000000..4f4145f1f6 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_7.rs @@ -0,0 +1,44 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// JobStatusOneOf7 : Optimistic locking failure for one or more specs in the publication. This case should typically be retried by the publisher. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf7 { + #[serde(rename = "failures", skip_serializing_if = "Option::is_none")] + pub failures: Option>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf7 { + /// Optimistic locking failure for one or more specs in the publication. This case should typically be retried by the publisher. + pub fn new(r#type: Type) -> JobStatusOneOf7 { + JobStatusOneOf7 { + failures: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "buildIdLockFailure")] + BuildIdLockFailure, +} + +impl Default for Type { + fn default() -> Type { + Self::BuildIdLockFailure + } +} + diff --git a/crates/control-plane-api/src/models/job_status_one_of_8.rs b/crates/control-plane-api/src/models/job_status_one_of_8.rs new file mode 100644 index 0000000000..d495d3f015 --- /dev/null +++ b/crates/control-plane-api/src/models/job_status_one_of_8.rs @@ -0,0 +1,41 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// JobStatusOneOf8 : The publication used the deprecated background flag, which is no longer supported. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusOneOf8 { + #[serde(rename = "type")] + pub r#type: Type, +} + +impl JobStatusOneOf8 { + /// The publication used the deprecated background flag, which is no longer supported. + pub fn new(r#type: Type) -> JobStatusOneOf8 { + JobStatusOneOf8 { + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "deprecatedBackground")] + DeprecatedBackground, +} + +impl Default for Type { + fn default() -> Type { + Self::DeprecatedBackground + } +} + diff --git a/crates/control-plane-api/src/models/lock_failure.rs b/crates/control-plane-api/src/models/lock_failure.rs new file mode 100644 index 0000000000..f0cc9caccb --- /dev/null +++ b/crates/control-plane-api/src/models/lock_failure.rs @@ -0,0 +1,35 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// LockFailure : Represents an optimistic lock failure when trying to update live specs. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LockFailure { + #[serde(rename = "actual", skip_serializing_if = "Option::is_none")] + pub actual: Option, + #[serde(rename = "catalog_name")] + pub catalog_name: String, + #[serde(rename = "expected")] + pub expected: String, +} + +impl LockFailure { + /// Represents an optimistic lock failure when trying to update live specs. + pub fn new(catalog_name: String, expected: String) -> LockFailure { + LockFailure { + actual: None, + catalog_name, + expected, + } + } +} + diff --git a/crates/control-plane-api/src/models/mod.rs b/crates/control-plane-api/src/models/mod.rs new file mode 100644 index 0000000000..d946ee3036 --- /dev/null +++ b/crates/control-plane-api/src/models/mod.rs @@ -0,0 +1,68 @@ +pub mod activation_status; +pub use self::activation_status::ActivationStatus; +pub mod affected_consumer; +pub use self::affected_consumer::AffectedConsumer; +pub mod api_error; +pub use self::api_error::ApiError; +pub mod auto_discover_failure; +pub use self::auto_discover_failure::AutoDiscoverFailure; +pub mod auto_discover_outcome; +pub use self::auto_discover_outcome::AutoDiscoverOutcome; +pub mod auto_discover_status; +pub use self::auto_discover_status::AutoDiscoverStatus; +pub mod catalog_type; +pub use self::catalog_type::CatalogType; +pub mod discover_change; +pub use self::discover_change::DiscoverChange; +pub mod error; +pub use self::error::Error; +pub mod evolved_collection; +pub use self::evolved_collection::EvolvedCollection; +pub mod incompatible_collection; +pub use self::incompatible_collection::IncompatibleCollection; +pub mod inferred_schema_status; +pub use self::inferred_schema_status::InferredSchemaStatus; +pub mod job_status; +pub use self::job_status::JobStatus; +pub mod job_status_one_of; +pub use self::job_status_one_of::JobStatusOneOf; +pub mod job_status_one_of_1; +pub use self::job_status_one_of_1::JobStatusOneOf1; +pub mod job_status_one_of_2; +pub use self::job_status_one_of_2::JobStatusOneOf2; +pub mod job_status_one_of_3; +pub use self::job_status_one_of_3::JobStatusOneOf3; +pub mod job_status_one_of_4; +pub use self::job_status_one_of_4::JobStatusOneOf4; +pub mod job_status_one_of_5; +pub use self::job_status_one_of_5::JobStatusOneOf5; +pub mod job_status_one_of_6; +pub use self::job_status_one_of_6::JobStatusOneOf6; +pub mod job_status_one_of_7; +pub use self::job_status_one_of_7::JobStatusOneOf7; +pub mod job_status_one_of_8; +pub use self::job_status_one_of_8::JobStatusOneOf8; +pub mod lock_failure; +pub use self::lock_failure::LockFailure; +pub mod publication_info; +pub use self::publication_info::PublicationInfo; +pub mod publication_status; +pub use self::publication_status::PublicationStatus; +pub mod re_create_reason; +pub use self::re_create_reason::ReCreateReason; +pub mod rejected_field; +pub use self::rejected_field::RejectedField; +pub mod source_capture_status; +pub use self::source_capture_status::SourceCaptureStatus; +pub mod status_response; +pub use self::status_response::StatusResponse; +pub mod status_response_controller_status; +pub use self::status_response_controller_status::StatusResponseControllerStatus; +pub mod status_response_controller_status_one_of; +pub use self::status_response_controller_status_one_of::StatusResponseControllerStatusOneOf; +pub mod status_response_controller_status_one_of_1; +pub use self::status_response_controller_status_one_of_1::StatusResponseControllerStatusOneOf1; +pub mod status_response_controller_status_one_of_2; +pub use self::status_response_controller_status_one_of_2::StatusResponseControllerStatusOneOf2; +pub mod status_response_controller_status_one_of_3; +pub use self::status_response_controller_status_one_of_3::StatusResponseControllerStatusOneOf3; diff --git a/crates/control-plane-api/src/models/publication_info.rs b/crates/control-plane-api/src/models/publication_info.rs new file mode 100644 index 0000000000..c71366dd8f --- /dev/null +++ b/crates/control-plane-api/src/models/publication_info.rs @@ -0,0 +1,54 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// PublicationInfo : Summary of a publication that was attempted by a controller. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PublicationInfo { + /// Time at which the publication was completed + #[serde(rename = "completed", skip_serializing_if = "Option::is_none")] + pub completed: Option, + #[serde(rename = "count", skip_serializing_if = "Option::is_none")] + pub count: Option, + /// Time at which the publication was initiated + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + /// A brief description of the reason for the publication + #[serde(rename = "detail", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub detail: Option>, + /// Errors will be non-empty for publications that were not successful + #[serde(rename = "errors", skip_serializing_if = "Option::is_none")] + pub errors: Option>, + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "is_touch", skip_serializing_if = "Option::is_none")] + pub is_touch: Option, + #[serde(rename = "result", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub result: Option>>, +} + +impl PublicationInfo { + /// Summary of a publication that was attempted by a controller. + pub fn new(id: String) -> PublicationInfo { + PublicationInfo { + completed: None, + count: None, + created: None, + detail: None, + errors: None, + id, + is_touch: None, + result: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/publication_status.rs b/crates/control-plane-api/src/models/publication_status.rs new file mode 100644 index 0000000000..c37c067968 --- /dev/null +++ b/crates/control-plane-api/src/models/publication_status.rs @@ -0,0 +1,36 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// PublicationStatus : Information on the publications performed by the controller. This does not include any information on user-initiated publications. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PublicationStatus { + #[serde(rename = "dependency_hash", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub dependency_hash: Option>, + /// A limited history of publications performed by this controller + #[serde(rename = "history")] + pub history: Vec, + #[serde(rename = "max_observed_pub_id", skip_serializing_if = "Option::is_none")] + pub max_observed_pub_id: Option, +} + +impl PublicationStatus { + /// Information on the publications performed by the controller. This does not include any information on user-initiated publications. + pub fn new(history: Vec) -> PublicationStatus { + PublicationStatus { + dependency_hash: None, + history, + max_observed_pub_id: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/re_create_reason.rs b/crates/control-plane-api/src/models/re_create_reason.rs new file mode 100644 index 0000000000..ba0d3cae7a --- /dev/null +++ b/crates/control-plane-api/src/models/re_create_reason.rs @@ -0,0 +1,30 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ReCreateReason : Reasons why a draft collection spec would need to be published under a new name. +/// Reasons why a draft collection spec would need to be published under a new name. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ReCreateReason { + /// The collection key in the draft differs from that of the live spec. + String(String), + /// One or more collection partition fields in the draft differs from that of the live spec. + String(String), +} + +impl Default for ReCreateReason { + fn default() -> Self { + Self::String(Default::default()) + } +} + diff --git a/crates/control-plane-api/src/models/rejected_field.rs b/crates/control-plane-api/src/models/rejected_field.rs new file mode 100644 index 0000000000..f742fe13eb --- /dev/null +++ b/crates/control-plane-api/src/models/rejected_field.rs @@ -0,0 +1,30 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RejectedField { + #[serde(rename = "field")] + pub field: String, + #[serde(rename = "reason")] + pub reason: String, +} + +impl RejectedField { + pub fn new(field: String, reason: String) -> RejectedField { + RejectedField { + field, + reason, + } + } +} + diff --git a/crates/control-plane-api/src/models/source_capture_status.rs b/crates/control-plane-api/src/models/source_capture_status.rs new file mode 100644 index 0000000000..52aff55556 --- /dev/null +++ b/crates/control-plane-api/src/models/source_capture_status.rs @@ -0,0 +1,34 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// SourceCaptureStatus : Status information about the `sourceCapture` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceCaptureStatus { + /// If `up_to_date` is `false`, then this will contain the set of `sourceCapture` collections that need to be added. This is provided simply to aid in debugging in case the publication to add the bindings fails. + #[serde(rename = "add_bindings", skip_serializing_if = "Option::is_none")] + pub add_bindings: Option>, + /// Whether the materialization bindings are up-to-date with respect to the `sourceCapture` bindings. In normal operation, this should always be `true`. Otherwise, there will be a controller `error` and the publication status will contain details of why the update failed. + #[serde(rename = "up_to_date", skip_serializing_if = "Option::is_none")] + pub up_to_date: Option, +} + +impl SourceCaptureStatus { + /// Status information about the `sourceCapture` + pub fn new() -> SourceCaptureStatus { + SourceCaptureStatus { + add_bindings: None, + up_to_date: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/status_response.rs b/crates/control-plane-api/src/models/status_response.rs new file mode 100644 index 0000000000..fbde98fb4e --- /dev/null +++ b/crates/control-plane-api/src/models/status_response.rs @@ -0,0 +1,67 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StatusResponse { + /// The name of the live spec + #[serde(rename = "catalog_name")] + pub catalog_name: String, + /// Error from the most recent controller run, or `null` if the run was successful. + #[serde(rename = "controller_error", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub controller_error: Option>, + /// The number of consecutive failures of the controller. Resets to 0 after any successful run. + #[serde(rename = "controller_failures")] + pub controller_failures: i32, + /// Time at which the controller is next scheduled to run. Or null if there is no run scheduled. + #[serde(rename = "controller_next_run", deserialize_with = "Option::deserialize")] + pub controller_next_run: Option, + #[serde(rename = "controller_status")] + pub controller_status: Box, + /// Time of the last controller run for this spec. + #[serde(rename = "controller_updated_at")] + pub controller_updated_at: String, + /// Whether the shards are disabled. Only pertinent to tasks. Omitted if false. + #[serde(rename = "disable")] + pub disable: bool, + #[serde(rename = "last_build_id")] + pub last_build_id: String, + #[serde(rename = "last_pub_id")] + pub last_pub_id: String, + #[serde(rename = "live_spec_id")] + pub live_spec_id: String, + /// Time of the last publication that affected the live spec. + #[serde(rename = "live_spec_updated_at")] + pub live_spec_updated_at: String, + #[serde(rename = "spec_type", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub spec_type: Option>, +} + +impl StatusResponse { + pub fn new(catalog_name: String, controller_failures: i32, controller_next_run: Option, controller_status: models::StatusResponseControllerStatus, controller_updated_at: String, disable: bool, last_build_id: String, last_pub_id: String, live_spec_id: String, live_spec_updated_at: String) -> StatusResponse { + StatusResponse { + catalog_name, + controller_error: None, + controller_failures, + controller_next_run, + controller_status: Box::new(controller_status), + controller_updated_at, + disable, + last_build_id, + last_pub_id, + live_spec_id, + live_spec_updated_at, + spec_type: None, + } + } +} + diff --git a/crates/control-plane-api/src/models/status_response_controller_status.rs b/crates/control-plane-api/src/models/status_response_controller_status.rs new file mode 100644 index 0000000000..9686a262b7 --- /dev/null +++ b/crates/control-plane-api/src/models/status_response_controller_status.rs @@ -0,0 +1,48 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// StatusResponseControllerStatus : The controller status json. +/// The controller status json. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum StatusResponseControllerStatus { + StatusResponseControllerStatusOneOf(Box), + StatusResponseControllerStatusOneOf1(Box), + StatusResponseControllerStatusOneOf2(Box), + StatusResponseControllerStatusOneOf3(Box), +} + +impl Default for StatusResponseControllerStatus { + fn default() -> Self { + Self::StatusResponseControllerStatusOneOf(Default::default()) + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "Capture")] + Capture, + #[serde(rename = "Collection")] + Collection, + #[serde(rename = "Materialization")] + Materialization, + #[serde(rename = "Test")] + Test, +} + +impl Default for Type { + fn default() -> Type { + Self::Capture + } +} + diff --git a/crates/control-plane-api/src/models/status_response_controller_status_one_of.rs b/crates/control-plane-api/src/models/status_response_controller_status_one_of.rs new file mode 100644 index 0000000000..71131a79b3 --- /dev/null +++ b/crates/control-plane-api/src/models/status_response_controller_status_one_of.rs @@ -0,0 +1,50 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// StatusResponseControllerStatusOneOf : Status of a capture controller +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StatusResponseControllerStatusOneOf { + #[serde(rename = "activation", skip_serializing_if = "Option::is_none")] + pub activation: Option>, + #[serde(rename = "auto_discover", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub auto_discover: Option>>, + #[serde(rename = "publications", skip_serializing_if = "Option::is_none")] + pub publications: Option>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl StatusResponseControllerStatusOneOf { + /// Status of a capture controller + pub fn new(r#type: Type) -> StatusResponseControllerStatusOneOf { + StatusResponseControllerStatusOneOf { + activation: None, + auto_discover: None, + publications: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "Capture")] + Capture, +} + +impl Default for Type { + fn default() -> Type { + Self::Capture + } +} + diff --git a/crates/control-plane-api/src/models/status_response_controller_status_one_of_1.rs b/crates/control-plane-api/src/models/status_response_controller_status_one_of_1.rs new file mode 100644 index 0000000000..149fc122a4 --- /dev/null +++ b/crates/control-plane-api/src/models/status_response_controller_status_one_of_1.rs @@ -0,0 +1,50 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// StatusResponseControllerStatusOneOf1 : The status of a collection controller +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StatusResponseControllerStatusOneOf1 { + #[serde(rename = "activation", skip_serializing_if = "Option::is_none")] + pub activation: Option>, + #[serde(rename = "inferred_schema", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub inferred_schema: Option>>, + #[serde(rename = "publications", skip_serializing_if = "Option::is_none")] + pub publications: Option>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl StatusResponseControllerStatusOneOf1 { + /// The status of a collection controller + pub fn new(r#type: Type) -> StatusResponseControllerStatusOneOf1 { + StatusResponseControllerStatusOneOf1 { + activation: None, + inferred_schema: None, + publications: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "Collection")] + Collection, +} + +impl Default for Type { + fn default() -> Type { + Self::Collection + } +} + diff --git a/crates/control-plane-api/src/models/status_response_controller_status_one_of_2.rs b/crates/control-plane-api/src/models/status_response_controller_status_one_of_2.rs new file mode 100644 index 0000000000..feb270da47 --- /dev/null +++ b/crates/control-plane-api/src/models/status_response_controller_status_one_of_2.rs @@ -0,0 +1,50 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// StatusResponseControllerStatusOneOf2 : Status of a materialization controller +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StatusResponseControllerStatusOneOf2 { + #[serde(rename = "activation", skip_serializing_if = "Option::is_none")] + pub activation: Option>, + #[serde(rename = "publications", skip_serializing_if = "Option::is_none")] + pub publications: Option>, + #[serde(rename = "source_capture", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub source_capture: Option>>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl StatusResponseControllerStatusOneOf2 { + /// Status of a materialization controller + pub fn new(r#type: Type) -> StatusResponseControllerStatusOneOf2 { + StatusResponseControllerStatusOneOf2 { + activation: None, + publications: None, + source_capture: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "Materialization")] + Materialization, +} + +impl Default for Type { + fn default() -> Type { + Self::Materialization + } +} + diff --git a/crates/control-plane-api/src/models/status_response_controller_status_one_of_3.rs b/crates/control-plane-api/src/models/status_response_controller_status_one_of_3.rs new file mode 100644 index 0000000000..fc297c581f --- /dev/null +++ b/crates/control-plane-api/src/models/status_response_controller_status_one_of_3.rs @@ -0,0 +1,45 @@ +/* + * Flow Control Plane V0 API + * + * some description here + * + * The version of the OpenAPI document: + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct StatusResponseControllerStatusOneOf3 { + #[serde(rename = "passing")] + pub passing: bool, + #[serde(rename = "publications", skip_serializing_if = "Option::is_none")] + pub publications: Option>, + #[serde(rename = "type")] + pub r#type: Type, +} + +impl StatusResponseControllerStatusOneOf3 { + pub fn new(passing: bool, r#type: Type) -> StatusResponseControllerStatusOneOf3 { + StatusResponseControllerStatusOneOf3 { + passing, + publications: None, + r#type, + } + } +} +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Type { + #[serde(rename = "Test")] + Test, +} + +impl Default for Type { + fn default() -> Type { + Self::Test + } +} +