diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index fd511f5f..2454d349 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -248,6 +248,12 @@ jobs: manylinux: auto docker-options: ${{ matrix.platform.maturin_docker_options }} args: --release --locked --out dist + env: + # Set the CFLAGS for the aarch64 target, defining the ARM architecture + # for the ring crate's build script. This is a workaround for the + # issue where the ring crate's build script is not able to detect the + # ARM architecture. + CFLAGS_aarch64_unknown_linux_gnu: "-march=armv8-a -D__ARM_ARCH=8" - uses: uraimo/run-on-arch-action@v2 if: ${{ matrix.platform.arch != 'ppc64' && matrix.platform.arch != 'ppc64le'}} name: Test wheel diff --git a/Cargo.toml b/Cargo.toml index 50ee53e0..151b0644 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,12 +5,8 @@ resolver = "2" [workspace.package] edition = "2021" version = "0.3.20" - - - - description = "Tower is the best way to host Python data apps in production" -rust-version = "1.77" +rust-version = "1.81" authors = ["Brad Heller "] license = "MIT" repository = "https://github.com/tower/tower-cli" diff --git a/crates/config/src/towerfile.rs b/crates/config/src/towerfile.rs index 103bf3bb..0b228d50 100644 --- a/crates/config/src/towerfile.rs +++ b/crates/config/src/towerfile.rs @@ -1,7 +1,6 @@ use crate::Error; use serde::Deserialize; use std::path::PathBuf; -use tower_telemetry::debug; #[derive(Deserialize, Debug)] pub struct Parameter{ @@ -33,7 +32,7 @@ pub struct App { pub description: String, #[serde(default)] - pub workspace: PathBuf, + pub import_paths: Vec, } #[derive(Deserialize, Debug)] @@ -60,7 +59,7 @@ impl Towerfile { source: vec![], schedule: String::from("0 0 * * *"), description: String::from(""), - workspace: PathBuf::new(), + import_paths: vec![], }, } } @@ -86,16 +85,6 @@ impl Towerfile { let mut towerfile = Self::from_toml(&std::fs::read_to_string(path.to_path_buf())?)?; towerfile.file_path = path; - // We set the workspace to the directory of the Towerfile if it's not set because that's - // the implicit behavior overall for legacy Towerfiles. - if towerfile.app.workspace.as_os_str().is_empty() { - debug!("Setting workspace to the directory of the Towerfile"); - towerfile.app.workspace = towerfile.file_path - .parent() - .map(|p| p.to_path_buf()) - .unwrap(); - } - Ok(towerfile) } @@ -261,19 +250,4 @@ mod test { assert_eq!(towerfile.parameters[0].name, "my_first_param"); assert_eq!(towerfile.parameters[1].name, "my_second_param"); } - - #[test] - fn test_parsing_workspaces() { - let toml = r#" - [app] - name = "my-app" - script = "my-app/script.py" - source = ["*.py"] - workspace = "../" - "#; - - // All we want need to do is to ensure that the workspace is set accordingly. - let towerfile = crate::Towerfile::from_toml(toml).unwrap(); - assert_eq!(towerfile.app.workspace, PathBuf::from("../")); - } } diff --git a/crates/tower-api/README.md b/crates/tower-api/README.md index 8ddba226..684db42e 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.14 +- API version: v0.6.19 - Package version: 1.0.0 - Generator version: 7.13.0 - Build package: `org.openapitools.codegen.languages.RustClientCodegen` @@ -39,6 +39,7 @@ Class | Method | HTTP request | Description *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_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 *DefaultApi* | [**create_session**](docs/DefaultApi.md#create_session) | **POST** /session | Create session *DefaultApi* | [**create_team**](docs/DefaultApi.md#create_team) | **POST** /teams | Create team @@ -47,6 +48,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**delete_app**](docs/DefaultApi.md#delete_app) | **DELETE** /apps/{slug} | Delete app *DefaultApi* | [**delete_authenticator**](docs/DefaultApi.md#delete_authenticator) | **DELETE** /accounts/authenticator | Delete authenticator *DefaultApi* | [**delete_catalog**](docs/DefaultApi.md#delete_catalog) | **DELETE** /catalogs/{slug} | Delete catalog +*DefaultApi* | [**delete_schedule**](docs/DefaultApi.md#delete_schedule) | **DELETE** /schedules/{id} | Delete schedule *DefaultApi* | [**delete_secret**](docs/DefaultApi.md#delete_secret) | **DELETE** /secrets/{name} | Delete secret *DefaultApi* | [**delete_team**](docs/DefaultApi.md#delete_team) | **DELETE** /teams | Delete team *DefaultApi* | [**delete_team_invitation**](docs/DefaultApi.md#delete_team_invitation) | **DELETE** /teams/{slug}/invites | Delete team invitation @@ -63,6 +65,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**generate_app_statistics**](docs/DefaultApi.md#generate_app_statistics) | **GET** /stats/apps | Generate app statistics *DefaultApi* | [**generate_authenticator**](docs/DefaultApi.md#generate_authenticator) | **POST** /accounts/authenticator/generate | Generate authenticator *DefaultApi* | [**generate_run_statistics**](docs/DefaultApi.md#generate_run_statistics) | **GET** /stats/runs | Generate run statistics +*DefaultApi* | [**generate_runner_credentials**](docs/DefaultApi.md#generate_runner_credentials) | **POST** /runners/credentials | Generate runner credentials *DefaultApi* | [**invite_team_member**](docs/DefaultApi.md#invite_team_member) | **POST** /teams/{slug}/invites | Invite team member *DefaultApi* | [**leave_team**](docs/DefaultApi.md#leave_team) | **POST** /teams/{slug}/leave | Leave team *DefaultApi* | [**list_alerts**](docs/DefaultApi.md#list_alerts) | **GET** /alerts | List alerts @@ -74,6 +77,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**list_catalogs**](docs/DefaultApi.md#list_catalogs) | **GET** /catalogs | List catalogs *DefaultApi* | [**list_my_team_invitations**](docs/DefaultApi.md#list_my_team_invitations) | **GET** /team-invites | List my team invitations *DefaultApi* | [**list_runs**](docs/DefaultApi.md#list_runs) | **GET** /apps/{slug}/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 *DefaultApi* | [**list_secrets**](docs/DefaultApi.md#list_secrets) | **GET** /secrets | List secrets *DefaultApi* | [**list_team_invitations**](docs/DefaultApi.md#list_team_invitations) | **GET** /teams/{slug}/invites | List team invitations @@ -91,6 +95,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**update_catalog**](docs/DefaultApi.md#update_catalog) | **PUT** /catalogs/{slug} | Update catalog *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_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/{slug} | Update team *DefaultApi* | [**update_user**](docs/DefaultApi.md#update_user) | **PUT** /user | Update user profile @@ -128,6 +133,8 @@ Class | Method | HTTP request | Description - [CreateDeviceLoginTicketResponse](docs/CreateDeviceLoginTicketResponse.md) - [CreatePasswordResetParams](docs/CreatePasswordResetParams.md) - [CreatePasswordResetResponse](docs/CreatePasswordResetResponse.md) + - [CreateScheduleParams](docs/CreateScheduleParams.md) + - [CreateScheduleResponse](docs/CreateScheduleResponse.md) - [CreateSecretParams](docs/CreateSecretParams.md) - [CreateSecretResponse](docs/CreateSecretResponse.md) - [CreateSessionParams](docs/CreateSessionParams.md) @@ -140,6 +147,7 @@ Class | Method | HTTP request | Description - [DeleteAuthenticatorParams](docs/DeleteAuthenticatorParams.md) - [DeleteAuthenticatorResponse](docs/DeleteAuthenticatorResponse.md) - [DeleteCatalogResponse](docs/DeleteCatalogResponse.md) + - [DeleteScheduleResponse](docs/DeleteScheduleResponse.md) - [DeleteSecretResponse](docs/DeleteSecretResponse.md) - [DeleteTeamInvitationParams](docs/DeleteTeamInvitationParams.md) - [DeleteTeamInvitationResponse](docs/DeleteTeamInvitationResponse.md) @@ -167,6 +175,7 @@ Class | Method | HTTP request | Description - [GenerateAppStatisticsResponse](docs/GenerateAppStatisticsResponse.md) - [GenerateAuthenticatorResponse](docs/GenerateAuthenticatorResponse.md) - [GenerateRunStatisticsResponse](docs/GenerateRunStatisticsResponse.md) + - [GenerateRunnerCredentialsResponse](docs/GenerateRunnerCredentialsResponse.md) - [InviteTeamMemberParams](docs/InviteTeamMemberParams.md) - [InviteTeamMemberResponse](docs/InviteTeamMemberResponse.md) - [LeaveTeamResponse](docs/LeaveTeamResponse.md) @@ -180,6 +189,7 @@ Class | Method | HTTP request | Description - [ListCatalogsResponse](docs/ListCatalogsResponse.md) - [ListMyTeamInvitationsResponse](docs/ListMyTeamInvitationsResponse.md) - [ListRunsResponse](docs/ListRunsResponse.md) + - [ListSchedulesResponse](docs/ListSchedulesResponse.md) - [ListSecretEnvironmentsResponse](docs/ListSecretEnvironmentsResponse.md) - [ListSecretsResponse](docs/ListSecretsResponse.md) - [ListTeamInvitationsResponse](docs/ListTeamInvitationsResponse.md) @@ -203,6 +213,8 @@ Class | Method | HTTP request | Description - [RunResults](docs/RunResults.md) - [RunStatistics](docs/RunStatistics.md) - [RunTimeseriesPoint](docs/RunTimeseriesPoint.md) + - [RunnerCredentials](docs/RunnerCredentials.md) + - [Schedule](docs/Schedule.md) - [SearchRunsResponse](docs/SearchRunsResponse.md) - [Secret](docs/Secret.md) - [Session](docs/Session.md) @@ -224,6 +236,8 @@ Class | Method | HTTP request | Description - [UpdateMyTeamInvitationResponse](docs/UpdateMyTeamInvitationResponse.md) - [UpdatePasswordResetParams](docs/UpdatePasswordResetParams.md) - [UpdatePasswordResetResponse](docs/UpdatePasswordResetResponse.md) + - [UpdateScheduleParams](docs/UpdateScheduleParams.md) + - [UpdateScheduleResponse](docs/UpdateScheduleResponse.md) - [UpdateSecretParams](docs/UpdateSecretParams.md) - [UpdateSecretResponse](docs/UpdateSecretResponse.md) - [UpdateTeamParams](docs/UpdateTeamParams.md) diff --git a/crates/tower-api/src/apis/configuration.rs b/crates/tower-api/src/apis/configuration.rs index 6ccacaf9..a6edd873 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.14 + * The version of the OpenAPI document: v0.6.19 * 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 390b2014..66794b72 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.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ @@ -80,6 +80,12 @@ pub struct CreatePasswordResetParams { pub create_password_reset_params: models::CreatePasswordResetParams } +/// struct for passing parameters to the method [`create_schedule`] +#[derive(Clone, Debug)] +pub struct CreateScheduleParams { + pub create_schedule_params: models::CreateScheduleParams +} + /// struct for passing parameters to the method [`create_secret`] #[derive(Clone, Debug)] pub struct CreateSecretParams { @@ -131,6 +137,13 @@ pub struct DeleteCatalogParams { pub slug: String } +/// struct for passing parameters to the method [`delete_schedule`] +#[derive(Clone, Debug)] +pub struct DeleteScheduleParams { + /// The ID of the schedule to delete. + pub id: String +} + /// struct for passing parameters to the method [`delete_secret`] #[derive(Clone, Debug)] pub struct DeleteSecretParams { @@ -337,6 +350,15 @@ pub struct ListRunsParams { pub end_at: Option } +/// struct for passing parameters to the method [`list_schedules`] +#[derive(Clone, Debug)] +pub struct ListSchedulesParams { + /// 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_secrets`] #[derive(Clone, Debug)] pub struct ListSecretsParams { @@ -456,6 +478,14 @@ pub struct UpdatePasswordResetParams { pub update_password_reset_params: models::UpdatePasswordResetParams } +/// struct for passing parameters to the method [`update_schedule`] +#[derive(Clone, Debug)] +pub struct UpdateScheduleParams { + /// The ID of the schedule to update. + pub id: String, + pub update_schedule_params: models::UpdateScheduleParams +} + /// struct for passing parameters to the method [`update_secret`] #[derive(Clone, Debug)] pub struct UpdateSecretParams { @@ -574,6 +604,14 @@ pub enum CreatePasswordResetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`create_schedule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateScheduleSuccess { + Status200(models::CreateScheduleResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`create_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -638,6 +676,14 @@ pub enum DeleteCatalogSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`delete_schedule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteScheduleSuccess { + Status200(models::DeleteScheduleResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`delete_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -766,6 +812,14 @@ pub enum GenerateRunStatisticsSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`generate_runner_credentials`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateRunnerCredentialsSuccess { + Status200(models::GenerateRunnerCredentialsResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`invite_team_member`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -854,6 +908,14 @@ pub enum ListRunsSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`list_schedules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListSchedulesSuccess { + Status200(models::ListSchedulesResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`list_secret_environments`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -991,6 +1053,14 @@ pub enum UpdatePasswordResetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`update_schedule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateScheduleSuccess { + Status200(models::UpdateScheduleResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1111,6 +1181,14 @@ pub enum CreatePasswordResetError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`create_schedule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateScheduleError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`create_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1175,6 +1253,14 @@ pub enum DeleteCatalogError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`delete_schedule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteScheduleError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`delete_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1306,6 +1392,14 @@ pub enum GenerateRunStatisticsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`generate_runner_credentials`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateRunnerCredentialsError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`invite_team_member`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1394,6 +1488,14 @@ pub enum ListRunsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_schedules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListSchedulesError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_secret_environments`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1530,6 +1632,14 @@ pub enum UpdatePasswordResetError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_schedule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateScheduleError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1973,6 +2083,42 @@ pub async fn create_password_reset(configuration: &configuration::Configuration, } } +/// Create a new schedule for an app. +pub async fn create_schedule(configuration: &configuration::Configuration, params: CreateScheduleParams) -> Result, Error> { + + let uri_str = format!("{}/schedules", 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_schedule_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 })) + } +} + /// Creates a new secret and associates it with the current account. pub async fn create_secret(configuration: &configuration::Configuration, params: CreateSecretParams) -> Result, Error> { @@ -2254,6 +2400,41 @@ pub async fn delete_catalog(configuration: &configuration::Configuration, params } } +/// Delete an existing schedule for an app. +pub async fn delete_schedule(configuration: &configuration::Configuration, params: DeleteScheduleParams) -> Result, Error> { + + let uri_str = format!("{}/schedules/{id}", configuration.base_path, id=crate::apis::urlencode(params.id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &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 })) + } +} + /// Delete a secret by name. pub async fn delete_secret(configuration: &configuration::Configuration, params: DeleteSecretParams) -> Result, Error> { @@ -2855,6 +3036,49 @@ pub async fn generate_run_statistics(configuration: &configuration::Configuratio } } +/// Uses your current authentication context to generate runner credentials that are used for authenticating runner requests +pub async fn generate_runner_credentials(configuration: &configuration::Configuration) -> Result, Error> { + + let uri_str = format!("{}/runners/credentials", 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 apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-API-Key", value); + }; + 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 })) + } +} + /// Invite a new team pub async fn invite_team_member(configuration: &configuration::Configuration, params: InviteTeamMemberParams) -> Result, Error> { @@ -3315,6 +3539,47 @@ pub async fn list_runs(configuration: &configuration::Configuration, params: Lis } } +/// List all schedules for an app. +pub async fn list_schedules(configuration: &configuration::Configuration, params: ListSchedulesParams) -> Result, Error> { + + let uri_str = format!("{}/schedules", 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 })) + } +} + /// Lists all the environments associated with secrets. pub async fn list_secret_environments(configuration: &configuration::Configuration) -> Result, Error> { @@ -3954,6 +4219,42 @@ pub async fn update_password_reset(configuration: &configuration::Configuration, } } +/// Update an existing schedule for an app. +pub async fn update_schedule(configuration: &configuration::Configuration, params: UpdateScheduleParams) -> Result, Error> { + + let uri_str = format!("{}/schedules/{id}", configuration.base_path, id=crate::apis::urlencode(params.id)); + 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_schedule_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 })) + } +} + /// Updates a secret that has previously been created in your account pub async fn update_secret(configuration: &configuration::Configuration, params: UpdateSecretParams) -> 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 be80f877..3c59f691 100644 --- a/crates/tower-api/src/models/accept_invitation_params.rs +++ b/crates/tower-api/src/models/accept_invitation_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/accept_invitation_response.rs b/crates/tower-api/src/models/accept_invitation_response.rs index 7162b648..2b6be00e 100644 --- a/crates/tower-api/src/models/accept_invitation_response.rs +++ b/crates/tower-api/src/models/accept_invitation_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/account.rs b/crates/tower-api/src/models/account.rs index 8aefa49c..d5de23cb 100644 --- a/crates/tower-api/src/models/account.rs +++ b/crates/tower-api/src/models/account.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/acknowledge_alert_response.rs b/crates/tower-api/src/models/acknowledge_alert_response.rs index 2b2336f1..67b8ae15 100644 --- a/crates/tower-api/src/models/acknowledge_alert_response.rs +++ b/crates/tower-api/src/models/acknowledge_alert_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 233c56e4..c6ace3a6 100644 --- a/crates/tower-api/src/models/acknowledge_all_alerts_response.rs +++ b/crates/tower-api/src/models/acknowledge_all_alerts_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/alert.rs b/crates/tower-api/src/models/alert.rs index c390e527..365c4b96 100644 --- a/crates/tower-api/src/models/alert.rs +++ b/crates/tower-api/src/models/alert.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/api_key.rs b/crates/tower-api/src/models/api_key.rs index d246646e..2ec47af1 100644 --- a/crates/tower-api/src/models/api_key.rs +++ b/crates/tower-api/src/models/api_key.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/app.rs b/crates/tower-api/src/models/app.rs index bc46834c..184e76b1 100644 --- a/crates/tower-api/src/models/app.rs +++ b/crates/tower-api/src/models/app.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/app_statistics.rs b/crates/tower-api/src/models/app_statistics.rs index 28ef50b2..5715d0c4 100644 --- a/crates/tower-api/src/models/app_statistics.rs +++ b/crates/tower-api/src/models/app_statistics.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/app_summary.rs b/crates/tower-api/src/models/app_summary.rs index 78dd3223..3fc2b2ef 100644 --- a/crates/tower-api/src/models/app_summary.rs +++ b/crates/tower-api/src/models/app_summary.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/app_version.rs b/crates/tower-api/src/models/app_version.rs index 0e5af416..2ce9dd1f 100644 --- a/crates/tower-api/src/models/app_version.rs +++ b/crates/tower-api/src/models/app_version.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/cancel_run_response.rs b/crates/tower-api/src/models/cancel_run_response.rs index 282f9672..79f94e3e 100644 --- a/crates/tower-api/src/models/cancel_run_response.rs +++ b/crates/tower-api/src/models/cancel_run_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/catalog.rs b/crates/tower-api/src/models/catalog.rs index 949ed3f6..b40c13fa 100644 --- a/crates/tower-api/src/models/catalog.rs +++ b/crates/tower-api/src/models/catalog.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/catalog_property.rs b/crates/tower-api/src/models/catalog_property.rs index 872e955f..36406b7a 100644 --- a/crates/tower-api/src/models/catalog_property.rs +++ b/crates/tower-api/src/models/catalog_property.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 31a47912..9b1246eb 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 b7ae9f36..5a0a32f9 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_account_params.rs b/crates/tower-api/src/models/create_account_params.rs index f01f79e3..f40e4487 100644 --- a/crates/tower-api/src/models/create_account_params.rs +++ b/crates/tower-api/src/models/create_account_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 f5fee769..8312c165 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_account_response.rs b/crates/tower-api/src/models/create_account_response.rs index db2a58e5..c902240d 100644 --- a/crates/tower-api/src/models/create_account_response.rs +++ b/crates/tower-api/src/models/create_account_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 8253850b..d09efa04 100644 --- a/crates/tower-api/src/models/create_api_key_params.rs +++ b/crates/tower-api/src/models/create_api_key_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 5dff994d..33a518c0 100644 --- a/crates/tower-api/src/models/create_api_key_response.rs +++ b/crates/tower-api/src/models/create_api_key_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_app_params.rs b/crates/tower-api/src/models/create_app_params.rs index 4d4ecf32..30aed35f 100644 --- a/crates/tower-api/src/models/create_app_params.rs +++ b/crates/tower-api/src/models/create_app_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_app_response.rs b/crates/tower-api/src/models/create_app_response.rs index 873cca41..9e4204c3 100644 --- a/crates/tower-api/src/models/create_app_response.rs +++ b/crates/tower-api/src/models/create_app_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_authenticator_params.rs b/crates/tower-api/src/models/create_authenticator_params.rs index 8297dabd..431a6085 100644 --- a/crates/tower-api/src/models/create_authenticator_params.rs +++ b/crates/tower-api/src/models/create_authenticator_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_authenticator_response.rs b/crates/tower-api/src/models/create_authenticator_response.rs index 21ec3f3c..14a288ae 100644 --- a/crates/tower-api/src/models/create_authenticator_response.rs +++ b/crates/tower-api/src/models/create_authenticator_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_catalog_params.rs b/crates/tower-api/src/models/create_catalog_params.rs index a1a41653..0db9b0e9 100644 --- a/crates/tower-api/src/models/create_catalog_params.rs +++ b/crates/tower-api/src/models/create_catalog_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_catalog_response.rs b/crates/tower-api/src/models/create_catalog_response.rs index 010dac07..a2933430 100644 --- a/crates/tower-api/src/models/create_catalog_response.rs +++ b/crates/tower-api/src/models/create_catalog_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 34357b43..ff72c19f 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 b52fd6bd..f61ba78f 100644 --- a/crates/tower-api/src/models/create_password_reset_params.rs +++ b/crates/tower-api/src/models/create_password_reset_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 6663d9f0..dabee43d 100644 --- a/crates/tower-api/src/models/create_password_reset_response.rs +++ b/crates/tower-api/src/models/create_password_reset_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_schedule_params.rs b/crates/tower-api/src/models/create_schedule_params.rs new file mode 100644 index 00000000..dddb475e --- /dev/null +++ b/crates/tower-api/src/models/create_schedule_params.rs @@ -0,0 +1,48 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateScheduleParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The slug of the app to create a schedule for + #[serde(rename = "app_slug")] + pub app_slug: String, + /// The specific app version to run (if omitted, will use the app's default version) + #[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, + /// The environment to run the app in + #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] + pub environment: Option, + /// Parameters to pass when running the app + #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")] + pub parameters: Option>, +} + +impl CreateScheduleParams { + pub fn new(app_slug: String, cron_string: String) -> CreateScheduleParams { + CreateScheduleParams { + schema: None, + app_slug, + app_version: None, + cron_string, + 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 new file mode 100644 index 00000000..b1cd82e0 --- /dev/null +++ b/crates/tower-api/src/models/create_schedule_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateScheduleResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "schedule")] + pub schedule: Box, +} + +impl CreateScheduleResponse { + pub fn new(schedule: models::Schedule) -> CreateScheduleResponse { + CreateScheduleResponse { + schema: None, + schedule: Box::new(schedule), + } + } +} + diff --git a/crates/tower-api/src/models/create_secret_params.rs b/crates/tower-api/src/models/create_secret_params.rs index d0f9fcd1..939b9ea8 100644 --- a/crates/tower-api/src/models/create_secret_params.rs +++ b/crates/tower-api/src/models/create_secret_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_secret_response.rs b/crates/tower-api/src/models/create_secret_response.rs index 2348487b..7e1b99f8 100644 --- a/crates/tower-api/src/models/create_secret_response.rs +++ b/crates/tower-api/src/models/create_secret_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_session_params.rs b/crates/tower-api/src/models/create_session_params.rs index dbf5a6f0..c2b0abf5 100644 --- a/crates/tower-api/src/models/create_session_params.rs +++ b/crates/tower-api/src/models/create_session_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_session_response.rs b/crates/tower-api/src/models/create_session_response.rs index 8ff938ea..6f93c641 100644 --- a/crates/tower-api/src/models/create_session_response.rs +++ b/crates/tower-api/src/models/create_session_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_team_params.rs b/crates/tower-api/src/models/create_team_params.rs index 99f5b1a9..11334fec 100644 --- a/crates/tower-api/src/models/create_team_params.rs +++ b/crates/tower-api/src/models/create_team_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/create_team_response.rs b/crates/tower-api/src/models/create_team_response.rs index d23a77b5..83431dd6 100644 --- a/crates/tower-api/src/models/create_team_response.rs +++ b/crates/tower-api/src/models/create_team_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 09240a9d..f53b1fc3 100644 --- a/crates/tower-api/src/models/delete_api_key_params.rs +++ b/crates/tower-api/src/models/delete_api_key_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 437b8536..eec85bf4 100644 --- a/crates/tower-api/src/models/delete_api_key_response.rs +++ b/crates/tower-api/src/models/delete_api_key_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_app_response.rs b/crates/tower-api/src/models/delete_app_response.rs index 2b384e0c..b6976af1 100644 --- a/crates/tower-api/src/models/delete_app_response.rs +++ b/crates/tower-api/src/models/delete_app_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_authenticator_params.rs b/crates/tower-api/src/models/delete_authenticator_params.rs index f8deb87d..bae4ded0 100644 --- a/crates/tower-api/src/models/delete_authenticator_params.rs +++ b/crates/tower-api/src/models/delete_authenticator_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_authenticator_response.rs b/crates/tower-api/src/models/delete_authenticator_response.rs index 8b913f2e..c0749bf7 100644 --- a/crates/tower-api/src/models/delete_authenticator_response.rs +++ b/crates/tower-api/src/models/delete_authenticator_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_catalog_response.rs b/crates/tower-api/src/models/delete_catalog_response.rs index a93f7302..3af444ec 100644 --- a/crates/tower-api/src/models/delete_catalog_response.rs +++ b/crates/tower-api/src/models/delete_catalog_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_schedule_response.rs b/crates/tower-api/src/models/delete_schedule_response.rs new file mode 100644 index 00000000..9a1055a2 --- /dev/null +++ b/crates/tower-api/src/models/delete_schedule_response.rs @@ -0,0 +1,32 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeleteScheduleResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The ID of the deleted schedule. + #[serde(rename = "id")] + pub id: String, +} + +impl DeleteScheduleResponse { + pub fn new(id: String) -> DeleteScheduleResponse { + DeleteScheduleResponse { + schema: None, + id, + } + } +} + diff --git a/crates/tower-api/src/models/delete_secret_response.rs b/crates/tower-api/src/models/delete_secret_response.rs index 83e56b4e..11b29bfa 100644 --- a/crates/tower-api/src/models/delete_secret_response.rs +++ b/crates/tower-api/src/models/delete_secret_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 4657f555..d5962539 100644 --- a/crates/tower-api/src/models/delete_team_invitation_params.rs +++ b/crates/tower-api/src/models/delete_team_invitation_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 59256758..70b4035d 100644 --- a/crates/tower-api/src/models/delete_team_invitation_response.rs +++ b/crates/tower-api/src/models/delete_team_invitation_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_team_params.rs b/crates/tower-api/src/models/delete_team_params.rs index e835915c..1a6d905f 100644 --- a/crates/tower-api/src/models/delete_team_params.rs +++ b/crates/tower-api/src/models/delete_team_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/delete_team_response.rs b/crates/tower-api/src/models/delete_team_response.rs index 6e913b76..8f5a3960 100644 --- a/crates/tower-api/src/models/delete_team_response.rs +++ b/crates/tower-api/src/models/delete_team_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/deploy_app_response.rs b/crates/tower-api/src/models/deploy_app_response.rs index 4930b05b..8dd463e6 100644 --- a/crates/tower-api/src/models/deploy_app_response.rs +++ b/crates/tower-api/src/models/deploy_app_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/describe_app_response.rs b/crates/tower-api/src/models/describe_app_response.rs index 5805bbfb..46e551cf 100644 --- a/crates/tower-api/src/models/describe_app_response.rs +++ b/crates/tower-api/src/models/describe_app_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 97699816..350ce54d 100644 --- a/crates/tower-api/src/models/describe_app_version_response.rs +++ b/crates/tower-api/src/models/describe_app_version_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 c73f77e9..2bb864cc 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 c67d8da1..22c24f95 100644 --- a/crates/tower-api/src/models/describe_run_logs_response.rs +++ b/crates/tower-api/src/models/describe_run_logs_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/describe_run_response.rs b/crates/tower-api/src/models/describe_run_response.rs index 34a183bd..bd15d01e 100644 --- a/crates/tower-api/src/models/describe_run_response.rs +++ b/crates/tower-api/src/models/describe_run_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 10696e0d..3569323b 100644 --- a/crates/tower-api/src/models/describe_secrets_key_response.rs +++ b/crates/tower-api/src/models/describe_secrets_key_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/describe_session_response.rs b/crates/tower-api/src/models/describe_session_response.rs index b92ff6a1..6cbf7922 100644 --- a/crates/tower-api/src/models/describe_session_response.rs +++ b/crates/tower-api/src/models/describe_session_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/encrypted_catalog_property.rs b/crates/tower-api/src/models/encrypted_catalog_property.rs index 61b5f044..4b77672c 100644 --- a/crates/tower-api/src/models/encrypted_catalog_property.rs +++ b/crates/tower-api/src/models/encrypted_catalog_property.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/error_detail.rs b/crates/tower-api/src/models/error_detail.rs index 870cae2b..60df6b40 100644 --- a/crates/tower-api/src/models/error_detail.rs +++ b/crates/tower-api/src/models/error_detail.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/error_model.rs b/crates/tower-api/src/models/error_model.rs index a9bc63a1..cfdafa2a 100644 --- a/crates/tower-api/src/models/error_model.rs +++ b/crates/tower-api/src/models/error_model.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/export_catalogs_params.rs b/crates/tower-api/src/models/export_catalogs_params.rs index 2081ca06..79edcf72 100644 --- a/crates/tower-api/src/models/export_catalogs_params.rs +++ b/crates/tower-api/src/models/export_catalogs_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/export_catalogs_response.rs b/crates/tower-api/src/models/export_catalogs_response.rs index 8a8f18c0..c6f2755e 100644 --- a/crates/tower-api/src/models/export_catalogs_response.rs +++ b/crates/tower-api/src/models/export_catalogs_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/export_secrets_params.rs b/crates/tower-api/src/models/export_secrets_params.rs index b46d9191..e747fa06 100644 --- a/crates/tower-api/src/models/export_secrets_params.rs +++ b/crates/tower-api/src/models/export_secrets_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/export_secrets_response.rs b/crates/tower-api/src/models/export_secrets_response.rs index 7810f6c0..8ed70ac5 100644 --- a/crates/tower-api/src/models/export_secrets_response.rs +++ b/crates/tower-api/src/models/export_secrets_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/exported_catalog.rs b/crates/tower-api/src/models/exported_catalog.rs index 8f1b4cdd..9a234cb5 100644 --- a/crates/tower-api/src/models/exported_catalog.rs +++ b/crates/tower-api/src/models/exported_catalog.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/exported_catalog_property.rs b/crates/tower-api/src/models/exported_catalog_property.rs index 8922fd16..d3fc0093 100644 --- a/crates/tower-api/src/models/exported_catalog_property.rs +++ b/crates/tower-api/src/models/exported_catalog_property.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/exported_secret.rs b/crates/tower-api/src/models/exported_secret.rs index 0b3dc57f..80d78b8f 100644 --- a/crates/tower-api/src/models/exported_secret.rs +++ b/crates/tower-api/src/models/exported_secret.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/featurebase_identity.rs b/crates/tower-api/src/models/featurebase_identity.rs index e807b6a0..1b5d82dd 100644 --- a/crates/tower-api/src/models/featurebase_identity.rs +++ b/crates/tower-api/src/models/featurebase_identity.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 9c8e74a8..7ea28873 100644 --- a/crates/tower-api/src/models/generate_app_statistics_response.rs +++ b/crates/tower-api/src/models/generate_app_statistics_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/generate_authenticator_response.rs b/crates/tower-api/src/models/generate_authenticator_response.rs index 60593acb..cd29b668 100644 --- a/crates/tower-api/src/models/generate_authenticator_response.rs +++ b/crates/tower-api/src/models/generate_authenticator_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 a6ec9aa5..12f4b2e3 100644 --- a/crates/tower-api/src/models/generate_run_statistics_response.rs +++ b/crates/tower-api/src/models/generate_run_statistics_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/generate_runner_credentials_response.rs b/crates/tower-api/src/models/generate_runner_credentials_response.rs new file mode 100644 index 00000000..2912f2f9 --- /dev/null +++ b/crates/tower-api/src/models/generate_runner_credentials_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenerateRunnerCredentialsResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "credentials")] + pub credentials: Box, +} + +impl GenerateRunnerCredentialsResponse { + pub fn new(credentials: models::RunnerCredentials) -> GenerateRunnerCredentialsResponse { + GenerateRunnerCredentialsResponse { + schema: None, + credentials: Box::new(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 67754637..7fbf894e 100644 --- a/crates/tower-api/src/models/invite_team_member_params.rs +++ b/crates/tower-api/src/models/invite_team_member_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 fe2db902..524b85be 100644 --- a/crates/tower-api/src/models/invite_team_member_response.rs +++ b/crates/tower-api/src/models/invite_team_member_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/leave_team_response.rs b/crates/tower-api/src/models/leave_team_response.rs index 9f23634a..3457f708 100644 --- a/crates/tower-api/src/models/leave_team_response.rs +++ b/crates/tower-api/src/models/leave_team_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 6c0884a6..e5483965 100644 --- a/crates/tower-api/src/models/list_alerts_200_response.rs +++ b/crates/tower-api/src/models/list_alerts_200_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_alerts_response.rs b/crates/tower-api/src/models/list_alerts_response.rs index 9a80bebc..5a5bbb78 100644 --- a/crates/tower-api/src/models/list_alerts_response.rs +++ b/crates/tower-api/src/models/list_alerts_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 4eb7de93..c0d186c9 100644 --- a/crates/tower-api/src/models/list_api_keys_response.rs +++ b/crates/tower-api/src/models/list_api_keys_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 8e7c4a3d..31eefa68 100644 --- a/crates/tower-api/src/models/list_app_environments_response.rs +++ b/crates/tower-api/src/models/list_app_environments_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 9b258f85..94cf84e5 100644 --- a/crates/tower-api/src/models/list_app_versions_response.rs +++ b/crates/tower-api/src/models/list_app_versions_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_apps_response.rs b/crates/tower-api/src/models/list_apps_response.rs index 8c86bbd6..864ece97 100644 --- a/crates/tower-api/src/models/list_apps_response.rs +++ b/crates/tower-api/src/models/list_apps_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_authenticators_response.rs b/crates/tower-api/src/models/list_authenticators_response.rs index 6a00c693..7d32e59b 100644 --- a/crates/tower-api/src/models/list_authenticators_response.rs +++ b/crates/tower-api/src/models/list_authenticators_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_catalogs_response.rs b/crates/tower-api/src/models/list_catalogs_response.rs index 20f9bd66..849d7e8c 100644 --- a/crates/tower-api/src/models/list_catalogs_response.rs +++ b/crates/tower-api/src/models/list_catalogs_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 9591f97c..033f692d 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_runs_response.rs b/crates/tower-api/src/models/list_runs_response.rs index efe72535..36596077 100644 --- a/crates/tower-api/src/models/list_runs_response.rs +++ b/crates/tower-api/src/models/list_runs_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_schedules_response.rs b/crates/tower-api/src/models/list_schedules_response.rs new file mode 100644 index 00000000..e6aae0cc --- /dev/null +++ b/crates/tower-api/src/models/list_schedules_response.rs @@ -0,0 +1,34 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListSchedulesResponse { + /// 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: Box, + #[serde(rename = "schedules")] + pub schedules: Vec, +} + +impl ListSchedulesResponse { + pub fn new(pages: models::Pagination, schedules: Vec) -> ListSchedulesResponse { + ListSchedulesResponse { + schema: None, + pages: Box::new(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 cba49f0c..84604ea9 100644 --- a/crates/tower-api/src/models/list_secret_environments_response.rs +++ b/crates/tower-api/src/models/list_secret_environments_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_secrets_response.rs b/crates/tower-api/src/models/list_secrets_response.rs index 343e0f93..29c97b7b 100644 --- a/crates/tower-api/src/models/list_secrets_response.rs +++ b/crates/tower-api/src/models/list_secrets_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 68b94ebd..bdbcd10a 100644 --- a/crates/tower-api/src/models/list_team_invitations_response.rs +++ b/crates/tower-api/src/models/list_team_invitations_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 8f9f5cf1..2cc6738b 100644 --- a/crates/tower-api/src/models/list_team_members_response.rs +++ b/crates/tower-api/src/models/list_team_members_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/list_teams_response.rs b/crates/tower-api/src/models/list_teams_response.rs index cf685cd9..cd6dc971 100644 --- a/crates/tower-api/src/models/list_teams_response.rs +++ b/crates/tower-api/src/models/list_teams_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/log_line.rs b/crates/tower-api/src/models/log_line.rs index 027fdfaa..eef729aa 100644 --- a/crates/tower-api/src/models/log_line.rs +++ b/crates/tower-api/src/models/log_line.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/mod.rs b/crates/tower-api/src/models/mod.rs index 3dc6b832..d129d5ce 100644 --- a/crates/tower-api/src/models/mod.rs +++ b/crates/tower-api/src/models/mod.rs @@ -58,6 +58,10 @@ pub mod create_password_reset_params; pub use self::create_password_reset_params::CreatePasswordResetParams; pub mod create_password_reset_response; pub use self::create_password_reset_response::CreatePasswordResetResponse; +pub mod create_schedule_params; +pub use self::create_schedule_params::CreateScheduleParams; +pub mod create_schedule_response; +pub use self::create_schedule_response::CreateScheduleResponse; pub mod create_secret_params; pub use self::create_secret_params::CreateSecretParams; pub mod create_secret_response; @@ -82,6 +86,8 @@ pub mod delete_authenticator_response; pub use self::delete_authenticator_response::DeleteAuthenticatorResponse; pub mod delete_catalog_response; pub use self::delete_catalog_response::DeleteCatalogResponse; +pub mod delete_schedule_response; +pub use self::delete_schedule_response::DeleteScheduleResponse; pub mod delete_secret_response; pub use self::delete_secret_response::DeleteSecretResponse; pub mod delete_team_invitation_params; @@ -136,6 +142,8 @@ pub mod generate_authenticator_response; pub use self::generate_authenticator_response::GenerateAuthenticatorResponse; pub mod generate_run_statistics_response; pub use self::generate_run_statistics_response::GenerateRunStatisticsResponse; +pub mod generate_runner_credentials_response; +pub use self::generate_runner_credentials_response::GenerateRunnerCredentialsResponse; pub mod invite_team_member_params; pub use self::invite_team_member_params::InviteTeamMemberParams; pub mod invite_team_member_response; @@ -162,6 +170,8 @@ pub mod list_my_team_invitations_response; pub use self::list_my_team_invitations_response::ListMyTeamInvitationsResponse; pub mod list_runs_response; pub use self::list_runs_response::ListRunsResponse; +pub mod list_schedules_response; +pub use self::list_schedules_response::ListSchedulesResponse; pub mod list_secret_environments_response; pub use self::list_secret_environments_response::ListSecretEnvironmentsResponse; pub mod list_secrets_response; @@ -202,10 +212,16 @@ pub mod run_log_line; pub use self::run_log_line::RunLogLine; pub mod run_parameter; pub use self::run_parameter::RunParameter; +pub mod run_results; +pub use self::run_results::RunResults; pub mod run_statistics; pub use self::run_statistics::RunStatistics; pub mod run_timeseries_point; pub use self::run_timeseries_point::RunTimeseriesPoint; +pub mod runner_credentials; +pub use self::runner_credentials::RunnerCredentials; +pub mod schedule; +pub use self::schedule::Schedule; pub mod search_runs_response; pub use self::search_runs_response::SearchRunsResponse; pub mod secret; @@ -248,6 +264,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_schedule_params; +pub use self::update_schedule_params::UpdateScheduleParams; +pub mod update_schedule_response; +pub use self::update_schedule_response::UpdateScheduleResponse; pub mod update_secret_params; pub use self::update_secret_params::UpdateSecretParams; pub mod update_secret_response; diff --git a/crates/tower-api/src/models/pagination.rs b/crates/tower-api/src/models/pagination.rs index 10786140..4ded98b1 100644 --- a/crates/tower-api/src/models/pagination.rs +++ b/crates/tower-api/src/models/pagination.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/parameter.rs b/crates/tower-api/src/models/parameter.rs index d2750240..d9481d59 100644 --- a/crates/tower-api/src/models/parameter.rs +++ b/crates/tower-api/src/models/parameter.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/refresh_session_params.rs b/crates/tower-api/src/models/refresh_session_params.rs index 257b5cca..8ef40907 100644 --- a/crates/tower-api/src/models/refresh_session_params.rs +++ b/crates/tower-api/src/models/refresh_session_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/refresh_session_response.rs b/crates/tower-api/src/models/refresh_session_response.rs index c0caa5b1..7ad25d0e 100644 --- a/crates/tower-api/src/models/refresh_session_response.rs +++ b/crates/tower-api/src/models/refresh_session_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 97b72e2b..8c2e71f3 100644 --- a/crates/tower-api/src/models/remove_team_member_params.rs +++ b/crates/tower-api/src/models/remove_team_member_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 aaf3b1d4..43eabd5d 100644 --- a/crates/tower-api/src/models/remove_team_member_response.rs +++ b/crates/tower-api/src/models/remove_team_member_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 6bba8e9a..d18acd6c 100644 --- a/crates/tower-api/src/models/resend_team_invitation_params.rs +++ b/crates/tower-api/src/models/resend_team_invitation_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 b9b52cbd..e2ff4171 100644 --- a/crates/tower-api/src/models/resend_team_invitation_response.rs +++ b/crates/tower-api/src/models/resend_team_invitation_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run.rs b/crates/tower-api/src/models/run.rs index 3553a60d..6f715d43 100644 --- a/crates/tower-api/src/models/run.rs +++ b/crates/tower-api/src/models/run.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_app_params.rs b/crates/tower-api/src/models/run_app_params.rs index 89f13af7..1cf9431c 100644 --- a/crates/tower-api/src/models/run_app_params.rs +++ b/crates/tower-api/src/models/run_app_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_app_response.rs b/crates/tower-api/src/models/run_app_response.rs index 3fbfec96..adb58c8a 100644 --- a/crates/tower-api/src/models/run_app_response.rs +++ b/crates/tower-api/src/models/run_app_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_failure_alert.rs b/crates/tower-api/src/models/run_failure_alert.rs index 15785483..b25f4448 100644 --- a/crates/tower-api/src/models/run_failure_alert.rs +++ b/crates/tower-api/src/models/run_failure_alert.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_log_line.rs b/crates/tower-api/src/models/run_log_line.rs index 17b23183..5176ece9 100644 --- a/crates/tower-api/src/models/run_log_line.rs +++ b/crates/tower-api/src/models/run_log_line.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_parameter.rs b/crates/tower-api/src/models/run_parameter.rs index 61f6b27a..1fd4549a 100644 --- a/crates/tower-api/src/models/run_parameter.rs +++ b/crates/tower-api/src/models/run_parameter.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_results.rs b/crates/tower-api/src/models/run_results.rs index cb3432e4..cdaaae76 100644 --- a/crates/tower-api/src/models/run_results.rs +++ b/crates/tower-api/src/models/run_results.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_statistics.rs b/crates/tower-api/src/models/run_statistics.rs index a93d954e..4e0ef41e 100644 --- a/crates/tower-api/src/models/run_statistics.rs +++ b/crates/tower-api/src/models/run_statistics.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/run_timeseries_point.rs b/crates/tower-api/src/models/run_timeseries_point.rs index eb9bacd6..18aa3bba 100644 --- a/crates/tower-api/src/models/run_timeseries_point.rs +++ b/crates/tower-api/src/models/run_timeseries_point.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/runner_credentials.rs b/crates/tower-api/src/models/runner_credentials.rs new file mode 100644 index 00000000..d750efe4 --- /dev/null +++ b/crates/tower-api/src/models/runner_credentials.rs @@ -0,0 +1,40 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunnerCredentials { + /// The signed certificate used by the runner to authenticate itself to Tower. + #[serde(rename = "certificate")] + pub certificate: String, + /// The private key used by the runner to authenticate itself to Tower. + #[serde(rename = "private_key")] + pub private_key: String, + /// The PEM encoded root CA certificate that is used to verify the runner's certificate when Tower is responsible for signing server certs. + #[serde(rename = "root_ca", deserialize_with = "Option::deserialize")] + pub root_ca: Option, + /// The host of the runner service that this runner will connect to. This is typically the Tower service host. + #[serde(rename = "runner_service_url")] + pub runner_service_url: String, +} + +impl RunnerCredentials { + pub fn new(certificate: String, private_key: String, root_ca: Option, runner_service_url: String) -> RunnerCredentials { + RunnerCredentials { + certificate, + private_key, + root_ca, + runner_service_url, + } + } +} + diff --git a/crates/tower-api/src/models/schedule.rs b/crates/tower-api/src/models/schedule.rs new file mode 100644 index 00000000..cd259634 --- /dev/null +++ b/crates/tower-api/src/models/schedule.rs @@ -0,0 +1,48 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Schedule { + /// The slug of the app that will be executed + #[serde(rename = "app_slug")] + pub app_slug: String, + /// The specific app version to run, or null for the default version + #[serde(rename = "app_version", skip_serializing_if = "Option::is_none")] + pub app_version: Option, + /// The cron expression defining when the app should run + #[serde(rename = "cron")] + pub cron: String, + /// The environment to run the app in + #[serde(rename = "environment")] + pub environment: String, + /// The unique identifier for the schedule + #[serde(rename = "id")] + pub id: String, + /// The parameters to pass when running the app + #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")] + pub parameters: Option>, +} + +impl Schedule { + pub fn new(app_slug: String, cron: String, environment: String, id: String) -> Schedule { + Schedule { + app_slug, + app_version: None, + cron, + environment, + id, + parameters: None, + } + } +} + diff --git a/crates/tower-api/src/models/search_runs_response.rs b/crates/tower-api/src/models/search_runs_response.rs index 3431e00e..f671b7db 100644 --- a/crates/tower-api/src/models/search_runs_response.rs +++ b/crates/tower-api/src/models/search_runs_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/secret.rs b/crates/tower-api/src/models/secret.rs index a85b3466..88275bed 100644 --- a/crates/tower-api/src/models/secret.rs +++ b/crates/tower-api/src/models/secret.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/session.rs b/crates/tower-api/src/models/session.rs index 81fff6ce..3703547b 100644 --- a/crates/tower-api/src/models/session.rs +++ b/crates/tower-api/src/models/session.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/sse_warning.rs b/crates/tower-api/src/models/sse_warning.rs index 754045cd..502e367a 100644 --- a/crates/tower-api/src/models/sse_warning.rs +++ b/crates/tower-api/src/models/sse_warning.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/statistics_settings.rs b/crates/tower-api/src/models/statistics_settings.rs index 4f468308..2a474be3 100644 --- a/crates/tower-api/src/models/statistics_settings.rs +++ b/crates/tower-api/src/models/statistics_settings.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 57c4cd74..e26e006e 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 99ecd695..476e16e9 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/team.rs b/crates/tower-api/src/models/team.rs index 7aa3126e..5f92a0ef 100644 --- a/crates/tower-api/src/models/team.rs +++ b/crates/tower-api/src/models/team.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/team_invitation.rs b/crates/tower-api/src/models/team_invitation.rs index b2dc713e..563c599b 100644 --- a/crates/tower-api/src/models/team_invitation.rs +++ b/crates/tower-api/src/models/team_invitation.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/token.rs b/crates/tower-api/src/models/token.rs index 2903f5a2..13cab94d 100644 --- a/crates/tower-api/src/models/token.rs +++ b/crates/tower-api/src/models/token.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/unverified_authenticator.rs b/crates/tower-api/src/models/unverified_authenticator.rs index 3f020523..78bb6b7c 100644 --- a/crates/tower-api/src/models/unverified_authenticator.rs +++ b/crates/tower-api/src/models/unverified_authenticator.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_account_slug_params.rs b/crates/tower-api/src/models/update_account_slug_params.rs index 11b8485c..a642b8db 100644 --- a/crates/tower-api/src/models/update_account_slug_params.rs +++ b/crates/tower-api/src/models/update_account_slug_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_account_slug_response.rs b/crates/tower-api/src/models/update_account_slug_response.rs index 47fd7fe8..173daebb 100644 --- a/crates/tower-api/src/models/update_account_slug_response.rs +++ b/crates/tower-api/src/models/update_account_slug_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_app_params.rs b/crates/tower-api/src/models/update_app_params.rs index faa5ddf5..5aeea452 100644 --- a/crates/tower-api/src/models/update_app_params.rs +++ b/crates/tower-api/src/models/update_app_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_app_response.rs b/crates/tower-api/src/models/update_app_response.rs index 923e7ac8..e5bdbf2c 100644 --- a/crates/tower-api/src/models/update_app_response.rs +++ b/crates/tower-api/src/models/update_app_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_catalog_params.rs b/crates/tower-api/src/models/update_catalog_params.rs index cff11303..6fc3d134 100644 --- a/crates/tower-api/src/models/update_catalog_params.rs +++ b/crates/tower-api/src/models/update_catalog_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_catalog_response.rs b/crates/tower-api/src/models/update_catalog_response.rs index 3b7ffc43..fb281b8e 100644 --- a/crates/tower-api/src/models/update_catalog_response.rs +++ b/crates/tower-api/src/models/update_catalog_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 c680dd22..aa683e2a 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 a355a9a2..09460498 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,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 98fd2c86..1505fa2f 100644 --- a/crates/tower-api/src/models/update_password_reset_params.rs +++ b/crates/tower-api/src/models/update_password_reset_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ 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 1c3748c3..c2a2f2f7 100644 --- a/crates/tower-api/src/models/update_password_reset_response.rs +++ b/crates/tower-api/src/models/update_password_reset_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_schedule_params.rs b/crates/tower-api/src/models/update_schedule_params.rs new file mode 100644 index 00000000..e63158db --- /dev/null +++ b/crates/tower-api/src/models/update_schedule_params.rs @@ -0,0 +1,48 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateScheduleParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The slug of the app that this schedule runs + #[serde(rename = "app_slug")] + pub app_slug: String, + /// The specific app version to run (if omitted, will use the app's default version) + #[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", skip_serializing_if = "Option::is_none")] + pub cron: Option, + /// The environment to run the app in + #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] + pub environment: Option, + /// Parameters to pass when running the app + #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")] + pub parameters: Option>, +} + +impl UpdateScheduleParams { + pub fn new(app_slug: String) -> UpdateScheduleParams { + UpdateScheduleParams { + schema: None, + app_slug, + app_version: None, + cron: None, + environment: None, + parameters: None, + } + } +} + diff --git a/crates/tower-api/src/models/update_schedule_response.rs b/crates/tower-api/src/models/update_schedule_response.rs new file mode 100644 index 00000000..b82997d0 --- /dev/null +++ b/crates/tower-api/src/models/update_schedule_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.19 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateScheduleResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "schedule")] + pub schedule: Box, +} + +impl UpdateScheduleResponse { + pub fn new(schedule: models::Schedule) -> UpdateScheduleResponse { + UpdateScheduleResponse { + schema: None, + schedule: Box::new(schedule), + } + } +} + diff --git a/crates/tower-api/src/models/update_secret_params.rs b/crates/tower-api/src/models/update_secret_params.rs index 81a5243b..3af8ac02 100644 --- a/crates/tower-api/src/models/update_secret_params.rs +++ b/crates/tower-api/src/models/update_secret_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_secret_response.rs b/crates/tower-api/src/models/update_secret_response.rs index a52444d3..9660200c 100644 --- a/crates/tower-api/src/models/update_secret_response.rs +++ b/crates/tower-api/src/models/update_secret_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_team_params.rs b/crates/tower-api/src/models/update_team_params.rs index 2548fb6e..cf606f1f 100644 --- a/crates/tower-api/src/models/update_team_params.rs +++ b/crates/tower-api/src/models/update_team_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_team_response.rs b/crates/tower-api/src/models/update_team_response.rs index 7def0051..cb6b9a74 100644 --- a/crates/tower-api/src/models/update_team_response.rs +++ b/crates/tower-api/src/models/update_team_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_user_params.rs b/crates/tower-api/src/models/update_user_params.rs index d646accb..45443c85 100644 --- a/crates/tower-api/src/models/update_user_params.rs +++ b/crates/tower-api/src/models/update_user_params.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/update_user_response.rs b/crates/tower-api/src/models/update_user_response.rs index 5322de80..766615f2 100644 --- a/crates/tower-api/src/models/update_user_response.rs +++ b/crates/tower-api/src/models/update_user_response.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/user.rs b/crates/tower-api/src/models/user.rs index 0b41b187..6a483fab 100644 --- a/crates/tower-api/src/models/user.rs +++ b/crates/tower-api/src/models/user.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/models/verified_authenticator.rs b/crates/tower-api/src/models/verified_authenticator.rs index a9ee8e1d..6fee1fc4 100644 --- a/crates/tower-api/src/models/verified_authenticator.rs +++ b/crates/tower-api/src/models/verified_authenticator.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.14 + * The version of the OpenAPI document: v0.6.19 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-package/src/lib.rs b/crates/tower-package/src/lib.rs index 8cce905c..9182f05d 100644 --- a/crates/tower-package/src/lib.rs +++ b/crates/tower-package/src/lib.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use std::pin::Pin; +use std::collections::{VecDeque, HashMap}; use tokio::{ fs::File, io::{AsyncRead, BufReader, AsyncReadExt, AsyncWriteExt}, @@ -18,7 +19,7 @@ use tower_telemetry::debug; mod error; pub use error::Error; -const CURRENT_PACKAGE_VERSION: i32 = 1; +const CURRENT_PACKAGE_VERSION: i32 = 2; #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Parameter{ @@ -29,7 +30,10 @@ pub struct Parameter{ #[derive(Clone, Serialize, Deserialize)] pub struct Manifest { + // version is the version of the packaging format that was used. pub version: Option, + + // invoke is the target in this package to invoke. pub invoke: String, #[serde(default)] @@ -38,6 +42,18 @@ pub struct Manifest { // schedule is the schedule that we want to execute this app on. this is, just temporarily, // where it will live. pub schedule: Option, + + // import_paths are the rewritten collection of modules that this app's code goes into. + #[serde(default)] + pub import_paths: Vec, + + // app_dir_name is the name of the application directory within the package. + #[serde(default)] + pub app_dir_name: String, + + // modules_dir_name is the name of the modules directory within the package. + #[serde(default)] + pub modules_dir_name: String, } impl Manifest { @@ -45,9 +61,12 @@ impl Manifest { let mut file = File::open(path).await?; let mut contents = String::new(); file.read_to_string(&mut contents).await?; + Self::from_json(&contents).await + } - let manifest: Self = serde_json::from_str(&contents)?; - Ok(manifest) + pub async fn from_json(data: &str) -> Result { + let manifest: Self = serde_json::from_str(data)?; + Ok(manifest) } } @@ -71,6 +90,8 @@ pub struct PackageSpec { // schedule defines the frequency that this app should be run on. pub schedule: Option, + + pub import_paths: Vec, } fn get_parameters(towerfile: &Towerfile) -> Vec { @@ -89,7 +110,9 @@ impl PackageSpec { pub fn from_towerfile(towerfile: &Towerfile) -> Self { debug!("creating package spec from towerfile: {:?}", towerfile); let towerfile_path = towerfile.file_path.clone(); - let base_dir = towerfile.app.workspace.clone(); + let base_dir = towerfile_path.parent(). + unwrap_or_else(|| Path::new(".")). + to_path_buf(); let schedule = if towerfile.app.schedule.is_empty() { None @@ -97,10 +120,16 @@ impl PackageSpec { Some(towerfile.app.schedule.to_string()) }; + // We need to turn these (validated) paths into something taht we can use at runtime. + let import_paths = towerfile.app.import_paths.iter() + .map(|p| p.to_string_lossy().to_string()) + .collect(); + Self { schedule, towerfile_path, base_dir, + import_paths, invoke: towerfile.app.script.clone(), file_globs: towerfile.app.source.clone(), parameters: get_parameters(towerfile), @@ -133,6 +162,9 @@ impl Package { invoke: "".to_string(), parameters: vec![], schedule: None, + import_paths: vec![], + app_dir_name: "app".to_string(), + modules_dir_name: "modules".to_string(), }, } } @@ -170,31 +202,70 @@ impl Package { let gzip = GzipEncoder::new(file); let mut builder = Builder::new(gzip); - for file_glob in spec.file_globs { - let path = base_dir.join(file_glob); - let path_str = extract_glob_path(path); - debug!("resolving glob pattern: {}", path_str); + // If the user didn't specify anything here we'll package everything under this directory + // and ship it to Tower. + let mut file_globs = spec.file_globs.clone(); - for entry in glob(&path_str).unwrap() { - let physical_path = entry.unwrap() - .canonicalize() - .unwrap(); + // If there was no source specified, we'll pull in all the source code in the current + // directory. + if file_globs.is_empty() { + debug!("no source files specified. using default paths."); + file_globs.push("./**/*".to_string()); + } - debug!(" - adding file: {:?}", physical_path); + // We'll collect all the file paths in a collection here. + let mut file_paths = HashMap::new(); + + for file_glob in file_globs { + let path = base_dir.join(file_glob); + resolve_glob_path(path, &base_dir, &mut file_paths).await; + } - // turn this back in to a path that is relative to the TAR file root - let cp = physical_path.clone(); - let logical_path = cp.strip_prefix(&base_dir).unwrap(); + // App code lives in the app dir + let app_dir = PathBuf::from("app"); + // Now that we have all the paths, we'll append them to the builder. + for (physical_path, logical_path) in file_paths { + // All of the app code goes into the "app" directory. + let logical_path = app_dir.join(logical_path); + builder.append_path_with_name(physical_path, logical_path).await?; + } + + // Module code lives in the modules dir. + let module_dir = PathBuf::from("modules"); + let mut import_paths = vec![]; + + // Now we need to package up all the modules to include in the code base too. + for import_path in &spec.import_paths { + // The import_path should always be relative to the base_path. + let import_path = base_dir.join(import_path).canonicalize()?; + let parent = import_path.parent().unwrap(); + + let mut file_paths = HashMap::new(); + resolve_path(&import_path, parent, &mut file_paths).await; + + // The file_name should constitute the logical path + let import_path = import_path.file_name().unwrap(); + let import_path = module_dir.join(import_path); + let import_path_str = import_path.into_os_string().into_string().unwrap(); + import_paths.push(import_path_str); + + // Now we write all of these paths to the modules directory. + for (physical_path, logical_path) in file_paths { + let logical_path = module_dir.join(logical_path); + debug!("adding file {}", logical_path.display()); builder.append_path_with_name(physical_path, logical_path).await?; } } let manifest = Manifest { + import_paths, version: Some(CURRENT_PACKAGE_VERSION), invoke: String::from(spec.invoke), parameters: spec.parameters, schedule: spec.schedule, + app_dir_name: app_dir.to_string_lossy().to_string(), + modules_dir_name: module_dir.to_string_lossy().to_string(), }; // the whole manifest needs to be written to a file as a convenient way to avoid having to @@ -211,18 +282,13 @@ impl Package { "Towerfile", ).await?; - // consume the builder to close it, then close the underlying gzip stream - let mut file = builder.into_inner().await?; - file.shutdown().await?; - - // TODO: When we want to enable gzip compression, we can uncomment the following lines. // We'll need to delete the lines above here. - //let mut gzip = builder.into_inner().await?; - //gzip.shutdown().await?; + let mut gzip = builder.into_inner().await?; + gzip.shutdown().await?; //// probably not explicitly required; however, makes the test suite pass so... - //let mut file = gzip.into_inner(); - //file.shutdown().await?; + let mut file = gzip.into_inner(); + file.shutdown().await?; Ok(Self { manifest, @@ -322,3 +388,105 @@ async fn unpack_archive>(package_path: P, output_path: P) -> Resu Ok(()) } + +async fn resolve_glob_path(path: PathBuf, base_dir: &PathBuf, file_paths: &mut HashMap) { + let path_str = extract_glob_path(path); + debug!("resolving glob pattern: {}", path_str); + + for entry in glob(&path_str).unwrap() { + resolve_path(&entry.unwrap(), base_dir, file_paths).await; + } +} + +async fn resolve_path(path: &PathBuf, base_dir: &Path, file_paths: &mut HashMap) { + let mut queue = VecDeque::new(); + queue.push_back(path.to_path_buf()); + + while let Some(current_path) = queue.pop_front() { + let canonical_path = current_path.canonicalize(); + + if canonical_path.is_err() { + debug!(" - skipping path {}: {}", current_path.display(), canonical_path.unwrap_err()); + continue; + } + + // We can safely unwrap this because we understand that it's not going to fail at this + // point. + let physical_path = canonical_path.unwrap(); + + if physical_path.is_dir() { + let mut entries = tokio::fs::read_dir(&physical_path).await.unwrap(); + + while let Some(entry) = entries.next_entry().await.unwrap() { + queue.push_back(entry.path()); + } + } else { + if !should_ignore_file(&physical_path) { + let cp = physical_path.clone(); + + match cp.strip_prefix(base_dir) { + Err(err) => { + debug!(" - skipping file {}: not in base directory {}: {:?}", physical_path.display(), base_dir.display(), err); + continue; + } + Ok(logical_path) => { + debug!(" - resolved path {} to logical path {}", physical_path.display(), logical_path.display()); + file_paths.insert(physical_path, logical_path.to_path_buf()); + } + } + } + } + } +} + +fn is_in_dir(p: &PathBuf, dir: &str) -> bool { + let mut comps = p.components(); + comps.any(|comp| { + if let std::path::Component::Normal(name) = comp { + name == dir + } else { + false + } + }) +} + +fn is_file(p: &PathBuf, name: &str) -> bool { + if let Some(file_name) = p.file_name() { + file_name == name + } else { + false + } +} + +fn should_ignore_file(p: &PathBuf) -> bool { + // Ignore anything that is compiled python + if p.ends_with(".pyc") { + return true; + } + + if is_file(p, "Towerfile") { + return true; + } + + // Ignore a .gitignore file + if is_file(p, ".gitignore") { + return true; + } + + // Remove anything thats __pycache__ + if is_in_dir(p, "__pycache__") { + return true + } + + // Ignore anything that lives within a .git directory + if is_in_dir(p, ".git") { + return true + } + + // Ignore anything that's in a virtualenv, too + if is_in_dir(p, ".venv") { + return true + } + + return false; +} diff --git a/crates/tower-package/tests/package_test.rs b/crates/tower-package/tests/package_test.rs index 033bdc18..69e2c96b 100644 --- a/crates/tower-package/tests/package_test.rs +++ b/crates/tower-package/tests/package_test.rs @@ -11,10 +11,22 @@ use tokio_stream::*; use async_compression::tokio::bufread::GzipDecoder; use tokio_tar::Archive; -use tower_package::{Package, PackageSpec}; +use tower_package::{Package, PackageSpec, Manifest}; use tower_telemetry::debug; use config::Towerfile; +macro_rules! make_path { + ($($component:expr),+ $(,)?) => { + { + let mut path = PathBuf::new(); + $( + path.push($component); + )+ + &path.to_string_lossy().to_string() + } + }; +} + #[tokio::test] async fn it_creates_package() { let tmp_dir = TmpDir::new("example").await.expect("Failed to create temp dir"); @@ -29,11 +41,12 @@ async fn it_creates_package() { file_globs: vec!["*.py".to_string()], parameters: vec![], schedule: None, + import_paths: vec![], }; let package = Package::build(spec).await.expect("Failed to build package"); - assert_eq!(package.manifest.version, Some(1)); + assert_eq!(package.manifest.version, Some(2)); assert_eq!(package.manifest.invoke, "main.py"); let package_file_path = package.package_file_path.clone().unwrap(); @@ -41,7 +54,7 @@ async fn it_creates_package() { let files = read_package_files(package).await; - assert!(files.contains_key("main.py"), "files {:?} was missing key main.py", files); + assert!(files.contains_key("app/main.py"), "files {:?} was missing key main.py", files); assert!(files.contains_key("MANIFEST"), "files {:?} was missing MANIFEST", files); } @@ -63,11 +76,12 @@ async fn it_respects_complex_file_globs() { ], parameters: vec![], schedule: Some("every 1 minute".to_string()), + import_paths: vec![], }; let package = Package::build(spec).await.expect("Failed to build package"); - assert_eq!(package.manifest.version, Some(1)); + assert_eq!(package.manifest.version, Some(2)); assert_eq!(package.manifest.invoke, "main.py"); assert_eq!(package.manifest.schedule, Some("every 1 minute".to_string())); @@ -76,13 +90,78 @@ async fn it_respects_complex_file_globs() { let files = read_package_files(package).await; - assert!(files.contains_key("main.py"), "files {:?} was missing key main.py", files); + assert!(files.contains_key("app/main.py"), "files {:?} was missing key main.py", files); assert!(files.contains_key("MANIFEST"), "files {:?} was missing MANIFEST", files); - assert!(files.contains_key("pack/__init__.py"), "files {:?} was missing pack/__init__.py", files); + assert!(files.contains_key("app/pack/__init__.py"), "files {:?} was missing pack/__init__.py", files); } #[tokio::test] -async fn it_respects_workspace_settings() { +async fn it_packages_all_files_by_default() { + let tmp_dir = TmpDir::new("all-files-by-default").await.expect("Failed to create temp dir"); + create_test_file(tmp_dir.to_path_buf(), "Towerfile", "").await; + create_test_file(tmp_dir.to_path_buf(), "main.py", "print('Hello, world!')").await; + create_test_file(tmp_dir.to_path_buf(), "pack/__init__.py", "").await; + create_test_file(tmp_dir.to_path_buf(), "pack/pack.py", "").await; + + let spec = PackageSpec { + invoke: "main.py".to_string(), + base_dir: tmp_dir.to_path_buf(), + towerfile_path: tmp_dir.to_path_buf().join("Towerfile").to_path_buf(), + file_globs: vec![], + parameters: vec![], + schedule: Some("every 1 minute".to_string()), + import_paths: vec![], + }; + + let package = Package::build(spec).await.expect("Failed to build package"); + + let package_file_path = package.package_file_path.clone().unwrap(); + assert!(!package_file_path.as_os_str().is_empty()); + + let files = read_package_files(package).await; + assert!(files.contains_key("MANIFEST"), "files {:?} was missing MANIFEST", files); + assert!(files.contains_key("app/main.py"), "files {:?} was missing key main.py", files); + assert!(files.contains_key("app/pack/__init__.py"), "files {:?} was missing pack/__init__.py", files); + assert!(files.contains_key("app/pack/pack.py"), "files {:?} was missing pack/__init__.py", files); +} + +#[tokio::test] +async fn it_packages_directory_contents() { + let tmp_dir = TmpDir::new("directory-contents").await.expect("Failed to create temp dir"); + create_test_file(tmp_dir.to_path_buf(), "Towerfile", "").await; + create_test_file(tmp_dir.to_path_buf(), "main.py", "print('Hello, world!')").await; + create_test_file(tmp_dir.to_path_buf(), "pack/__init__.py", "").await; + create_test_file(tmp_dir.to_path_buf(), "pack/pack.py", "").await; + create_test_file(tmp_dir.to_path_buf(), "pack/submodule/pack.py", "").await; + + let spec = PackageSpec { + invoke: "main.py".to_string(), + base_dir: tmp_dir.to_path_buf(), + towerfile_path: tmp_dir.to_path_buf().join("Towerfile").to_path_buf(), + file_globs: vec![ + "main.py".to_string(), + "pack".to_string(), + ], + parameters: vec![], + schedule: Some("every 1 minute".to_string()), + import_paths: vec![], + }; + + let package = Package::build(spec).await.expect("Failed to build package"); + + let package_file_path = package.package_file_path.clone().unwrap(); + assert!(!package_file_path.as_os_str().is_empty()); + + let files = read_package_files(package).await; + assert!(files.contains_key("MANIFEST"), "files {:?} was missing MANIFEST", files); + assert!(files.contains_key("app/main.py"), "files {:?} was missing key main.py", files); + assert!(files.contains_key("app/pack/__init__.py"), "files {:?} was missing pack/__init__.py", files); + assert!(files.contains_key("app/pack/pack.py"), "files {:?} was missing pack/__init__.py", files); + assert!(files.contains_key("app/pack/submodule/pack.py"), "files {:?} was missing pack/submodule/pack.py", files); +} + +#[tokio::test] +async fn it_packages_import_paths() { let tmp_dir = TmpDir::new("example").await.expect("Failed to create temp dir"); create_test_file(tmp_dir.to_path_buf(), "app/Towerfile", "").await; create_test_file(tmp_dir.to_path_buf(), "app/main.py", "print('Hello, world!')").await; @@ -90,28 +169,64 @@ async fn it_respects_workspace_settings() { create_test_file(tmp_dir.to_path_buf(), "shared/module/test.py", "").await; let spec = PackageSpec { - invoke: "app/main.py".to_string(), - base_dir: tmp_dir.to_path_buf(), + invoke: "main.py".to_string(), + base_dir: tmp_dir.to_path_buf().join("app"), towerfile_path: tmp_dir.to_path_buf().join("app").join("Towerfile").to_path_buf(), file_globs: vec![ "**/*.py".to_string(), ], parameters: vec![], schedule: None, + import_paths: vec!["../shared".to_string()], }; let package = Package::build(spec).await.expect("Failed to build package"); - assert_eq!(package.manifest.version, Some(1)); - assert_eq!(package.manifest.invoke, "app/main.py"); + assert_eq!(package.manifest.version, Some(2)); + assert_eq!(package.manifest.invoke, "main.py"); assert_eq!(package.manifest.schedule, None); let files = read_package_files(package).await; - assert!(files.contains_key("app/main.py"), "files {:?} was missing key app/main.py", files); assert!(files.contains_key("MANIFEST"), "files {:?} was missing MANIFEST", files); - assert!(files.contains_key("shared/module/__init__.py"), "files {:?} was missing shared/module/__init__.py", files); - assert!(files.contains_key("shared/module/test.py"), "files {:?} was missing shared/module/test.py", files); + assert!(files.contains_key("app/main.py"), "files {:?} was missing key app/main.py", files); + assert!(files.contains_key("modules/shared/module/__init__.py"), "files {:?} was missing shared/module/__init__.py", files); + assert!(files.contains_key("modules/shared/module/test.py"), "files {:?} was missing shared/module/test.py", files); + + // Let's decode the manifest and make sure import paths are set correctly. + let manifest = Manifest::from_json(files.get("MANIFEST").unwrap()).await.expect("Manifest was not valid JSON"); + + // NOTE: These paths are joined by the OS so we need to be more specific about the expected + // path. + assert!(manifest.import_paths.contains(make_path!("modules", "shared")), "Import paths {:?} did not contain expected path", manifest.import_paths); +} + +#[tokio::test] +async fn it_excludes_various_content_that_should_not_be_there() { + let tmp_dir = TmpDir::new("example").await.expect("Failed to create temp dir"); + create_test_file(tmp_dir.to_path_buf(), "Towerfile", "").await; + create_test_file(tmp_dir.to_path_buf(), "main.py", "print('Hello, world!')").await; + create_test_file(tmp_dir.to_path_buf(), "main.py.pyc", "print('Hello, world!')").await; + create_test_file(tmp_dir.to_path_buf(), "some-app/test.py", "print('Hello, world!')").await; + create_test_file(tmp_dir.to_path_buf(), "some-app/__pycache__/test.pyc", "print('Hello, world!')").await; + create_test_file(tmp_dir.to_path_buf(), ".git/some-file", "").await; + + let spec = PackageSpec { + invoke: "main.py".to_string(), + base_dir: tmp_dir.to_path_buf(), + towerfile_path: tmp_dir.to_path_buf().join("Towerfile").to_path_buf(), + file_globs: vec![], + parameters: vec![], + schedule: None, + import_paths: vec![], + }; + + let package = Package::build(spec).await.expect("Failed to build package"); + let files = read_package_files(package).await; + + assert!(!files.contains_key(".git/some-file"), "files {:?} had .git directory", files); + assert!(!files.contains_key("some-app/__pycache__/test.pyc"), "files {:?} contained a .pyc", files); + assert!(!files.contains_key("main.py.pyc"), "files {:?} contained a .pyc", files); } #[tokio::test] diff --git a/crates/tower-runtime/src/errors.rs b/crates/tower-runtime/src/errors.rs index a6296764..78ac4785 100644 --- a/crates/tower-runtime/src/errors.rs +++ b/crates/tower-runtime/src/errors.rs @@ -56,8 +56,11 @@ pub enum Error { #[snafu(display("failed to create a virtual environment"))] VirtualEnvCreationFailed, - #[snafu(display("watier channel closed unexpectedly when polled"))] + #[snafu(display("waiter channel closed unexpectedly when polled"))] WaiterClosed, + + #[snafu(display("running Tower apps on this platform is not supported"))] + UnsupportedPlatform, } impl From for Error { @@ -65,3 +68,9 @@ impl From for Error { Error::SpawnFailed } } + +impl From for Error { + fn from(_: std::env::JoinPathsError) -> Self { + Error::UnsupportedPlatform + } +} diff --git a/crates/tower-runtime/src/local.rs b/crates/tower-runtime/src/local.rs index 9160056c..9a82efd4 100644 --- a/crates/tower-runtime/src/local.rs +++ b/crates/tower-runtime/src/local.rs @@ -1,5 +1,5 @@ use std::path::{Path, PathBuf}; -use std::env::{self, current_dir}; +use std::env; use std::process::Stdio; use std::sync::Arc; use std::collections::HashMap; @@ -130,24 +130,28 @@ impl App for LocalApp { let ctx = opts.ctx.clone(); let package = opts.package; let environment = opts.environment; + debug!(ctx: &ctx, "executing app with version {:?}", package.manifest.version); + + // This is the base path of where the package was unpacked. let package_path = package.unpacked_path .clone() .unwrap() .to_path_buf(); + // We'll need the Python path for later on. let mut python_path = find_python(None).await?; debug!(ctx: &ctx, "using system python at {:?}", python_path); // set for later on. - let working_dir = if let Some(dir) = opts.cwd { - dir + let working_dir = if package.manifest.version == Some(2) { + package_path.join(&package.manifest.app_dir_name) } else { - current_dir().unwrap() + opts.cwd.unwrap_or(package_path.to_path_buf()) }; let mut is_virtualenv = false; - if Path::new(&package_path.join("requirements.txt")).exists() { + if Path::new(&working_dir.join("requirements.txt")).exists() { debug!(ctx: &ctx, "requirements.txt file found. installing dependencies"); // There's a requirements.txt, so we'll create a new virtualenv and install the files @@ -181,7 +185,7 @@ impl App for LocalApp { .current_dir(&working_dir) .arg("install") .arg("-r") - .arg(package_path.join("requirements.txt")) + .arg(working_dir.join("requirements.txt")) .stdin(Stdio::null()) .stdout(Stdio::piped()) .stderr(Stdio::piped()) @@ -221,9 +225,38 @@ impl App for LocalApp { let manifest = &package.manifest; let secrets = opts.secrets; let params= opts.parameters; - let other_env_vars = opts.env_vars; + let mut other_env_vars = opts.env_vars; + + if !package.manifest.import_paths.is_empty() { + debug!(ctx: &ctx, "adding import paths to PYTHONPATH: {:?}", package.manifest.import_paths); + + let import_paths = package.manifest.import_paths + .iter() + .map(|p| package_path.join(p)) + .collect::>(); + + let import_paths = std::env::join_paths(import_paths)? + .to_string_lossy() + .to_string(); + + if other_env_vars.contains_key("PYTHONPATH") { + // If we already have a PYTHONPATH, we need to append to it. + let existing = other_env_vars.get("PYTHONPATH").unwrap(); + let pythonpath = std::env::join_paths(vec![existing, &import_paths])? + .to_string_lossy() + .to_string(); + + other_env_vars.insert("PYTHONPATH".to_string(), pythonpath); + } else { + // Otherwise, we just set it. + other_env_vars.insert("PYTHONPATH".to_string(), import_paths); + } + } + + // We need to resolve the program + let program_path = working_dir.join(manifest.invoke.clone()); - Self::execute_python_program(&ctx, &environment, working_dir, is_virtualenv, python_path, package_path, &manifest, secrets, params, other_env_vars).await + Self::execute_python_program(&ctx, &environment, working_dir, is_virtualenv, python_path, program_path, &manifest, secrets, params, other_env_vars).await }; if let Ok(mut child) = res { @@ -306,22 +339,33 @@ impl LocalApp { cwd: PathBuf, is_virtualenv: bool, python_path: PathBuf, - package_path: PathBuf, + program_path: PathBuf, manifest: &Manifest, secrets: HashMap, params: HashMap, other_env_vars: HashMap, ) -> Result { + let env_vars = make_env_vars( + &ctx, + env, + &cwd, + is_virtualenv, + &secrets, + ¶ms, + &other_env_vars, + ); + debug!(ctx: &ctx, " - python script {}", manifest.invoke); + debug!(ctx: &ctx, " - python path {}", env_vars.get("PYTHONPATH").unwrap()); let child = Command::new(python_path) .current_dir(&cwd) .arg("-u") - .arg(package_path.join(manifest.invoke.clone())) + .arg(program_path) .stdin(Stdio::null()) .stdout(Stdio::piped()) .stderr(Stdio::piped()) - .envs(make_env_vars(&ctx, env, &cwd, is_virtualenv, &secrets, ¶ms, &other_env_vars)) + .envs(env_vars) .kill_on_drop(true) .spawn()?; @@ -412,6 +456,16 @@ fn make_env_vars(ctx: &tower_telemetry::Context, env: &str, cwd: &PathBuf, is_vi // We also need a PYTHONPATH that is set to the current working directory to help with the // dependency resolution problem at runtime. let pythonpath = cwd.to_string_lossy().to_string(); + let pythonpath = if res.contains_key("PYTHONPATH") { + // If we already have a PYTHONPATH, we need to append to it. + let existing = res.get("PYTHONPATH").unwrap(); + let joined_paths = std::env::join_paths([existing, &pythonpath]).unwrap(); + joined_paths.to_string_lossy().to_string() + } else { + // There was no previously set PYTHONPATH, so we just include our current directory. + pythonpath + }; + res.insert("PYTHONPATH".to_string(), pythonpath); // Inject a TOWER_ENVIRONMENT parameter so you know what environment you're running in. Empty diff --git a/flake.nix b/flake.nix index dc4ed476..c2c66dca 100644 --- a/flake.nix +++ b/flake.nix @@ -21,15 +21,40 @@ inherit system; }; - version = builtins.readFile "${./.}/version.txt"; maintainer = "Tower Computing Inc. "; homepage = "https://github.com/tower/tower-cli"; description = "Tower CLI and runtime environment"; - longDescription = '' + longDescription = " | Tower CLI and runtime environment Tower is the best way to host Python data apps in production. This package provides the Tower CLI tool for managing and deploying applications to the Tower platform. + "; + + getVersionScript = '' + VERSION=${builtins.getEnv "VERSION"} + if [ -z "$VERSION" ]; then + VERSION="SNAPSHOT" + fi + ''; + + mkNfpmConfig = { arch, packager }: '' + name: tower + arch: ${arch} + platform: linux + version: $VERSION + ${if packager == "rpm" then "release: 1" else "section: utils\npriority: optional"} + maintainer: ${maintainer} + description: ${longDescription} + vendor: Tower Computing Inc. + homepage: "${homepage}" + license: MIT + + contents: + - src: package/usr/bin/tower + dst: /usr/bin/tower + file_info: + mode: 0755 ''; commonNativeBuildInputs = with pkgs; [ pkg-config ]; @@ -137,156 +162,99 @@ tower-macos-arm = tower-macos-arm; tower-deb-x86 = pkgs.stdenv.mkDerivation { - name = "tower-${version}-amd64.deb"; - nativeBuildInputs = with pkgs; [ nfpm ]; + name = "tower-deb-amd64"; + nativeBuildInputs = with pkgs; [ nfpm python git ]; unpackPhase = "true"; buildPhase = '' + ${getVersionScript} + mkdir -p package/usr/bin cp ${tower-linux-x86}/bin/tower package/usr/bin/ chmod 755 package/usr/bin/tower - cat > nfpm.yaml << 'EOF' - name: tower - arch: amd64 - platform: linux - version: ${version} - section: utils - priority: optional - maintainer: ${maintainer} - description: | - ${longDescription} - vendor: Tower Computing Inc. - homepage: ${homepage} - license: MIT - - contents: - - src: package/usr/bin/tower - dst: /usr/bin/tower - file_info: - mode: 0755 + cat > nfpm.yaml << EOF + ${mkNfpmConfig { arch = "amd64"; packager = "deb"; }} EOF ''; installPhase = '' mkdir -p $out - nfpm package --config nfpm.yaml --packager deb --target $out/tower_${version}_amd64.deb + nfpm package --config nfpm.yaml --packager deb --target $out/tower_''${VERSION}_amd64.deb ''; }; - tower-cli-deb-arm64 = pkgs.stdenv.mkDerivation { - name = "tower-${version}-arm64.deb"; - nativeBuildInputs = with pkgs; [ nfpm ]; + tower-deb-arm64 = pkgs.stdenv.mkDerivation { + name = "tower-deb-arm64"; + nativeBuildInputs = with pkgs; [ nfpm python git ]; unpackPhase = "true"; buildPhase = '' + ${getVersionScript} + mkdir -p package/usr/bin cp ${tower-linux-arm64}/bin/tower package/usr/bin/ chmod 755 package/usr/bin/tower - cat > nfpm.yaml << 'EOF' - name: tower - arch: arm64 - platform: linux - version: ${version} - section: utils - priority: optional - maintainer: ${maintainer} - description: | - ${longDescription} - vendor: Tower Computing Inc. - homepage: ${homepage} - license: MIT - - contents: - - src: package/usr/bin/tower - dst: /usr/bin/tower - file_info: - mode: 0755 + cat > nfpm.yaml << EOF + ${mkNfpmConfig { arch = "arm64"; packager = "deb"; }} EOF ''; installPhase = '' mkdir -p $out - nfpm package --config nfpm.yaml --packager deb --target $out/tower_${version}_arm64.deb + cat nfpm.yaml + nfpm package --config nfpm.yaml --packager deb --target $out/tower_''${VERSION}_arm64.deb ''; }; tower-rpm-x86 = pkgs.stdenv.mkDerivation { - name = "tower-${version}-x86_64.rpm"; - nativeBuildInputs = with pkgs; [ nfpm ]; + name = "tower-rpm-x86_64"; + nativeBuildInputs = with pkgs; [ nfpm python git ]; unpackPhase = "true"; buildPhase = '' + ${getVersionScript} + mkdir -p package/usr/bin cp ${tower-linux-x86}/bin/tower package/usr/bin/ chmod 755 package/usr/bin/tower - cat > nfpm.yaml << 'EOF' - name: tower - arch: x86_64 - platform: linux - version: ${version} - release: 1 - maintainer: ${maintainer} - description: | - ${longDescription} - vendor: Tower Computing Inc. - homepage: ${homepage} - license: MIT - - contents: - - src: package/usr/bin/tower - dst: /usr/bin/tower - file_info: - mode: 0755 + cat > nfpm.yaml << EOF + ${mkNfpmConfig { arch = "x86_64"; packager = "rpm"; }} EOF ''; installPhase = '' mkdir -p $out - nfpm package --config nfpm.yaml --packager rpm --target $out/tower-${version}-1.x86_64.rpm + nfpm package --config nfpm.yaml --packager rpm --target $out/tower-''${VERSION}-1.x86_64.rpm ''; }; tower-rpm-arm64 = pkgs.stdenv.mkDerivation { - name = "tower-${version}-aarch64.rpm"; - nativeBuildInputs = with pkgs; [ nfpm ]; + name = "tower-rpm-aarch64"; + nativeBuildInputs = with pkgs; [ nfpm python git ]; unpackPhase = "true"; buildPhase = '' + ${getVersionScript} + mkdir -p package/usr/bin cp ${tower-linux-arm64}/bin/tower package/usr/bin/ chmod 755 package/usr/bin/tower - cat > nfpm.yaml << 'EOF' - name: tower - arch: aarch64 - platform: linux - version: ${version} - release: 1 - maintainer: ${maintainer} - description: | - ${longDescription} - vendor: Tower Computing Inc. - homepage: ${homepage} - license: MIT - - contents: - - src: package/usr/bin/tower - dst: /usr/bin/tower - file_info: - mode: 0755 + cat > nfpm.yaml << EOF + ${mkNfpmConfig { arch = "aarch64"; packager = "rpm"; }} EOF ''; installPhase = '' mkdir -p $out - nfpm package --config nfpm.yaml --packager rpm --target $out/tower-${version}-1.aarch64.rpm + nfpm package --config nfpm.yaml --packager rpm --target $out/tower-''${VERSION}-1.aarch64.rpm ''; }; }; diff --git a/scripts/build-nix-target.sh b/scripts/build-nix-target.sh new file mode 100755 index 00000000..c14a044a --- /dev/null +++ b/scripts/build-nix-target.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname "$0")/.." + +VERSION=$(python scripts/semver.py) +export VERSION + +TARGET=${1:-tower-deb-arm64} + +nix build .#${TARGET} --impure + +cp result/* ./ && rm result diff --git a/scripts/semver.py b/scripts/semver.py index d708d956..bc5b5340 100755 --- a/scripts/semver.py +++ b/scripts/semver.py @@ -6,7 +6,7 @@ BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -SEMVER_EXP = re.compile("\d+\.\d+(\.\d+)?(-rc\.(\d+))?") +SEMVER_EXP = re.compile(r"\d+\.\d+(\.\d+)?(-rc\.(\d+))?") class Version: def __init__(self, version_str):