diff --git a/Cargo.lock b/Cargo.lock index acfd899d..5bc58994 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -527,6 +527,16 @@ dependencies = [ "cipher", ] +[[package]] +name = "ctrlc" +version = "3.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73" +dependencies = [ + "nix 0.30.1", + "windows-sys 0.59.0", +] + [[package]] name = "darling" version = "0.20.11" @@ -697,6 +707,17 @@ dependencies = [ "str-buf", ] +[[package]] +name = "eventsource-stream" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74fef4569247a5f429d9156b9d0a2599914385dd189c539334c625d8099d90ab" +dependencies = [ + "futures-core", + "nom", + "pin-project-lite", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -835,6 +856,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.31" @@ -1412,6 +1439,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1460,6 +1493,28 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2034,6 +2089,22 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "reqwest-eventsource" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632c55746dbb44275691640e7b40c907c16a2dc1a5842aa98aaec90da6ec6bde" +dependencies = [ + "eventsource-stream", + "futures-core", + "futures-timer", + "mime", + "nom", + "pin-project-lite", + "reqwest", + "thiserror 1.0.69", +] + [[package]] name = "ring" version = "0.17.14" @@ -2182,7 +2253,7 @@ dependencies = [ "libc", "log", "memchr", - "nix", + "nix 0.23.2", "radix_trie", "scopeguard", "smallvec", @@ -2850,11 +2921,13 @@ dependencies = [ "colored", "config", "crypto", + "ctrlc", "futures-util", "http", "indicatif", "promptly", "reqwest", + "reqwest-eventsource", "rpassword", "rsa", "serde", diff --git a/Cargo.toml b/Cargo.toml index e763a0b3..f9911bd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ cli-table = "0.4" colored = "2" config = { path = "crates/config" } crypto = { path = "crates/crypto" } +ctrlc = "3" dirs = "5" futures = "0.3" futures-util = "0.3" @@ -37,6 +38,7 @@ pem = "3" promptly = "0.3" rand = "0.8" reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] } +reqwest-eventsource = { version = "0.6" } rpassword = "7" rsa = "0.9" serde = "1" diff --git a/crates/tower-api/README.md b/crates/tower-api/README.md index a59a4f34..d7bd0fa2 100644 --- a/crates/tower-api/README.md +++ b/crates/tower-api/README.md @@ -8,7 +8,7 @@ For more information, please visit [https://tower.dev](https://tower.dev) This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. -- API version: v0.6.24 +- API version: v0.6.27 - Package version: 1.0.0 - Generator version: 7.13.0 - Build package: `org.openapitools.codegen.languages.RustClientCodegen` @@ -38,6 +38,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**create_authenticator**](docs/DefaultApi.md#create_authenticator) | **POST** /accounts/authenticator | Create authenticator *DefaultApi* | [**create_catalog**](docs/DefaultApi.md#create_catalog) | **POST** /catalogs | Create catalog *DefaultApi* | [**create_device_login_ticket**](docs/DefaultApi.md#create_device_login_ticket) | **GET** /login/device | Create device login ticket +*DefaultApi* | [**create_environment**](docs/DefaultApi.md#create_environment) | **POST** /environments | Create environment *DefaultApi* | [**create_password_reset**](docs/DefaultApi.md#create_password_reset) | **POST** /accounts/password-reset | Create password reset *DefaultApi* | [**create_schedule**](docs/DefaultApi.md#create_schedule) | **POST** /schedules | Create schedule *DefaultApi* | [**create_secret**](docs/DefaultApi.md#create_secret) | **POST** /secrets | Create secret @@ -75,7 +76,9 @@ Class | Method | HTTP request | Description *DefaultApi* | [**list_apps**](docs/DefaultApi.md#list_apps) | **GET** /apps | List apps *DefaultApi* | [**list_authenticators**](docs/DefaultApi.md#list_authenticators) | **GET** /accounts/authenticator | List authenticators *DefaultApi* | [**list_catalogs**](docs/DefaultApi.md#list_catalogs) | **GET** /catalogs | List catalogs +*DefaultApi* | [**list_environments**](docs/DefaultApi.md#list_environments) | **GET** /environments | List environments *DefaultApi* | [**list_my_team_invitations**](docs/DefaultApi.md#list_my_team_invitations) | **GET** /team-invites | List my team invitations +*DefaultApi* | [**list_plans**](docs/DefaultApi.md#list_plans) | **GET** /plans | List account plans *DefaultApi* | [**list_runs**](docs/DefaultApi.md#list_runs) | **GET** /apps/{name}/runs | List runs *DefaultApi* | [**list_schedules**](docs/DefaultApi.md#list_schedules) | **GET** /schedules | List schedules *DefaultApi* | [**list_secret_environments**](docs/DefaultApi.md#list_secret_environments) | **GET** /secrets/environments | List secret environments @@ -93,8 +96,10 @@ Class | Method | HTTP request | Description *DefaultApi* | [**update_account_name**](docs/DefaultApi.md#update_account_name) | **PUT** /accounts/{name} | Update account name *DefaultApi* | [**update_app**](docs/DefaultApi.md#update_app) | **PUT** /apps/{name} | Update app *DefaultApi* | [**update_catalog**](docs/DefaultApi.md#update_catalog) | **PUT** /catalogs/{name} | Update catalog +*DefaultApi* | [**update_environment**](docs/DefaultApi.md#update_environment) | **PUT** /environments/{name} | Update environment *DefaultApi* | [**update_my_team_invitation**](docs/DefaultApi.md#update_my_team_invitation) | **PUT** /team-invites | Update my team invitation *DefaultApi* | [**update_password_reset**](docs/DefaultApi.md#update_password_reset) | **POST** /accounts/password-reset/{code} | Update password reset +*DefaultApi* | [**update_plan**](docs/DefaultApi.md#update_plan) | **PUT** /plan | Update plan *DefaultApi* | [**update_schedule**](docs/DefaultApi.md#update_schedule) | **PUT** /schedules/{id} | Update schedule *DefaultApi* | [**update_secret**](docs/DefaultApi.md#update_secret) | **PUT** /secrets/{name} | Update secret *DefaultApi* | [**update_team**](docs/DefaultApi.md#update_team) | **PUT** /teams/{name} | Update team @@ -131,6 +136,8 @@ Class | Method | HTTP request | Description - [CreateCatalogParams](docs/CreateCatalogParams.md) - [CreateCatalogResponse](docs/CreateCatalogResponse.md) - [CreateDeviceLoginTicketResponse](docs/CreateDeviceLoginTicketResponse.md) + - [CreateEnvironmentParams](docs/CreateEnvironmentParams.md) + - [CreateEnvironmentResponse](docs/CreateEnvironmentResponse.md) - [CreatePasswordResetParams](docs/CreatePasswordResetParams.md) - [CreatePasswordResetResponse](docs/CreatePasswordResetResponse.md) - [CreateScheduleParams](docs/CreateScheduleParams.md) @@ -162,8 +169,13 @@ Class | Method | HTTP request | Description - [DescribeSecretsKeyResponse](docs/DescribeSecretsKeyResponse.md) - [DescribeSessionResponse](docs/DescribeSessionResponse.md) - [EncryptedCatalogProperty](docs/EncryptedCatalogProperty.md) + - [Environment](docs/Environment.md) - [ErrorDetail](docs/ErrorDetail.md) - [ErrorModel](docs/ErrorModel.md) + - [EventError](docs/EventError.md) + - [EventLog](docs/EventLog.md) + - [EventRunFailureAlert](docs/EventRunFailureAlert.md) + - [EventWarning](docs/EventWarning.md) - [ExportCatalogsParams](docs/ExportCatalogsParams.md) - [ExportCatalogsResponse](docs/ExportCatalogsResponse.md) - [ExportSecretsParams](docs/ExportSecretsParams.md) @@ -172,6 +184,7 @@ Class | Method | HTTP request | Description - [ExportedCatalogProperty](docs/ExportedCatalogProperty.md) - [ExportedSecret](docs/ExportedSecret.md) - [FeaturebaseIdentity](docs/FeaturebaseIdentity.md) + - [Features](docs/Features.md) - [GenerateAppStatisticsResponse](docs/GenerateAppStatisticsResponse.md) - [GenerateAuthenticatorResponse](docs/GenerateAuthenticatorResponse.md) - [GenerateRunStatisticsResponse](docs/GenerateRunStatisticsResponse.md) @@ -179,6 +192,7 @@ Class | Method | HTTP request | Description - [InviteTeamMemberParams](docs/InviteTeamMemberParams.md) - [InviteTeamMemberResponse](docs/InviteTeamMemberResponse.md) - [LeaveTeamResponse](docs/LeaveTeamResponse.md) + - [ListAccountPlansResponse](docs/ListAccountPlansResponse.md) - [ListAlerts200Response](docs/ListAlerts200Response.md) - [ListAlertsResponse](docs/ListAlertsResponse.md) - [ListApiKeysResponse](docs/ListApiKeysResponse.md) @@ -187,6 +201,7 @@ Class | Method | HTTP request | Description - [ListAppsResponse](docs/ListAppsResponse.md) - [ListAuthenticatorsResponse](docs/ListAuthenticatorsResponse.md) - [ListCatalogsResponse](docs/ListCatalogsResponse.md) + - [ListEnvironmentsResponse](docs/ListEnvironmentsResponse.md) - [ListMyTeamInvitationsResponse](docs/ListMyTeamInvitationsResponse.md) - [ListRunsResponse](docs/ListRunsResponse.md) - [ListSchedulesResponse](docs/ListSchedulesResponse.md) @@ -198,6 +213,7 @@ Class | Method | HTTP request | Description - [LogLine](docs/LogLine.md) - [Pagination](docs/Pagination.md) - [Parameter](docs/Parameter.md) + - [Plan](docs/Plan.md) - [RefreshSessionParams](docs/RefreshSessionParams.md) - [RefreshSessionResponse](docs/RefreshSessionResponse.md) - [RemoveTeamMemberParams](docs/RemoveTeamMemberParams.md) @@ -232,10 +248,14 @@ Class | Method | HTTP request | Description - [UpdateAppResponse](docs/UpdateAppResponse.md) - [UpdateCatalogParams](docs/UpdateCatalogParams.md) - [UpdateCatalogResponse](docs/UpdateCatalogResponse.md) + - [UpdateEnvironmentParams](docs/UpdateEnvironmentParams.md) + - [UpdateEnvironmentResponse](docs/UpdateEnvironmentResponse.md) - [UpdateMyTeamInvitationParams](docs/UpdateMyTeamInvitationParams.md) - [UpdateMyTeamInvitationResponse](docs/UpdateMyTeamInvitationResponse.md) - [UpdatePasswordResetParams](docs/UpdatePasswordResetParams.md) - [UpdatePasswordResetResponse](docs/UpdatePasswordResetResponse.md) + - [UpdatePlanParams](docs/UpdatePlanParams.md) + - [UpdatePlanResponse](docs/UpdatePlanResponse.md) - [UpdateScheduleParams](docs/UpdateScheduleParams.md) - [UpdateScheduleResponse](docs/UpdateScheduleResponse.md) - [UpdateSecretParams](docs/UpdateSecretParams.md) diff --git a/crates/tower-api/src/apis/configuration.rs b/crates/tower-api/src/apis/configuration.rs index 45b100ab..e9675e44 100644 --- a/crates/tower-api/src/apis/configuration.rs +++ b/crates/tower-api/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/apis/default_api.rs b/crates/tower-api/src/apis/default_api.rs index 3feb8ece..8c36ed3b 100644 --- a/crates/tower-api/src/apis/default_api.rs +++ b/crates/tower-api/src/apis/default_api.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ @@ -74,6 +74,12 @@ pub struct CreateCatalogParams { pub create_catalog_params: models::CreateCatalogParams } +/// struct for passing parameters to the method [`create_environment`] +#[derive(Clone, Debug)] +pub struct CreateEnvironmentParams { + pub create_environment_params: models::CreateEnvironmentParams +} + /// struct for passing parameters to the method [`create_password_reset`] #[derive(Clone, Debug)] pub struct CreatePasswordResetParams { @@ -175,7 +181,9 @@ pub struct DeployAppParams { /// The name of the app to deploy. pub name: String, /// The encoding of the content. - pub content_encoding: Option + pub content_encoding: Option, + /// The SHA256 hash of the content, used to verify integrity. + pub x_tower_checksum_sha256: Option } /// struct for passing parameters to the method [`describe_app`] @@ -335,6 +343,15 @@ pub struct ListCatalogsParams { pub page_size: Option } +/// struct for passing parameters to the method [`list_plans`] +#[derive(Clone, Debug)] +pub struct ListPlansParams { + /// The page number to fetch. + pub page: Option, + /// The number of records to fetch on each page. + pub page_size: Option +} + /// struct for passing parameters to the method [`list_runs`] #[derive(Clone, Debug)] pub struct ListRunsParams { @@ -466,6 +483,14 @@ pub struct UpdateCatalogParams { pub update_catalog_params: models::UpdateCatalogParams } +/// struct for passing parameters to the method [`update_environment`] +#[derive(Clone, Debug)] +pub struct UpdateEnvironmentParams { + /// The current name of the environment to update. + pub name: String, + pub update_environment_params: models::UpdateEnvironmentParams +} + /// struct for passing parameters to the method [`update_my_team_invitation`] #[derive(Clone, Debug)] pub struct UpdateMyTeamInvitationParams { @@ -480,6 +505,12 @@ pub struct UpdatePasswordResetParams { pub update_password_reset_params: models::UpdatePasswordResetParams } +/// struct for passing parameters to the method [`update_plan`] +#[derive(Clone, Debug)] +pub struct UpdatePlanParams { + pub update_plan_params: models::UpdatePlanParams +} + /// struct for passing parameters to the method [`update_schedule`] #[derive(Clone, Debug)] pub struct UpdateScheduleParams { @@ -598,6 +629,14 @@ pub enum CreateDeviceLoginTicketSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`create_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateEnvironmentSuccess { + Status200(models::CreateEnvironmentResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`create_password_reset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -894,6 +933,14 @@ pub enum ListCatalogsSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`list_environments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListEnvironmentsSuccess { + Status200(models::ListEnvironmentsResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`list_my_team_invitations`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -902,6 +949,14 @@ pub enum ListMyTeamInvitationsSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`list_plans`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListPlansSuccess { + Status200(models::ListAccountPlansResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`list_runs`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1039,6 +1094,14 @@ pub enum UpdateCatalogSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`update_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateEnvironmentSuccess { + Status200(models::UpdateEnvironmentResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_my_team_invitation`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1055,6 +1118,14 @@ pub enum UpdatePasswordResetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`update_plan`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdatePlanSuccess { + Status201(models::UpdatePlanResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_schedule`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1175,6 +1246,14 @@ pub enum CreateDeviceLoginTicketError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`create_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateEnvironmentError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`create_password_reset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1474,6 +1553,14 @@ pub enum ListCatalogsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_environments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListEnvironmentsError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_my_team_invitations`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1482,6 +1569,14 @@ pub enum ListMyTeamInvitationsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_plans`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListPlansError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_runs`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1618,6 +1713,14 @@ pub enum UpdateCatalogError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateEnvironmentError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_my_team_invitation`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1634,6 +1737,14 @@ pub enum UpdatePasswordResetError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_plan`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdatePlanError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_schedule`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -2052,6 +2163,42 @@ pub async fn create_device_login_ticket(configuration: &configuration::Configura } } +/// Create a new environment for an app. +pub async fn create_environment(configuration: &configuration::Configuration, params: CreateEnvironmentParams) -> Result, Error> { + + let uri_str = format!("{}/environments", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + req_builder = req_builder.json(¶ms.create_environment_params); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Starts the password reset process for an account. If an email address exists for the account supplied, you will get a reset password email. pub async fn create_password_reset(configuration: &configuration::Configuration, params: CreatePasswordResetParams) -> Result, Error> { @@ -2562,6 +2709,9 @@ pub async fn deploy_app(configuration: &configuration::Configuration, params: De if let Some(param_value) = params.content_encoding { req_builder = req_builder.header("Content-Encoding", param_value.to_string()); } + if let Some(param_value) = params.x_tower_checksum_sha256 { + req_builder = req_builder.header("X-Tower-Checksum-SHA256", param_value.to_string()); + } if let Some(ref token) = configuration.bearer_access_token { req_builder = req_builder.bearer_auth(token.to_owned()); }; @@ -3456,6 +3606,41 @@ pub async fn list_catalogs(configuration: &configuration::Configuration, params: } } +/// List all environments in your account. +pub async fn list_environments(configuration: &configuration::Configuration) -> Result, Error> { + + let uri_str = format!("{}/environments", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// List your pending invitations for teams pub async fn list_my_team_invitations(configuration: &configuration::Configuration) -> Result, Error> { @@ -3491,6 +3676,47 @@ pub async fn list_my_team_invitations(configuration: &configuration::Configurati } } +/// List active and past account plans for the current account. +pub async fn list_plans(configuration: &configuration::Configuration, params: ListPlansParams) -> Result, Error> { + + let uri_str = format!("{}/plans", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = params.page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = params.page_size { + req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Generates a list of all the runs for a given app. The list is paginated based on the query string parameters passed in. pub async fn list_runs(configuration: &configuration::Configuration, params: ListRunsParams) -> Result, Error> { @@ -4155,6 +4381,42 @@ pub async fn update_catalog(configuration: &configuration::Configuration, params } } +/// Rename your environment +pub async fn update_environment(configuration: &configuration::Configuration, params: UpdateEnvironmentParams) -> Result, Error> { + + let uri_str = format!("{}/environments/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + req_builder = req_builder.json(¶ms.update_environment_params); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Update a team invitation that you have pending pub async fn update_my_team_invitation(configuration: &configuration::Configuration, params: UpdateMyTeamInvitationParams) -> Result, Error> { @@ -4224,6 +4486,41 @@ pub async fn update_password_reset(configuration: &configuration::Configuration, } } +pub async fn update_plan(configuration: &configuration::Configuration, params: UpdatePlanParams) -> Result, Error> { + + let uri_str = format!("{}/plan", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + req_builder = req_builder.json(¶ms.update_plan_params); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Update an existing schedule for an app. pub async fn update_schedule(configuration: &configuration::Configuration, params: UpdateScheduleParams) -> Result, Error> { diff --git a/crates/tower-api/src/models/accept_invitation_params.rs b/crates/tower-api/src/models/accept_invitation_params.rs index 5857c33d..ab0936a6 100644 --- a/crates/tower-api/src/models/accept_invitation_params.rs +++ b/crates/tower-api/src/models/accept_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcceptInvitationParams { diff --git a/crates/tower-api/src/models/accept_invitation_response.rs b/crates/tower-api/src/models/accept_invitation_response.rs index bf931c70..05bfc4db 100644 --- a/crates/tower-api/src/models/accept_invitation_response.rs +++ b/crates/tower-api/src/models/accept_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcceptInvitationResponse { @@ -17,14 +17,14 @@ pub struct AcceptInvitationResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "user")] - pub user: Box, + pub user: models::User, } impl AcceptInvitationResponse { pub fn new(user: models::User) -> AcceptInvitationResponse { AcceptInvitationResponse { schema: None, - user: Box::new(user), + user, } } } diff --git a/crates/tower-api/src/models/account.rs b/crates/tower-api/src/models/account.rs index 21e47197..b9be25f9 100644 --- a/crates/tower-api/src/models/account.rs +++ b/crates/tower-api/src/models/account.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Account { diff --git a/crates/tower-api/src/models/acknowledge_alert_response.rs b/crates/tower-api/src/models/acknowledge_alert_response.rs index 0b5d010c..ceffbdcd 100644 --- a/crates/tower-api/src/models/acknowledge_alert_response.rs +++ b/crates/tower-api/src/models/acknowledge_alert_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcknowledgeAlertResponse { diff --git a/crates/tower-api/src/models/acknowledge_all_alerts_response.rs b/crates/tower-api/src/models/acknowledge_all_alerts_response.rs index 5d933afd..20507611 100644 --- a/crates/tower-api/src/models/acknowledge_all_alerts_response.rs +++ b/crates/tower-api/src/models/acknowledge_all_alerts_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcknowledgeAllAlertsResponse { diff --git a/crates/tower-api/src/models/alert.rs b/crates/tower-api/src/models/alert.rs index 54d4adc8..0538dbfe 100644 --- a/crates/tower-api/src/models/alert.rs +++ b/crates/tower-api/src/models/alert.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Alert { @@ -20,7 +20,7 @@ pub struct Alert { #[serde(rename = "created_at")] pub created_at: String, #[serde(rename = "detail")] - pub detail: Box, + pub detail: models::RunFailureAlert, #[serde(rename = "seq")] pub seq: i64, #[serde(rename = "status")] @@ -33,7 +33,7 @@ impl Alert { acked, alert_type, created_at, - detail: Box::new(detail), + detail, seq, status, } diff --git a/crates/tower-api/src/models/api_key.rs b/crates/tower-api/src/models/api_key.rs index 865a8c21..65aa1a61 100644 --- a/crates/tower-api/src/models/api_key.rs +++ b/crates/tower-api/src/models/api_key.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiKey { diff --git a/crates/tower-api/src/models/app.rs b/crates/tower-api/src/models/app.rs index f083ee66..a92e4d25 100644 --- a/crates/tower-api/src/models/app.rs +++ b/crates/tower-api/src/models/app.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct App { @@ -21,7 +21,7 @@ pub struct App { pub health_status: HealthStatus, /// The last run of this app, null if none. #[serde(rename = "last_run", skip_serializing_if = "Option::is_none")] - pub last_run: Option>, + pub last_run: Option, /// The name of the app. #[serde(rename = "name")] pub name: String, @@ -33,7 +33,7 @@ pub struct App { pub owner: String, /// The stats of all the runs of this app #[serde(rename = "run_results", skip_serializing_if = "Option::is_none")] - pub run_results: Option>, + pub run_results: Option, /// The schedule associated with this app, null if none. #[serde(rename = "schedule", deserialize_with = "Option::deserialize")] pub schedule: Option, @@ -70,7 +70,7 @@ impl App { } } /// The health status of this app -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum HealthStatus { #[serde(rename = "healthy")] Healthy, @@ -83,8 +83,25 @@ impl Default for HealthStatus { Self::Healthy } } + +impl<'de> Deserialize<'de> for HealthStatus { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "healthy" => Ok(Self::Healthy), + "warning" => Ok(Self::Warning), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["healthy", "warning"], + )), + } + } +} /// The status of the app -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Status { #[serde(rename = "active")] Active, @@ -98,3 +115,20 @@ impl Default for Status { } } +impl<'de> Deserialize<'de> for Status { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "active" => Ok(Self::Active), + "disabled" => Ok(Self::Disabled), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["active", "disabled"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/app_statistics.rs b/crates/tower-api/src/models/app_statistics.rs index afed4963..c8321773 100644 --- a/crates/tower-api/src/models/app_statistics.rs +++ b/crates/tower-api/src/models/app_statistics.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AppStatistics { diff --git a/crates/tower-api/src/models/app_summary.rs b/crates/tower-api/src/models/app_summary.rs index 2e668277..7809b315 100644 --- a/crates/tower-api/src/models/app_summary.rs +++ b/crates/tower-api/src/models/app_summary.rs @@ -3,18 +3,18 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AppSummary { #[serde(rename = "app")] - pub app: Box, + pub app: models::App, #[serde(rename = "runs")] pub runs: Vec, } @@ -22,7 +22,7 @@ pub struct AppSummary { impl AppSummary { pub fn new(app: models::App, runs: Vec) -> AppSummary { AppSummary { - app: Box::new(app), + app, runs, } } diff --git a/crates/tower-api/src/models/app_version.rs b/crates/tower-api/src/models/app_version.rs index 7f07a7d8..3c370f6c 100644 --- a/crates/tower-api/src/models/app_version.rs +++ b/crates/tower-api/src/models/app_version.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AppVersion { diff --git a/crates/tower-api/src/models/cancel_run_response.rs b/crates/tower-api/src/models/cancel_run_response.rs index 1e150433..2ac391cd 100644 --- a/crates/tower-api/src/models/cancel_run_response.rs +++ b/crates/tower-api/src/models/cancel_run_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CancelRunResponse { @@ -17,14 +17,14 @@ pub struct CancelRunResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl CancelRunResponse { pub fn new(run: models::Run) -> CancelRunResponse { CancelRunResponse { schema: None, - run: Box::new(run), + run, } } } diff --git a/crates/tower-api/src/models/catalog.rs b/crates/tower-api/src/models/catalog.rs index d6333426..2654ddb8 100644 --- a/crates/tower-api/src/models/catalog.rs +++ b/crates/tower-api/src/models/catalog.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Catalog { diff --git a/crates/tower-api/src/models/catalog_property.rs b/crates/tower-api/src/models/catalog_property.rs index 4b0dd4cb..32d23ef2 100644 --- a/crates/tower-api/src/models/catalog_property.rs +++ b/crates/tower-api/src/models/catalog_property.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CatalogProperty { diff --git a/crates/tower-api/src/models/claim_device_login_ticket_params.rs b/crates/tower-api/src/models/claim_device_login_ticket_params.rs index 23cca6a5..8f60c19b 100644 --- a/crates/tower-api/src/models/claim_device_login_ticket_params.rs +++ b/crates/tower-api/src/models/claim_device_login_ticket_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ClaimDeviceLoginTicketParams { diff --git a/crates/tower-api/src/models/claim_device_login_ticket_response.rs b/crates/tower-api/src/models/claim_device_login_ticket_response.rs index 3c3d2e61..07d247af 100644 --- a/crates/tower-api/src/models/claim_device_login_ticket_response.rs +++ b/crates/tower-api/src/models/claim_device_login_ticket_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ClaimDeviceLoginTicketResponse { diff --git a/crates/tower-api/src/models/create_account_params.rs b/crates/tower-api/src/models/create_account_params.rs index 3d7d2194..958d56c9 100644 --- a/crates/tower-api/src/models/create_account_params.rs +++ b/crates/tower-api/src/models/create_account_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAccountParams { diff --git a/crates/tower-api/src/models/create_account_params_flags_struct.rs b/crates/tower-api/src/models/create_account_params_flags_struct.rs index 4fa9e105..a71ee086 100644 --- a/crates/tower-api/src/models/create_account_params_flags_struct.rs +++ b/crates/tower-api/src/models/create_account_params_flags_struct.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAccountParamsFlagsStruct { diff --git a/crates/tower-api/src/models/create_account_response.rs b/crates/tower-api/src/models/create_account_response.rs index b883b7fd..de4c86cc 100644 --- a/crates/tower-api/src/models/create_account_response.rs +++ b/crates/tower-api/src/models/create_account_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAccountResponse { @@ -17,14 +17,14 @@ pub struct CreateAccountResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl CreateAccountResponse { pub fn new(session: models::Session) -> CreateAccountResponse { CreateAccountResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/create_api_key_params.rs b/crates/tower-api/src/models/create_api_key_params.rs index 8c75b66f..57838d09 100644 --- a/crates/tower-api/src/models/create_api_key_params.rs +++ b/crates/tower-api/src/models/create_api_key_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateApiKeyParams { diff --git a/crates/tower-api/src/models/create_api_key_response.rs b/crates/tower-api/src/models/create_api_key_response.rs index 4e99c580..7e789aeb 100644 --- a/crates/tower-api/src/models/create_api_key_response.rs +++ b/crates/tower-api/src/models/create_api_key_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateApiKeyResponse { @@ -18,14 +18,14 @@ pub struct CreateApiKeyResponse { pub schema: Option, /// Created API key #[serde(rename = "api_key")] - pub api_key: Box, + pub api_key: models::ApiKey, } impl CreateApiKeyResponse { pub fn new(api_key: models::ApiKey) -> CreateApiKeyResponse { CreateApiKeyResponse { schema: None, - api_key: Box::new(api_key), + api_key, } } } diff --git a/crates/tower-api/src/models/create_app_params.rs b/crates/tower-api/src/models/create_app_params.rs index 08d370eb..c87259d7 100644 --- a/crates/tower-api/src/models/create_app_params.rs +++ b/crates/tower-api/src/models/create_app_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAppParams { diff --git a/crates/tower-api/src/models/create_app_response.rs b/crates/tower-api/src/models/create_app_response.rs index e2b02249..4fb240bc 100644 --- a/crates/tower-api/src/models/create_app_response.rs +++ b/crates/tower-api/src/models/create_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAppResponse { @@ -17,14 +17,14 @@ pub struct CreateAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "app")] - pub app: Box, + pub app: models::App, } impl CreateAppResponse { pub fn new(app: models::App) -> CreateAppResponse { CreateAppResponse { schema: None, - app: Box::new(app), + app, } } } diff --git a/crates/tower-api/src/models/create_authenticator_params.rs b/crates/tower-api/src/models/create_authenticator_params.rs index 9d08f255..e593e037 100644 --- a/crates/tower-api/src/models/create_authenticator_params.rs +++ b/crates/tower-api/src/models/create_authenticator_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAuthenticatorParams { diff --git a/crates/tower-api/src/models/create_authenticator_response.rs b/crates/tower-api/src/models/create_authenticator_response.rs index 60feed4a..825bce5b 100644 --- a/crates/tower-api/src/models/create_authenticator_response.rs +++ b/crates/tower-api/src/models/create_authenticator_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAuthenticatorResponse { @@ -17,14 +17,14 @@ pub struct CreateAuthenticatorResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "authenticator")] - pub authenticator: Box, + pub authenticator: models::VerifiedAuthenticator, } impl CreateAuthenticatorResponse { pub fn new(authenticator: models::VerifiedAuthenticator) -> CreateAuthenticatorResponse { CreateAuthenticatorResponse { schema: None, - authenticator: Box::new(authenticator), + authenticator, } } } diff --git a/crates/tower-api/src/models/create_catalog_params.rs b/crates/tower-api/src/models/create_catalog_params.rs index bc244d04..0e222f42 100644 --- a/crates/tower-api/src/models/create_catalog_params.rs +++ b/crates/tower-api/src/models/create_catalog_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateCatalogParams { @@ -38,7 +38,7 @@ impl CreateCatalogParams { } } /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Type { #[serde(rename = "snowflake-open-catalog")] SnowflakeOpenCatalog, @@ -56,3 +56,22 @@ impl Default for Type { } } +impl<'de> Deserialize<'de> for Type { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "snowflake-open-catalog" => Ok(Self::SnowflakeOpenCatalog), + "apache-polaris" => Ok(Self::ApachePolaris), + "cloudflare-r2-catalog" => Ok(Self::CloudflareR2Catalog), + "lakekeeper" => Ok(Self::Lakekeeper), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["snowflake-open-catalog", "apache-polaris", "cloudflare-r2-catalog", "lakekeeper"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/create_catalog_response.rs b/crates/tower-api/src/models/create_catalog_response.rs index 53dd0c52..d45675f2 100644 --- a/crates/tower-api/src/models/create_catalog_response.rs +++ b/crates/tower-api/src/models/create_catalog_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateCatalogResponse { @@ -17,14 +17,14 @@ pub struct CreateCatalogResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "catalog")] - pub catalog: Box, + pub catalog: models::Catalog, } impl CreateCatalogResponse { pub fn new(catalog: models::Catalog) -> CreateCatalogResponse { CreateCatalogResponse { schema: None, - catalog: Box::new(catalog), + catalog, } } } diff --git a/crates/tower-api/src/models/create_device_login_ticket_response.rs b/crates/tower-api/src/models/create_device_login_ticket_response.rs index ef434875..5a829451 100644 --- a/crates/tower-api/src/models/create_device_login_ticket_response.rs +++ b/crates/tower-api/src/models/create_device_login_ticket_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateDeviceLoginTicketResponse { diff --git a/crates/tower-api/src/models/create_environment_params.rs b/crates/tower-api/src/models/create_environment_params.rs new file mode 100644 index 00000000..f8ba0792 --- /dev/null +++ b/crates/tower-api/src/models/create_environment_params.rs @@ -0,0 +1,32 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateEnvironmentParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The name of the environment + #[serde(rename = "name")] + pub name: String, +} + +impl CreateEnvironmentParams { + pub fn new(name: String) -> CreateEnvironmentParams { + CreateEnvironmentParams { + schema: None, + name, + } + } +} + diff --git a/crates/tower-api/src/models/create_environment_response.rs b/crates/tower-api/src/models/create_environment_response.rs new file mode 100644 index 00000000..7fb41c81 --- /dev/null +++ b/crates/tower-api/src/models/create_environment_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateEnvironmentResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "environment")] + pub environment: models::Environment, +} + +impl CreateEnvironmentResponse { + pub fn new(environment: models::Environment) -> CreateEnvironmentResponse { + CreateEnvironmentResponse { + schema: None, + environment, + } + } +} + diff --git a/crates/tower-api/src/models/create_password_reset_params.rs b/crates/tower-api/src/models/create_password_reset_params.rs index 88e0289c..761ceebc 100644 --- a/crates/tower-api/src/models/create_password_reset_params.rs +++ b/crates/tower-api/src/models/create_password_reset_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreatePasswordResetParams { diff --git a/crates/tower-api/src/models/create_password_reset_response.rs b/crates/tower-api/src/models/create_password_reset_response.rs index 4e25cc8e..1bfc214f 100644 --- a/crates/tower-api/src/models/create_password_reset_response.rs +++ b/crates/tower-api/src/models/create_password_reset_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreatePasswordResetResponse { diff --git a/crates/tower-api/src/models/create_schedule_params.rs b/crates/tower-api/src/models/create_schedule_params.rs index 7c0866be..b51a5ff4 100644 --- a/crates/tower-api/src/models/create_schedule_params.rs +++ b/crates/tower-api/src/models/create_schedule_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateScheduleParams { @@ -23,8 +23,8 @@ pub struct CreateScheduleParams { #[serde(rename = "app_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub app_version: Option>, /// The cron expression defining when the app should run - #[serde(rename = "cron_string")] - pub cron_string: String, + #[serde(rename = "cron")] + pub cron: String, /// The environment to run the app in #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] pub environment: Option, @@ -34,12 +34,12 @@ pub struct CreateScheduleParams { } impl CreateScheduleParams { - pub fn new(app_name: String, cron_string: String) -> CreateScheduleParams { + pub fn new(app_name: String, cron: String) -> CreateScheduleParams { CreateScheduleParams { schema: None, app_name, app_version: None, - cron_string, + cron, environment: None, parameters: None, } diff --git a/crates/tower-api/src/models/create_schedule_response.rs b/crates/tower-api/src/models/create_schedule_response.rs index 2077e916..5ea8fd97 100644 --- a/crates/tower-api/src/models/create_schedule_response.rs +++ b/crates/tower-api/src/models/create_schedule_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateScheduleResponse { @@ -17,14 +17,14 @@ pub struct CreateScheduleResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "schedule")] - pub schedule: Box, + pub schedule: models::Schedule, } impl CreateScheduleResponse { pub fn new(schedule: models::Schedule) -> CreateScheduleResponse { CreateScheduleResponse { schema: None, - schedule: Box::new(schedule), + schedule, } } } diff --git a/crates/tower-api/src/models/create_secret_params.rs b/crates/tower-api/src/models/create_secret_params.rs index 15b5f885..19516ee7 100644 --- a/crates/tower-api/src/models/create_secret_params.rs +++ b/crates/tower-api/src/models/create_secret_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSecretParams { diff --git a/crates/tower-api/src/models/create_secret_response.rs b/crates/tower-api/src/models/create_secret_response.rs index 2fa5ce9a..e6b4158f 100644 --- a/crates/tower-api/src/models/create_secret_response.rs +++ b/crates/tower-api/src/models/create_secret_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSecretResponse { @@ -17,14 +17,14 @@ pub struct CreateSecretResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "secret")] - pub secret: Box, + pub secret: models::Secret, } impl CreateSecretResponse { pub fn new(secret: models::Secret) -> CreateSecretResponse { CreateSecretResponse { schema: None, - secret: Box::new(secret), + secret, } } } diff --git a/crates/tower-api/src/models/create_session_params.rs b/crates/tower-api/src/models/create_session_params.rs index f141cfc4..7abc0836 100644 --- a/crates/tower-api/src/models/create_session_params.rs +++ b/crates/tower-api/src/models/create_session_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSessionParams { diff --git a/crates/tower-api/src/models/create_session_response.rs b/crates/tower-api/src/models/create_session_response.rs index e7d37695..83f42ddf 100644 --- a/crates/tower-api/src/models/create_session_response.rs +++ b/crates/tower-api/src/models/create_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSessionResponse { @@ -18,14 +18,14 @@ pub struct CreateSessionResponse { pub schema: Option, /// The new session information. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl CreateSessionResponse { pub fn new(session: models::Session) -> CreateSessionResponse { CreateSessionResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/create_team_params.rs b/crates/tower-api/src/models/create_team_params.rs index 1ec83581..18c53b19 100644 --- a/crates/tower-api/src/models/create_team_params.rs +++ b/crates/tower-api/src/models/create_team_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateTeamParams { diff --git a/crates/tower-api/src/models/create_team_response.rs b/crates/tower-api/src/models/create_team_response.rs index 560f8681..75bc1bbb 100644 --- a/crates/tower-api/src/models/create_team_response.rs +++ b/crates/tower-api/src/models/create_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateTeamResponse { @@ -18,14 +18,14 @@ pub struct CreateTeamResponse { pub schema: Option, /// The team that was just created #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl CreateTeamResponse { pub fn new(team: models::Team) -> CreateTeamResponse { CreateTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/delete_api_key_params.rs b/crates/tower-api/src/models/delete_api_key_params.rs index e31065d5..99cb217a 100644 --- a/crates/tower-api/src/models/delete_api_key_params.rs +++ b/crates/tower-api/src/models/delete_api_key_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteApiKeyParams { diff --git a/crates/tower-api/src/models/delete_api_key_response.rs b/crates/tower-api/src/models/delete_api_key_response.rs index eac3b2ed..d89d01ff 100644 --- a/crates/tower-api/src/models/delete_api_key_response.rs +++ b/crates/tower-api/src/models/delete_api_key_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteApiKeyResponse { @@ -18,14 +18,14 @@ pub struct DeleteApiKeyResponse { pub schema: Option, /// Created API key #[serde(rename = "api_key")] - pub api_key: Box, + pub api_key: models::ApiKey, } impl DeleteApiKeyResponse { pub fn new(api_key: models::ApiKey) -> DeleteApiKeyResponse { DeleteApiKeyResponse { schema: None, - api_key: Box::new(api_key), + api_key, } } } diff --git a/crates/tower-api/src/models/delete_app_response.rs b/crates/tower-api/src/models/delete_app_response.rs index d5d89c7f..af1b2e9f 100644 --- a/crates/tower-api/src/models/delete_app_response.rs +++ b/crates/tower-api/src/models/delete_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteAppResponse { @@ -17,14 +17,14 @@ pub struct DeleteAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "app")] - pub app: Box, + pub app: models::App, } impl DeleteAppResponse { pub fn new(app: models::App) -> DeleteAppResponse { DeleteAppResponse { schema: None, - app: Box::new(app), + app, } } } diff --git a/crates/tower-api/src/models/delete_authenticator_params.rs b/crates/tower-api/src/models/delete_authenticator_params.rs index 95d82a48..efa81d7c 100644 --- a/crates/tower-api/src/models/delete_authenticator_params.rs +++ b/crates/tower-api/src/models/delete_authenticator_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteAuthenticatorParams { diff --git a/crates/tower-api/src/models/delete_authenticator_response.rs b/crates/tower-api/src/models/delete_authenticator_response.rs index 71cc947d..6db18c1f 100644 --- a/crates/tower-api/src/models/delete_authenticator_response.rs +++ b/crates/tower-api/src/models/delete_authenticator_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteAuthenticatorResponse { @@ -17,14 +17,14 @@ pub struct DeleteAuthenticatorResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "authenticator")] - pub authenticator: Box, + pub authenticator: models::VerifiedAuthenticator, } impl DeleteAuthenticatorResponse { pub fn new(authenticator: models::VerifiedAuthenticator) -> DeleteAuthenticatorResponse { DeleteAuthenticatorResponse { schema: None, - authenticator: Box::new(authenticator), + authenticator, } } } diff --git a/crates/tower-api/src/models/delete_catalog_response.rs b/crates/tower-api/src/models/delete_catalog_response.rs index e5f5f15d..9334b707 100644 --- a/crates/tower-api/src/models/delete_catalog_response.rs +++ b/crates/tower-api/src/models/delete_catalog_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteCatalogResponse { @@ -17,14 +17,14 @@ pub struct DeleteCatalogResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "catalog")] - pub catalog: Box, + pub catalog: models::Catalog, } impl DeleteCatalogResponse { pub fn new(catalog: models::Catalog) -> DeleteCatalogResponse { DeleteCatalogResponse { schema: None, - catalog: Box::new(catalog), + catalog, } } } diff --git a/crates/tower-api/src/models/delete_schedule_response.rs b/crates/tower-api/src/models/delete_schedule_response.rs index 5bc84960..f3a909aa 100644 --- a/crates/tower-api/src/models/delete_schedule_response.rs +++ b/crates/tower-api/src/models/delete_schedule_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteScheduleResponse { diff --git a/crates/tower-api/src/models/delete_secret_response.rs b/crates/tower-api/src/models/delete_secret_response.rs index 2de5d0fd..04c95e28 100644 --- a/crates/tower-api/src/models/delete_secret_response.rs +++ b/crates/tower-api/src/models/delete_secret_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteSecretResponse { @@ -17,14 +17,14 @@ pub struct DeleteSecretResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "secret")] - pub secret: Box, + pub secret: models::Secret, } impl DeleteSecretResponse { pub fn new(secret: models::Secret) -> DeleteSecretResponse { DeleteSecretResponse { schema: None, - secret: Box::new(secret), + secret, } } } diff --git a/crates/tower-api/src/models/delete_team_invitation_params.rs b/crates/tower-api/src/models/delete_team_invitation_params.rs index 9900fb2e..94cabda2 100644 --- a/crates/tower-api/src/models/delete_team_invitation_params.rs +++ b/crates/tower-api/src/models/delete_team_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamInvitationParams { diff --git a/crates/tower-api/src/models/delete_team_invitation_response.rs b/crates/tower-api/src/models/delete_team_invitation_response.rs index 679f9496..d01f02f2 100644 --- a/crates/tower-api/src/models/delete_team_invitation_response.rs +++ b/crates/tower-api/src/models/delete_team_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamInvitationResponse { @@ -18,14 +18,14 @@ pub struct DeleteTeamInvitationResponse { pub schema: Option, /// The team invitation that was just removed #[serde(rename = "invitation")] - pub invitation: Box, + pub invitation: models::TeamInvitation, } impl DeleteTeamInvitationResponse { pub fn new(invitation: models::TeamInvitation) -> DeleteTeamInvitationResponse { DeleteTeamInvitationResponse { schema: None, - invitation: Box::new(invitation), + invitation, } } } diff --git a/crates/tower-api/src/models/delete_team_params.rs b/crates/tower-api/src/models/delete_team_params.rs index f551ff9c..778097e1 100644 --- a/crates/tower-api/src/models/delete_team_params.rs +++ b/crates/tower-api/src/models/delete_team_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamParams { diff --git a/crates/tower-api/src/models/delete_team_response.rs b/crates/tower-api/src/models/delete_team_response.rs index 65cf9b78..6fe1066b 100644 --- a/crates/tower-api/src/models/delete_team_response.rs +++ b/crates/tower-api/src/models/delete_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamResponse { @@ -18,14 +18,14 @@ pub struct DeleteTeamResponse { pub schema: Option, /// The team that was just created #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl DeleteTeamResponse { pub fn new(team: models::Team) -> DeleteTeamResponse { DeleteTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/deploy_app_response.rs b/crates/tower-api/src/models/deploy_app_response.rs index 3b902b9b..760fef4d 100644 --- a/crates/tower-api/src/models/deploy_app_response.rs +++ b/crates/tower-api/src/models/deploy_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeployAppResponse { @@ -17,14 +17,14 @@ pub struct DeployAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "version")] - pub version: Box, + pub version: models::AppVersion, } impl DeployAppResponse { pub fn new(version: models::AppVersion) -> DeployAppResponse { DeployAppResponse { schema: None, - version: Box::new(version), + version, } } } diff --git a/crates/tower-api/src/models/describe_app_response.rs b/crates/tower-api/src/models/describe_app_response.rs index 8a5f7019..cb9775b5 100644 --- a/crates/tower-api/src/models/describe_app_response.rs +++ b/crates/tower-api/src/models/describe_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeAppResponse { @@ -17,7 +17,7 @@ pub struct DescribeAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "app")] - pub app: Box, + pub app: models::App, #[serde(rename = "runs")] pub runs: Vec, } @@ -26,7 +26,7 @@ impl DescribeAppResponse { pub fn new(app: models::App, runs: Vec) -> DescribeAppResponse { DescribeAppResponse { schema: None, - app: Box::new(app), + app, runs, } } diff --git a/crates/tower-api/src/models/describe_app_version_response.rs b/crates/tower-api/src/models/describe_app_version_response.rs index 22226b04..77eb955b 100644 --- a/crates/tower-api/src/models/describe_app_version_response.rs +++ b/crates/tower-api/src/models/describe_app_version_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeAppVersionResponse { @@ -17,14 +17,14 @@ pub struct DescribeAppVersionResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "version")] - pub version: Box, + pub version: models::AppVersion, } impl DescribeAppVersionResponse { pub fn new(version: models::AppVersion) -> DescribeAppVersionResponse { DescribeAppVersionResponse { schema: None, - version: Box::new(version), + version, } } } diff --git a/crates/tower-api/src/models/describe_device_login_session_response.rs b/crates/tower-api/src/models/describe_device_login_session_response.rs index ac62e574..276d1253 100644 --- a/crates/tower-api/src/models/describe_device_login_session_response.rs +++ b/crates/tower-api/src/models/describe_device_login_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeDeviceLoginSessionResponse { @@ -18,14 +18,14 @@ pub struct DescribeDeviceLoginSessionResponse { pub schema: Option, /// The current session associated with your authentication method. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl DescribeDeviceLoginSessionResponse { pub fn new(session: models::Session) -> DescribeDeviceLoginSessionResponse { DescribeDeviceLoginSessionResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/describe_run_logs_response.rs b/crates/tower-api/src/models/describe_run_logs_response.rs index cf50dfd6..ab779807 100644 --- a/crates/tower-api/src/models/describe_run_logs_response.rs +++ b/crates/tower-api/src/models/describe_run_logs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeRunLogsResponse { diff --git a/crates/tower-api/src/models/describe_run_response.rs b/crates/tower-api/src/models/describe_run_response.rs index d4757410..c47ecf88 100644 --- a/crates/tower-api/src/models/describe_run_response.rs +++ b/crates/tower-api/src/models/describe_run_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeRunResponse { @@ -17,14 +17,14 @@ pub struct DescribeRunResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl DescribeRunResponse { pub fn new(run: models::Run) -> DescribeRunResponse { DescribeRunResponse { schema: None, - run: Box::new(run), + run, } } } diff --git a/crates/tower-api/src/models/describe_secrets_key_response.rs b/crates/tower-api/src/models/describe_secrets_key_response.rs index b7e4dd80..b5f5fa14 100644 --- a/crates/tower-api/src/models/describe_secrets_key_response.rs +++ b/crates/tower-api/src/models/describe_secrets_key_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeSecretsKeyResponse { diff --git a/crates/tower-api/src/models/describe_session_response.rs b/crates/tower-api/src/models/describe_session_response.rs index 32059fa1..5f6ed823 100644 --- a/crates/tower-api/src/models/describe_session_response.rs +++ b/crates/tower-api/src/models/describe_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeSessionResponse { @@ -18,14 +18,14 @@ pub struct DescribeSessionResponse { pub schema: Option, /// The current session associated with your authentication method. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl DescribeSessionResponse { pub fn new(session: models::Session) -> DescribeSessionResponse { DescribeSessionResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/encrypted_catalog_property.rs b/crates/tower-api/src/models/encrypted_catalog_property.rs index 05bf2401..d66b21eb 100644 --- a/crates/tower-api/src/models/encrypted_catalog_property.rs +++ b/crates/tower-api/src/models/encrypted_catalog_property.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EncryptedCatalogProperty { diff --git a/crates/tower-api/src/models/environment.rs b/crates/tower-api/src/models/environment.rs new file mode 100644 index 00000000..8c3a9b36 --- /dev/null +++ b/crates/tower-api/src/models/environment.rs @@ -0,0 +1,28 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Environment { + /// The human readable name for the environment + #[serde(rename = "name")] + pub name: String, +} + +impl Environment { + pub fn new(name: String) -> Environment { + Environment { + name, + } + } +} + diff --git a/crates/tower-api/src/models/error_detail.rs b/crates/tower-api/src/models/error_detail.rs index 82246d0e..e9b09217 100644 --- a/crates/tower-api/src/models/error_detail.rs +++ b/crates/tower-api/src/models/error_detail.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorDetail { diff --git a/crates/tower-api/src/models/error_model.rs b/crates/tower-api/src/models/error_model.rs index 550a5ab1..0c6c7ad2 100644 --- a/crates/tower-api/src/models/error_model.rs +++ b/crates/tower-api/src/models/error_model.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorModel { diff --git a/crates/tower-api/src/models/event_error.rs b/crates/tower-api/src/models/event_error.rs new file mode 100644 index 00000000..5b84a63f --- /dev/null +++ b/crates/tower-api/src/models/event_error.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventError { + #[serde(rename = "data")] + pub data: models::SseWarning, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventError { + pub fn new(data: models::SseWarning, event: Event) -> EventError { + EventError { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "error")] + Error, +} + +impl Default for Event { + fn default() -> Event { + Self::Error + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "error" => Ok(Self::Error), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["error"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/event_log.rs b/crates/tower-api/src/models/event_log.rs new file mode 100644 index 00000000..380c0511 --- /dev/null +++ b/crates/tower-api/src/models/event_log.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventLog { + #[serde(rename = "data")] + pub data: models::LogLine, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventLog { + pub fn new(data: models::LogLine, event: Event) -> EventLog { + EventLog { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "log")] + Log, +} + +impl Default for Event { + fn default() -> Event { + Self::Log + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "log" => Ok(Self::Log), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["log"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/event_run_failure_alert.rs b/crates/tower-api/src/models/event_run_failure_alert.rs new file mode 100644 index 00000000..1143d8c1 --- /dev/null +++ b/crates/tower-api/src/models/event_run_failure_alert.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventRunFailureAlert { + #[serde(rename = "data")] + pub data: models::RunFailureAlert, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventRunFailureAlert { + pub fn new(data: models::RunFailureAlert, event: Event) -> EventRunFailureAlert { + EventRunFailureAlert { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "run_failure_alert")] + RunFailureAlert, +} + +impl Default for Event { + fn default() -> Event { + Self::RunFailureAlert + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "run_failure_alert" => Ok(Self::RunFailureAlert), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["run_failure_alert"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/event_warning.rs b/crates/tower-api/src/models/event_warning.rs new file mode 100644 index 00000000..30d3b160 --- /dev/null +++ b/crates/tower-api/src/models/event_warning.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventWarning { + #[serde(rename = "data")] + pub data: models::SseWarning, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventWarning { + pub fn new(data: models::SseWarning, event: Event) -> EventWarning { + EventWarning { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "warning")] + Warning, +} + +impl Default for Event { + fn default() -> Event { + Self::Warning + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "warning" => Ok(Self::Warning), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["warning"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/export_catalogs_params.rs b/crates/tower-api/src/models/export_catalogs_params.rs index 6fd5d6db..9eed5f3e 100644 --- a/crates/tower-api/src/models/export_catalogs_params.rs +++ b/crates/tower-api/src/models/export_catalogs_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportCatalogsParams { diff --git a/crates/tower-api/src/models/export_catalogs_response.rs b/crates/tower-api/src/models/export_catalogs_response.rs index 5ce0c191..20c07993 100644 --- a/crates/tower-api/src/models/export_catalogs_response.rs +++ b/crates/tower-api/src/models/export_catalogs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportCatalogsResponse { @@ -19,7 +19,7 @@ pub struct ExportCatalogsResponse { #[serde(rename = "catalogs")] pub catalogs: Vec, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ExportCatalogsResponse { @@ -27,7 +27,7 @@ impl ExportCatalogsResponse { ExportCatalogsResponse { schema: None, catalogs, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/export_secrets_params.rs b/crates/tower-api/src/models/export_secrets_params.rs index 202d4da7..fa10763b 100644 --- a/crates/tower-api/src/models/export_secrets_params.rs +++ b/crates/tower-api/src/models/export_secrets_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportSecretsParams { diff --git a/crates/tower-api/src/models/export_secrets_response.rs b/crates/tower-api/src/models/export_secrets_response.rs index 5845f1e4..556f8d28 100644 --- a/crates/tower-api/src/models/export_secrets_response.rs +++ b/crates/tower-api/src/models/export_secrets_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportSecretsResponse { @@ -17,7 +17,7 @@ pub struct ExportSecretsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "secrets")] pub secrets: Vec, } @@ -26,7 +26,7 @@ impl ExportSecretsResponse { pub fn new(pages: models::Pagination, secrets: Vec) -> ExportSecretsResponse { ExportSecretsResponse { schema: None, - pages: Box::new(pages), + pages, secrets, } } diff --git a/crates/tower-api/src/models/exported_catalog.rs b/crates/tower-api/src/models/exported_catalog.rs index a760a3df..4df878ad 100644 --- a/crates/tower-api/src/models/exported_catalog.rs +++ b/crates/tower-api/src/models/exported_catalog.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportedCatalog { diff --git a/crates/tower-api/src/models/exported_catalog_property.rs b/crates/tower-api/src/models/exported_catalog_property.rs index d97157a9..af44933c 100644 --- a/crates/tower-api/src/models/exported_catalog_property.rs +++ b/crates/tower-api/src/models/exported_catalog_property.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportedCatalogProperty { diff --git a/crates/tower-api/src/models/exported_secret.rs b/crates/tower-api/src/models/exported_secret.rs index f67eae27..19b11890 100644 --- a/crates/tower-api/src/models/exported_secret.rs +++ b/crates/tower-api/src/models/exported_secret.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportedSecret { diff --git a/crates/tower-api/src/models/featurebase_identity.rs b/crates/tower-api/src/models/featurebase_identity.rs index 55075941..ca53329c 100644 --- a/crates/tower-api/src/models/featurebase_identity.rs +++ b/crates/tower-api/src/models/featurebase_identity.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FeaturebaseIdentity { diff --git a/crates/tower-api/src/models/features.rs b/crates/tower-api/src/models/features.rs new file mode 100644 index 00000000..a3133073 --- /dev/null +++ b/crates/tower-api/src/models/features.rs @@ -0,0 +1,44 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Features { + /// Whether self-hosted runners are enabled + #[serde(rename = "has_self_hosted_runners", skip_serializing_if = "Option::is_none")] + pub has_self_hosted_runners: Option, + /// The number of apps that can be created + #[serde(rename = "num_apps", skip_serializing_if = "Option::is_none")] + pub num_apps: Option, + /// The number of minutes that can be used for free per month + #[serde(rename = "num_minutes", skip_serializing_if = "Option::is_none")] + pub num_minutes: Option, + /// The number of schedules that can be created + #[serde(rename = "num_schedules", skip_serializing_if = "Option::is_none")] + pub num_schedules: Option, + /// The number of team members that can be added + #[serde(rename = "num_team_members", skip_serializing_if = "Option::is_none")] + pub num_team_members: Option, +} + +impl Features { + pub fn new() -> Features { + Features { + has_self_hosted_runners: None, + num_apps: None, + num_minutes: None, + num_schedules: None, + num_team_members: None, + } + } +} + diff --git a/crates/tower-api/src/models/generate_app_statistics_response.rs b/crates/tower-api/src/models/generate_app_statistics_response.rs index f610c10b..f1dc07f5 100644 --- a/crates/tower-api/src/models/generate_app_statistics_response.rs +++ b/crates/tower-api/src/models/generate_app_statistics_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateAppStatisticsResponse { @@ -17,14 +17,14 @@ pub struct GenerateAppStatisticsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "statistics")] - pub statistics: Box, + pub statistics: models::AppStatistics, } impl GenerateAppStatisticsResponse { pub fn new(statistics: models::AppStatistics) -> GenerateAppStatisticsResponse { GenerateAppStatisticsResponse { schema: None, - statistics: Box::new(statistics), + statistics, } } } diff --git a/crates/tower-api/src/models/generate_authenticator_response.rs b/crates/tower-api/src/models/generate_authenticator_response.rs index 4d6dcc50..1338f0ef 100644 --- a/crates/tower-api/src/models/generate_authenticator_response.rs +++ b/crates/tower-api/src/models/generate_authenticator_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateAuthenticatorResponse { @@ -17,14 +17,14 @@ pub struct GenerateAuthenticatorResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "authenticator")] - pub authenticator: Box, + pub authenticator: models::UnverifiedAuthenticator, } impl GenerateAuthenticatorResponse { pub fn new(authenticator: models::UnverifiedAuthenticator) -> GenerateAuthenticatorResponse { GenerateAuthenticatorResponse { schema: None, - authenticator: Box::new(authenticator), + authenticator, } } } diff --git a/crates/tower-api/src/models/generate_run_statistics_response.rs b/crates/tower-api/src/models/generate_run_statistics_response.rs index a564800d..750fd78e 100644 --- a/crates/tower-api/src/models/generate_run_statistics_response.rs +++ b/crates/tower-api/src/models/generate_run_statistics_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateRunStatisticsResponse { @@ -19,9 +19,9 @@ pub struct GenerateRunStatisticsResponse { #[serde(rename = "series")] pub series: Vec, #[serde(rename = "settings")] - pub settings: Box, + pub settings: models::StatisticsSettings, #[serde(rename = "stats")] - pub stats: Box, + pub stats: models::RunStatistics, } impl GenerateRunStatisticsResponse { @@ -29,8 +29,8 @@ impl GenerateRunStatisticsResponse { GenerateRunStatisticsResponse { schema: None, series, - settings: Box::new(settings), - stats: Box::new(stats), + settings, + stats, } } } diff --git a/crates/tower-api/src/models/generate_runner_credentials_response.rs b/crates/tower-api/src/models/generate_runner_credentials_response.rs index 2f6eb2fb..ddb242b5 100644 --- a/crates/tower-api/src/models/generate_runner_credentials_response.rs +++ b/crates/tower-api/src/models/generate_runner_credentials_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateRunnerCredentialsResponse { @@ -17,14 +17,14 @@ pub struct GenerateRunnerCredentialsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "credentials")] - pub credentials: Box, + pub credentials: models::RunnerCredentials, } impl GenerateRunnerCredentialsResponse { pub fn new(credentials: models::RunnerCredentials) -> GenerateRunnerCredentialsResponse { GenerateRunnerCredentialsResponse { schema: None, - credentials: Box::new(credentials), + credentials, } } } diff --git a/crates/tower-api/src/models/invite_team_member_params.rs b/crates/tower-api/src/models/invite_team_member_params.rs index dcb0dd38..0887c0e8 100644 --- a/crates/tower-api/src/models/invite_team_member_params.rs +++ b/crates/tower-api/src/models/invite_team_member_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InviteTeamMemberParams { diff --git a/crates/tower-api/src/models/invite_team_member_response.rs b/crates/tower-api/src/models/invite_team_member_response.rs index 5a6d1ce1..6503f744 100644 --- a/crates/tower-api/src/models/invite_team_member_response.rs +++ b/crates/tower-api/src/models/invite_team_member_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InviteTeamMemberResponse { diff --git a/crates/tower-api/src/models/leave_team_response.rs b/crates/tower-api/src/models/leave_team_response.rs index abc5e67f..1ce6996e 100644 --- a/crates/tower-api/src/models/leave_team_response.rs +++ b/crates/tower-api/src/models/leave_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LeaveTeamResponse { @@ -18,14 +18,14 @@ pub struct LeaveTeamResponse { pub schema: Option, /// The team that you just left #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl LeaveTeamResponse { pub fn new(team: models::Team) -> LeaveTeamResponse { LeaveTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/list_account_plans_response.rs b/crates/tower-api/src/models/list_account_plans_response.rs new file mode 100644 index 00000000..b2f6d019 --- /dev/null +++ b/crates/tower-api/src/models/list_account_plans_response.rs @@ -0,0 +1,34 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListAccountPlansResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "pages")] + pub pages: models::Pagination, + #[serde(rename = "plans")] + pub plans: Vec, +} + +impl ListAccountPlansResponse { + pub fn new(pages: models::Pagination, plans: Vec) -> ListAccountPlansResponse { + ListAccountPlansResponse { + schema: None, + pages, + plans, + } + } +} + diff --git a/crates/tower-api/src/models/list_alerts_200_response.rs b/crates/tower-api/src/models/list_alerts_200_response.rs index 9628e891..1fdf60dc 100644 --- a/crates/tower-api/src/models/list_alerts_200_response.rs +++ b/crates/tower-api/src/models/list_alerts_200_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAlerts200Response { diff --git a/crates/tower-api/src/models/list_alerts_response.rs b/crates/tower-api/src/models/list_alerts_response.rs index bbbb140b..2a22a32e 100644 --- a/crates/tower-api/src/models/list_alerts_response.rs +++ b/crates/tower-api/src/models/list_alerts_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAlertsResponse { @@ -21,7 +21,7 @@ pub struct ListAlertsResponse { pub alerts: Vec, /// Pagination information #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ListAlertsResponse { @@ -29,7 +29,7 @@ impl ListAlertsResponse { ListAlertsResponse { schema: None, alerts, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/list_api_keys_response.rs b/crates/tower-api/src/models/list_api_keys_response.rs index 6e920370..7ac17841 100644 --- a/crates/tower-api/src/models/list_api_keys_response.rs +++ b/crates/tower-api/src/models/list_api_keys_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListApiKeysResponse { diff --git a/crates/tower-api/src/models/list_app_environments_response.rs b/crates/tower-api/src/models/list_app_environments_response.rs index 19806ed7..32783a2c 100644 --- a/crates/tower-api/src/models/list_app_environments_response.rs +++ b/crates/tower-api/src/models/list_app_environments_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAppEnvironmentsResponse { diff --git a/crates/tower-api/src/models/list_app_versions_response.rs b/crates/tower-api/src/models/list_app_versions_response.rs index aa6c7efc..fae16f65 100644 --- a/crates/tower-api/src/models/list_app_versions_response.rs +++ b/crates/tower-api/src/models/list_app_versions_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAppVersionsResponse { diff --git a/crates/tower-api/src/models/list_apps_response.rs b/crates/tower-api/src/models/list_apps_response.rs index 39517049..792473d3 100644 --- a/crates/tower-api/src/models/list_apps_response.rs +++ b/crates/tower-api/src/models/list_apps_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAppsResponse { @@ -19,7 +19,7 @@ pub struct ListAppsResponse { #[serde(rename = "apps")] pub apps: Vec, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ListAppsResponse { @@ -27,7 +27,7 @@ impl ListAppsResponse { ListAppsResponse { schema: None, apps, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/list_authenticators_response.rs b/crates/tower-api/src/models/list_authenticators_response.rs index ab6cdfbb..caed34d0 100644 --- a/crates/tower-api/src/models/list_authenticators_response.rs +++ b/crates/tower-api/src/models/list_authenticators_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAuthenticatorsResponse { diff --git a/crates/tower-api/src/models/list_catalogs_response.rs b/crates/tower-api/src/models/list_catalogs_response.rs index 86647c30..8cf6df9f 100644 --- a/crates/tower-api/src/models/list_catalogs_response.rs +++ b/crates/tower-api/src/models/list_catalogs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListCatalogsResponse { @@ -19,7 +19,7 @@ pub struct ListCatalogsResponse { #[serde(rename = "catalogs")] pub catalogs: Vec, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ListCatalogsResponse { @@ -27,7 +27,7 @@ impl ListCatalogsResponse { ListCatalogsResponse { schema: None, catalogs, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/list_environments_response.rs b/crates/tower-api/src/models/list_environments_response.rs new file mode 100644 index 00000000..0b038169 --- /dev/null +++ b/crates/tower-api/src/models/list_environments_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListEnvironmentsResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "environments")] + pub environments: Vec, +} + +impl ListEnvironmentsResponse { + pub fn new(environments: Vec) -> ListEnvironmentsResponse { + ListEnvironmentsResponse { + schema: None, + environments, + } + } +} + diff --git a/crates/tower-api/src/models/list_my_team_invitations_response.rs b/crates/tower-api/src/models/list_my_team_invitations_response.rs index f17dc63a..e32d41ae 100644 --- a/crates/tower-api/src/models/list_my_team_invitations_response.rs +++ b/crates/tower-api/src/models/list_my_team_invitations_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListMyTeamInvitationsResponse { diff --git a/crates/tower-api/src/models/list_runs_response.rs b/crates/tower-api/src/models/list_runs_response.rs index f27bfeec..c2e33c4d 100644 --- a/crates/tower-api/src/models/list_runs_response.rs +++ b/crates/tower-api/src/models/list_runs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListRunsResponse { @@ -17,7 +17,7 @@ pub struct ListRunsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "runs")] pub runs: Vec, } @@ -26,7 +26,7 @@ impl ListRunsResponse { pub fn new(pages: models::Pagination, runs: Vec) -> ListRunsResponse { ListRunsResponse { schema: None, - pages: Box::new(pages), + pages, runs, } } diff --git a/crates/tower-api/src/models/list_schedules_response.rs b/crates/tower-api/src/models/list_schedules_response.rs index 26ec075d..adb63697 100644 --- a/crates/tower-api/src/models/list_schedules_response.rs +++ b/crates/tower-api/src/models/list_schedules_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListSchedulesResponse { @@ -17,7 +17,7 @@ pub struct ListSchedulesResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "schedules")] pub schedules: Vec, } @@ -26,7 +26,7 @@ impl ListSchedulesResponse { pub fn new(pages: models::Pagination, schedules: Vec) -> ListSchedulesResponse { ListSchedulesResponse { schema: None, - pages: Box::new(pages), + pages, schedules, } } diff --git a/crates/tower-api/src/models/list_secret_environments_response.rs b/crates/tower-api/src/models/list_secret_environments_response.rs index 251645f2..c2d5c573 100644 --- a/crates/tower-api/src/models/list_secret_environments_response.rs +++ b/crates/tower-api/src/models/list_secret_environments_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListSecretEnvironmentsResponse { diff --git a/crates/tower-api/src/models/list_secrets_response.rs b/crates/tower-api/src/models/list_secrets_response.rs index 841586dc..e7f01b50 100644 --- a/crates/tower-api/src/models/list_secrets_response.rs +++ b/crates/tower-api/src/models/list_secrets_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListSecretsResponse { @@ -17,7 +17,7 @@ pub struct ListSecretsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "secrets")] pub secrets: Vec, } @@ -26,7 +26,7 @@ impl ListSecretsResponse { pub fn new(pages: models::Pagination, secrets: Vec) -> ListSecretsResponse { ListSecretsResponse { schema: None, - pages: Box::new(pages), + pages, secrets, } } diff --git a/crates/tower-api/src/models/list_team_invitations_response.rs b/crates/tower-api/src/models/list_team_invitations_response.rs index ae9d565b..4d29b120 100644 --- a/crates/tower-api/src/models/list_team_invitations_response.rs +++ b/crates/tower-api/src/models/list_team_invitations_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListTeamInvitationsResponse { diff --git a/crates/tower-api/src/models/list_team_members_response.rs b/crates/tower-api/src/models/list_team_members_response.rs index a6d81e15..189e74db 100644 --- a/crates/tower-api/src/models/list_team_members_response.rs +++ b/crates/tower-api/src/models/list_team_members_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListTeamMembersResponse { diff --git a/crates/tower-api/src/models/list_teams_response.rs b/crates/tower-api/src/models/list_teams_response.rs index 7fabb0b8..f1a6dea6 100644 --- a/crates/tower-api/src/models/list_teams_response.rs +++ b/crates/tower-api/src/models/list_teams_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListTeamsResponse { diff --git a/crates/tower-api/src/models/log_line.rs b/crates/tower-api/src/models/log_line.rs index d172a21f..895d5f8c 100644 --- a/crates/tower-api/src/models/log_line.rs +++ b/crates/tower-api/src/models/log_line.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LogLine { @@ -42,7 +42,7 @@ impl LogLine { } } /// The channel (either Program or Setup) this log line belongs to. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Channel { #[serde(rename = "program")] Program, @@ -56,3 +56,20 @@ impl Default for Channel { } } +impl<'de> Deserialize<'de> for Channel { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "program" => Ok(Self::Program), + "setup" => Ok(Self::Setup), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["program", "setup"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/mod.rs b/crates/tower-api/src/models/mod.rs index e503a5db..7bafa55c 100644 --- a/crates/tower-api/src/models/mod.rs +++ b/crates/tower-api/src/models/mod.rs @@ -54,6 +54,10 @@ pub mod create_catalog_response; pub use self::create_catalog_response::CreateCatalogResponse; pub mod create_device_login_ticket_response; pub use self::create_device_login_ticket_response::CreateDeviceLoginTicketResponse; +pub mod create_environment_params; +pub use self::create_environment_params::CreateEnvironmentParams; +pub mod create_environment_response; +pub use self::create_environment_response::CreateEnvironmentResponse; pub mod create_password_reset_params; pub use self::create_password_reset_params::CreatePasswordResetParams; pub mod create_password_reset_response; @@ -116,10 +120,20 @@ pub mod describe_session_response; pub use self::describe_session_response::DescribeSessionResponse; pub mod encrypted_catalog_property; pub use self::encrypted_catalog_property::EncryptedCatalogProperty; +pub mod environment; +pub use self::environment::Environment; pub mod error_detail; pub use self::error_detail::ErrorDetail; pub mod error_model; pub use self::error_model::ErrorModel; +pub mod event_error; +pub use self::event_error::EventError; +pub mod event_log; +pub use self::event_log::EventLog; +pub mod event_run_failure_alert; +pub use self::event_run_failure_alert::EventRunFailureAlert; +pub mod event_warning; +pub use self::event_warning::EventWarning; pub mod export_catalogs_params; pub use self::export_catalogs_params::ExportCatalogsParams; pub mod export_catalogs_response; @@ -136,6 +150,8 @@ pub mod exported_secret; pub use self::exported_secret::ExportedSecret; pub mod featurebase_identity; pub use self::featurebase_identity::FeaturebaseIdentity; +pub mod features; +pub use self::features::Features; pub mod generate_app_statistics_response; pub use self::generate_app_statistics_response::GenerateAppStatisticsResponse; pub mod generate_authenticator_response; @@ -150,6 +166,8 @@ pub mod invite_team_member_response; pub use self::invite_team_member_response::InviteTeamMemberResponse; pub mod leave_team_response; pub use self::leave_team_response::LeaveTeamResponse; +pub mod list_account_plans_response; +pub use self::list_account_plans_response::ListAccountPlansResponse; pub mod list_alerts_200_response; pub use self::list_alerts_200_response::ListAlerts200Response; pub mod list_alerts_response; @@ -166,6 +184,8 @@ pub mod list_authenticators_response; pub use self::list_authenticators_response::ListAuthenticatorsResponse; pub mod list_catalogs_response; pub use self::list_catalogs_response::ListCatalogsResponse; +pub mod list_environments_response; +pub use self::list_environments_response::ListEnvironmentsResponse; pub mod list_my_team_invitations_response; pub use self::list_my_team_invitations_response::ListMyTeamInvitationsResponse; pub mod list_runs_response; @@ -188,6 +208,8 @@ pub mod pagination; pub use self::pagination::Pagination; pub mod parameter; pub use self::parameter::Parameter; +pub mod plan; +pub use self::plan::Plan; pub mod refresh_session_params; pub use self::refresh_session_params::RefreshSessionParams; pub mod refresh_session_response; @@ -256,6 +278,10 @@ pub mod update_catalog_params; pub use self::update_catalog_params::UpdateCatalogParams; pub mod update_catalog_response; pub use self::update_catalog_response::UpdateCatalogResponse; +pub mod update_environment_params; +pub use self::update_environment_params::UpdateEnvironmentParams; +pub mod update_environment_response; +pub use self::update_environment_response::UpdateEnvironmentResponse; pub mod update_my_team_invitation_params; pub use self::update_my_team_invitation_params::UpdateMyTeamInvitationParams; pub mod update_my_team_invitation_response; @@ -264,6 +290,10 @@ pub mod update_password_reset_params; pub use self::update_password_reset_params::UpdatePasswordResetParams; pub mod update_password_reset_response; pub use self::update_password_reset_response::UpdatePasswordResetResponse; +pub mod update_plan_params; +pub use self::update_plan_params::UpdatePlanParams; +pub mod update_plan_response; +pub use self::update_plan_response::UpdatePlanResponse; pub mod update_schedule_params; pub use self::update_schedule_params::UpdateScheduleParams; pub mod update_schedule_response; diff --git a/crates/tower-api/src/models/pagination.rs b/crates/tower-api/src/models/pagination.rs index be08c4a7..5585f050 100644 --- a/crates/tower-api/src/models/pagination.rs +++ b/crates/tower-api/src/models/pagination.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pagination { diff --git a/crates/tower-api/src/models/parameter.rs b/crates/tower-api/src/models/parameter.rs index 50552afa..a6451786 100644 --- a/crates/tower-api/src/models/parameter.rs +++ b/crates/tower-api/src/models/parameter.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Parameter { diff --git a/crates/tower-api/src/models/plan.rs b/crates/tower-api/src/models/plan.rs new file mode 100644 index 00000000..151c540c --- /dev/null +++ b/crates/tower-api/src/models/plan.rs @@ -0,0 +1,48 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Plan { + #[serde(rename = "account_id")] + pub account_id: String, + #[serde(rename = "base_plan_name")] + pub base_plan_name: String, + #[serde(rename = "created_at")] + pub created_at: String, + #[serde(rename = "end_at", skip_serializing_if = "Option::is_none")] + pub end_at: Option, + #[serde(rename = "features")] + pub features: models::Features, + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "start_at")] + pub start_at: String, + #[serde(rename = "status")] + pub status: String, +} + +impl Plan { + pub fn new(account_id: String, base_plan_name: String, created_at: String, features: models::Features, id: String, start_at: String, status: String) -> Plan { + Plan { + account_id, + base_plan_name, + created_at, + end_at: None, + features, + id, + start_at, + status, + } + } +} + diff --git a/crates/tower-api/src/models/refresh_session_params.rs b/crates/tower-api/src/models/refresh_session_params.rs index 435b87bd..49d6cf1a 100644 --- a/crates/tower-api/src/models/refresh_session_params.rs +++ b/crates/tower-api/src/models/refresh_session_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RefreshSessionParams { diff --git a/crates/tower-api/src/models/refresh_session_response.rs b/crates/tower-api/src/models/refresh_session_response.rs index 048b1cf1..79375a92 100644 --- a/crates/tower-api/src/models/refresh_session_response.rs +++ b/crates/tower-api/src/models/refresh_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RefreshSessionResponse { @@ -21,7 +21,7 @@ pub struct RefreshSessionResponse { pub refreshed_at: String, /// Refresh the current session and return the updated session information. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl RefreshSessionResponse { @@ -29,7 +29,7 @@ impl RefreshSessionResponse { RefreshSessionResponse { schema: None, refreshed_at, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/remove_team_member_params.rs b/crates/tower-api/src/models/remove_team_member_params.rs index b9587a16..f92f57c5 100644 --- a/crates/tower-api/src/models/remove_team_member_params.rs +++ b/crates/tower-api/src/models/remove_team_member_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RemoveTeamMemberParams { diff --git a/crates/tower-api/src/models/remove_team_member_response.rs b/crates/tower-api/src/models/remove_team_member_response.rs index 4ab73ada..838a1e17 100644 --- a/crates/tower-api/src/models/remove_team_member_response.rs +++ b/crates/tower-api/src/models/remove_team_member_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RemoveTeamMemberResponse { @@ -18,14 +18,14 @@ pub struct RemoveTeamMemberResponse { pub schema: Option, /// The team member that was just removed #[serde(rename = "team_member")] - pub team_member: Box, + pub team_member: models::User, } impl RemoveTeamMemberResponse { pub fn new(team_member: models::User) -> RemoveTeamMemberResponse { RemoveTeamMemberResponse { schema: None, - team_member: Box::new(team_member), + team_member, } } } diff --git a/crates/tower-api/src/models/resend_team_invitation_params.rs b/crates/tower-api/src/models/resend_team_invitation_params.rs index bfdcf2ed..4e9e1616 100644 --- a/crates/tower-api/src/models/resend_team_invitation_params.rs +++ b/crates/tower-api/src/models/resend_team_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ResendTeamInvitationParams { diff --git a/crates/tower-api/src/models/resend_team_invitation_response.rs b/crates/tower-api/src/models/resend_team_invitation_response.rs index 1510671f..9106bd81 100644 --- a/crates/tower-api/src/models/resend_team_invitation_response.rs +++ b/crates/tower-api/src/models/resend_team_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ResendTeamInvitationResponse { @@ -18,14 +18,14 @@ pub struct ResendTeamInvitationResponse { pub schema: Option, /// The team invitations that were resent #[serde(rename = "team_invitation")] - pub team_invitation: Box, + pub team_invitation: models::TeamInvitation, } impl ResendTeamInvitationResponse { pub fn new(team_invitation: models::TeamInvitation) -> ResendTeamInvitationResponse { ResendTeamInvitationResponse { schema: None, - team_invitation: Box::new(team_invitation), + team_invitation, } } } diff --git a/crates/tower-api/src/models/run.rs b/crates/tower-api/src/models/run.rs index dcfe8d68..36c76af6 100644 --- a/crates/tower-api/src/models/run.rs +++ b/crates/tower-api/src/models/run.rs @@ -3,16 +3,19 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Run { + /// Link to the run in the Tower UI + #[serde(rename = "$link")] + pub dollar_link: String, #[serde(rename = "app_name")] pub app_name: String, /// This property is deprecated. Please use app_name instead. @@ -49,8 +52,9 @@ pub struct Run { } impl Run { - pub fn new(app_name: String, app_version: String, cancelled_at: Option, created_at: String, ended_at: Option, environment: String, exit_code: Option, number: i64, parameters: Vec, run_id: String, scheduled_at: String, started_at: Option, status: Status, status_group: StatusGroup) -> Run { + pub fn new(dollar_link: String, app_name: String, app_version: String, cancelled_at: Option, created_at: String, ended_at: Option, environment: String, exit_code: Option, number: i64, parameters: Vec, run_id: String, scheduled_at: String, started_at: Option, status: Status, status_group: StatusGroup) -> Run { Run { + dollar_link, app_name, app_slug: None, app_version, @@ -70,7 +74,7 @@ impl Run { } } /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Status { #[serde(rename = "scheduled")] Scheduled, @@ -93,8 +97,30 @@ impl Default for Status { Self::Scheduled } } + +impl<'de> Deserialize<'de> for Status { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "scheduled" => Ok(Self::Scheduled), + "pending" => Ok(Self::Pending), + "running" => Ok(Self::Running), + "crashed" => Ok(Self::Crashed), + "errored" => Ok(Self::Errored), + "exited" => Ok(Self::Exited), + "cancelled" => Ok(Self::Cancelled), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["scheduled", "pending", "running", "crashed", "errored", "exited", "cancelled"], + )), + } + } +} /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum StatusGroup { #[serde(rename = "successful")] Successful, @@ -110,3 +136,21 @@ impl Default for StatusGroup { } } +impl<'de> Deserialize<'de> for StatusGroup { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "successful" => Ok(Self::Successful), + "failed" => Ok(Self::Failed), + "" => Ok(Self::Empty), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["successful", "failed", ""], + )), + } + } +} + diff --git a/crates/tower-api/src/models/run_app_params.rs b/crates/tower-api/src/models/run_app_params.rs index 5ae8d7e2..7318fd1c 100644 --- a/crates/tower-api/src/models/run_app_params.rs +++ b/crates/tower-api/src/models/run_app_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunAppParams { diff --git a/crates/tower-api/src/models/run_app_response.rs b/crates/tower-api/src/models/run_app_response.rs index 0b1cdacd..1d258d7c 100644 --- a/crates/tower-api/src/models/run_app_response.rs +++ b/crates/tower-api/src/models/run_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunAppResponse { @@ -17,14 +17,14 @@ pub struct RunAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl RunAppResponse { pub fn new(run: models::Run) -> RunAppResponse { RunAppResponse { schema: None, - run: Box::new(run), + run, } } } diff --git a/crates/tower-api/src/models/run_failure_alert.rs b/crates/tower-api/src/models/run_failure_alert.rs index ed012a20..e66b1cca 100644 --- a/crates/tower-api/src/models/run_failure_alert.rs +++ b/crates/tower-api/src/models/run_failure_alert.rs @@ -3,29 +3,29 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunFailureAlert { /// App that the failed Run belongs to #[serde(rename = "app")] - pub app: Box, + pub app: models::App, /// Run that failed #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl RunFailureAlert { pub fn new(app: models::App, run: models::Run) -> RunFailureAlert { RunFailureAlert { - app: Box::new(app), - run: Box::new(run), + app, + run, } } } diff --git a/crates/tower-api/src/models/run_log_line.rs b/crates/tower-api/src/models/run_log_line.rs index a8a1c76b..4ec656d7 100644 --- a/crates/tower-api/src/models/run_log_line.rs +++ b/crates/tower-api/src/models/run_log_line.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunLogLine { diff --git a/crates/tower-api/src/models/run_parameter.rs b/crates/tower-api/src/models/run_parameter.rs index d509e6cf..9d716df2 100644 --- a/crates/tower-api/src/models/run_parameter.rs +++ b/crates/tower-api/src/models/run_parameter.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunParameter { diff --git a/crates/tower-api/src/models/run_results.rs b/crates/tower-api/src/models/run_results.rs index f5a4352a..b07c0dc2 100644 --- a/crates/tower-api/src/models/run_results.rs +++ b/crates/tower-api/src/models/run_results.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunResults { diff --git a/crates/tower-api/src/models/run_statistics.rs b/crates/tower-api/src/models/run_statistics.rs index 96df2303..96627061 100644 --- a/crates/tower-api/src/models/run_statistics.rs +++ b/crates/tower-api/src/models/run_statistics.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunStatistics { diff --git a/crates/tower-api/src/models/run_timeseries_point.rs b/crates/tower-api/src/models/run_timeseries_point.rs index 4d84c5c2..38c24b8f 100644 --- a/crates/tower-api/src/models/run_timeseries_point.rs +++ b/crates/tower-api/src/models/run_timeseries_point.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunTimeseriesPoint { diff --git a/crates/tower-api/src/models/runner_credentials.rs b/crates/tower-api/src/models/runner_credentials.rs index a063c84f..46ccb00e 100644 --- a/crates/tower-api/src/models/runner_credentials.rs +++ b/crates/tower-api/src/models/runner_credentials.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunnerCredentials { diff --git a/crates/tower-api/src/models/schedule.rs b/crates/tower-api/src/models/schedule.rs index 87e6a738..63bd333d 100644 --- a/crates/tower-api/src/models/schedule.rs +++ b/crates/tower-api/src/models/schedule.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Schedule { diff --git a/crates/tower-api/src/models/search_runs_response.rs b/crates/tower-api/src/models/search_runs_response.rs index 116a52db..a1727ed7 100644 --- a/crates/tower-api/src/models/search_runs_response.rs +++ b/crates/tower-api/src/models/search_runs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SearchRunsResponse { @@ -17,7 +17,7 @@ pub struct SearchRunsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "runs")] pub runs: Vec, } @@ -26,7 +26,7 @@ impl SearchRunsResponse { pub fn new(pages: models::Pagination, runs: Vec) -> SearchRunsResponse { SearchRunsResponse { schema: None, - pages: Box::new(pages), + pages, runs, } } diff --git a/crates/tower-api/src/models/secret.rs b/crates/tower-api/src/models/secret.rs index 5e712cff..ce2359cb 100644 --- a/crates/tower-api/src/models/secret.rs +++ b/crates/tower-api/src/models/secret.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Secret { diff --git a/crates/tower-api/src/models/session.rs b/crates/tower-api/src/models/session.rs index f921304e..3f9090a8 100644 --- a/crates/tower-api/src/models/session.rs +++ b/crates/tower-api/src/models/session.rs @@ -3,33 +3,33 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Session { #[serde(rename = "featurebase_identity")] - pub featurebase_identity: Box, + pub featurebase_identity: models::FeaturebaseIdentity, #[serde(rename = "teams")] pub teams: Vec, #[serde(rename = "token")] - pub token: Box, + pub token: models::Token, #[serde(rename = "user")] - pub user: Box, + pub user: models::User, } impl Session { pub fn new(featurebase_identity: models::FeaturebaseIdentity, teams: Vec, token: models::Token, user: models::User) -> Session { Session { - featurebase_identity: Box::new(featurebase_identity), + featurebase_identity, teams, - token: Box::new(token), - user: Box::new(user), + token, + user, } } } diff --git a/crates/tower-api/src/models/sse_warning.rs b/crates/tower-api/src/models/sse_warning.rs index 444dd342..33c5f32a 100644 --- a/crates/tower-api/src/models/sse_warning.rs +++ b/crates/tower-api/src/models/sse_warning.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SseWarning { diff --git a/crates/tower-api/src/models/statistics_settings.rs b/crates/tower-api/src/models/statistics_settings.rs index 6043d303..1b0ab33d 100644 --- a/crates/tower-api/src/models/statistics_settings.rs +++ b/crates/tower-api/src/models/statistics_settings.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct StatisticsSettings { @@ -38,7 +38,7 @@ impl StatisticsSettings { } } /// The interval for the statistics period. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Interval { #[serde(rename = "daily")] Daily, @@ -52,3 +52,20 @@ impl Default for Interval { } } +impl<'de> Deserialize<'de> for Interval { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "daily" => Ok(Self::Daily), + "hourly" => Ok(Self::Hourly), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["daily", "hourly"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/stream_alerts_200_response_inner.rs b/crates/tower-api/src/models/stream_alerts_200_response_inner.rs index 0ada5201..a8ac7329 100644 --- a/crates/tower-api/src/models/stream_alerts_200_response_inner.rs +++ b/crates/tower-api/src/models/stream_alerts_200_response_inner.rs @@ -3,24 +3,52 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum StreamAlerts200ResponseInner { - SseWarning(models::SseWarning), - RunFailureAlert(models::RunFailureAlert), + EventError(models::EventError), + EventRunFailureAlert(models::EventRunFailureAlert), } impl Default for StreamAlerts200ResponseInner { fn default() -> Self { - Self::SseWarning(Default::default()) + Self::EventError(Default::default()) + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "run_failure_alert")] + RunFailureAlert, +} + +impl Default for Event { + fn default() -> Event { + Self::RunFailureAlert + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "run_failure_alert" => Ok(Self::RunFailureAlert), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["run_failure_alert"], + )), + } } } diff --git a/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs b/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs index e050cad5..3dbfe984 100644 --- a/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs +++ b/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs @@ -3,38 +3,52 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum StreamRunLogs200ResponseInner { - LogLine(models::LogLine), - SseWarning(models::SseWarning), + EventLog(models::EventLog), + EventWarning(models::EventWarning), } impl Default for StreamRunLogs200ResponseInner { fn default() -> Self { - Self::LogLine(Default::default()) + Self::EventLog(Default::default()) } } -/// The channel (either Program or Setup) this log line belongs to. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Channel { - #[serde(rename = "program")] - Program, - #[serde(rename = "setup")] - Setup, +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "warning")] + Warning, } -impl Default for Channel { - fn default() -> Channel { - Self::Program +impl Default for Event { + fn default() -> Event { + Self::Warning + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "warning" => Ok(Self::Warning), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["warning"], + )), + } } } diff --git a/crates/tower-api/src/models/team.rs b/crates/tower-api/src/models/team.rs index 575ed92f..47db460c 100644 --- a/crates/tower-api/src/models/team.rs +++ b/crates/tower-api/src/models/team.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Team { @@ -19,7 +19,7 @@ pub struct Team { #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] pub slug: Option, #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option>, + pub token: Option, /// The type of team, either 'personal' or 'team'. #[serde(rename = "type")] pub r#type: String, diff --git a/crates/tower-api/src/models/team_invitation.rs b/crates/tower-api/src/models/team_invitation.rs index fe98c92a..e3d757ed 100644 --- a/crates/tower-api/src/models/team_invitation.rs +++ b/crates/tower-api/src/models/team_invitation.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TeamInvitation { @@ -18,7 +18,7 @@ pub struct TeamInvitation { #[serde(rename = "invitation_sent_at")] pub invitation_sent_at: String, #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl TeamInvitation { @@ -26,7 +26,7 @@ impl TeamInvitation { TeamInvitation { email, invitation_sent_at, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/token.rs b/crates/tower-api/src/models/token.rs index ac82c16c..6ae7494a 100644 --- a/crates/tower-api/src/models/token.rs +++ b/crates/tower-api/src/models/token.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Token { diff --git a/crates/tower-api/src/models/unverified_authenticator.rs b/crates/tower-api/src/models/unverified_authenticator.rs index 40f89720..15054d38 100644 --- a/crates/tower-api/src/models/unverified_authenticator.rs +++ b/crates/tower-api/src/models/unverified_authenticator.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UnverifiedAuthenticator { diff --git a/crates/tower-api/src/models/update_account_name_params.rs b/crates/tower-api/src/models/update_account_name_params.rs index 902a12f5..9c6f3286 100644 --- a/crates/tower-api/src/models/update_account_name_params.rs +++ b/crates/tower-api/src/models/update_account_name_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateAccountNameParams { diff --git a/crates/tower-api/src/models/update_account_name_response.rs b/crates/tower-api/src/models/update_account_name_response.rs index cdc37a8b..9cc9f01d 100644 --- a/crates/tower-api/src/models/update_account_name_response.rs +++ b/crates/tower-api/src/models/update_account_name_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateAccountNameResponse { @@ -17,14 +17,14 @@ pub struct UpdateAccountNameResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "account")] - pub account: Box, + pub account: models::Account, } impl UpdateAccountNameResponse { pub fn new(account: models::Account) -> UpdateAccountNameResponse { UpdateAccountNameResponse { schema: None, - account: Box::new(account), + account, } } } diff --git a/crates/tower-api/src/models/update_app_params.rs b/crates/tower-api/src/models/update_app_params.rs index 59a85ce1..1b692b94 100644 --- a/crates/tower-api/src/models/update_app_params.rs +++ b/crates/tower-api/src/models/update_app_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateAppParams { diff --git a/crates/tower-api/src/models/update_app_response.rs b/crates/tower-api/src/models/update_app_response.rs index 0897c283..4e4faa45 100644 --- a/crates/tower-api/src/models/update_app_response.rs +++ b/crates/tower-api/src/models/update_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateAppResponse { @@ -17,14 +17,14 @@ pub struct UpdateAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "App")] - pub app: Box, + pub app: models::App, } impl UpdateAppResponse { pub fn new(app: models::App) -> UpdateAppResponse { UpdateAppResponse { schema: None, - app: Box::new(app), + app, } } } diff --git a/crates/tower-api/src/models/update_catalog_params.rs b/crates/tower-api/src/models/update_catalog_params.rs index 8a98d5c9..63ffb054 100644 --- a/crates/tower-api/src/models/update_catalog_params.rs +++ b/crates/tower-api/src/models/update_catalog_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateCatalogParams { diff --git a/crates/tower-api/src/models/update_catalog_response.rs b/crates/tower-api/src/models/update_catalog_response.rs index 91df8ce3..386ccbb2 100644 --- a/crates/tower-api/src/models/update_catalog_response.rs +++ b/crates/tower-api/src/models/update_catalog_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateCatalogResponse { @@ -17,14 +17,14 @@ pub struct UpdateCatalogResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "catalog")] - pub catalog: Box, + pub catalog: models::Catalog, } impl UpdateCatalogResponse { pub fn new(catalog: models::Catalog) -> UpdateCatalogResponse { UpdateCatalogResponse { schema: None, - catalog: Box::new(catalog), + catalog, } } } diff --git a/crates/tower-api/src/models/update_environment_params.rs b/crates/tower-api/src/models/update_environment_params.rs new file mode 100644 index 00000000..453b6698 --- /dev/null +++ b/crates/tower-api/src/models/update_environment_params.rs @@ -0,0 +1,32 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateEnvironmentParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The desired new name of the environment + #[serde(rename = "new_name")] + pub new_name: String, +} + +impl UpdateEnvironmentParams { + pub fn new(new_name: String) -> UpdateEnvironmentParams { + UpdateEnvironmentParams { + schema: None, + new_name, + } + } +} + diff --git a/crates/tower-api/src/models/update_environment_response.rs b/crates/tower-api/src/models/update_environment_response.rs new file mode 100644 index 00000000..518d9843 --- /dev/null +++ b/crates/tower-api/src/models/update_environment_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateEnvironmentResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "environment")] + pub environment: models::Environment, +} + +impl UpdateEnvironmentResponse { + pub fn new(environment: models::Environment) -> UpdateEnvironmentResponse { + UpdateEnvironmentResponse { + schema: None, + environment, + } + } +} + diff --git a/crates/tower-api/src/models/update_my_team_invitation_params.rs b/crates/tower-api/src/models/update_my_team_invitation_params.rs index a9047268..8a7d9458 100644 --- a/crates/tower-api/src/models/update_my_team_invitation_params.rs +++ b/crates/tower-api/src/models/update_my_team_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateMyTeamInvitationParams { diff --git a/crates/tower-api/src/models/update_my_team_invitation_response.rs b/crates/tower-api/src/models/update_my_team_invitation_response.rs index 4256b36c..7a2dccde 100644 --- a/crates/tower-api/src/models/update_my_team_invitation_response.rs +++ b/crates/tower-api/src/models/update_my_team_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateMyTeamInvitationResponse { diff --git a/crates/tower-api/src/models/update_password_reset_params.rs b/crates/tower-api/src/models/update_password_reset_params.rs index a2950e42..53977c70 100644 --- a/crates/tower-api/src/models/update_password_reset_params.rs +++ b/crates/tower-api/src/models/update_password_reset_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdatePasswordResetParams { diff --git a/crates/tower-api/src/models/update_password_reset_response.rs b/crates/tower-api/src/models/update_password_reset_response.rs index e039b90a..30850489 100644 --- a/crates/tower-api/src/models/update_password_reset_response.rs +++ b/crates/tower-api/src/models/update_password_reset_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdatePasswordResetResponse { diff --git a/crates/tower-api/src/models/update_plan_params.rs b/crates/tower-api/src/models/update_plan_params.rs new file mode 100644 index 00000000..72648c48 --- /dev/null +++ b/crates/tower-api/src/models/update_plan_params.rs @@ -0,0 +1,36 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdatePlanParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The name of the base plan to use. + #[serde(rename = "base_plan_name")] + pub base_plan_name: String, + /// Optional expiration date for the plan. + #[serde(rename = "end_at", skip_serializing_if = "Option::is_none")] + pub end_at: Option, +} + +impl UpdatePlanParams { + pub fn new(base_plan_name: String) -> UpdatePlanParams { + UpdatePlanParams { + schema: None, + base_plan_name, + end_at: None, + } + } +} + diff --git a/crates/tower-api/src/models/update_plan_response.rs b/crates/tower-api/src/models/update_plan_response.rs new file mode 100644 index 00000000..73ac0012 --- /dev/null +++ b/crates/tower-api/src/models/update_plan_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdatePlanResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "plan")] + pub plan: models::Plan, +} + +impl UpdatePlanResponse { + pub fn new(plan: models::Plan) -> UpdatePlanResponse { + UpdatePlanResponse { + schema: None, + plan, + } + } +} + diff --git a/crates/tower-api/src/models/update_schedule_params.rs b/crates/tower-api/src/models/update_schedule_params.rs index d1d68463..23a870c9 100644 --- a/crates/tower-api/src/models/update_schedule_params.rs +++ b/crates/tower-api/src/models/update_schedule_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateScheduleParams { diff --git a/crates/tower-api/src/models/update_schedule_response.rs b/crates/tower-api/src/models/update_schedule_response.rs index 679b1cb3..93bd656c 100644 --- a/crates/tower-api/src/models/update_schedule_response.rs +++ b/crates/tower-api/src/models/update_schedule_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateScheduleResponse { @@ -17,14 +17,14 @@ pub struct UpdateScheduleResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "schedule")] - pub schedule: Box, + pub schedule: models::Schedule, } impl UpdateScheduleResponse { pub fn new(schedule: models::Schedule) -> UpdateScheduleResponse { UpdateScheduleResponse { schema: None, - schedule: Box::new(schedule), + schedule, } } } diff --git a/crates/tower-api/src/models/update_secret_params.rs b/crates/tower-api/src/models/update_secret_params.rs index 254a6a5a..448461a1 100644 --- a/crates/tower-api/src/models/update_secret_params.rs +++ b/crates/tower-api/src/models/update_secret_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateSecretParams { diff --git a/crates/tower-api/src/models/update_secret_response.rs b/crates/tower-api/src/models/update_secret_response.rs index 18a380d0..4fc33a70 100644 --- a/crates/tower-api/src/models/update_secret_response.rs +++ b/crates/tower-api/src/models/update_secret_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateSecretResponse { @@ -17,14 +17,14 @@ pub struct UpdateSecretResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "secret")] - pub secret: Box, + pub secret: models::Secret, } impl UpdateSecretResponse { pub fn new(secret: models::Secret) -> UpdateSecretResponse { UpdateSecretResponse { schema: None, - secret: Box::new(secret), + secret, } } } diff --git a/crates/tower-api/src/models/update_team_params.rs b/crates/tower-api/src/models/update_team_params.rs index 7c5f9468..2503ce5e 100644 --- a/crates/tower-api/src/models/update_team_params.rs +++ b/crates/tower-api/src/models/update_team_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTeamParams { diff --git a/crates/tower-api/src/models/update_team_response.rs b/crates/tower-api/src/models/update_team_response.rs index 9c419e12..0cfb699e 100644 --- a/crates/tower-api/src/models/update_team_response.rs +++ b/crates/tower-api/src/models/update_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTeamResponse { @@ -18,14 +18,14 @@ pub struct UpdateTeamResponse { pub schema: Option, /// The team that was just created #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl UpdateTeamResponse { pub fn new(team: models::Team) -> UpdateTeamResponse { UpdateTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/update_user_params.rs b/crates/tower-api/src/models/update_user_params.rs index 80b45315..a22dca2e 100644 --- a/crates/tower-api/src/models/update_user_params.rs +++ b/crates/tower-api/src/models/update_user_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateUserParams { diff --git a/crates/tower-api/src/models/update_user_response.rs b/crates/tower-api/src/models/update_user_response.rs index c9b8d627..cc7e12bf 100644 --- a/crates/tower-api/src/models/update_user_response.rs +++ b/crates/tower-api/src/models/update_user_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateUserResponse { @@ -17,14 +17,14 @@ pub struct UpdateUserResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "user")] - pub user: Box, + pub user: models::User, } impl UpdateUserResponse { pub fn new(user: models::User) -> UpdateUserResponse { UpdateUserResponse { schema: None, - user: Box::new(user), + user, } } } diff --git a/crates/tower-api/src/models/user.rs b/crates/tower-api/src/models/user.rs index e3dbc1fa..d4724aee 100644 --- a/crates/tower-api/src/models/user.rs +++ b/crates/tower-api/src/models/user.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { diff --git a/crates/tower-api/src/models/verified_authenticator.rs b/crates/tower-api/src/models/verified_authenticator.rs index 57918f78..6cc8b86b 100644 --- a/crates/tower-api/src/models/verified_authenticator.rs +++ b/crates/tower-api/src/models/verified_authenticator.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.24 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct VerifiedAuthenticator { diff --git a/crates/tower-cmd/Cargo.toml b/crates/tower-cmd/Cargo.toml index 4a973752..afa661aa 100644 --- a/crates/tower-cmd/Cargo.toml +++ b/crates/tower-cmd/Cargo.toml @@ -12,11 +12,13 @@ cli-table = { workspace = true } colored = { workspace = true } config = { workspace = true } crypto = { workspace = true } +ctrlc = { workspace = true } futures-util = { workspace = true } http = { workspace = true } indicatif = { workspace = true } promptly = { workspace = true } reqwest = { workspace = true } +reqwest-eventsource = { workspace = true } rpassword = { workspace = true } rsa = { workspace = true } serde = { workspace = true } diff --git a/crates/tower-cmd/src/api.rs b/crates/tower-cmd/src/api.rs index 3263cf1e..8930f89d 100644 --- a/crates/tower-cmd/src/api.rs +++ b/crates/tower-cmd/src/api.rs @@ -4,6 +4,10 @@ use http::StatusCode; use std::collections::HashMap; use tower_api::apis::ResponseContent; use tower_telemetry::debug; +use tokio::sync::mpsc; +use reqwest_eventsource::{Event, EventSource}; +use tower_api::apis::configuration; +use futures_util::StreamExt; /// Helper trait to extract the successful response data from API responses pub trait ResponseEntity { @@ -68,6 +72,17 @@ pub async fn delete_app(config: &Config, name: &str) -> Result Result> { + let api_config = &config.into(); + + let params = tower_api::apis::default_api::DescribeRunParams { + name: app_name.to_string(), + seq, + }; + + unwrap_api_response(tower_api::apis::default_api::describe_run(api_config, params)).await +} + pub async fn describe_run_logs(config: &Config, name: &str, seq: i64) -> Result> { let api_config = &config.into(); @@ -205,6 +220,119 @@ pub async fn refresh_session(config: &Config) -> Result for LogStreamError { + fn from(err: reqwest_eventsource::CannotCloneRequestError) -> Self { + debug!("Failed to clone request {:?}", err); + LogStreamError::Unknown + } +} + +async fn drain_run_logs_stream(mut source: EventSource, tx: mpsc::Sender) { + while let Some(event) = source.next().await { + match event { + Ok(reqwest_eventsource::Event::Open) => { + panic!("Received unexpected open event in log stream. This shouldn't happen."); + } + Ok(Event::Message(message)) => { + match message.event.as_str() { + "log" => { + let event_log = serde_json::from_str(&message.data); + + match event_log { + Ok(event) => { + tx.send(LogStreamEvent::EventLog(event)).await.ok(); + }, + Err(err) => { + debug!("Failed to parse log message: {}. Error: {}", message.data, err); + } + }; + }, + "warning" => { + let event_warning = serde_json::from_str(&message.data); + if let Ok(event) = event_warning { + tx.send(LogStreamEvent::EventWarning(event)).await.ok(); + } else { + debug!("Failed to parse warning message: {:?}", message.data); + } + } + _ => { + debug!("Unknown or unsupported log message: {:?}", message); + } + }; + }, + Err(err) => { + debug!("Error in log stream: {}", err); + break; // Exit on error + } + } + } +} + +pub async fn stream_run_logs(config: &Config, app_name: &str, seq: i64) -> Result, LogStreamError> { + let api_config: configuration::Configuration = config.into(); + + // These represent the messages that we'll stream to the client. + let (tx, rx) = mpsc::channel(1); + + // This code is copied from tower-api. Since that code is generated, there's not really a good + // way to share this code between here and the rest of the app. + let name = tower_api::apis::urlencode(app_name); + let uri = format!("{}/apps/{name}/runs/{seq}/logs/stream", api_config.base_path, name=name, seq=seq); + let mut builder = api_config.client.request(reqwest::Method::GET, &uri); + + if let Some(ref user_agent) = api_config.user_agent { + builder = builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + if let Some(ref token) = api_config.bearer_access_token { + builder = builder.bearer_auth(token.to_owned()); + }; + + // Now let's try to open the event source with the server. + let mut source = EventSource::new(builder)?; + + if let Some(event) = source.next().await { + match event { + Ok(Event::Open) => { + tokio::spawn(drain_run_logs_stream(source, tx)); + Ok(rx) + }, + Ok(Event::Message(message)) => { + // This is a bug in the program and should never happen. + panic!("Received message when expected an open event. Message: {:?}", message); + }, + Err(err) => { + match err { + reqwest_eventsource::Error::Transport(e) => { + Err(LogStreamError::Reqwest(e)) + }, + reqwest_eventsource::Error::StreamEnded => { + drop(tx); + Ok(rx) + }, + _ => { + Err(LogStreamError::Unknown) + } + } + } + } + } else { + // If we didn't get an event, we can't stream logs. + Err(LogStreamError::Unknown) + } +} + /// Helper function to handle Tower API responses and extract the relevant data async fn unwrap_api_response(api_call: F) -> Result> where @@ -431,3 +559,14 @@ impl ResponseEntity for tower_api::apis::default_api::DescribeSessionSuccess { } } } + +impl ResponseEntity for tower_api::apis::default_api::DescribeRunSuccess { + type Data = tower_api::models::DescribeRunResponse; + + fn extract_data(self) -> Option { + match self { + Self::Status200(resp) => Some(resp), + Self::UnknownValue(_) => None, + } + } +} diff --git a/crates/tower-cmd/src/apps.rs b/crates/tower-cmd/src/apps.rs index 5a8ae0b7..6ad153ef 100644 --- a/crates/tower-cmd/src/apps.rs +++ b/crates/tower-cmd/src/apps.rs @@ -5,6 +5,7 @@ use config::Config; use tower_api::models::Run; use crate::{ + util::dates, output, api, }; @@ -55,7 +56,8 @@ pub async fn do_logs(config: Config, cmd: &ArgMatches) { if let Ok(resp) = api::describe_run_logs(&config, &name, seq).await { for line in resp.log_lines { - output::log_line(&line.timestamp, &line.message, output::LogLineType::Remote); + let ts = dates::format_str(&line.timestamp); + output::log_line(&ts, &line.message, output::LogLineType::Remote); } } } diff --git a/crates/tower-cmd/src/error.rs b/crates/tower-cmd/src/error.rs index fab554d3..1eb80c67 100644 --- a/crates/tower-cmd/src/error.rs +++ b/crates/tower-cmd/src/error.rs @@ -1,5 +1,6 @@ use snafu::prelude::*; use tower_telemetry::debug; +use tower_api::apis::default_api::DescribeRunError; #[derive(Debug, Snafu)] pub enum Error { @@ -11,6 +12,12 @@ pub enum Error { #[snafu(display("cryptography error"))] CryptographyError, + + #[snafu(display("run completed"))] + RunCompleted, + + #[snafu(display("unknown error"))] + UnknownError, } impl From for Error { @@ -19,3 +26,10 @@ impl From for Error { Self::CryptographyError } } + +impl From> for Error { + fn from(err: tower_api::apis::Error) -> Self { + debug!("API error: {:?}", err); + Self::UnknownError + } +} diff --git a/crates/tower-cmd/src/run.rs b/crates/tower-cmd/src/run.rs index f1f72681..12b5e3e0 100644 --- a/crates/tower-cmd/src/run.rs +++ b/crates/tower-cmd/src/run.rs @@ -5,10 +5,15 @@ use std::path::PathBuf; use tower_package::{Package, PackageSpec}; use tower_runtime::{local::LocalApp, App, AppLauncher, OutputReceiver}; use tower_telemetry::{Context, debug}; +use tower_api::models::Run; -use tokio::sync::mpsc::unbounded_channel; +use tokio::sync::{ + oneshot::self, + mpsc::unbounded_channel, +}; use crate::{ + util::dates, output, api, Error, @@ -20,7 +25,6 @@ pub fn run_cmd() -> Command { .arg( Arg::new("dir") .long("dir") - .short('d') .help("The directory containing the Towerfile") .default_value("."), ) @@ -33,8 +37,8 @@ pub fn run_cmd() -> Command { ) .arg( Arg::new("environment") - .short('e') .long("environment") + .short('e') .help("The environment to invoke the app in") .default_value("default"), ) @@ -45,6 +49,13 @@ pub fn run_cmd() -> Command { .help("Parameters (key=value) to pass to the app") .action(clap::ArgAction::Append), ) + .arg( + Arg::new("detached") + .long("detached") + .short('d') + .help("Don't follow the run output in your CLI") + .action(clap::ArgAction::SetTrue), + ) .about("Run your code in Tower or locally") } @@ -73,7 +84,8 @@ pub async fn do_run(config: Config, args: &ArgMatches, cmd: Option<(&str, &ArgMa do_run_local(config, path, env, params).await; } } else { - do_run_remote(config, path, env, params, app_name).await; + let follow = should_follow_run(args); + do_run_remote(config, path, env, params, app_name, follow).await; } } Err(err) => { @@ -169,6 +181,7 @@ async fn do_run_remote( env: &str, params: HashMap, app_name: Option, + should_follow_run: bool, ) { let app_slug = app_name.unwrap_or_else(|| { // Load the Towerfile @@ -188,15 +201,103 @@ async fn do_run_remote( Ok(res) => { spinner.success(); - let line = format!( - "Run #{} for app `{}` has been scheduled", - res.run.number, app_slug - ); - output::success(&line); + let run = res.run; + + if should_follow_run { + do_follow_run(config, &run).await; + } else { + let line = format!( + "Run #{} for app `{}` has been scheduled", + run.number, app_slug + ); + output::success(&line); + + let link_line = format!(" See more: {}", run.dollar_link); + output::write(&link_line); + output::newline(); + } } } } +async fn do_follow_run( + config: Config, + run: &Run, +) { + let mut spinner = output::spinner("Waiting for run to start..."); + + match wait_for_run_start(&config, &run).await { + Err(err) => { + spinner.failure(); + debug!("Failed to wait for run to start: {}", err); + let msg = format!("An error occurred while waiting for the run to start. This shouldn't happen! You can get more details at {:?} or by contacting support.", run.dollar_link); + output::failure(&msg); + }, + Ok(()) => { + spinner.success(); + + // We do this here, explicitly, to not double-monitor our API via the + // `wait_for_run_start` function above. + let mut run_complete = monitor_run_completion(&config, run); + + // We set a Ctrl+C handler here, if invoked it will print a message that shows where + // the user can follow the run. + let run_copy = run.clone(); + + ctrlc::set_handler(move || { + output::newline(); + + let msg = format!( + "Run #{} for app `{}` is still running.", + run_copy.number, run_copy.app_name + ); + output::write(&msg); + output::newline(); + + let msg = format!( + "You can follow it at {}", + run_copy.dollar_link + ); + output::write(&msg); + output::newline(); + + // According to + // https://www.agileconnection.com/article/overview-linux-exit-codes... + std::process::exit(130); + }).expect("Failed to set Ctrl+C handler"); + + // Now we follow the logs from the run. We can stream them from the cloud to here using + // the stream_logs API endpoint. + match api::stream_run_logs(&config, &run.app_name, run.number).await { + Ok(mut output) => { + loop { + tokio::select! { + Some(event) = output.recv() => print_log_stream_event(event), + res = &mut run_complete => { + match res { + Ok(run) => print_run_completion(&run), + Err(err) => { + debug!("Failed to monitor run completion: {:?}", err); + let msg = format!("An error occurred while waiting for the run to complete. This shouldn't happen! You can get more details at {:?} or by contacting support.", run.dollar_link); + output::failure(&msg); + } + } + + break; + }, + }; + } + }, + Err(err) => { + debug!("Failed to stream run logs: {:?}", err); + let msg = format!("An error occurred while streaming logs from Tower to your console. You can get more details at {:?} or by contacting support.", run.dollar_link); + output::failure(&msg); + } + } + } + }; +} + /// get_run_parameters takes care of all the hairy bits around digging about in the `clap` /// internals to figure out what the user is requesting. In the end, it determines if we are meant /// to do a local run or a remote run, and it determines the path to the relevant Towerfile that @@ -213,6 +314,13 @@ fn get_run_parameters( Ok((local, path, params, app_name)) } +fn should_follow_run( + args: &ArgMatches, +) -> bool { + let local = *args.get_one::("detached").unwrap(); + !local +} + /// Parses `--parameter` arguments into a HashMap of key-value pairs. /// Handles format like "--parameter key=value" fn parse_parameters(args: &ArgMatches) -> HashMap { @@ -347,9 +455,9 @@ async fn build_package(towerfile: &Towerfile) -> Package { async fn monitor_output(mut output: OutputReceiver) { loop { if let Some(line) = output.recv().await { - let ts = &line.time; + let ts = dates::format(line.time); let msg = &line.line; - output::log_line(&ts.to_rfc3339(), msg, output::LogLineType::Local); + output::log_line(&ts, msg, output::LogLineType::Local); } else { break; } @@ -383,3 +491,129 @@ fn create_pyiceberg_catalog_property_name(catalog_name: &str, property_name: &st format!("PYICEBERG_CATALOG__{}__{}", catalog_name, property_name) } +/// wait_for_run_start waits for the run to enter a "running" state. It polls the API every 500ms to see +/// if it's started yet. +async fn wait_for_run_start(config: &Config, run: &Run) -> Result<(), Error> { + loop { + let res = api::describe_run(config, &run.app_name, run.number).await?; + + if is_run_started(&res.run)? { + break + } else { + // Wait half a second to to try again. + tokio::time::sleep(tokio::time::Duration::from_millis(500)).await; + } + } + + Ok(()) +} + +/// wait_for_run_completion waits for the run to enter an terminal state. It polls the API every +/// 500ms to see if it's started yet. +async fn wait_for_run_completion(config: &Config, run: &Run) -> Result { + loop { + let res = api::describe_run(config, &run.app_name, run.number).await?; + + if is_run_finished(&res.run) { + return Ok(res.run) + } else { + // Wait half a second to to try again. + tokio::time::sleep(tokio::time::Duration::from_millis(500)).await; + } + } +} + +/// is_run_started checks if the run has started by looking at its status. +fn is_run_started(run: &Run) -> Result { + match run.status { + tower_api::models::run::Status::Scheduled => Ok(false), + tower_api::models::run::Status::Pending => Ok(false), + tower_api::models::run::Status::Running => Ok(true), + _ => Err(Error::RunCompleted), + } +} + +/// is_run_finished checks if the run has finished by looking at its status. +fn is_run_finished(run: &Run) -> bool { + match run.status { + tower_api::models::run::Status::Scheduled => false, + tower_api::models::run::Status::Pending => false, + tower_api::models::run::Status::Running => false, + _ => true, + } +} + +fn monitor_run_completion(config: &Config, run: &Run) -> oneshot::Receiver { + // we'll use this as a way of monitoring for when the run has reached a terminal state. + let (tx, rx) = oneshot::channel(); + + // We need to spawn a task that will wait for run completion, and we need copies of these + // objects in order for them to run elsewhere. + let config_clone = config.clone(); + let run_clone = run.clone(); + + tokio::spawn(async move { + let run = wait_for_run_completion(&config_clone, &run_clone). + await. + unwrap(); + + let _ = tx.send(run); + }); + + rx +} + +fn print_log_stream_event(event: api::LogStreamEvent) { + match event { + api::LogStreamEvent::EventLog(log) => { + let ts = dates::format_str(&log.reported_at); + + output::log_line( + &ts, + &log.content, + output::LogLineType::Remote, + ); + } + api::LogStreamEvent::EventWarning(warning) => { + debug!("warning: {:?}", warning); + } + } +} + +fn print_run_completion(run: &Run) { + let link_line = format!(" See more: {}", run.dollar_link); + + match run.status { + tower_api::models::run::Status::Errored => { + let line = format!( + "Run #{} for app `{}` had an error", + run.number, run.app_name + ); + output::failure(&line); + }, + tower_api::models::run::Status::Crashed => { + let line = format!( + "Run #{} for app `{}` crashed", + run.number, run.app_name + ); + output::failure(&line); + }, + tower_api::models::run::Status::Cancelled => { + let line = format!( + "Run #{} for app `{}` was cancelled", + run.number, run.app_name + ); + output::failure(&line); + }, + _ => { + let line = format!( + "Run #{} for app `{}` has exited successfully", + run.number, run.app_name + ); + output::success(&line); + } + } + + output::write(&link_line); + output::newline(); +} diff --git a/crates/tower-cmd/src/util/dates.rs b/crates/tower-cmd/src/util/dates.rs new file mode 100644 index 00000000..a1984f16 --- /dev/null +++ b/crates/tower-cmd/src/util/dates.rs @@ -0,0 +1,12 @@ +use chrono::{DateTime, Utc}; + +pub fn format_str(ts: &str) -> String { + let dt: DateTime = DateTime::parse_from_rfc3339(ts) + .unwrap() + .with_timezone(&Utc); + + format(dt) +} +pub fn format(dt: DateTime) -> String { + dt.format("%F %T").to_string() +} diff --git a/crates/tower-cmd/src/util/mod.rs b/crates/tower-cmd/src/util/mod.rs index 23a6bb3f..4424a057 100644 --- a/crates/tower-cmd/src/util/mod.rs +++ b/crates/tower-cmd/src/util/mod.rs @@ -2,3 +2,4 @@ pub mod apps; pub mod deploy; pub mod progress; pub mod cmd; +pub mod dates; diff --git a/scripts/rust-api-client-generator-config.yaml b/scripts/rust-api-client-generator-config.yaml index 703d3f05..0c93a61c 100644 --- a/scripts/rust-api-client-generator-config.yaml +++ b/scripts/rust-api-client-generator-config.yaml @@ -24,3 +24,4 @@ additionalProperties: dateLibrary: chrono useRustLogging: true rustfmt: true + avoidBoxedModels: true diff --git a/scripts/rust-client-templates/model.mustache b/scripts/rust-client-templates/model.mustache index a4970abf..3de0dad7 100644 --- a/scripts/rust-client-templates/model.mustache +++ b/scripts/rust-client-templates/model.mustache @@ -1,6 +1,6 @@ {{>partial_header}} use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; {{#models}} {{#model}} {{^isEnum}}{{#vendorExtensions.x-rust-has-byte-array}} @@ -65,6 +65,26 @@ impl std::fmt::Display for {{{classname}}} { } } +impl<'de> Deserialize<'de> for {{{classname}}} { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + {{#allowableValues}} + {{#enumVars}} + "{{{value}}}" => Self::{{{name}}}, + {{/enumVars}} + {{/allowableValues}} + _ => Err(serde::de::Error::unknown_variant( + &s, + &[{{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}], + )), + } + } +} + {{/isInteger}} impl Default for {{{classname}}} { fn default() -> {{{classname}}} { @@ -201,7 +221,7 @@ impl Default for {{classname}} { {{#vars}} {{#isEnum}} /// {{{description}}} -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum {{{enumName}}} { {{#allowableValues}} {{#enumVars}} @@ -218,6 +238,26 @@ impl Default for {{{enumName}}} { {{/allowableValues}} } } + +impl<'de> Deserialize<'de> for {{{enumName}}} { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + {{#allowableValues}} + {{#enumVars}} + "{{{value}}}" => Ok(Self::{{{name}}}), + {{/enumVars}} + {{/allowableValues}} + _ => Err(serde::de::Error::unknown_variant( + &s, + &[{{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}], + )), + } + } +} {{/isEnum}} {{/vars}}