diff --git a/Cargo.lock b/Cargo.lock index acfd899d..103519dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -387,7 +387,7 @@ dependencies = [ [[package]] name = "config" -version = "0.3.22" +version = "0.3.23" dependencies = [ "chrono", "clap", @@ -474,7 +474,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto" -version = "0.3.22" +version = "0.3.23" dependencies = [ "aes-gcm", "base64", @@ -527,6 +527,16 @@ dependencies = [ "cipher", ] +[[package]] +name = "ctrlc" +version = "3.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73" +dependencies = [ + "nix 0.30.1", + "windows-sys 0.59.0", +] + [[package]] name = "darling" version = "0.20.11" @@ -697,6 +707,17 @@ dependencies = [ "str-buf", ] +[[package]] +name = "eventsource-stream" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74fef4569247a5f429d9156b9d0a2599914385dd189c539334c625d8099d90ab" +dependencies = [ + "futures-core", + "nom", + "pin-project-lite", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -835,6 +856,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.31" @@ -1412,6 +1439,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1460,6 +1493,28 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2034,6 +2089,22 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "reqwest-eventsource" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632c55746dbb44275691640e7b40c907c16a2dc1a5842aa98aaec90da6ec6bde" +dependencies = [ + "eventsource-stream", + "futures-core", + "futures-timer", + "mime", + "nom", + "pin-project-lite", + "reqwest", + "thiserror 1.0.69", +] + [[package]] name = "ring" version = "0.17.14" @@ -2182,7 +2253,7 @@ dependencies = [ "libc", "log", "memchr", - "nix", + "nix 0.23.2", "radix_trie", "scopeguard", "smallvec", @@ -2558,7 +2629,7 @@ dependencies = [ [[package]] name = "testutils" -version = "0.3.22" +version = "0.3.23" dependencies = [ "pem", "rsa", @@ -2804,7 +2875,7 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "tower" -version = "0.3.22" +version = "0.3.23" dependencies = [ "tokio", "tower-api", @@ -2828,7 +2899,7 @@ dependencies = [ [[package]] name = "tower-api" -version = "0.3.22" +version = "0.3.23" dependencies = [ "reqwest", "serde", @@ -2840,7 +2911,7 @@ dependencies = [ [[package]] name = "tower-cmd" -version = "0.3.22" +version = "0.3.23" dependencies = [ "anyhow", "bytes", @@ -2850,11 +2921,13 @@ dependencies = [ "colored", "config", "crypto", + "ctrlc", "futures-util", "http", "indicatif", "promptly", "reqwest", + "reqwest-eventsource", "rpassword", "rsa", "serde", @@ -2897,7 +2970,7 @@ checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-package" -version = "0.3.22" +version = "0.3.23" dependencies = [ "async-compression", "config", @@ -2916,7 +2989,7 @@ dependencies = [ [[package]] name = "tower-runtime" -version = "0.3.22" +version = "0.3.23" dependencies = [ "chrono", "config", @@ -2936,7 +3009,7 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tower-telemetry" -version = "0.3.22" +version = "0.3.23" dependencies = [ "tracing", "tracing-appender", @@ -2945,7 +3018,7 @@ dependencies = [ [[package]] name = "tower-uv" -version = "0.3.22" +version = "0.3.23" dependencies = [ "async-compression", "async_zip", @@ -2959,7 +3032,7 @@ dependencies = [ [[package]] name = "tower-version" -version = "0.3.22" +version = "0.3.23" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index e763a0b3..7c617fce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ resolver = "2" [workspace.package] edition = "2021" -version = "0.3.22" +version = "0.3.23" + description = "Tower is the best way to host Python data apps in production" @@ -26,6 +27,7 @@ cli-table = "0.4" colored = "2" config = { path = "crates/config" } crypto = { path = "crates/crypto" } +ctrlc = "3" dirs = "5" futures = "0.3" futures-util = "0.3" @@ -37,6 +39,7 @@ pem = "3" promptly = "0.3" rand = "0.8" reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] } +reqwest-eventsource = { version = "0.6" } rpassword = "7" rsa = "0.9" serde = "1" diff --git a/crates/config/src/error.rs b/crates/config/src/error.rs index 3f4479dd..fd276531 100644 --- a/crates/config/src/error.rs +++ b/crates/config/src/error.rs @@ -21,8 +21,8 @@ pub enum Error { #[snafu(display("Missing required app field `{}` in Towerfile", field))] MissingRequiredAppField { field: String }, - #[snafu(display("Team with slug {} not found!", team_slug))] - TeamNotFound { team_slug: String }, + #[snafu(display("Team with name {} not found!", team_name))] + TeamNotFound { team_name: String }, #[snafu(display("Unknown describe session value: {}", value))] UnknownDescribeSessionValue { value: serde_json::Value }, diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index ce6d5d3b..29848012 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -129,7 +129,7 @@ impl Config { } /// Sets the active team in the session by team slug and saves it - pub fn set_active_team_by_slug(&self, team_slug: &str) -> Result<(), Error> { + pub fn set_active_team_by_name(&self, name: &str) -> Result<(), Error> { // Get the current session let mut session = Session::from_config_dir()?; @@ -137,10 +137,10 @@ impl Config { let team = session .teams .iter() - .find(|team| team.slug == team_slug) + .find(|team| team.name == name) .cloned() .ok_or(Error::TeamNotFound { - team_slug: team_slug.to_string(), + team_name: name.to_string(), })?; // Set the active team diff --git a/crates/config/src/session.rs b/crates/config/src/session.rs index ca4203fd..2fddd910 100644 --- a/crates/config/src/session.rs +++ b/crates/config/src/session.rs @@ -30,7 +30,6 @@ pub struct Token { #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Team { - pub slug: String, pub name: String, pub token: Token, pub team_type: String, @@ -189,7 +188,6 @@ impl Session { .teams .iter() .map(|team_api| Team { - slug: team_api.slug.clone(), name: team_api.name.clone(), token: if let Some(token) = &team_api.token { Token { @@ -232,7 +230,6 @@ impl Session { .teams .iter() .map(|t| Team { - slug: t.slug.clone(), name: t.name.clone(), team_type: t.r#type.clone(), token: Token { diff --git a/crates/tower-api/README.md b/crates/tower-api/README.md index 684db42e..d7bd0fa2 100644 --- a/crates/tower-api/README.md +++ b/crates/tower-api/README.md @@ -8,7 +8,7 @@ For more information, please visit [https://tower.dev](https://tower.dev) This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. -- API version: v0.6.19 +- API version: v0.6.27 - Package version: 1.0.0 - Generator version: 7.13.0 - Build package: `org.openapitools.codegen.languages.RustClientCodegen` @@ -30,7 +30,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**accept_invitation**](docs/DefaultApi.md#accept_invitation) | **POST** /accounts/invite | Accept an invitation code *DefaultApi* | [**acknowledge_alert**](docs/DefaultApi.md#acknowledge_alert) | **POST** /alerts/{alert_seq}/acknowledge | Acknowledge alert *DefaultApi* | [**acknowledge_all_alerts**](docs/DefaultApi.md#acknowledge_all_alerts) | **POST** /alerts/acknowledge-all | Acknowledge all alerts -*DefaultApi* | [**cancel_run**](docs/DefaultApi.md#cancel_run) | **POST** /apps/{slug}/runs/{seq} | Cancel run +*DefaultApi* | [**cancel_run**](docs/DefaultApi.md#cancel_run) | **POST** /apps/{name}/runs/{seq} | Cancel run *DefaultApi* | [**claim_device_login_ticket**](docs/DefaultApi.md#claim_device_login_ticket) | **POST** /login/device/claim | Claim a device login ticket *DefaultApi* | [**create_account**](docs/DefaultApi.md#create_account) | **POST** /accounts | Create account *DefaultApi* | [**create_api_key**](docs/DefaultApi.md#create_api_key) | **POST** /api-keys | Create API Key @@ -38,6 +38,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**create_authenticator**](docs/DefaultApi.md#create_authenticator) | **POST** /accounts/authenticator | Create authenticator *DefaultApi* | [**create_catalog**](docs/DefaultApi.md#create_catalog) | **POST** /catalogs | Create catalog *DefaultApi* | [**create_device_login_ticket**](docs/DefaultApi.md#create_device_login_ticket) | **GET** /login/device | Create device login ticket +*DefaultApi* | [**create_environment**](docs/DefaultApi.md#create_environment) | **POST** /environments | Create environment *DefaultApi* | [**create_password_reset**](docs/DefaultApi.md#create_password_reset) | **POST** /accounts/password-reset | Create password reset *DefaultApi* | [**create_schedule**](docs/DefaultApi.md#create_schedule) | **POST** /schedules | Create schedule *DefaultApi* | [**create_secret**](docs/DefaultApi.md#create_secret) | **POST** /secrets | Create secret @@ -45,19 +46,19 @@ Class | Method | HTTP request | Description *DefaultApi* | [**create_team**](docs/DefaultApi.md#create_team) | **POST** /teams | Create team *DefaultApi* | [**delete_alert**](docs/DefaultApi.md#delete_alert) | **DELETE** /alerts/{alert_id} | Delete alert *DefaultApi* | [**delete_api_key**](docs/DefaultApi.md#delete_api_key) | **DELETE** /api-keys | Delete API key -*DefaultApi* | [**delete_app**](docs/DefaultApi.md#delete_app) | **DELETE** /apps/{slug} | Delete app +*DefaultApi* | [**delete_app**](docs/DefaultApi.md#delete_app) | **DELETE** /apps/{name} | 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_catalog**](docs/DefaultApi.md#delete_catalog) | **DELETE** /catalogs/{name} | 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 -*DefaultApi* | [**deploy_app**](docs/DefaultApi.md#deploy_app) | **POST** /apps/{slug}/deploy | Deploy app -*DefaultApi* | [**describe_app**](docs/DefaultApi.md#describe_app) | **GET** /apps/{slug} | Describe app +*DefaultApi* | [**delete_team_invitation**](docs/DefaultApi.md#delete_team_invitation) | **DELETE** /teams/{name}/invites | Delete team invitation +*DefaultApi* | [**deploy_app**](docs/DefaultApi.md#deploy_app) | **POST** /apps/{name}/deploy | Deploy app +*DefaultApi* | [**describe_app**](docs/DefaultApi.md#describe_app) | **GET** /apps/{name} | Describe app *DefaultApi* | [**describe_app_version**](docs/DefaultApi.md#describe_app_version) | **GET** /apps/{name}/versions/{num} | Describe app version *DefaultApi* | [**describe_device_login_session**](docs/DefaultApi.md#describe_device_login_session) | **GET** /login/device/{device_code} | Describe device login session -*DefaultApi* | [**describe_run**](docs/DefaultApi.md#describe_run) | **GET** /apps/{slug}/runs/{seq} | Describe run -*DefaultApi* | [**describe_run_logs**](docs/DefaultApi.md#describe_run_logs) | **GET** /apps/{slug}/runs/{seq}/logs | Describe run logs +*DefaultApi* | [**describe_run**](docs/DefaultApi.md#describe_run) | **GET** /apps/{name}/runs/{seq} | Describe run +*DefaultApi* | [**describe_run_logs**](docs/DefaultApi.md#describe_run_logs) | **GET** /apps/{name}/runs/{seq}/logs | Describe run logs *DefaultApi* | [**describe_secrets_key**](docs/DefaultApi.md#describe_secrets_key) | **GET** /secrets/key | Describe encryption key *DefaultApi* | [**describe_session**](docs/DefaultApi.md#describe_session) | **GET** /session | Describe session *DefaultApi* | [**export_catalogs**](docs/DefaultApi.md#export_catalogs) | **POST** /catalogs/export | Export catalogs @@ -66,38 +67,42 @@ Class | Method | HTTP request | Description *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* | [**invite_team_member**](docs/DefaultApi.md#invite_team_member) | **POST** /teams/{name}/invites | Invite team member +*DefaultApi* | [**leave_team**](docs/DefaultApi.md#leave_team) | **POST** /teams/{name}/leave | Leave team *DefaultApi* | [**list_alerts**](docs/DefaultApi.md#list_alerts) | **GET** /alerts | List alerts *DefaultApi* | [**list_api_keys**](docs/DefaultApi.md#list_api_keys) | **GET** /api-keys | List API keys -*DefaultApi* | [**list_app_environments**](docs/DefaultApi.md#list_app_environments) | **GET** /apps/{slug}/environments | List app environments +*DefaultApi* | [**list_app_environments**](docs/DefaultApi.md#list_app_environments) | **GET** /apps/{name}/environments | List app environments *DefaultApi* | [**list_app_versions**](docs/DefaultApi.md#list_app_versions) | **GET** /apps/{name}/versions | List app versions *DefaultApi* | [**list_apps**](docs/DefaultApi.md#list_apps) | **GET** /apps | List apps *DefaultApi* | [**list_authenticators**](docs/DefaultApi.md#list_authenticators) | **GET** /accounts/authenticator | List authenticators *DefaultApi* | [**list_catalogs**](docs/DefaultApi.md#list_catalogs) | **GET** /catalogs | List catalogs +*DefaultApi* | [**list_environments**](docs/DefaultApi.md#list_environments) | **GET** /environments | List environments *DefaultApi* | [**list_my_team_invitations**](docs/DefaultApi.md#list_my_team_invitations) | **GET** /team-invites | List my team invitations -*DefaultApi* | [**list_runs**](docs/DefaultApi.md#list_runs) | **GET** /apps/{slug}/runs | List runs +*DefaultApi* | [**list_plans**](docs/DefaultApi.md#list_plans) | **GET** /plans | List account plans +*DefaultApi* | [**list_runs**](docs/DefaultApi.md#list_runs) | **GET** /apps/{name}/runs | List runs *DefaultApi* | [**list_schedules**](docs/DefaultApi.md#list_schedules) | **GET** /schedules | List schedules *DefaultApi* | [**list_secret_environments**](docs/DefaultApi.md#list_secret_environments) | **GET** /secrets/environments | List secret environments *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 -*DefaultApi* | [**list_team_members**](docs/DefaultApi.md#list_team_members) | **GET** /teams/{slug}/members | List team members +*DefaultApi* | [**list_team_invitations**](docs/DefaultApi.md#list_team_invitations) | **GET** /teams/{name}/invites | List team invitations +*DefaultApi* | [**list_team_members**](docs/DefaultApi.md#list_team_members) | **GET** /teams/{name}/members | List team members *DefaultApi* | [**list_teams**](docs/DefaultApi.md#list_teams) | **GET** /teams | List teams *DefaultApi* | [**refresh_session**](docs/DefaultApi.md#refresh_session) | **POST** /session/refresh | Refresh session -*DefaultApi* | [**remove_team_member**](docs/DefaultApi.md#remove_team_member) | **DELETE** /teams/{slug}/members | Remove team member -*DefaultApi* | [**resend_team_invitation**](docs/DefaultApi.md#resend_team_invitation) | **POST** /teams/{slug}/invites/resend | Resend team invitation -*DefaultApi* | [**run_app**](docs/DefaultApi.md#run_app) | **POST** /apps/{slug}/runs | Run app +*DefaultApi* | [**remove_team_member**](docs/DefaultApi.md#remove_team_member) | **DELETE** /teams/{name}/members | Remove team member +*DefaultApi* | [**resend_team_invitation**](docs/DefaultApi.md#resend_team_invitation) | **POST** /teams/{name}/invites/resend | Resend team invitation +*DefaultApi* | [**run_app**](docs/DefaultApi.md#run_app) | **POST** /apps/{name}/runs | Run app *DefaultApi* | [**search_runs**](docs/DefaultApi.md#search_runs) | **GET** /runs | Search runs *DefaultApi* | [**stream_alerts**](docs/DefaultApi.md#stream_alerts) | **GET** /alerts/stream | Stream alert notifications -*DefaultApi* | [**stream_run_logs**](docs/DefaultApi.md#stream_run_logs) | **GET** /apps/{slug}/runs/{seq}/logs/stream | Stream run logs -*DefaultApi* | [**update_account_slug**](docs/DefaultApi.md#update_account_slug) | **PUT** /accounts/{slug} | Update account slug +*DefaultApi* | [**stream_run_logs**](docs/DefaultApi.md#stream_run_logs) | **GET** /apps/{name}/runs/{seq}/logs/stream | Stream run logs +*DefaultApi* | [**update_account_name**](docs/DefaultApi.md#update_account_name) | **PUT** /accounts/{name} | Update account name *DefaultApi* | [**update_app**](docs/DefaultApi.md#update_app) | **PUT** /apps/{name} | Update app -*DefaultApi* | [**update_catalog**](docs/DefaultApi.md#update_catalog) | **PUT** /catalogs/{slug} | Update catalog +*DefaultApi* | [**update_catalog**](docs/DefaultApi.md#update_catalog) | **PUT** /catalogs/{name} | Update catalog +*DefaultApi* | [**update_environment**](docs/DefaultApi.md#update_environment) | **PUT** /environments/{name} | Update environment *DefaultApi* | [**update_my_team_invitation**](docs/DefaultApi.md#update_my_team_invitation) | **PUT** /team-invites | Update my team invitation *DefaultApi* | [**update_password_reset**](docs/DefaultApi.md#update_password_reset) | **POST** /accounts/password-reset/{code} | Update password reset +*DefaultApi* | [**update_plan**](docs/DefaultApi.md#update_plan) | **PUT** /plan | Update plan *DefaultApi* | [**update_schedule**](docs/DefaultApi.md#update_schedule) | **PUT** /schedules/{id} | Update schedule *DefaultApi* | [**update_secret**](docs/DefaultApi.md#update_secret) | **PUT** /secrets/{name} | Update secret -*DefaultApi* | [**update_team**](docs/DefaultApi.md#update_team) | **PUT** /teams/{slug} | Update team +*DefaultApi* | [**update_team**](docs/DefaultApi.md#update_team) | **PUT** /teams/{name} | Update team *DefaultApi* | [**update_user**](docs/DefaultApi.md#update_user) | **PUT** /user | Update user profile @@ -131,6 +136,8 @@ Class | Method | HTTP request | Description - [CreateCatalogParams](docs/CreateCatalogParams.md) - [CreateCatalogResponse](docs/CreateCatalogResponse.md) - [CreateDeviceLoginTicketResponse](docs/CreateDeviceLoginTicketResponse.md) + - [CreateEnvironmentParams](docs/CreateEnvironmentParams.md) + - [CreateEnvironmentResponse](docs/CreateEnvironmentResponse.md) - [CreatePasswordResetParams](docs/CreatePasswordResetParams.md) - [CreatePasswordResetResponse](docs/CreatePasswordResetResponse.md) - [CreateScheduleParams](docs/CreateScheduleParams.md) @@ -162,8 +169,13 @@ Class | Method | HTTP request | Description - [DescribeSecretsKeyResponse](docs/DescribeSecretsKeyResponse.md) - [DescribeSessionResponse](docs/DescribeSessionResponse.md) - [EncryptedCatalogProperty](docs/EncryptedCatalogProperty.md) + - [Environment](docs/Environment.md) - [ErrorDetail](docs/ErrorDetail.md) - [ErrorModel](docs/ErrorModel.md) + - [EventError](docs/EventError.md) + - [EventLog](docs/EventLog.md) + - [EventRunFailureAlert](docs/EventRunFailureAlert.md) + - [EventWarning](docs/EventWarning.md) - [ExportCatalogsParams](docs/ExportCatalogsParams.md) - [ExportCatalogsResponse](docs/ExportCatalogsResponse.md) - [ExportSecretsParams](docs/ExportSecretsParams.md) @@ -172,6 +184,7 @@ Class | Method | HTTP request | Description - [ExportedCatalogProperty](docs/ExportedCatalogProperty.md) - [ExportedSecret](docs/ExportedSecret.md) - [FeaturebaseIdentity](docs/FeaturebaseIdentity.md) + - [Features](docs/Features.md) - [GenerateAppStatisticsResponse](docs/GenerateAppStatisticsResponse.md) - [GenerateAuthenticatorResponse](docs/GenerateAuthenticatorResponse.md) - [GenerateRunStatisticsResponse](docs/GenerateRunStatisticsResponse.md) @@ -179,6 +192,7 @@ Class | Method | HTTP request | Description - [InviteTeamMemberParams](docs/InviteTeamMemberParams.md) - [InviteTeamMemberResponse](docs/InviteTeamMemberResponse.md) - [LeaveTeamResponse](docs/LeaveTeamResponse.md) + - [ListAccountPlansResponse](docs/ListAccountPlansResponse.md) - [ListAlerts200Response](docs/ListAlerts200Response.md) - [ListAlertsResponse](docs/ListAlertsResponse.md) - [ListApiKeysResponse](docs/ListApiKeysResponse.md) @@ -187,6 +201,7 @@ Class | Method | HTTP request | Description - [ListAppsResponse](docs/ListAppsResponse.md) - [ListAuthenticatorsResponse](docs/ListAuthenticatorsResponse.md) - [ListCatalogsResponse](docs/ListCatalogsResponse.md) + - [ListEnvironmentsResponse](docs/ListEnvironmentsResponse.md) - [ListMyTeamInvitationsResponse](docs/ListMyTeamInvitationsResponse.md) - [ListRunsResponse](docs/ListRunsResponse.md) - [ListSchedulesResponse](docs/ListSchedulesResponse.md) @@ -198,6 +213,7 @@ Class | Method | HTTP request | Description - [LogLine](docs/LogLine.md) - [Pagination](docs/Pagination.md) - [Parameter](docs/Parameter.md) + - [Plan](docs/Plan.md) - [RefreshSessionParams](docs/RefreshSessionParams.md) - [RefreshSessionResponse](docs/RefreshSessionResponse.md) - [RemoveTeamMemberParams](docs/RemoveTeamMemberParams.md) @@ -226,16 +242,20 @@ Class | Method | HTTP request | Description - [TeamInvitation](docs/TeamInvitation.md) - [Token](docs/Token.md) - [UnverifiedAuthenticator](docs/UnverifiedAuthenticator.md) - - [UpdateAccountSlugParams](docs/UpdateAccountSlugParams.md) - - [UpdateAccountSlugResponse](docs/UpdateAccountSlugResponse.md) + - [UpdateAccountNameParams](docs/UpdateAccountNameParams.md) + - [UpdateAccountNameResponse](docs/UpdateAccountNameResponse.md) - [UpdateAppParams](docs/UpdateAppParams.md) - [UpdateAppResponse](docs/UpdateAppResponse.md) - [UpdateCatalogParams](docs/UpdateCatalogParams.md) - [UpdateCatalogResponse](docs/UpdateCatalogResponse.md) + - [UpdateEnvironmentParams](docs/UpdateEnvironmentParams.md) + - [UpdateEnvironmentResponse](docs/UpdateEnvironmentResponse.md) - [UpdateMyTeamInvitationParams](docs/UpdateMyTeamInvitationParams.md) - [UpdateMyTeamInvitationResponse](docs/UpdateMyTeamInvitationResponse.md) - [UpdatePasswordResetParams](docs/UpdatePasswordResetParams.md) - [UpdatePasswordResetResponse](docs/UpdatePasswordResetResponse.md) + - [UpdatePlanParams](docs/UpdatePlanParams.md) + - [UpdatePlanResponse](docs/UpdatePlanResponse.md) - [UpdateScheduleParams](docs/UpdateScheduleParams.md) - [UpdateScheduleResponse](docs/UpdateScheduleResponse.md) - [UpdateSecretParams](docs/UpdateSecretParams.md) diff --git a/crates/tower-api/src/apis/configuration.rs b/crates/tower-api/src/apis/configuration.rs index a6edd873..e9675e44 100644 --- a/crates/tower-api/src/apis/configuration.rs +++ b/crates/tower-api/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ diff --git a/crates/tower-api/src/apis/default_api.rs b/crates/tower-api/src/apis/default_api.rs index 66794b72..8c36ed3b 100644 --- a/crates/tower-api/src/apis/default_api.rs +++ b/crates/tower-api/src/apis/default_api.rs @@ -3,7 +3,7 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ @@ -32,8 +32,8 @@ pub struct AcknowledgeAlertParams { /// struct for passing parameters to the method [`cancel_run`] #[derive(Clone, Debug)] pub struct CancelRunParams { - /// The slug of the app to fetch runs for. - pub slug: String, + /// The name of the app to fetch runs for. + pub name: String, /// The number of the run to fetch. pub seq: i64 } @@ -74,6 +74,12 @@ pub struct CreateCatalogParams { pub create_catalog_params: models::CreateCatalogParams } +/// struct for passing parameters to the method [`create_environment`] +#[derive(Clone, Debug)] +pub struct CreateEnvironmentParams { + pub create_environment_params: models::CreateEnvironmentParams +} + /// struct for passing parameters to the method [`create_password_reset`] #[derive(Clone, Debug)] pub struct CreatePasswordResetParams { @@ -120,8 +126,8 @@ pub struct DeleteApiKeyParams { /// struct for passing parameters to the method [`delete_app`] #[derive(Clone, Debug)] pub struct DeleteAppParams { - /// The slug of the app to delete. - pub slug: String + /// The name of the app to delete. + pub name: String } /// struct for passing parameters to the method [`delete_authenticator`] @@ -133,8 +139,10 @@ pub struct DeleteAuthenticatorParams { /// struct for passing parameters to the method [`delete_catalog`] #[derive(Clone, Debug)] pub struct DeleteCatalogParams { - /// The slug of the catalog to update. - pub slug: String + /// The name of the catalog to update. + pub name: String, + /// The environment of the catalog to delete. + pub environment: Option } /// struct for passing parameters to the method [`delete_schedule`] @@ -162,25 +170,27 @@ pub struct DeleteTeamParams { /// struct for passing parameters to the method [`delete_team_invitation`] #[derive(Clone, Debug)] pub struct DeleteTeamInvitationParams { - /// The slug of the team to remove someone from - pub slug: String, + /// The name of the team to remove someone from + pub name: String, pub delete_team_invitation_params: models::DeleteTeamInvitationParams } /// struct for passing parameters to the method [`deploy_app`] #[derive(Clone, Debug)] pub struct DeployAppParams { - /// The slug of the app to deploy. - pub slug: String, + /// The name of the app to deploy. + pub name: String, /// The encoding of the content. - pub content_encoding: Option + pub content_encoding: Option, + /// The SHA256 hash of the content, used to verify integrity. + pub x_tower_checksum_sha256: Option } /// struct for passing parameters to the method [`describe_app`] #[derive(Clone, Debug)] pub struct DescribeAppParams { - /// The slug of the app to fetch. - pub slug: String, + /// The name of the app to fetch. + pub name: String, /// The number of recent runs to fetch for the app. pub runs: Option, /// Filter runs scheduled after this datetime (inclusive). Provide timestamps in ISO-8601 format. @@ -210,8 +220,8 @@ pub struct DescribeDeviceLoginSessionParams { /// struct for passing parameters to the method [`describe_run`] #[derive(Clone, Debug)] pub struct DescribeRunParams { - /// The slug of the app to fetch runs for. - pub slug: String, + /// The name of the app to fetch runs for. + pub name: String, /// The number of the run to fetch. pub seq: i64 } @@ -219,8 +229,8 @@ pub struct DescribeRunParams { /// struct for passing parameters to the method [`describe_run_logs`] #[derive(Clone, Debug)] pub struct DescribeRunLogsParams { - /// The slug of the app to get logs for. - pub slug: String, + /// The name of the app to get logs for. + pub name: String, /// The sequence number of the run to get logs for. pub seq: i64 } @@ -260,16 +270,16 @@ pub struct GenerateRunStatisticsParams { /// struct for passing parameters to the method [`invite_team_member`] #[derive(Clone, Debug)] pub struct InviteTeamMemberParams { - /// The slug of the team to invite someone to - pub slug: String, + /// The name of the team to invite someone to + pub name: String, pub invite_team_member_params: models::InviteTeamMemberParams } /// struct for passing parameters to the method [`leave_team`] #[derive(Clone, Debug)] pub struct LeaveTeamParams { - /// The slug of the team to leave - pub slug: String + /// The name of the team to leave + pub name: String } /// struct for passing parameters to the method [`list_alerts`] @@ -293,7 +303,7 @@ pub struct ListAlertsParams { #[derive(Clone, Debug)] pub struct ListAppEnvironmentsParams { /// The name of the app to get the version for. - pub slug: String + pub name: String } /// struct for passing parameters to the method [`list_app_versions`] @@ -333,11 +343,20 @@ pub struct ListCatalogsParams { pub page_size: Option } +/// struct for passing parameters to the method [`list_plans`] +#[derive(Clone, Debug)] +pub struct ListPlansParams { + /// The page number to fetch. + pub page: Option, + /// The number of records to fetch on each page. + pub page_size: Option +} + /// struct for passing parameters to the method [`list_runs`] #[derive(Clone, Debug)] pub struct ListRunsParams { - /// The slug of the app to fetch runs for. - pub slug: String, + /// The name of the app to fetch runs for. + pub name: String, /// The page number to fetch. pub page: Option, /// The number of records to fetch on each page. @@ -375,15 +394,15 @@ pub struct ListSecretsParams { /// struct for passing parameters to the method [`list_team_invitations`] #[derive(Clone, Debug)] pub struct ListTeamInvitationsParams { - /// The slug of the team to list members for - pub slug: String + /// The name of the team to list members for + pub name: String } /// struct for passing parameters to the method [`list_team_members`] #[derive(Clone, Debug)] pub struct ListTeamMembersParams { - /// The slug of the team to list members for - pub slug: String + /// The name of the team to list members for + pub name: String } /// struct for passing parameters to the method [`refresh_session`] @@ -395,24 +414,24 @@ pub struct RefreshSessionParams { /// struct for passing parameters to the method [`remove_team_member`] #[derive(Clone, Debug)] pub struct RemoveTeamMemberParams { - /// The slug of the team to remove someone from - pub slug: String, + /// The name of the team to remove someone from + pub name: String, pub remove_team_member_params: models::RemoveTeamMemberParams } /// struct for passing parameters to the method [`resend_team_invitation`] #[derive(Clone, Debug)] pub struct ResendTeamInvitationParams { - /// The slug of the team to invite someone to - pub slug: String, + /// The name of the team to invite someone to + pub name: String, pub resend_team_invitation_params: models::ResendTeamInvitationParams } /// struct for passing parameters to the method [`run_app`] #[derive(Clone, Debug)] pub struct RunAppParams { - /// The slug of the app to fetch runs for. - pub slug: String, + /// The name of the app to fetch runs for. + pub name: String, pub run_app_params: models::RunAppParams } @@ -434,18 +453,18 @@ pub struct SearchRunsParams { /// struct for passing parameters to the method [`stream_run_logs`] #[derive(Clone, Debug)] pub struct StreamRunLogsParams { - /// The slug of the app to get logs for. - pub slug: String, + /// The name of the app to get logs for. + pub name: String, /// The sequence number of the run to get logs for. pub seq: i64 } -/// struct for passing parameters to the method [`update_account_slug`] +/// struct for passing parameters to the method [`update_account_name`] #[derive(Clone, Debug)] -pub struct UpdateAccountSlugParams { - /// The slug of the account to update - pub slug: String, - pub update_account_slug_params: models::UpdateAccountSlugParams +pub struct UpdateAccountNameParams { + /// The name of the account to update + pub name: String, + pub update_account_name_params: models::UpdateAccountNameParams } /// struct for passing parameters to the method [`update_app`] @@ -459,11 +478,19 @@ pub struct UpdateAppParams { /// struct for passing parameters to the method [`update_catalog`] #[derive(Clone, Debug)] pub struct UpdateCatalogParams { - /// The slug of the catalog to update. - pub slug: String, + /// The name of the catalog to update. + pub name: String, pub update_catalog_params: models::UpdateCatalogParams } +/// struct for passing parameters to the method [`update_environment`] +#[derive(Clone, Debug)] +pub struct UpdateEnvironmentParams { + /// The current name of the environment to update. + pub name: String, + pub update_environment_params: models::UpdateEnvironmentParams +} + /// struct for passing parameters to the method [`update_my_team_invitation`] #[derive(Clone, Debug)] pub struct UpdateMyTeamInvitationParams { @@ -478,6 +505,12 @@ pub struct UpdatePasswordResetParams { pub update_password_reset_params: models::UpdatePasswordResetParams } +/// struct for passing parameters to the method [`update_plan`] +#[derive(Clone, Debug)] +pub struct UpdatePlanParams { + pub update_plan_params: models::UpdatePlanParams +} + /// struct for passing parameters to the method [`update_schedule`] #[derive(Clone, Debug)] pub struct UpdateScheduleParams { @@ -496,8 +529,8 @@ pub struct UpdateSecretParams { /// struct for passing parameters to the method [`update_team`] #[derive(Clone, Debug)] pub struct UpdateTeamParams { - /// The slug of the team to update - pub slug: String, + /// The name of the team to update + pub name: String, pub update_team_params: models::UpdateTeamParams } @@ -596,6 +629,14 @@ pub enum CreateDeviceLoginTicketSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`create_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateEnvironmentSuccess { + Status200(models::CreateEnvironmentResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`create_password_reset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -892,6 +933,14 @@ pub enum ListCatalogsSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`list_environments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListEnvironmentsSuccess { + Status200(models::ListEnvironmentsResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`list_my_team_invitations`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -900,6 +949,14 @@ pub enum ListMyTeamInvitationsSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`list_plans`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListPlansSuccess { + Status200(models::ListAccountPlansResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`list_runs`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1013,11 +1070,11 @@ pub enum StreamRunLogsSuccess { UnknownValue(serde_json::Value), } -/// struct for typed successes of method [`update_account_slug`] +/// struct for typed successes of method [`update_account_name`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum UpdateAccountSlugSuccess { - Status200(models::UpdateAccountSlugResponse), +pub enum UpdateAccountNameSuccess { + Status200(models::UpdateAccountNameResponse), UnknownValue(serde_json::Value), } @@ -1037,6 +1094,14 @@ pub enum UpdateCatalogSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`update_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateEnvironmentSuccess { + Status200(models::UpdateEnvironmentResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_my_team_invitation`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1053,6 +1118,14 @@ pub enum UpdatePasswordResetSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`update_plan`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdatePlanSuccess { + Status201(models::UpdatePlanResponse), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_schedule`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1173,6 +1246,14 @@ pub enum CreateDeviceLoginTicketError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`create_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateEnvironmentError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`create_password_reset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1472,6 +1553,14 @@ pub enum ListCatalogsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_environments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListEnvironmentsError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_my_team_invitations`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1480,6 +1569,14 @@ pub enum ListMyTeamInvitationsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_plans`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListPlansError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_runs`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1592,10 +1689,10 @@ pub enum StreamRunLogsError { UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`update_account_slug`] +/// struct for typed errors of method [`update_account_name`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum UpdateAccountSlugError { +pub enum UpdateAccountNameError { DefaultResponse(models::ErrorModel), UnknownValue(serde_json::Value), } @@ -1616,6 +1713,14 @@ pub enum UpdateCatalogError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_environment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateEnvironmentError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_my_team_invitation`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1632,6 +1737,14 @@ pub enum UpdatePasswordResetError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_plan`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdatePlanError { + DefaultResponse(models::ErrorModel), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_schedule`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1774,7 +1887,7 @@ pub async fn acknowledge_all_alerts(configuration: &configuration::Configuration /// Cancel a run pub async fn cancel_run(configuration: &configuration::Configuration, params: CancelRunParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/runs/{seq}", configuration.base_path, slug=crate::apis::urlencode(params.slug), seq=params.seq); + let uri_str = format!("{}/apps/{name}/runs/{seq}", configuration.base_path, name=crate::apis::urlencode(params.name), seq=params.seq); let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -2050,6 +2163,42 @@ pub async fn create_device_login_ticket(configuration: &configuration::Configura } } +/// Create a new environment for an app. +pub async fn create_environment(configuration: &configuration::Configuration, params: CreateEnvironmentParams) -> Result, Error> { + + let uri_str = format!("{}/environments", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + req_builder = req_builder.json(¶ms.create_environment_params); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Starts the password reset process for an account. If an email address exists for the account supplied, you will get a reset password email. pub async fn create_password_reset(configuration: &configuration::Configuration, params: CreatePasswordResetParams) -> Result, Error> { @@ -2297,7 +2446,7 @@ pub async fn delete_api_key(configuration: &configuration::Configuration, params /// Delete one of your apps, the associated code, and all the runs as well. pub async fn delete_app(configuration: &configuration::Configuration, params: DeleteAppParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/apps/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -2368,9 +2517,12 @@ pub async fn delete_authenticator(configuration: &configuration::Configuration, /// Delete a new catalog object in the currently authenticated account. pub async fn delete_catalog(configuration: &configuration::Configuration, params: DeleteCatalogParams) -> Result, Error> { - let uri_str = format!("{}/catalogs/{slug}", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/catalogs/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + if let Some(ref param_value) = params.environment { + req_builder = req_builder.query(&[("environment", ¶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()); } @@ -2512,7 +2664,7 @@ pub async fn delete_team(configuration: &configuration::Configuration, params: D /// Delete a pending team invitation that you have previously sent pub async fn delete_team_invitation(configuration: &configuration::Configuration, params: DeleteTeamInvitationParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/invites", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/invites", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -2548,7 +2700,7 @@ pub async fn delete_team_invitation(configuration: &configuration::Configuration /// Deploy a new version of an app. Reads the request body, which is a TAR file (or a GZipped TAR file) and creates a new deployment for an app based on that file. pub async fn deploy_app(configuration: &configuration::Configuration, params: DeployAppParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/deploy", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/apps/{name}/deploy", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -2557,6 +2709,9 @@ pub async fn deploy_app(configuration: &configuration::Configuration, params: De if let Some(param_value) = params.content_encoding { req_builder = req_builder.header("Content-Encoding", param_value.to_string()); } + if let Some(param_value) = params.x_tower_checksum_sha256 { + req_builder = req_builder.header("X-Tower-Checksum-SHA256", param_value.to_string()); + } if let Some(ref token) = configuration.bearer_access_token { req_builder = req_builder.bearer_auth(token.to_owned()); }; @@ -2586,7 +2741,7 @@ pub async fn deploy_app(configuration: &configuration::Configuration, params: De /// Get all the runs for the current account. pub async fn describe_app(configuration: &configuration::Configuration, params: DescribeAppParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/apps/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = params.runs { @@ -2700,7 +2855,7 @@ pub async fn describe_device_login_session(configuration: &configuration::Config /// Describe a run of an app. pub async fn describe_run(configuration: &configuration::Configuration, params: DescribeRunParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/runs/{seq}", configuration.base_path, slug=crate::apis::urlencode(params.slug), seq=params.seq); + let uri_str = format!("{}/apps/{name}/runs/{seq}", configuration.base_path, name=crate::apis::urlencode(params.name), seq=params.seq); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -2743,7 +2898,7 @@ pub async fn describe_run(configuration: &configuration::Configuration, params: /// Retrieves the logs associated with a particular run of an app. pub async fn describe_run_logs(configuration: &configuration::Configuration, params: DescribeRunLogsParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/runs/{seq}/logs", configuration.base_path, slug=crate::apis::urlencode(params.slug), seq=params.seq); + let uri_str = format!("{}/apps/{name}/runs/{seq}/logs", configuration.base_path, name=crate::apis::urlencode(params.name), seq=params.seq); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3082,7 +3237,7 @@ pub async fn generate_runner_credentials(configuration: &configuration::Configur /// Invite a new team pub async fn invite_team_member(configuration: &configuration::Configuration, params: InviteTeamMemberParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/invites", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/invites", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3118,7 +3273,7 @@ pub async fn invite_team_member(configuration: &configuration::Configuration, pa /// Remove yourself from a team, if that's something you'd like to do for whatever reason. If you're the last member of a team, you cannot remove yourself. You should delete the team instead. pub async fn leave_team(configuration: &configuration::Configuration, params: LeaveTeamParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/leave", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/leave", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3241,7 +3396,7 @@ pub async fn list_api_keys(configuration: &configuration::Configuration) -> Resu /// Generates a list of all the known environments for a given app in the current account. pub async fn list_app_environments(configuration: &configuration::Configuration, params: ListAppEnvironmentsParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/environments", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/apps/{name}/environments", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3451,6 +3606,41 @@ pub async fn list_catalogs(configuration: &configuration::Configuration, params: } } +/// List all environments in your account. +pub async fn list_environments(configuration: &configuration::Configuration) -> Result, Error> { + + let uri_str = format!("{}/environments", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// List your pending invitations for teams pub async fn list_my_team_invitations(configuration: &configuration::Configuration) -> Result, Error> { @@ -3486,10 +3676,51 @@ pub async fn list_my_team_invitations(configuration: &configuration::Configurati } } +/// List active and past account plans for the current account. +pub async fn list_plans(configuration: &configuration::Configuration, params: ListPlansParams) -> Result, Error> { + + let uri_str = format!("{}/plans", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = params.page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = params.page_size { + req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Generates a list of all the runs for a given app. The list is paginated based on the query string parameters passed in. pub async fn list_runs(configuration: &configuration::Configuration, params: ListRunsParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/runs", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/apps/{name}/runs", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = params.page { @@ -3665,7 +3896,7 @@ pub async fn list_secrets(configuration: &configuration::Configuration, params: /// List the pending invitations for a team pub async fn list_team_invitations(configuration: &configuration::Configuration, params: ListTeamInvitationsParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/invites", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/invites", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3700,7 +3931,7 @@ pub async fn list_team_invitations(configuration: &configuration::Configuration, /// List the members of a team pub async fn list_team_members(configuration: &configuration::Configuration, params: ListTeamMembersParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/members", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/members", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3806,7 +4037,7 @@ pub async fn refresh_session(configuration: &configuration::Configuration, param /// Remove a new team pub async fn remove_team_member(configuration: &configuration::Configuration, params: RemoveTeamMemberParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/members", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/members", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3842,7 +4073,7 @@ pub async fn remove_team_member(configuration: &configuration::Configuration, pa /// Resend a team invitation to a user if they need a reminder or if they lost it pub async fn resend_team_invitation(configuration: &configuration::Configuration, params: ResendTeamInvitationParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}/invites/resend", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}/invites/resend", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -3878,7 +4109,7 @@ pub async fn resend_team_invitation(configuration: &configuration::Configuration /// Runs an app with the supplied parameters. pub async fn run_app(configuration: &configuration::Configuration, params: RunAppParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/runs", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/apps/{name}/runs", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -4010,7 +4241,7 @@ pub async fn stream_alerts(configuration: &configuration::Configuration) -> Resu /// Streams the logs associated with a particular run of an app in real-time. pub async fn stream_run_logs(configuration: &configuration::Configuration, params: StreamRunLogsParams) -> Result, Error> { - let uri_str = format!("{}/apps/{slug}/runs/{seq}/logs/stream", configuration.base_path, slug=crate::apis::urlencode(params.slug), seq=params.seq); + let uri_str = format!("{}/apps/{name}/runs/{seq}/logs/stream", configuration.base_path, name=crate::apis::urlencode(params.name), seq=params.seq); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -4042,10 +4273,10 @@ pub async fn stream_run_logs(configuration: &configuration::Configuration, param } } -/// Update the slug for an account -pub async fn update_account_slug(configuration: &configuration::Configuration, params: UpdateAccountSlugParams) -> Result, Error> { +/// Update the name for an account +pub async fn update_account_name(configuration: &configuration::Configuration, params: UpdateAccountNameParams) -> Result, Error> { - let uri_str = format!("{}/accounts/{slug}", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/accounts/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -4054,7 +4285,7 @@ pub async fn update_account_slug(configuration: &configuration::Configuration, p 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_account_slug_params); + req_builder = req_builder.json(¶ms.update_account_name_params); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; @@ -4069,11 +4300,11 @@ pub async fn update_account_slug(configuration: &configuration::Configuration, p if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; - let entity: Option = serde_json::from_str(&content).ok(); + 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(); + let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) } } @@ -4117,7 +4348,7 @@ pub async fn update_app(configuration: &configuration::Configuration, params: Up /// Update a new catalog object in the currently authenticated account. pub async fn update_catalog(configuration: &configuration::Configuration, params: UpdateCatalogParams) -> Result, Error> { - let uri_str = format!("{}/catalogs/{slug}", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/catalogs/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -4150,6 +4381,42 @@ pub async fn update_catalog(configuration: &configuration::Configuration, params } } +/// Rename your environment +pub async fn update_environment(configuration: &configuration::Configuration, params: UpdateEnvironmentParams) -> Result, Error> { + + let uri_str = format!("{}/environments/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + req_builder = req_builder.json(¶ms.update_environment_params); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Update a team invitation that you have pending pub async fn update_my_team_invitation(configuration: &configuration::Configuration, params: UpdateMyTeamInvitationParams) -> Result, Error> { @@ -4219,6 +4486,41 @@ pub async fn update_password_reset(configuration: &configuration::Configuration, } } +pub async fn update_plan(configuration: &configuration::Configuration, params: UpdatePlanParams) -> Result, Error> { + + let uri_str = format!("{}/plan", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref token) = configuration.bearer_access_token { + req_builder = req_builder.bearer_auth(token.to_owned()); + }; + req_builder = req_builder.json(¶ms.update_plan_params); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + let tower_trace_id = resp + .headers() + .get("x-tower-trace-id") + .and_then(|v| v.to_str().ok()) + .map_or(String::from(DEFAULT_TOWER_TRACE_ID), String::from); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { tower_trace_id, status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { tower_trace_id, status, content, entity })) + } +} + /// Update an existing schedule for an app. pub async fn update_schedule(configuration: &configuration::Configuration, params: UpdateScheduleParams) -> Result, Error> { @@ -4291,10 +4593,10 @@ pub async fn update_secret(configuration: &configuration::Configuration, params: } } -/// Update a team with a new name or slug. Note that updating the team with a new slug will cause all your URLs to change! +/// Update a team with a new name or name. Note that updating the team with a new name will cause all your URLs to change! pub async fn update_team(configuration: &configuration::Configuration, params: UpdateTeamParams) -> Result, Error> { - let uri_str = format!("{}/teams/{slug}", configuration.base_path, slug=crate::apis::urlencode(params.slug)); + let uri_str = format!("{}/teams/{name}", configuration.base_path, name=crate::apis::urlencode(params.name)); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { diff --git a/crates/tower-api/src/models/accept_invitation_params.rs b/crates/tower-api/src/models/accept_invitation_params.rs index 3c59f691..ab0936a6 100644 --- a/crates/tower-api/src/models/accept_invitation_params.rs +++ b/crates/tower-api/src/models/accept_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcceptInvitationParams { diff --git a/crates/tower-api/src/models/accept_invitation_response.rs b/crates/tower-api/src/models/accept_invitation_response.rs index 2b6be00e..05bfc4db 100644 --- a/crates/tower-api/src/models/accept_invitation_response.rs +++ b/crates/tower-api/src/models/accept_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcceptInvitationResponse { @@ -17,14 +17,14 @@ pub struct AcceptInvitationResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "user")] - pub user: Box, + pub user: models::User, } impl AcceptInvitationResponse { pub fn new(user: models::User) -> AcceptInvitationResponse { AcceptInvitationResponse { schema: None, - user: Box::new(user), + user, } } } diff --git a/crates/tower-api/src/models/account.rs b/crates/tower-api/src/models/account.rs index d5de23cb..b9be25f9 100644 --- a/crates/tower-api/src/models/account.rs +++ b/crates/tower-api/src/models/account.rs @@ -3,27 +3,28 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Account { #[serde(rename = "name")] pub name: String, - #[serde(rename = "slug")] - pub slug: String, + /// This property is deprecated. Please use name instead. + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, } impl Account { - pub fn new(name: String, slug: String) -> Account { + pub fn new(name: String) -> Account { Account { name, - slug, + slug: None, } } } diff --git a/crates/tower-api/src/models/acknowledge_alert_response.rs b/crates/tower-api/src/models/acknowledge_alert_response.rs index 67b8ae15..ceffbdcd 100644 --- a/crates/tower-api/src/models/acknowledge_alert_response.rs +++ b/crates/tower-api/src/models/acknowledge_alert_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcknowledgeAlertResponse { diff --git a/crates/tower-api/src/models/acknowledge_all_alerts_response.rs b/crates/tower-api/src/models/acknowledge_all_alerts_response.rs index c6ace3a6..20507611 100644 --- a/crates/tower-api/src/models/acknowledge_all_alerts_response.rs +++ b/crates/tower-api/src/models/acknowledge_all_alerts_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AcknowledgeAllAlertsResponse { diff --git a/crates/tower-api/src/models/alert.rs b/crates/tower-api/src/models/alert.rs index 365c4b96..0538dbfe 100644 --- a/crates/tower-api/src/models/alert.rs +++ b/crates/tower-api/src/models/alert.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Alert { @@ -20,7 +20,7 @@ pub struct Alert { #[serde(rename = "created_at")] pub created_at: String, #[serde(rename = "detail")] - pub detail: Box, + pub detail: models::RunFailureAlert, #[serde(rename = "seq")] pub seq: i64, #[serde(rename = "status")] @@ -33,7 +33,7 @@ impl Alert { acked, alert_type, created_at, - detail: Box::new(detail), + detail, seq, status, } diff --git a/crates/tower-api/src/models/api_key.rs b/crates/tower-api/src/models/api_key.rs index 2ec47af1..65aa1a61 100644 --- a/crates/tower-api/src/models/api_key.rs +++ b/crates/tower-api/src/models/api_key.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiKey { diff --git a/crates/tower-api/src/models/app.rs b/crates/tower-api/src/models/app.rs index 184e76b1..a92e4d25 100644 --- a/crates/tower-api/src/models/app.rs +++ b/crates/tower-api/src/models/app.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct App { @@ -21,7 +21,7 @@ pub struct App { pub health_status: HealthStatus, /// The last run of this app, null if none. #[serde(rename = "last_run", skip_serializing_if = "Option::is_none")] - pub last_run: Option>, + pub last_run: Option, /// The name of the app. #[serde(rename = "name")] pub name: String, @@ -33,16 +33,16 @@ pub struct App { pub owner: String, /// The stats of all the runs of this app #[serde(rename = "run_results", skip_serializing_if = "Option::is_none")] - pub run_results: Option>, + pub run_results: Option, /// The schedule associated with this app, null if none. #[serde(rename = "schedule", deserialize_with = "Option::deserialize")] pub schedule: Option, /// A short description of the app. Can be empty. #[serde(rename = "short_description")] pub short_description: String, - /// The unique slug of the app. - #[serde(rename = "slug")] - pub slug: String, + /// This property is deprecated. Please use name instead. + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, /// The status of the app #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, @@ -52,7 +52,7 @@ pub struct App { } impl App { - pub fn new(created_at: String, health_status: HealthStatus, name: String, next_run_at: Option, owner: String, schedule: Option, short_description: String, slug: String, version: Option) -> App { + pub fn new(created_at: String, health_status: HealthStatus, name: String, next_run_at: Option, owner: String, schedule: Option, short_description: String, version: Option) -> App { App { created_at, health_status, @@ -63,14 +63,14 @@ impl App { run_results: None, schedule, short_description, - slug, + slug: None, status: None, version, } } } /// The health status of this app -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum HealthStatus { #[serde(rename = "healthy")] Healthy, @@ -83,8 +83,25 @@ impl Default for HealthStatus { Self::Healthy } } + +impl<'de> Deserialize<'de> for HealthStatus { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "healthy" => Ok(Self::Healthy), + "warning" => Ok(Self::Warning), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["healthy", "warning"], + )), + } + } +} /// The status of the app -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Status { #[serde(rename = "active")] Active, @@ -98,3 +115,20 @@ impl Default for Status { } } +impl<'de> Deserialize<'de> for Status { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "active" => Ok(Self::Active), + "disabled" => Ok(Self::Disabled), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["active", "disabled"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/app_statistics.rs b/crates/tower-api/src/models/app_statistics.rs index 5715d0c4..c8321773 100644 --- a/crates/tower-api/src/models/app_statistics.rs +++ b/crates/tower-api/src/models/app_statistics.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AppStatistics { diff --git a/crates/tower-api/src/models/app_summary.rs b/crates/tower-api/src/models/app_summary.rs index 3fc2b2ef..7809b315 100644 --- a/crates/tower-api/src/models/app_summary.rs +++ b/crates/tower-api/src/models/app_summary.rs @@ -3,18 +3,18 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AppSummary { #[serde(rename = "app")] - pub app: Box, + pub app: models::App, #[serde(rename = "runs")] pub runs: Vec, } @@ -22,7 +22,7 @@ pub struct AppSummary { impl AppSummary { pub fn new(app: models::App, runs: Vec) -> AppSummary { AppSummary { - app: Box::new(app), + app, runs, } } diff --git a/crates/tower-api/src/models/app_version.rs b/crates/tower-api/src/models/app_version.rs index 2ce9dd1f..3c370f6c 100644 --- a/crates/tower-api/src/models/app_version.rs +++ b/crates/tower-api/src/models/app_version.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AppVersion { diff --git a/crates/tower-api/src/models/cancel_run_response.rs b/crates/tower-api/src/models/cancel_run_response.rs index 79f94e3e..2ac391cd 100644 --- a/crates/tower-api/src/models/cancel_run_response.rs +++ b/crates/tower-api/src/models/cancel_run_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CancelRunResponse { @@ -17,14 +17,14 @@ pub struct CancelRunResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl CancelRunResponse { pub fn new(run: models::Run) -> CancelRunResponse { CancelRunResponse { schema: None, - run: Box::new(run), + run, } } } diff --git a/crates/tower-api/src/models/catalog.rs b/crates/tower-api/src/models/catalog.rs index b40c13fa..2654ddb8 100644 --- a/crates/tower-api/src/models/catalog.rs +++ b/crates/tower-api/src/models/catalog.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Catalog { @@ -21,20 +21,21 @@ pub struct Catalog { pub name: String, #[serde(rename = "properties")] pub properties: Vec, - #[serde(rename = "slug")] - pub slug: String, + /// This property is deprecated. Please use name instead. + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, #[serde(rename = "type")] pub r#type: String, } impl Catalog { - pub fn new(created_at: String, environment: String, name: String, properties: Vec, slug: String, r#type: String) -> Catalog { + pub fn new(created_at: String, environment: String, name: String, properties: Vec, r#type: String) -> Catalog { Catalog { created_at, environment, name, properties, - slug, + slug: None, r#type, } } diff --git a/crates/tower-api/src/models/catalog_property.rs b/crates/tower-api/src/models/catalog_property.rs index 36406b7a..32d23ef2 100644 --- a/crates/tower-api/src/models/catalog_property.rs +++ b/crates/tower-api/src/models/catalog_property.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CatalogProperty { diff --git a/crates/tower-api/src/models/claim_device_login_ticket_params.rs b/crates/tower-api/src/models/claim_device_login_ticket_params.rs index 9b1246eb..8f60c19b 100644 --- a/crates/tower-api/src/models/claim_device_login_ticket_params.rs +++ b/crates/tower-api/src/models/claim_device_login_ticket_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ClaimDeviceLoginTicketParams { diff --git a/crates/tower-api/src/models/claim_device_login_ticket_response.rs b/crates/tower-api/src/models/claim_device_login_ticket_response.rs index 5a0a32f9..07d247af 100644 --- a/crates/tower-api/src/models/claim_device_login_ticket_response.rs +++ b/crates/tower-api/src/models/claim_device_login_ticket_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ClaimDeviceLoginTicketResponse { diff --git a/crates/tower-api/src/models/create_account_params.rs b/crates/tower-api/src/models/create_account_params.rs index f40e4487..958d56c9 100644 --- a/crates/tower-api/src/models/create_account_params.rs +++ b/crates/tower-api/src/models/create_account_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAccountParams { diff --git a/crates/tower-api/src/models/create_account_params_flags_struct.rs b/crates/tower-api/src/models/create_account_params_flags_struct.rs index 8312c165..a71ee086 100644 --- a/crates/tower-api/src/models/create_account_params_flags_struct.rs +++ b/crates/tower-api/src/models/create_account_params_flags_struct.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAccountParamsFlagsStruct { diff --git a/crates/tower-api/src/models/create_account_response.rs b/crates/tower-api/src/models/create_account_response.rs index c902240d..de4c86cc 100644 --- a/crates/tower-api/src/models/create_account_response.rs +++ b/crates/tower-api/src/models/create_account_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAccountResponse { @@ -17,14 +17,14 @@ pub struct CreateAccountResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl CreateAccountResponse { pub fn new(session: models::Session) -> CreateAccountResponse { CreateAccountResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/create_api_key_params.rs b/crates/tower-api/src/models/create_api_key_params.rs index d09efa04..57838d09 100644 --- a/crates/tower-api/src/models/create_api_key_params.rs +++ b/crates/tower-api/src/models/create_api_key_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateApiKeyParams { diff --git a/crates/tower-api/src/models/create_api_key_response.rs b/crates/tower-api/src/models/create_api_key_response.rs index 33a518c0..7e789aeb 100644 --- a/crates/tower-api/src/models/create_api_key_response.rs +++ b/crates/tower-api/src/models/create_api_key_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateApiKeyResponse { @@ -18,14 +18,14 @@ pub struct CreateApiKeyResponse { pub schema: Option, /// Created API key #[serde(rename = "api_key")] - pub api_key: Box, + pub api_key: models::ApiKey, } impl CreateApiKeyResponse { pub fn new(api_key: models::ApiKey) -> CreateApiKeyResponse { CreateApiKeyResponse { schema: None, - api_key: Box::new(api_key), + api_key, } } } diff --git a/crates/tower-api/src/models/create_app_params.rs b/crates/tower-api/src/models/create_app_params.rs index 30aed35f..c87259d7 100644 --- a/crates/tower-api/src/models/create_app_params.rs +++ b/crates/tower-api/src/models/create_app_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAppParams { @@ -22,7 +22,7 @@ pub struct CreateAppParams { /// A description of the app. #[serde(rename = "short_description", skip_serializing_if = "Option::is_none")] pub short_description: Option, - /// A slug for the app. + /// The slug of the app. Legacy CLI will send it but we don't need it. #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] pub slug: Option, } diff --git a/crates/tower-api/src/models/create_app_response.rs b/crates/tower-api/src/models/create_app_response.rs index 9e4204c3..4fb240bc 100644 --- a/crates/tower-api/src/models/create_app_response.rs +++ b/crates/tower-api/src/models/create_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAppResponse { @@ -17,14 +17,14 @@ pub struct CreateAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "app")] - pub app: Box, + pub app: models::App, } impl CreateAppResponse { pub fn new(app: models::App) -> CreateAppResponse { CreateAppResponse { schema: None, - app: Box::new(app), + app, } } } diff --git a/crates/tower-api/src/models/create_authenticator_params.rs b/crates/tower-api/src/models/create_authenticator_params.rs index 431a6085..e593e037 100644 --- a/crates/tower-api/src/models/create_authenticator_params.rs +++ b/crates/tower-api/src/models/create_authenticator_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAuthenticatorParams { diff --git a/crates/tower-api/src/models/create_authenticator_response.rs b/crates/tower-api/src/models/create_authenticator_response.rs index 14a288ae..825bce5b 100644 --- a/crates/tower-api/src/models/create_authenticator_response.rs +++ b/crates/tower-api/src/models/create_authenticator_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateAuthenticatorResponse { @@ -17,14 +17,14 @@ pub struct CreateAuthenticatorResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "authenticator")] - pub authenticator: Box, + pub authenticator: models::VerifiedAuthenticator, } impl CreateAuthenticatorResponse { pub fn new(authenticator: models::VerifiedAuthenticator) -> CreateAuthenticatorResponse { CreateAuthenticatorResponse { schema: None, - authenticator: Box::new(authenticator), + authenticator, } } } diff --git a/crates/tower-api/src/models/create_catalog_params.rs b/crates/tower-api/src/models/create_catalog_params.rs index 0db9b0e9..0e222f42 100644 --- a/crates/tower-api/src/models/create_catalog_params.rs +++ b/crates/tower-api/src/models/create_catalog_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateCatalogParams { @@ -22,26 +22,23 @@ pub struct CreateCatalogParams { pub name: String, #[serde(rename = "properties")] pub properties: Vec, - #[serde(rename = "slug")] - pub slug: String, #[serde(rename = "type")] pub r#type: Type, } impl CreateCatalogParams { - pub fn new(environment: String, name: String, properties: Vec, slug: String, r#type: Type) -> CreateCatalogParams { + pub fn new(environment: String, name: String, properties: Vec, r#type: Type) -> CreateCatalogParams { CreateCatalogParams { schema: None, environment, name, properties, - slug, r#type, } } } /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Type { #[serde(rename = "snowflake-open-catalog")] SnowflakeOpenCatalog, @@ -59,3 +56,22 @@ impl Default for Type { } } +impl<'de> Deserialize<'de> for Type { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "snowflake-open-catalog" => Ok(Self::SnowflakeOpenCatalog), + "apache-polaris" => Ok(Self::ApachePolaris), + "cloudflare-r2-catalog" => Ok(Self::CloudflareR2Catalog), + "lakekeeper" => Ok(Self::Lakekeeper), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["snowflake-open-catalog", "apache-polaris", "cloudflare-r2-catalog", "lakekeeper"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/create_catalog_response.rs b/crates/tower-api/src/models/create_catalog_response.rs index a2933430..d45675f2 100644 --- a/crates/tower-api/src/models/create_catalog_response.rs +++ b/crates/tower-api/src/models/create_catalog_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateCatalogResponse { @@ -17,14 +17,14 @@ pub struct CreateCatalogResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "catalog")] - pub catalog: Box, + pub catalog: models::Catalog, } impl CreateCatalogResponse { pub fn new(catalog: models::Catalog) -> CreateCatalogResponse { CreateCatalogResponse { schema: None, - catalog: Box::new(catalog), + catalog, } } } diff --git a/crates/tower-api/src/models/create_device_login_ticket_response.rs b/crates/tower-api/src/models/create_device_login_ticket_response.rs index ff72c19f..5a829451 100644 --- a/crates/tower-api/src/models/create_device_login_ticket_response.rs +++ b/crates/tower-api/src/models/create_device_login_ticket_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateDeviceLoginTicketResponse { diff --git a/crates/tower-api/src/models/create_environment_params.rs b/crates/tower-api/src/models/create_environment_params.rs new file mode 100644 index 00000000..f8ba0792 --- /dev/null +++ b/crates/tower-api/src/models/create_environment_params.rs @@ -0,0 +1,32 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateEnvironmentParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The name of the environment + #[serde(rename = "name")] + pub name: String, +} + +impl CreateEnvironmentParams { + pub fn new(name: String) -> CreateEnvironmentParams { + CreateEnvironmentParams { + schema: None, + name, + } + } +} + diff --git a/crates/tower-api/src/models/create_environment_response.rs b/crates/tower-api/src/models/create_environment_response.rs new file mode 100644 index 00000000..7fb41c81 --- /dev/null +++ b/crates/tower-api/src/models/create_environment_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateEnvironmentResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "environment")] + pub environment: models::Environment, +} + +impl CreateEnvironmentResponse { + pub fn new(environment: models::Environment) -> CreateEnvironmentResponse { + CreateEnvironmentResponse { + schema: None, + environment, + } + } +} + diff --git a/crates/tower-api/src/models/create_password_reset_params.rs b/crates/tower-api/src/models/create_password_reset_params.rs index f61ba78f..761ceebc 100644 --- a/crates/tower-api/src/models/create_password_reset_params.rs +++ b/crates/tower-api/src/models/create_password_reset_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreatePasswordResetParams { diff --git a/crates/tower-api/src/models/create_password_reset_response.rs b/crates/tower-api/src/models/create_password_reset_response.rs index dabee43d..1bfc214f 100644 --- a/crates/tower-api/src/models/create_password_reset_response.rs +++ b/crates/tower-api/src/models/create_password_reset_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreatePasswordResetResponse { diff --git a/crates/tower-api/src/models/create_schedule_params.rs b/crates/tower-api/src/models/create_schedule_params.rs index dddb475e..b51a5ff4 100644 --- a/crates/tower-api/src/models/create_schedule_params.rs +++ b/crates/tower-api/src/models/create_schedule_params.rs @@ -3,28 +3,28 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateScheduleParams { /// 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 name of the app to create a schedule for + #[serde(rename = "app_name")] + pub app_name: 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, + #[serde(rename = "cron")] + pub cron: String, /// The environment to run the app in #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] pub environment: Option, @@ -34,12 +34,12 @@ pub struct CreateScheduleParams { } impl CreateScheduleParams { - pub fn new(app_slug: String, cron_string: String) -> CreateScheduleParams { + pub fn new(app_name: String, cron: String) -> CreateScheduleParams { CreateScheduleParams { schema: None, - app_slug, + app_name, app_version: None, - cron_string, + cron, environment: None, parameters: None, } diff --git a/crates/tower-api/src/models/create_schedule_response.rs b/crates/tower-api/src/models/create_schedule_response.rs index b1cd82e0..5ea8fd97 100644 --- a/crates/tower-api/src/models/create_schedule_response.rs +++ b/crates/tower-api/src/models/create_schedule_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateScheduleResponse { @@ -17,14 +17,14 @@ pub struct CreateScheduleResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "schedule")] - pub schedule: Box, + pub schedule: models::Schedule, } impl CreateScheduleResponse { pub fn new(schedule: models::Schedule) -> CreateScheduleResponse { CreateScheduleResponse { schema: None, - schedule: Box::new(schedule), + schedule, } } } diff --git a/crates/tower-api/src/models/create_secret_params.rs b/crates/tower-api/src/models/create_secret_params.rs index 939b9ea8..19516ee7 100644 --- a/crates/tower-api/src/models/create_secret_params.rs +++ b/crates/tower-api/src/models/create_secret_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSecretParams { diff --git a/crates/tower-api/src/models/create_secret_response.rs b/crates/tower-api/src/models/create_secret_response.rs index 7e1b99f8..e6b4158f 100644 --- a/crates/tower-api/src/models/create_secret_response.rs +++ b/crates/tower-api/src/models/create_secret_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSecretResponse { @@ -17,14 +17,14 @@ pub struct CreateSecretResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "secret")] - pub secret: Box, + pub secret: models::Secret, } impl CreateSecretResponse { pub fn new(secret: models::Secret) -> CreateSecretResponse { CreateSecretResponse { schema: None, - secret: Box::new(secret), + secret, } } } diff --git a/crates/tower-api/src/models/create_session_params.rs b/crates/tower-api/src/models/create_session_params.rs index c2b0abf5..7abc0836 100644 --- a/crates/tower-api/src/models/create_session_params.rs +++ b/crates/tower-api/src/models/create_session_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSessionParams { diff --git a/crates/tower-api/src/models/create_session_response.rs b/crates/tower-api/src/models/create_session_response.rs index 6f93c641..83f42ddf 100644 --- a/crates/tower-api/src/models/create_session_response.rs +++ b/crates/tower-api/src/models/create_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateSessionResponse { @@ -18,14 +18,14 @@ pub struct CreateSessionResponse { pub schema: Option, /// The new session information. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl CreateSessionResponse { pub fn new(session: models::Session) -> CreateSessionResponse { CreateSessionResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/create_team_params.rs b/crates/tower-api/src/models/create_team_params.rs index 11334fec..18c53b19 100644 --- a/crates/tower-api/src/models/create_team_params.rs +++ b/crates/tower-api/src/models/create_team_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateTeamParams { @@ -19,17 +19,13 @@ pub struct CreateTeamParams { /// The name of the team to create #[serde(rename = "name")] pub name: String, - /// The slug of the team to create - #[serde(rename = "slug")] - pub slug: String, } impl CreateTeamParams { - pub fn new(name: String, slug: String) -> CreateTeamParams { + pub fn new(name: String) -> CreateTeamParams { CreateTeamParams { schema: None, name, - slug, } } } diff --git a/crates/tower-api/src/models/create_team_response.rs b/crates/tower-api/src/models/create_team_response.rs index 83431dd6..75bc1bbb 100644 --- a/crates/tower-api/src/models/create_team_response.rs +++ b/crates/tower-api/src/models/create_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateTeamResponse { @@ -18,14 +18,14 @@ pub struct CreateTeamResponse { pub schema: Option, /// The team that was just created #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl CreateTeamResponse { pub fn new(team: models::Team) -> CreateTeamResponse { CreateTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/delete_api_key_params.rs b/crates/tower-api/src/models/delete_api_key_params.rs index f53b1fc3..99cb217a 100644 --- a/crates/tower-api/src/models/delete_api_key_params.rs +++ b/crates/tower-api/src/models/delete_api_key_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteApiKeyParams { diff --git a/crates/tower-api/src/models/delete_api_key_response.rs b/crates/tower-api/src/models/delete_api_key_response.rs index eec85bf4..d89d01ff 100644 --- a/crates/tower-api/src/models/delete_api_key_response.rs +++ b/crates/tower-api/src/models/delete_api_key_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteApiKeyResponse { @@ -18,14 +18,14 @@ pub struct DeleteApiKeyResponse { pub schema: Option, /// Created API key #[serde(rename = "api_key")] - pub api_key: Box, + pub api_key: models::ApiKey, } impl DeleteApiKeyResponse { pub fn new(api_key: models::ApiKey) -> DeleteApiKeyResponse { DeleteApiKeyResponse { schema: None, - api_key: Box::new(api_key), + api_key, } } } diff --git a/crates/tower-api/src/models/delete_app_response.rs b/crates/tower-api/src/models/delete_app_response.rs index b6976af1..af1b2e9f 100644 --- a/crates/tower-api/src/models/delete_app_response.rs +++ b/crates/tower-api/src/models/delete_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteAppResponse { @@ -17,14 +17,14 @@ pub struct DeleteAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "app")] - pub app: Box, + pub app: models::App, } impl DeleteAppResponse { pub fn new(app: models::App) -> DeleteAppResponse { DeleteAppResponse { schema: None, - app: Box::new(app), + app, } } } diff --git a/crates/tower-api/src/models/delete_authenticator_params.rs b/crates/tower-api/src/models/delete_authenticator_params.rs index bae4ded0..efa81d7c 100644 --- a/crates/tower-api/src/models/delete_authenticator_params.rs +++ b/crates/tower-api/src/models/delete_authenticator_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteAuthenticatorParams { diff --git a/crates/tower-api/src/models/delete_authenticator_response.rs b/crates/tower-api/src/models/delete_authenticator_response.rs index c0749bf7..6db18c1f 100644 --- a/crates/tower-api/src/models/delete_authenticator_response.rs +++ b/crates/tower-api/src/models/delete_authenticator_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteAuthenticatorResponse { @@ -17,14 +17,14 @@ pub struct DeleteAuthenticatorResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "authenticator")] - pub authenticator: Box, + pub authenticator: models::VerifiedAuthenticator, } impl DeleteAuthenticatorResponse { pub fn new(authenticator: models::VerifiedAuthenticator) -> DeleteAuthenticatorResponse { DeleteAuthenticatorResponse { schema: None, - authenticator: Box::new(authenticator), + authenticator, } } } diff --git a/crates/tower-api/src/models/delete_catalog_response.rs b/crates/tower-api/src/models/delete_catalog_response.rs index 3af444ec..9334b707 100644 --- a/crates/tower-api/src/models/delete_catalog_response.rs +++ b/crates/tower-api/src/models/delete_catalog_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteCatalogResponse { @@ -17,14 +17,14 @@ pub struct DeleteCatalogResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "catalog")] - pub catalog: Box, + pub catalog: models::Catalog, } impl DeleteCatalogResponse { pub fn new(catalog: models::Catalog) -> DeleteCatalogResponse { DeleteCatalogResponse { schema: None, - catalog: Box::new(catalog), + catalog, } } } diff --git a/crates/tower-api/src/models/delete_schedule_response.rs b/crates/tower-api/src/models/delete_schedule_response.rs index 9a1055a2..f3a909aa 100644 --- a/crates/tower-api/src/models/delete_schedule_response.rs +++ b/crates/tower-api/src/models/delete_schedule_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteScheduleResponse { diff --git a/crates/tower-api/src/models/delete_secret_response.rs b/crates/tower-api/src/models/delete_secret_response.rs index 11b29bfa..04c95e28 100644 --- a/crates/tower-api/src/models/delete_secret_response.rs +++ b/crates/tower-api/src/models/delete_secret_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteSecretResponse { @@ -17,14 +17,14 @@ pub struct DeleteSecretResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "secret")] - pub secret: Box, + pub secret: models::Secret, } impl DeleteSecretResponse { pub fn new(secret: models::Secret) -> DeleteSecretResponse { DeleteSecretResponse { schema: None, - secret: Box::new(secret), + secret, } } } diff --git a/crates/tower-api/src/models/delete_team_invitation_params.rs b/crates/tower-api/src/models/delete_team_invitation_params.rs index d5962539..94cabda2 100644 --- a/crates/tower-api/src/models/delete_team_invitation_params.rs +++ b/crates/tower-api/src/models/delete_team_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamInvitationParams { diff --git a/crates/tower-api/src/models/delete_team_invitation_response.rs b/crates/tower-api/src/models/delete_team_invitation_response.rs index 70b4035d..d01f02f2 100644 --- a/crates/tower-api/src/models/delete_team_invitation_response.rs +++ b/crates/tower-api/src/models/delete_team_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamInvitationResponse { @@ -18,14 +18,14 @@ pub struct DeleteTeamInvitationResponse { pub schema: Option, /// The team invitation that was just removed #[serde(rename = "invitation")] - pub invitation: Box, + pub invitation: models::TeamInvitation, } impl DeleteTeamInvitationResponse { pub fn new(invitation: models::TeamInvitation) -> DeleteTeamInvitationResponse { DeleteTeamInvitationResponse { schema: None, - invitation: Box::new(invitation), + invitation, } } } diff --git a/crates/tower-api/src/models/delete_team_params.rs b/crates/tower-api/src/models/delete_team_params.rs index 1a6d905f..778097e1 100644 --- a/crates/tower-api/src/models/delete_team_params.rs +++ b/crates/tower-api/src/models/delete_team_params.rs @@ -3,29 +3,29 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamParams { /// 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 team to delete - #[serde(rename = "slug")] - pub slug: String, + /// The name of the team to delete + #[serde(rename = "name")] + pub name: String, } impl DeleteTeamParams { - pub fn new(slug: String) -> DeleteTeamParams { + pub fn new(name: String) -> DeleteTeamParams { DeleteTeamParams { schema: None, - slug, + name, } } } diff --git a/crates/tower-api/src/models/delete_team_response.rs b/crates/tower-api/src/models/delete_team_response.rs index 8f5a3960..6fe1066b 100644 --- a/crates/tower-api/src/models/delete_team_response.rs +++ b/crates/tower-api/src/models/delete_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteTeamResponse { @@ -18,14 +18,14 @@ pub struct DeleteTeamResponse { pub schema: Option, /// The team that was just created #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl DeleteTeamResponse { pub fn new(team: models::Team) -> DeleteTeamResponse { DeleteTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/deploy_app_response.rs b/crates/tower-api/src/models/deploy_app_response.rs index 8dd463e6..760fef4d 100644 --- a/crates/tower-api/src/models/deploy_app_response.rs +++ b/crates/tower-api/src/models/deploy_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeployAppResponse { @@ -17,14 +17,14 @@ pub struct DeployAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "version")] - pub version: Box, + pub version: models::AppVersion, } impl DeployAppResponse { pub fn new(version: models::AppVersion) -> DeployAppResponse { DeployAppResponse { schema: None, - version: Box::new(version), + version, } } } diff --git a/crates/tower-api/src/models/describe_app_response.rs b/crates/tower-api/src/models/describe_app_response.rs index 46e551cf..cb9775b5 100644 --- a/crates/tower-api/src/models/describe_app_response.rs +++ b/crates/tower-api/src/models/describe_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeAppResponse { @@ -17,7 +17,7 @@ pub struct DescribeAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "app")] - pub app: Box, + pub app: models::App, #[serde(rename = "runs")] pub runs: Vec, } @@ -26,7 +26,7 @@ impl DescribeAppResponse { pub fn new(app: models::App, runs: Vec) -> DescribeAppResponse { DescribeAppResponse { schema: None, - app: Box::new(app), + app, runs, } } diff --git a/crates/tower-api/src/models/describe_app_version_response.rs b/crates/tower-api/src/models/describe_app_version_response.rs index 350ce54d..77eb955b 100644 --- a/crates/tower-api/src/models/describe_app_version_response.rs +++ b/crates/tower-api/src/models/describe_app_version_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeAppVersionResponse { @@ -17,14 +17,14 @@ pub struct DescribeAppVersionResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "version")] - pub version: Box, + pub version: models::AppVersion, } impl DescribeAppVersionResponse { pub fn new(version: models::AppVersion) -> DescribeAppVersionResponse { DescribeAppVersionResponse { schema: None, - version: Box::new(version), + version, } } } diff --git a/crates/tower-api/src/models/describe_device_login_session_response.rs b/crates/tower-api/src/models/describe_device_login_session_response.rs index 2bb864cc..276d1253 100644 --- a/crates/tower-api/src/models/describe_device_login_session_response.rs +++ b/crates/tower-api/src/models/describe_device_login_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeDeviceLoginSessionResponse { @@ -18,14 +18,14 @@ pub struct DescribeDeviceLoginSessionResponse { pub schema: Option, /// The current session associated with your authentication method. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl DescribeDeviceLoginSessionResponse { pub fn new(session: models::Session) -> DescribeDeviceLoginSessionResponse { DescribeDeviceLoginSessionResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/describe_run_logs_response.rs b/crates/tower-api/src/models/describe_run_logs_response.rs index 22c24f95..ab779807 100644 --- a/crates/tower-api/src/models/describe_run_logs_response.rs +++ b/crates/tower-api/src/models/describe_run_logs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeRunLogsResponse { diff --git a/crates/tower-api/src/models/describe_run_response.rs b/crates/tower-api/src/models/describe_run_response.rs index bd15d01e..c47ecf88 100644 --- a/crates/tower-api/src/models/describe_run_response.rs +++ b/crates/tower-api/src/models/describe_run_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeRunResponse { @@ -17,14 +17,14 @@ pub struct DescribeRunResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl DescribeRunResponse { pub fn new(run: models::Run) -> DescribeRunResponse { DescribeRunResponse { schema: None, - run: Box::new(run), + run, } } } diff --git a/crates/tower-api/src/models/describe_secrets_key_response.rs b/crates/tower-api/src/models/describe_secrets_key_response.rs index 3569323b..b5f5fa14 100644 --- a/crates/tower-api/src/models/describe_secrets_key_response.rs +++ b/crates/tower-api/src/models/describe_secrets_key_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeSecretsKeyResponse { diff --git a/crates/tower-api/src/models/describe_session_response.rs b/crates/tower-api/src/models/describe_session_response.rs index 6cbf7922..5f6ed823 100644 --- a/crates/tower-api/src/models/describe_session_response.rs +++ b/crates/tower-api/src/models/describe_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DescribeSessionResponse { @@ -18,14 +18,14 @@ pub struct DescribeSessionResponse { pub schema: Option, /// The current session associated with your authentication method. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl DescribeSessionResponse { pub fn new(session: models::Session) -> DescribeSessionResponse { DescribeSessionResponse { schema: None, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/encrypted_catalog_property.rs b/crates/tower-api/src/models/encrypted_catalog_property.rs index 4b77672c..d66b21eb 100644 --- a/crates/tower-api/src/models/encrypted_catalog_property.rs +++ b/crates/tower-api/src/models/encrypted_catalog_property.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EncryptedCatalogProperty { diff --git a/crates/tower-api/src/models/environment.rs b/crates/tower-api/src/models/environment.rs new file mode 100644 index 00000000..8c3a9b36 --- /dev/null +++ b/crates/tower-api/src/models/environment.rs @@ -0,0 +1,28 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Environment { + /// The human readable name for the environment + #[serde(rename = "name")] + pub name: String, +} + +impl Environment { + pub fn new(name: String) -> Environment { + Environment { + name, + } + } +} + diff --git a/crates/tower-api/src/models/error_detail.rs b/crates/tower-api/src/models/error_detail.rs index 60df6b40..e9b09217 100644 --- a/crates/tower-api/src/models/error_detail.rs +++ b/crates/tower-api/src/models/error_detail.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorDetail { diff --git a/crates/tower-api/src/models/error_model.rs b/crates/tower-api/src/models/error_model.rs index cfdafa2a..0c6c7ad2 100644 --- a/crates/tower-api/src/models/error_model.rs +++ b/crates/tower-api/src/models/error_model.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorModel { diff --git a/crates/tower-api/src/models/event_error.rs b/crates/tower-api/src/models/event_error.rs new file mode 100644 index 00000000..5b84a63f --- /dev/null +++ b/crates/tower-api/src/models/event_error.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventError { + #[serde(rename = "data")] + pub data: models::SseWarning, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventError { + pub fn new(data: models::SseWarning, event: Event) -> EventError { + EventError { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "error")] + Error, +} + +impl Default for Event { + fn default() -> Event { + Self::Error + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "error" => Ok(Self::Error), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["error"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/event_log.rs b/crates/tower-api/src/models/event_log.rs new file mode 100644 index 00000000..380c0511 --- /dev/null +++ b/crates/tower-api/src/models/event_log.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventLog { + #[serde(rename = "data")] + pub data: models::LogLine, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventLog { + pub fn new(data: models::LogLine, event: Event) -> EventLog { + EventLog { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "log")] + Log, +} + +impl Default for Event { + fn default() -> Event { + Self::Log + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "log" => Ok(Self::Log), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["log"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/event_run_failure_alert.rs b/crates/tower-api/src/models/event_run_failure_alert.rs new file mode 100644 index 00000000..1143d8c1 --- /dev/null +++ b/crates/tower-api/src/models/event_run_failure_alert.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventRunFailureAlert { + #[serde(rename = "data")] + pub data: models::RunFailureAlert, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventRunFailureAlert { + pub fn new(data: models::RunFailureAlert, event: Event) -> EventRunFailureAlert { + EventRunFailureAlert { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "run_failure_alert")] + RunFailureAlert, +} + +impl Default for Event { + fn default() -> Event { + Self::RunFailureAlert + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "run_failure_alert" => Ok(Self::RunFailureAlert), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["run_failure_alert"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/event_warning.rs b/crates/tower-api/src/models/event_warning.rs new file mode 100644 index 00000000..30d3b160 --- /dev/null +++ b/crates/tower-api/src/models/event_warning.rs @@ -0,0 +1,67 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventWarning { + #[serde(rename = "data")] + pub data: models::SseWarning, + /// The event name. + #[serde(rename = "event")] + pub event: Event, + /// The event ID. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The retry time in milliseconds. + #[serde(rename = "retry", skip_serializing_if = "Option::is_none")] + pub retry: Option, +} + +impl EventWarning { + pub fn new(data: models::SseWarning, event: Event) -> EventWarning { + EventWarning { + data, + event, + id: None, + retry: None, + } + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "warning")] + Warning, +} + +impl Default for Event { + fn default() -> Event { + Self::Warning + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "warning" => Ok(Self::Warning), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["warning"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/export_catalogs_params.rs b/crates/tower-api/src/models/export_catalogs_params.rs index 79edcf72..9eed5f3e 100644 --- a/crates/tower-api/src/models/export_catalogs_params.rs +++ b/crates/tower-api/src/models/export_catalogs_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportCatalogsParams { diff --git a/crates/tower-api/src/models/export_catalogs_response.rs b/crates/tower-api/src/models/export_catalogs_response.rs index c6f2755e..20c07993 100644 --- a/crates/tower-api/src/models/export_catalogs_response.rs +++ b/crates/tower-api/src/models/export_catalogs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportCatalogsResponse { @@ -19,7 +19,7 @@ pub struct ExportCatalogsResponse { #[serde(rename = "catalogs")] pub catalogs: Vec, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ExportCatalogsResponse { @@ -27,7 +27,7 @@ impl ExportCatalogsResponse { ExportCatalogsResponse { schema: None, catalogs, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/export_secrets_params.rs b/crates/tower-api/src/models/export_secrets_params.rs index e747fa06..fa10763b 100644 --- a/crates/tower-api/src/models/export_secrets_params.rs +++ b/crates/tower-api/src/models/export_secrets_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportSecretsParams { diff --git a/crates/tower-api/src/models/export_secrets_response.rs b/crates/tower-api/src/models/export_secrets_response.rs index 8ed70ac5..556f8d28 100644 --- a/crates/tower-api/src/models/export_secrets_response.rs +++ b/crates/tower-api/src/models/export_secrets_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportSecretsResponse { @@ -17,7 +17,7 @@ pub struct ExportSecretsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "secrets")] pub secrets: Vec, } @@ -26,7 +26,7 @@ impl ExportSecretsResponse { pub fn new(pages: models::Pagination, secrets: Vec) -> ExportSecretsResponse { ExportSecretsResponse { schema: None, - pages: Box::new(pages), + pages, secrets, } } diff --git a/crates/tower-api/src/models/exported_catalog.rs b/crates/tower-api/src/models/exported_catalog.rs index 9a234cb5..4df878ad 100644 --- a/crates/tower-api/src/models/exported_catalog.rs +++ b/crates/tower-api/src/models/exported_catalog.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportedCatalog { @@ -21,20 +21,21 @@ pub struct ExportedCatalog { pub name: String, #[serde(rename = "properties")] pub properties: Vec, - #[serde(rename = "slug")] - pub slug: String, + /// This property is deprecated. Please use name instead. + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, #[serde(rename = "type")] pub r#type: String, } impl ExportedCatalog { - pub fn new(created_at: String, environment: String, name: String, properties: Vec, slug: String, r#type: String) -> ExportedCatalog { + pub fn new(created_at: String, environment: String, name: String, properties: Vec, r#type: String) -> ExportedCatalog { ExportedCatalog { created_at, environment, name, properties, - slug, + slug: None, r#type, } } diff --git a/crates/tower-api/src/models/exported_catalog_property.rs b/crates/tower-api/src/models/exported_catalog_property.rs index d3fc0093..af44933c 100644 --- a/crates/tower-api/src/models/exported_catalog_property.rs +++ b/crates/tower-api/src/models/exported_catalog_property.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportedCatalogProperty { diff --git a/crates/tower-api/src/models/exported_secret.rs b/crates/tower-api/src/models/exported_secret.rs index 80d78b8f..19b11890 100644 --- a/crates/tower-api/src/models/exported_secret.rs +++ b/crates/tower-api/src/models/exported_secret.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportedSecret { diff --git a/crates/tower-api/src/models/featurebase_identity.rs b/crates/tower-api/src/models/featurebase_identity.rs index 1b5d82dd..ca53329c 100644 --- a/crates/tower-api/src/models/featurebase_identity.rs +++ b/crates/tower-api/src/models/featurebase_identity.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FeaturebaseIdentity { diff --git a/crates/tower-api/src/models/features.rs b/crates/tower-api/src/models/features.rs new file mode 100644 index 00000000..a3133073 --- /dev/null +++ b/crates/tower-api/src/models/features.rs @@ -0,0 +1,44 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Features { + /// Whether self-hosted runners are enabled + #[serde(rename = "has_self_hosted_runners", skip_serializing_if = "Option::is_none")] + pub has_self_hosted_runners: Option, + /// The number of apps that can be created + #[serde(rename = "num_apps", skip_serializing_if = "Option::is_none")] + pub num_apps: Option, + /// The number of minutes that can be used for free per month + #[serde(rename = "num_minutes", skip_serializing_if = "Option::is_none")] + pub num_minutes: Option, + /// The number of schedules that can be created + #[serde(rename = "num_schedules", skip_serializing_if = "Option::is_none")] + pub num_schedules: Option, + /// The number of team members that can be added + #[serde(rename = "num_team_members", skip_serializing_if = "Option::is_none")] + pub num_team_members: Option, +} + +impl Features { + pub fn new() -> Features { + Features { + has_self_hosted_runners: None, + num_apps: None, + num_minutes: None, + num_schedules: None, + num_team_members: None, + } + } +} + diff --git a/crates/tower-api/src/models/generate_app_statistics_response.rs b/crates/tower-api/src/models/generate_app_statistics_response.rs index 7ea28873..f1dc07f5 100644 --- a/crates/tower-api/src/models/generate_app_statistics_response.rs +++ b/crates/tower-api/src/models/generate_app_statistics_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateAppStatisticsResponse { @@ -17,14 +17,14 @@ pub struct GenerateAppStatisticsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "statistics")] - pub statistics: Box, + pub statistics: models::AppStatistics, } impl GenerateAppStatisticsResponse { pub fn new(statistics: models::AppStatistics) -> GenerateAppStatisticsResponse { GenerateAppStatisticsResponse { schema: None, - statistics: Box::new(statistics), + statistics, } } } diff --git a/crates/tower-api/src/models/generate_authenticator_response.rs b/crates/tower-api/src/models/generate_authenticator_response.rs index cd29b668..1338f0ef 100644 --- a/crates/tower-api/src/models/generate_authenticator_response.rs +++ b/crates/tower-api/src/models/generate_authenticator_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateAuthenticatorResponse { @@ -17,14 +17,14 @@ pub struct GenerateAuthenticatorResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "authenticator")] - pub authenticator: Box, + pub authenticator: models::UnverifiedAuthenticator, } impl GenerateAuthenticatorResponse { pub fn new(authenticator: models::UnverifiedAuthenticator) -> GenerateAuthenticatorResponse { GenerateAuthenticatorResponse { schema: None, - authenticator: Box::new(authenticator), + authenticator, } } } diff --git a/crates/tower-api/src/models/generate_run_statistics_response.rs b/crates/tower-api/src/models/generate_run_statistics_response.rs index 12f4b2e3..750fd78e 100644 --- a/crates/tower-api/src/models/generate_run_statistics_response.rs +++ b/crates/tower-api/src/models/generate_run_statistics_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateRunStatisticsResponse { @@ -19,9 +19,9 @@ pub struct GenerateRunStatisticsResponse { #[serde(rename = "series")] pub series: Vec, #[serde(rename = "settings")] - pub settings: Box, + pub settings: models::StatisticsSettings, #[serde(rename = "stats")] - pub stats: Box, + pub stats: models::RunStatistics, } impl GenerateRunStatisticsResponse { @@ -29,8 +29,8 @@ impl GenerateRunStatisticsResponse { GenerateRunStatisticsResponse { schema: None, series, - settings: Box::new(settings), - stats: Box::new(stats), + settings, + stats, } } } diff --git a/crates/tower-api/src/models/generate_runner_credentials_response.rs b/crates/tower-api/src/models/generate_runner_credentials_response.rs index 2912f2f9..ddb242b5 100644 --- a/crates/tower-api/src/models/generate_runner_credentials_response.rs +++ b/crates/tower-api/src/models/generate_runner_credentials_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateRunnerCredentialsResponse { @@ -17,14 +17,14 @@ pub struct GenerateRunnerCredentialsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "credentials")] - pub credentials: Box, + pub credentials: models::RunnerCredentials, } impl GenerateRunnerCredentialsResponse { pub fn new(credentials: models::RunnerCredentials) -> GenerateRunnerCredentialsResponse { GenerateRunnerCredentialsResponse { schema: None, - credentials: Box::new(credentials), + credentials, } } } diff --git a/crates/tower-api/src/models/invite_team_member_params.rs b/crates/tower-api/src/models/invite_team_member_params.rs index 7fbf894e..0887c0e8 100644 --- a/crates/tower-api/src/models/invite_team_member_params.rs +++ b/crates/tower-api/src/models/invite_team_member_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InviteTeamMemberParams { diff --git a/crates/tower-api/src/models/invite_team_member_response.rs b/crates/tower-api/src/models/invite_team_member_response.rs index 524b85be..6503f744 100644 --- a/crates/tower-api/src/models/invite_team_member_response.rs +++ b/crates/tower-api/src/models/invite_team_member_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InviteTeamMemberResponse { diff --git a/crates/tower-api/src/models/leave_team_response.rs b/crates/tower-api/src/models/leave_team_response.rs index 3457f708..1ce6996e 100644 --- a/crates/tower-api/src/models/leave_team_response.rs +++ b/crates/tower-api/src/models/leave_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LeaveTeamResponse { @@ -18,14 +18,14 @@ pub struct LeaveTeamResponse { pub schema: Option, /// The team that you just left #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl LeaveTeamResponse { pub fn new(team: models::Team) -> LeaveTeamResponse { LeaveTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/list_account_plans_response.rs b/crates/tower-api/src/models/list_account_plans_response.rs new file mode 100644 index 00000000..b2f6d019 --- /dev/null +++ b/crates/tower-api/src/models/list_account_plans_response.rs @@ -0,0 +1,34 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListAccountPlansResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "pages")] + pub pages: models::Pagination, + #[serde(rename = "plans")] + pub plans: Vec, +} + +impl ListAccountPlansResponse { + pub fn new(pages: models::Pagination, plans: Vec) -> ListAccountPlansResponse { + ListAccountPlansResponse { + schema: None, + pages, + plans, + } + } +} + diff --git a/crates/tower-api/src/models/list_alerts_200_response.rs b/crates/tower-api/src/models/list_alerts_200_response.rs index e5483965..1fdf60dc 100644 --- a/crates/tower-api/src/models/list_alerts_200_response.rs +++ b/crates/tower-api/src/models/list_alerts_200_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAlerts200Response { diff --git a/crates/tower-api/src/models/list_alerts_response.rs b/crates/tower-api/src/models/list_alerts_response.rs index 5a5bbb78..2a22a32e 100644 --- a/crates/tower-api/src/models/list_alerts_response.rs +++ b/crates/tower-api/src/models/list_alerts_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAlertsResponse { @@ -21,7 +21,7 @@ pub struct ListAlertsResponse { pub alerts: Vec, /// Pagination information #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ListAlertsResponse { @@ -29,7 +29,7 @@ impl ListAlertsResponse { ListAlertsResponse { schema: None, alerts, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/list_api_keys_response.rs b/crates/tower-api/src/models/list_api_keys_response.rs index c0d186c9..7ac17841 100644 --- a/crates/tower-api/src/models/list_api_keys_response.rs +++ b/crates/tower-api/src/models/list_api_keys_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListApiKeysResponse { diff --git a/crates/tower-api/src/models/list_app_environments_response.rs b/crates/tower-api/src/models/list_app_environments_response.rs index 31eefa68..32783a2c 100644 --- a/crates/tower-api/src/models/list_app_environments_response.rs +++ b/crates/tower-api/src/models/list_app_environments_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAppEnvironmentsResponse { diff --git a/crates/tower-api/src/models/list_app_versions_response.rs b/crates/tower-api/src/models/list_app_versions_response.rs index 94cf84e5..fae16f65 100644 --- a/crates/tower-api/src/models/list_app_versions_response.rs +++ b/crates/tower-api/src/models/list_app_versions_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAppVersionsResponse { diff --git a/crates/tower-api/src/models/list_apps_response.rs b/crates/tower-api/src/models/list_apps_response.rs index 864ece97..792473d3 100644 --- a/crates/tower-api/src/models/list_apps_response.rs +++ b/crates/tower-api/src/models/list_apps_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAppsResponse { @@ -19,7 +19,7 @@ pub struct ListAppsResponse { #[serde(rename = "apps")] pub apps: Vec, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ListAppsResponse { @@ -27,7 +27,7 @@ impl ListAppsResponse { ListAppsResponse { schema: None, apps, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/list_authenticators_response.rs b/crates/tower-api/src/models/list_authenticators_response.rs index 7d32e59b..caed34d0 100644 --- a/crates/tower-api/src/models/list_authenticators_response.rs +++ b/crates/tower-api/src/models/list_authenticators_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListAuthenticatorsResponse { diff --git a/crates/tower-api/src/models/list_catalogs_response.rs b/crates/tower-api/src/models/list_catalogs_response.rs index 849d7e8c..8cf6df9f 100644 --- a/crates/tower-api/src/models/list_catalogs_response.rs +++ b/crates/tower-api/src/models/list_catalogs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListCatalogsResponse { @@ -19,7 +19,7 @@ pub struct ListCatalogsResponse { #[serde(rename = "catalogs")] pub catalogs: Vec, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, } impl ListCatalogsResponse { @@ -27,7 +27,7 @@ impl ListCatalogsResponse { ListCatalogsResponse { schema: None, catalogs, - pages: Box::new(pages), + pages, } } } diff --git a/crates/tower-api/src/models/list_environments_response.rs b/crates/tower-api/src/models/list_environments_response.rs new file mode 100644 index 00000000..0b038169 --- /dev/null +++ b/crates/tower-api/src/models/list_environments_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ListEnvironmentsResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "environments")] + pub environments: Vec, +} + +impl ListEnvironmentsResponse { + pub fn new(environments: Vec) -> ListEnvironmentsResponse { + ListEnvironmentsResponse { + schema: None, + environments, + } + } +} + diff --git a/crates/tower-api/src/models/list_my_team_invitations_response.rs b/crates/tower-api/src/models/list_my_team_invitations_response.rs index 033f692d..e32d41ae 100644 --- a/crates/tower-api/src/models/list_my_team_invitations_response.rs +++ b/crates/tower-api/src/models/list_my_team_invitations_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListMyTeamInvitationsResponse { diff --git a/crates/tower-api/src/models/list_runs_response.rs b/crates/tower-api/src/models/list_runs_response.rs index 36596077..c2e33c4d 100644 --- a/crates/tower-api/src/models/list_runs_response.rs +++ b/crates/tower-api/src/models/list_runs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListRunsResponse { @@ -17,7 +17,7 @@ pub struct ListRunsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "runs")] pub runs: Vec, } @@ -26,7 +26,7 @@ impl ListRunsResponse { pub fn new(pages: models::Pagination, runs: Vec) -> ListRunsResponse { ListRunsResponse { schema: None, - pages: Box::new(pages), + pages, runs, } } diff --git a/crates/tower-api/src/models/list_schedules_response.rs b/crates/tower-api/src/models/list_schedules_response.rs index e6aae0cc..adb63697 100644 --- a/crates/tower-api/src/models/list_schedules_response.rs +++ b/crates/tower-api/src/models/list_schedules_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListSchedulesResponse { @@ -17,7 +17,7 @@ pub struct ListSchedulesResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "schedules")] pub schedules: Vec, } @@ -26,7 +26,7 @@ impl ListSchedulesResponse { pub fn new(pages: models::Pagination, schedules: Vec) -> ListSchedulesResponse { ListSchedulesResponse { schema: None, - pages: Box::new(pages), + pages, schedules, } } diff --git a/crates/tower-api/src/models/list_secret_environments_response.rs b/crates/tower-api/src/models/list_secret_environments_response.rs index 84604ea9..c2d5c573 100644 --- a/crates/tower-api/src/models/list_secret_environments_response.rs +++ b/crates/tower-api/src/models/list_secret_environments_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListSecretEnvironmentsResponse { diff --git a/crates/tower-api/src/models/list_secrets_response.rs b/crates/tower-api/src/models/list_secrets_response.rs index 29c97b7b..e7f01b50 100644 --- a/crates/tower-api/src/models/list_secrets_response.rs +++ b/crates/tower-api/src/models/list_secrets_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListSecretsResponse { @@ -17,7 +17,7 @@ pub struct ListSecretsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "secrets")] pub secrets: Vec, } @@ -26,7 +26,7 @@ impl ListSecretsResponse { pub fn new(pages: models::Pagination, secrets: Vec) -> ListSecretsResponse { ListSecretsResponse { schema: None, - pages: Box::new(pages), + pages, secrets, } } diff --git a/crates/tower-api/src/models/list_team_invitations_response.rs b/crates/tower-api/src/models/list_team_invitations_response.rs index bdbcd10a..4d29b120 100644 --- a/crates/tower-api/src/models/list_team_invitations_response.rs +++ b/crates/tower-api/src/models/list_team_invitations_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListTeamInvitationsResponse { diff --git a/crates/tower-api/src/models/list_team_members_response.rs b/crates/tower-api/src/models/list_team_members_response.rs index 2cc6738b..189e74db 100644 --- a/crates/tower-api/src/models/list_team_members_response.rs +++ b/crates/tower-api/src/models/list_team_members_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListTeamMembersResponse { diff --git a/crates/tower-api/src/models/list_teams_response.rs b/crates/tower-api/src/models/list_teams_response.rs index cd6dc971..f1a6dea6 100644 --- a/crates/tower-api/src/models/list_teams_response.rs +++ b/crates/tower-api/src/models/list_teams_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ListTeamsResponse { diff --git a/crates/tower-api/src/models/log_line.rs b/crates/tower-api/src/models/log_line.rs index eef729aa..895d5f8c 100644 --- a/crates/tower-api/src/models/log_line.rs +++ b/crates/tower-api/src/models/log_line.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LogLine { @@ -42,7 +42,7 @@ impl LogLine { } } /// The channel (either Program or Setup) this log line belongs to. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Channel { #[serde(rename = "program")] Program, @@ -56,3 +56,20 @@ impl Default for Channel { } } +impl<'de> Deserialize<'de> for Channel { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "program" => Ok(Self::Program), + "setup" => Ok(Self::Setup), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["program", "setup"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/mod.rs b/crates/tower-api/src/models/mod.rs index d129d5ce..7bafa55c 100644 --- a/crates/tower-api/src/models/mod.rs +++ b/crates/tower-api/src/models/mod.rs @@ -54,6 +54,10 @@ pub mod create_catalog_response; pub use self::create_catalog_response::CreateCatalogResponse; pub mod create_device_login_ticket_response; pub use self::create_device_login_ticket_response::CreateDeviceLoginTicketResponse; +pub mod create_environment_params; +pub use self::create_environment_params::CreateEnvironmentParams; +pub mod create_environment_response; +pub use self::create_environment_response::CreateEnvironmentResponse; pub mod create_password_reset_params; pub use self::create_password_reset_params::CreatePasswordResetParams; pub mod create_password_reset_response; @@ -116,10 +120,20 @@ pub mod describe_session_response; pub use self::describe_session_response::DescribeSessionResponse; pub mod encrypted_catalog_property; pub use self::encrypted_catalog_property::EncryptedCatalogProperty; +pub mod environment; +pub use self::environment::Environment; pub mod error_detail; pub use self::error_detail::ErrorDetail; pub mod error_model; pub use self::error_model::ErrorModel; +pub mod event_error; +pub use self::event_error::EventError; +pub mod event_log; +pub use self::event_log::EventLog; +pub mod event_run_failure_alert; +pub use self::event_run_failure_alert::EventRunFailureAlert; +pub mod event_warning; +pub use self::event_warning::EventWarning; pub mod export_catalogs_params; pub use self::export_catalogs_params::ExportCatalogsParams; pub mod export_catalogs_response; @@ -136,6 +150,8 @@ pub mod exported_secret; pub use self::exported_secret::ExportedSecret; pub mod featurebase_identity; pub use self::featurebase_identity::FeaturebaseIdentity; +pub mod features; +pub use self::features::Features; pub mod generate_app_statistics_response; pub use self::generate_app_statistics_response::GenerateAppStatisticsResponse; pub mod generate_authenticator_response; @@ -150,6 +166,8 @@ pub mod invite_team_member_response; pub use self::invite_team_member_response::InviteTeamMemberResponse; pub mod leave_team_response; pub use self::leave_team_response::LeaveTeamResponse; +pub mod list_account_plans_response; +pub use self::list_account_plans_response::ListAccountPlansResponse; pub mod list_alerts_200_response; pub use self::list_alerts_200_response::ListAlerts200Response; pub mod list_alerts_response; @@ -166,6 +184,8 @@ pub mod list_authenticators_response; pub use self::list_authenticators_response::ListAuthenticatorsResponse; pub mod list_catalogs_response; pub use self::list_catalogs_response::ListCatalogsResponse; +pub mod list_environments_response; +pub use self::list_environments_response::ListEnvironmentsResponse; pub mod list_my_team_invitations_response; pub use self::list_my_team_invitations_response::ListMyTeamInvitationsResponse; pub mod list_runs_response; @@ -188,6 +208,8 @@ pub mod pagination; pub use self::pagination::Pagination; pub mod parameter; pub use self::parameter::Parameter; +pub mod plan; +pub use self::plan::Plan; pub mod refresh_session_params; pub use self::refresh_session_params::RefreshSessionParams; pub mod refresh_session_response; @@ -244,10 +266,10 @@ pub mod token; pub use self::token::Token; pub mod unverified_authenticator; pub use self::unverified_authenticator::UnverifiedAuthenticator; -pub mod update_account_slug_params; -pub use self::update_account_slug_params::UpdateAccountSlugParams; -pub mod update_account_slug_response; -pub use self::update_account_slug_response::UpdateAccountSlugResponse; +pub mod update_account_name_params; +pub use self::update_account_name_params::UpdateAccountNameParams; +pub mod update_account_name_response; +pub use self::update_account_name_response::UpdateAccountNameResponse; pub mod update_app_params; pub use self::update_app_params::UpdateAppParams; pub mod update_app_response; @@ -256,6 +278,10 @@ pub mod update_catalog_params; pub use self::update_catalog_params::UpdateCatalogParams; pub mod update_catalog_response; pub use self::update_catalog_response::UpdateCatalogResponse; +pub mod update_environment_params; +pub use self::update_environment_params::UpdateEnvironmentParams; +pub mod update_environment_response; +pub use self::update_environment_response::UpdateEnvironmentResponse; pub mod update_my_team_invitation_params; pub use self::update_my_team_invitation_params::UpdateMyTeamInvitationParams; pub mod update_my_team_invitation_response; @@ -264,6 +290,10 @@ pub mod update_password_reset_params; pub use self::update_password_reset_params::UpdatePasswordResetParams; pub mod update_password_reset_response; pub use self::update_password_reset_response::UpdatePasswordResetResponse; +pub mod update_plan_params; +pub use self::update_plan_params::UpdatePlanParams; +pub mod update_plan_response; +pub use self::update_plan_response::UpdatePlanResponse; pub mod update_schedule_params; pub use self::update_schedule_params::UpdateScheduleParams; pub mod update_schedule_response; diff --git a/crates/tower-api/src/models/pagination.rs b/crates/tower-api/src/models/pagination.rs index 4ded98b1..5585f050 100644 --- a/crates/tower-api/src/models/pagination.rs +++ b/crates/tower-api/src/models/pagination.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pagination { diff --git a/crates/tower-api/src/models/parameter.rs b/crates/tower-api/src/models/parameter.rs index d9481d59..a6451786 100644 --- a/crates/tower-api/src/models/parameter.rs +++ b/crates/tower-api/src/models/parameter.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Parameter { diff --git a/crates/tower-api/src/models/plan.rs b/crates/tower-api/src/models/plan.rs new file mode 100644 index 00000000..151c540c --- /dev/null +++ b/crates/tower-api/src/models/plan.rs @@ -0,0 +1,48 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Plan { + #[serde(rename = "account_id")] + pub account_id: String, + #[serde(rename = "base_plan_name")] + pub base_plan_name: String, + #[serde(rename = "created_at")] + pub created_at: String, + #[serde(rename = "end_at", skip_serializing_if = "Option::is_none")] + pub end_at: Option, + #[serde(rename = "features")] + pub features: models::Features, + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "start_at")] + pub start_at: String, + #[serde(rename = "status")] + pub status: String, +} + +impl Plan { + pub fn new(account_id: String, base_plan_name: String, created_at: String, features: models::Features, id: String, start_at: String, status: String) -> Plan { + Plan { + account_id, + base_plan_name, + created_at, + end_at: None, + features, + id, + start_at, + status, + } + } +} + diff --git a/crates/tower-api/src/models/refresh_session_params.rs b/crates/tower-api/src/models/refresh_session_params.rs index 8ef40907..49d6cf1a 100644 --- a/crates/tower-api/src/models/refresh_session_params.rs +++ b/crates/tower-api/src/models/refresh_session_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RefreshSessionParams { diff --git a/crates/tower-api/src/models/refresh_session_response.rs b/crates/tower-api/src/models/refresh_session_response.rs index 7ad25d0e..79375a92 100644 --- a/crates/tower-api/src/models/refresh_session_response.rs +++ b/crates/tower-api/src/models/refresh_session_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RefreshSessionResponse { @@ -21,7 +21,7 @@ pub struct RefreshSessionResponse { pub refreshed_at: String, /// Refresh the current session and return the updated session information. #[serde(rename = "session")] - pub session: Box, + pub session: models::Session, } impl RefreshSessionResponse { @@ -29,7 +29,7 @@ impl RefreshSessionResponse { RefreshSessionResponse { schema: None, refreshed_at, - session: Box::new(session), + session, } } } diff --git a/crates/tower-api/src/models/remove_team_member_params.rs b/crates/tower-api/src/models/remove_team_member_params.rs index 8c2e71f3..f92f57c5 100644 --- a/crates/tower-api/src/models/remove_team_member_params.rs +++ b/crates/tower-api/src/models/remove_team_member_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RemoveTeamMemberParams { diff --git a/crates/tower-api/src/models/remove_team_member_response.rs b/crates/tower-api/src/models/remove_team_member_response.rs index 43eabd5d..838a1e17 100644 --- a/crates/tower-api/src/models/remove_team_member_response.rs +++ b/crates/tower-api/src/models/remove_team_member_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RemoveTeamMemberResponse { @@ -18,14 +18,14 @@ pub struct RemoveTeamMemberResponse { pub schema: Option, /// The team member that was just removed #[serde(rename = "team_member")] - pub team_member: Box, + pub team_member: models::User, } impl RemoveTeamMemberResponse { pub fn new(team_member: models::User) -> RemoveTeamMemberResponse { RemoveTeamMemberResponse { schema: None, - team_member: Box::new(team_member), + team_member, } } } diff --git a/crates/tower-api/src/models/resend_team_invitation_params.rs b/crates/tower-api/src/models/resend_team_invitation_params.rs index d18acd6c..4e9e1616 100644 --- a/crates/tower-api/src/models/resend_team_invitation_params.rs +++ b/crates/tower-api/src/models/resend_team_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ResendTeamInvitationParams { diff --git a/crates/tower-api/src/models/resend_team_invitation_response.rs b/crates/tower-api/src/models/resend_team_invitation_response.rs index e2ff4171..9106bd81 100644 --- a/crates/tower-api/src/models/resend_team_invitation_response.rs +++ b/crates/tower-api/src/models/resend_team_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ResendTeamInvitationResponse { @@ -18,14 +18,14 @@ pub struct ResendTeamInvitationResponse { pub schema: Option, /// The team invitations that were resent #[serde(rename = "team_invitation")] - pub team_invitation: Box, + pub team_invitation: models::TeamInvitation, } impl ResendTeamInvitationResponse { pub fn new(team_invitation: models::TeamInvitation) -> ResendTeamInvitationResponse { ResendTeamInvitationResponse { schema: None, - team_invitation: Box::new(team_invitation), + team_invitation, } } } diff --git a/crates/tower-api/src/models/run.rs b/crates/tower-api/src/models/run.rs index 6f715d43..36c76af6 100644 --- a/crates/tower-api/src/models/run.rs +++ b/crates/tower-api/src/models/run.rs @@ -3,20 +3,24 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Run { + /// Link to the run in the Tower UI + #[serde(rename = "$link")] + pub dollar_link: String, #[serde(rename = "app_name")] pub app_name: String, - #[serde(rename = "app_slug")] - pub app_slug: String, + /// This property is deprecated. Please use app_name instead. + #[serde(rename = "app_slug", skip_serializing_if = "Option::is_none")] + pub app_slug: Option, #[serde(rename = "app_version")] pub app_version: String, #[serde(rename = "cancelled_at", deserialize_with = "Option::deserialize")] @@ -48,10 +52,11 @@ pub struct Run { } impl Run { - pub fn new(app_name: String, app_slug: String, app_version: String, cancelled_at: Option, created_at: String, ended_at: Option, environment: String, exit_code: Option, number: i64, parameters: Vec, run_id: String, scheduled_at: String, started_at: Option, status: Status, status_group: StatusGroup) -> Run { + pub fn new(dollar_link: String, app_name: String, app_version: String, cancelled_at: Option, created_at: String, ended_at: Option, environment: String, exit_code: Option, number: i64, parameters: Vec, run_id: String, scheduled_at: String, started_at: Option, status: Status, status_group: StatusGroup) -> Run { Run { + dollar_link, app_name, - app_slug, + app_slug: None, app_version, cancelled_at, created_at, @@ -69,7 +74,7 @@ impl Run { } } /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Status { #[serde(rename = "scheduled")] Scheduled, @@ -92,8 +97,30 @@ impl Default for Status { Self::Scheduled } } + +impl<'de> Deserialize<'de> for Status { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "scheduled" => Ok(Self::Scheduled), + "pending" => Ok(Self::Pending), + "running" => Ok(Self::Running), + "crashed" => Ok(Self::Crashed), + "errored" => Ok(Self::Errored), + "exited" => Ok(Self::Exited), + "cancelled" => Ok(Self::Cancelled), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["scheduled", "pending", "running", "crashed", "errored", "exited", "cancelled"], + )), + } + } +} /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum StatusGroup { #[serde(rename = "successful")] Successful, @@ -109,3 +136,21 @@ impl Default for StatusGroup { } } +impl<'de> Deserialize<'de> for StatusGroup { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "successful" => Ok(Self::Successful), + "failed" => Ok(Self::Failed), + "" => Ok(Self::Empty), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["successful", "failed", ""], + )), + } + } +} + diff --git a/crates/tower-api/src/models/run_app_params.rs b/crates/tower-api/src/models/run_app_params.rs index 1cf9431c..7318fd1c 100644 --- a/crates/tower-api/src/models/run_app_params.rs +++ b/crates/tower-api/src/models/run_app_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunAppParams { diff --git a/crates/tower-api/src/models/run_app_response.rs b/crates/tower-api/src/models/run_app_response.rs index adb58c8a..1d258d7c 100644 --- a/crates/tower-api/src/models/run_app_response.rs +++ b/crates/tower-api/src/models/run_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunAppResponse { @@ -17,14 +17,14 @@ pub struct RunAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl RunAppResponse { pub fn new(run: models::Run) -> RunAppResponse { RunAppResponse { schema: None, - run: Box::new(run), + run, } } } diff --git a/crates/tower-api/src/models/run_failure_alert.rs b/crates/tower-api/src/models/run_failure_alert.rs index b25f4448..e66b1cca 100644 --- a/crates/tower-api/src/models/run_failure_alert.rs +++ b/crates/tower-api/src/models/run_failure_alert.rs @@ -3,29 +3,29 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunFailureAlert { /// App that the failed Run belongs to #[serde(rename = "app")] - pub app: Box, + pub app: models::App, /// Run that failed #[serde(rename = "run")] - pub run: Box, + pub run: models::Run, } impl RunFailureAlert { pub fn new(app: models::App, run: models::Run) -> RunFailureAlert { RunFailureAlert { - app: Box::new(app), - run: Box::new(run), + app, + run, } } } diff --git a/crates/tower-api/src/models/run_log_line.rs b/crates/tower-api/src/models/run_log_line.rs index 5176ece9..4ec656d7 100644 --- a/crates/tower-api/src/models/run_log_line.rs +++ b/crates/tower-api/src/models/run_log_line.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunLogLine { diff --git a/crates/tower-api/src/models/run_parameter.rs b/crates/tower-api/src/models/run_parameter.rs index 1fd4549a..9d716df2 100644 --- a/crates/tower-api/src/models/run_parameter.rs +++ b/crates/tower-api/src/models/run_parameter.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunParameter { diff --git a/crates/tower-api/src/models/run_results.rs b/crates/tower-api/src/models/run_results.rs index cdaaae76..b07c0dc2 100644 --- a/crates/tower-api/src/models/run_results.rs +++ b/crates/tower-api/src/models/run_results.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunResults { diff --git a/crates/tower-api/src/models/run_statistics.rs b/crates/tower-api/src/models/run_statistics.rs index 4e0ef41e..96627061 100644 --- a/crates/tower-api/src/models/run_statistics.rs +++ b/crates/tower-api/src/models/run_statistics.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunStatistics { diff --git a/crates/tower-api/src/models/run_timeseries_point.rs b/crates/tower-api/src/models/run_timeseries_point.rs index 18aa3bba..38c24b8f 100644 --- a/crates/tower-api/src/models/run_timeseries_point.rs +++ b/crates/tower-api/src/models/run_timeseries_point.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunTimeseriesPoint { diff --git a/crates/tower-api/src/models/runner_credentials.rs b/crates/tower-api/src/models/runner_credentials.rs index d750efe4..46ccb00e 100644 --- a/crates/tower-api/src/models/runner_credentials.rs +++ b/crates/tower-api/src/models/runner_credentials.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RunnerCredentials { diff --git a/crates/tower-api/src/models/schedule.rs b/crates/tower-api/src/models/schedule.rs index cd259634..63bd333d 100644 --- a/crates/tower-api/src/models/schedule.rs +++ b/crates/tower-api/src/models/schedule.rs @@ -3,19 +3,19 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Schedule { - /// The slug of the app that will be executed - #[serde(rename = "app_slug")] - pub app_slug: String, + /// The name of the app that will be executed + #[serde(rename = "app_name")] + pub app_name: 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, @@ -34,9 +34,9 @@ pub struct Schedule { } impl Schedule { - pub fn new(app_slug: String, cron: String, environment: String, id: String) -> Schedule { + pub fn new(app_name: String, cron: String, environment: String, id: String) -> Schedule { Schedule { - app_slug, + app_name, app_version: None, cron, environment, diff --git a/crates/tower-api/src/models/search_runs_response.rs b/crates/tower-api/src/models/search_runs_response.rs index f671b7db..a1727ed7 100644 --- a/crates/tower-api/src/models/search_runs_response.rs +++ b/crates/tower-api/src/models/search_runs_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SearchRunsResponse { @@ -17,7 +17,7 @@ pub struct SearchRunsResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "pages")] - pub pages: Box, + pub pages: models::Pagination, #[serde(rename = "runs")] pub runs: Vec, } @@ -26,7 +26,7 @@ impl SearchRunsResponse { pub fn new(pages: models::Pagination, runs: Vec) -> SearchRunsResponse { SearchRunsResponse { schema: None, - pages: Box::new(pages), + pages, runs, } } diff --git a/crates/tower-api/src/models/secret.rs b/crates/tower-api/src/models/secret.rs index 88275bed..ce2359cb 100644 --- a/crates/tower-api/src/models/secret.rs +++ b/crates/tower-api/src/models/secret.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Secret { diff --git a/crates/tower-api/src/models/session.rs b/crates/tower-api/src/models/session.rs index 3703547b..3f9090a8 100644 --- a/crates/tower-api/src/models/session.rs +++ b/crates/tower-api/src/models/session.rs @@ -3,33 +3,33 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Session { #[serde(rename = "featurebase_identity")] - pub featurebase_identity: Box, + pub featurebase_identity: models::FeaturebaseIdentity, #[serde(rename = "teams")] pub teams: Vec, #[serde(rename = "token")] - pub token: Box, + pub token: models::Token, #[serde(rename = "user")] - pub user: Box, + pub user: models::User, } impl Session { pub fn new(featurebase_identity: models::FeaturebaseIdentity, teams: Vec, token: models::Token, user: models::User) -> Session { Session { - featurebase_identity: Box::new(featurebase_identity), + featurebase_identity, teams, - token: Box::new(token), - user: Box::new(user), + token, + user, } } } diff --git a/crates/tower-api/src/models/sse_warning.rs b/crates/tower-api/src/models/sse_warning.rs index 502e367a..33c5f32a 100644 --- a/crates/tower-api/src/models/sse_warning.rs +++ b/crates/tower-api/src/models/sse_warning.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SseWarning { diff --git a/crates/tower-api/src/models/statistics_settings.rs b/crates/tower-api/src/models/statistics_settings.rs index 2a474be3..1b0ab33d 100644 --- a/crates/tower-api/src/models/statistics_settings.rs +++ b/crates/tower-api/src/models/statistics_settings.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct StatisticsSettings { @@ -38,7 +38,7 @@ impl StatisticsSettings { } } /// The interval for the statistics period. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum Interval { #[serde(rename = "daily")] Daily, @@ -52,3 +52,20 @@ impl Default for Interval { } } +impl<'de> Deserialize<'de> for Interval { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "daily" => Ok(Self::Daily), + "hourly" => Ok(Self::Hourly), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["daily", "hourly"], + )), + } + } +} + diff --git a/crates/tower-api/src/models/stream_alerts_200_response_inner.rs b/crates/tower-api/src/models/stream_alerts_200_response_inner.rs index e26e006e..a8ac7329 100644 --- a/crates/tower-api/src/models/stream_alerts_200_response_inner.rs +++ b/crates/tower-api/src/models/stream_alerts_200_response_inner.rs @@ -3,24 +3,52 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum StreamAlerts200ResponseInner { - SseWarning(models::SseWarning), - RunFailureAlert(models::RunFailureAlert), + EventError(models::EventError), + EventRunFailureAlert(models::EventRunFailureAlert), } impl Default for StreamAlerts200ResponseInner { fn default() -> Self { - Self::SseWarning(Default::default()) + Self::EventError(Default::default()) + } +} +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "run_failure_alert")] + RunFailureAlert, +} + +impl Default for Event { + fn default() -> Event { + Self::RunFailureAlert + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "run_failure_alert" => Ok(Self::RunFailureAlert), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["run_failure_alert"], + )), + } } } diff --git a/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs b/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs index 476e16e9..3dbfe984 100644 --- a/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs +++ b/crates/tower-api/src/models/stream_run_logs_200_response_inner.rs @@ -3,38 +3,52 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum StreamRunLogs200ResponseInner { - LogLine(models::LogLine), - SseWarning(models::SseWarning), + EventLog(models::EventLog), + EventWarning(models::EventWarning), } impl Default for StreamRunLogs200ResponseInner { fn default() -> Self { - Self::LogLine(Default::default()) + Self::EventLog(Default::default()) } } -/// The channel (either Program or Setup) this log line belongs to. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Channel { - #[serde(rename = "program")] - Program, - #[serde(rename = "setup")] - Setup, +/// The event name. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] +pub enum Event { + #[serde(rename = "warning")] + Warning, } -impl Default for Channel { - fn default() -> Channel { - Self::Program +impl Default for Event { + fn default() -> Event { + Self::Warning + } +} + +impl<'de> Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + "warning" => Ok(Self::Warning), + _ => Err(serde::de::Error::unknown_variant( + &s, + &["warning"], + )), + } } } diff --git a/crates/tower-api/src/models/team.rs b/crates/tower-api/src/models/team.rs index 5f92a0ef..47db460c 100644 --- a/crates/tower-api/src/models/team.rs +++ b/crates/tower-api/src/models/team.rs @@ -3,32 +3,33 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Team { #[serde(rename = "name")] pub name: String, - #[serde(rename = "slug")] - pub slug: String, + /// This property is deprecated. Please use name instead. + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option>, + pub token: Option, /// The type of team, either 'personal' or 'team'. #[serde(rename = "type")] pub r#type: String, } impl Team { - pub fn new(name: String, slug: String, r#type: String) -> Team { + pub fn new(name: String, r#type: String) -> Team { Team { name, - slug, + slug: None, token: None, r#type, } diff --git a/crates/tower-api/src/models/team_invitation.rs b/crates/tower-api/src/models/team_invitation.rs index 563c599b..e3d757ed 100644 --- a/crates/tower-api/src/models/team_invitation.rs +++ b/crates/tower-api/src/models/team_invitation.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TeamInvitation { @@ -18,7 +18,7 @@ pub struct TeamInvitation { #[serde(rename = "invitation_sent_at")] pub invitation_sent_at: String, #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl TeamInvitation { @@ -26,7 +26,7 @@ impl TeamInvitation { TeamInvitation { email, invitation_sent_at, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/token.rs b/crates/tower-api/src/models/token.rs index 13cab94d..6ae7494a 100644 --- a/crates/tower-api/src/models/token.rs +++ b/crates/tower-api/src/models/token.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Token { diff --git a/crates/tower-api/src/models/unverified_authenticator.rs b/crates/tower-api/src/models/unverified_authenticator.rs index 78bb6b7c..15054d38 100644 --- a/crates/tower-api/src/models/unverified_authenticator.rs +++ b/crates/tower-api/src/models/unverified_authenticator.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UnverifiedAuthenticator { diff --git a/crates/tower-api/src/models/update_account_name_params.rs b/crates/tower-api/src/models/update_account_name_params.rs new file mode 100644 index 00000000..9c6f3286 --- /dev/null +++ b/crates/tower-api/src/models/update_account_name_params.rs @@ -0,0 +1,32 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateAccountNameParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The new name for the account + #[serde(rename = "name")] + pub name: String, +} + +impl UpdateAccountNameParams { + pub fn new(name: String) -> UpdateAccountNameParams { + UpdateAccountNameParams { + schema: None, + name, + } + } +} + diff --git a/crates/tower-api/src/models/update_account_name_response.rs b/crates/tower-api/src/models/update_account_name_response.rs new file mode 100644 index 00000000..9cc9f01d --- /dev/null +++ b/crates/tower-api/src/models/update_account_name_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateAccountNameResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "account")] + pub account: models::Account, +} + +impl UpdateAccountNameResponse { + pub fn new(account: models::Account) -> UpdateAccountNameResponse { + UpdateAccountNameResponse { + schema: None, + account, + } + } +} + 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 a642b8db..39fba629 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.19 + * The version of the OpenAPI document: v0.6.22 * 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 173daebb..93f3a2cd 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.19 + * The version of the OpenAPI document: v0.6.22 * 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 5aeea452..1b692b94 100644 --- a/crates/tower-api/src/models/update_app_params.rs +++ b/crates/tower-api/src/models/update_app_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateAppParams { diff --git a/crates/tower-api/src/models/update_app_response.rs b/crates/tower-api/src/models/update_app_response.rs index e5bdbf2c..4e4faa45 100644 --- a/crates/tower-api/src/models/update_app_response.rs +++ b/crates/tower-api/src/models/update_app_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateAppResponse { @@ -17,14 +17,14 @@ pub struct UpdateAppResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "App")] - pub app: Box, + pub app: models::App, } impl UpdateAppResponse { pub fn new(app: models::App) -> UpdateAppResponse { UpdateAppResponse { schema: None, - app: Box::new(app), + app, } } } diff --git a/crates/tower-api/src/models/update_catalog_params.rs b/crates/tower-api/src/models/update_catalog_params.rs index 6fc3d134..63ffb054 100644 --- a/crates/tower-api/src/models/update_catalog_params.rs +++ b/crates/tower-api/src/models/update_catalog_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateCatalogParams { @@ -19,19 +19,15 @@ pub struct UpdateCatalogParams { /// New environment for the catalog #[serde(rename = "environment")] pub environment: String, - /// New name for the catalog - #[serde(rename = "name")] - pub name: String, #[serde(rename = "properties")] pub properties: Vec, } impl UpdateCatalogParams { - pub fn new(environment: String, name: String, properties: Vec) -> UpdateCatalogParams { + pub fn new(environment: String, properties: Vec) -> UpdateCatalogParams { UpdateCatalogParams { schema: None, environment, - name, properties, } } diff --git a/crates/tower-api/src/models/update_catalog_response.rs b/crates/tower-api/src/models/update_catalog_response.rs index fb281b8e..386ccbb2 100644 --- a/crates/tower-api/src/models/update_catalog_response.rs +++ b/crates/tower-api/src/models/update_catalog_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateCatalogResponse { @@ -17,14 +17,14 @@ pub struct UpdateCatalogResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "catalog")] - pub catalog: Box, + pub catalog: models::Catalog, } impl UpdateCatalogResponse { pub fn new(catalog: models::Catalog) -> UpdateCatalogResponse { UpdateCatalogResponse { schema: None, - catalog: Box::new(catalog), + catalog, } } } diff --git a/crates/tower-api/src/models/update_environment_params.rs b/crates/tower-api/src/models/update_environment_params.rs new file mode 100644 index 00000000..453b6698 --- /dev/null +++ b/crates/tower-api/src/models/update_environment_params.rs @@ -0,0 +1,32 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateEnvironmentParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The desired new name of the environment + #[serde(rename = "new_name")] + pub new_name: String, +} + +impl UpdateEnvironmentParams { + pub fn new(new_name: String) -> UpdateEnvironmentParams { + UpdateEnvironmentParams { + schema: None, + new_name, + } + } +} + diff --git a/crates/tower-api/src/models/update_environment_response.rs b/crates/tower-api/src/models/update_environment_response.rs new file mode 100644 index 00000000..518d9843 --- /dev/null +++ b/crates/tower-api/src/models/update_environment_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateEnvironmentResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "environment")] + pub environment: models::Environment, +} + +impl UpdateEnvironmentResponse { + pub fn new(environment: models::Environment) -> UpdateEnvironmentResponse { + UpdateEnvironmentResponse { + schema: None, + environment, + } + } +} + diff --git a/crates/tower-api/src/models/update_my_team_invitation_params.rs b/crates/tower-api/src/models/update_my_team_invitation_params.rs index aa683e2a..8a7d9458 100644 --- a/crates/tower-api/src/models/update_my_team_invitation_params.rs +++ b/crates/tower-api/src/models/update_my_team_invitation_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateMyTeamInvitationParams { @@ -19,17 +19,17 @@ pub struct UpdateMyTeamInvitationParams { /// Whether or not the invitation was accepted. If false, it's considered rejected. #[serde(rename = "accepted")] pub accepted: bool, - /// The slug of the team invitation to update - #[serde(rename = "slug")] - pub slug: String, + /// The name of the team invitation to update + #[serde(rename = "name")] + pub name: String, } impl UpdateMyTeamInvitationParams { - pub fn new(accepted: bool, slug: String) -> UpdateMyTeamInvitationParams { + pub fn new(accepted: bool, name: String) -> UpdateMyTeamInvitationParams { UpdateMyTeamInvitationParams { schema: None, accepted, - slug, + name, } } } 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 09460498..7a2dccde 100644 --- a/crates/tower-api/src/models/update_my_team_invitation_response.rs +++ b/crates/tower-api/src/models/update_my_team_invitation_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateMyTeamInvitationResponse { diff --git a/crates/tower-api/src/models/update_password_reset_params.rs b/crates/tower-api/src/models/update_password_reset_params.rs index 1505fa2f..53977c70 100644 --- a/crates/tower-api/src/models/update_password_reset_params.rs +++ b/crates/tower-api/src/models/update_password_reset_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdatePasswordResetParams { diff --git a/crates/tower-api/src/models/update_password_reset_response.rs b/crates/tower-api/src/models/update_password_reset_response.rs index c2a2f2f7..30850489 100644 --- a/crates/tower-api/src/models/update_password_reset_response.rs +++ b/crates/tower-api/src/models/update_password_reset_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdatePasswordResetResponse { diff --git a/crates/tower-api/src/models/update_plan_params.rs b/crates/tower-api/src/models/update_plan_params.rs new file mode 100644 index 00000000..72648c48 --- /dev/null +++ b/crates/tower-api/src/models/update_plan_params.rs @@ -0,0 +1,36 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdatePlanParams { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + /// The name of the base plan to use. + #[serde(rename = "base_plan_name")] + pub base_plan_name: String, + /// Optional expiration date for the plan. + #[serde(rename = "end_at", skip_serializing_if = "Option::is_none")] + pub end_at: Option, +} + +impl UpdatePlanParams { + pub fn new(base_plan_name: String) -> UpdatePlanParams { + UpdatePlanParams { + schema: None, + base_plan_name, + end_at: None, + } + } +} + diff --git a/crates/tower-api/src/models/update_plan_response.rs b/crates/tower-api/src/models/update_plan_response.rs new file mode 100644 index 00000000..73ac0012 --- /dev/null +++ b/crates/tower-api/src/models/update_plan_response.rs @@ -0,0 +1,31 @@ +/* + * Tower API + * + * REST API to interact with Tower Services. + * + * The version of the OpenAPI document: v0.6.27 + * Contact: hello@tower.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize, Deserializer}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdatePlanResponse { + /// A URL to the JSON Schema for this object. + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "plan")] + pub plan: models::Plan, +} + +impl UpdatePlanResponse { + pub fn new(plan: models::Plan) -> UpdatePlanResponse { + UpdatePlanResponse { + schema: None, + plan, + } + } +} + diff --git a/crates/tower-api/src/models/update_schedule_params.rs b/crates/tower-api/src/models/update_schedule_params.rs index e63158db..23a870c9 100644 --- a/crates/tower-api/src/models/update_schedule_params.rs +++ b/crates/tower-api/src/models/update_schedule_params.rs @@ -3,22 +3,22 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateScheduleParams { /// 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 name of the app that this schedule runs + #[serde(rename = "app_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub app_name: Option>, /// 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>, @@ -34,10 +34,10 @@ pub struct UpdateScheduleParams { } impl UpdateScheduleParams { - pub fn new(app_slug: String) -> UpdateScheduleParams { + pub fn new() -> UpdateScheduleParams { UpdateScheduleParams { schema: None, - app_slug, + app_name: None, app_version: None, cron: None, environment: None, diff --git a/crates/tower-api/src/models/update_schedule_response.rs b/crates/tower-api/src/models/update_schedule_response.rs index b82997d0..93bd656c 100644 --- a/crates/tower-api/src/models/update_schedule_response.rs +++ b/crates/tower-api/src/models/update_schedule_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateScheduleResponse { @@ -17,14 +17,14 @@ pub struct UpdateScheduleResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "schedule")] - pub schedule: Box, + pub schedule: models::Schedule, } impl UpdateScheduleResponse { pub fn new(schedule: models::Schedule) -> UpdateScheduleResponse { UpdateScheduleResponse { schema: None, - schedule: Box::new(schedule), + schedule, } } } diff --git a/crates/tower-api/src/models/update_secret_params.rs b/crates/tower-api/src/models/update_secret_params.rs index 3af8ac02..448461a1 100644 --- a/crates/tower-api/src/models/update_secret_params.rs +++ b/crates/tower-api/src/models/update_secret_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateSecretParams { diff --git a/crates/tower-api/src/models/update_secret_response.rs b/crates/tower-api/src/models/update_secret_response.rs index 9660200c..4fc33a70 100644 --- a/crates/tower-api/src/models/update_secret_response.rs +++ b/crates/tower-api/src/models/update_secret_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateSecretResponse { @@ -17,14 +17,14 @@ pub struct UpdateSecretResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "secret")] - pub secret: Box, + pub secret: models::Secret, } impl UpdateSecretResponse { pub fn new(secret: models::Secret) -> UpdateSecretResponse { UpdateSecretResponse { schema: None, - secret: Box::new(secret), + secret, } } } diff --git a/crates/tower-api/src/models/update_team_params.rs b/crates/tower-api/src/models/update_team_params.rs index cf606f1f..2503ce5e 100644 --- a/crates/tower-api/src/models/update_team_params.rs +++ b/crates/tower-api/src/models/update_team_params.rs @@ -3,33 +3,29 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTeamParams { /// A URL to the JSON Schema for this object. #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, - /// The name of the team to create. This is optional, if you supply null it will not update the team name. + /// The name of the team to to update. This is optional, if you supply null it will not update the team name. #[serde(rename = "name", deserialize_with = "Option::deserialize")] pub name: Option, - /// The new slug that you want the team to use. This is optional, if you supply null it will not update the slug. - #[serde(rename = "slug", deserialize_with = "Option::deserialize")] - pub slug: Option, } impl UpdateTeamParams { - pub fn new(name: Option, slug: Option) -> UpdateTeamParams { + pub fn new(name: Option) -> UpdateTeamParams { UpdateTeamParams { schema: None, name, - slug, } } } diff --git a/crates/tower-api/src/models/update_team_response.rs b/crates/tower-api/src/models/update_team_response.rs index cb6b9a74..0cfb699e 100644 --- a/crates/tower-api/src/models/update_team_response.rs +++ b/crates/tower-api/src/models/update_team_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTeamResponse { @@ -18,14 +18,14 @@ pub struct UpdateTeamResponse { pub schema: Option, /// The team that was just created #[serde(rename = "team")] - pub team: Box, + pub team: models::Team, } impl UpdateTeamResponse { pub fn new(team: models::Team) -> UpdateTeamResponse { UpdateTeamResponse { schema: None, - team: Box::new(team), + team, } } } diff --git a/crates/tower-api/src/models/update_user_params.rs b/crates/tower-api/src/models/update_user_params.rs index 45443c85..a22dca2e 100644 --- a/crates/tower-api/src/models/update_user_params.rs +++ b/crates/tower-api/src/models/update_user_params.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateUserParams { diff --git a/crates/tower-api/src/models/update_user_response.rs b/crates/tower-api/src/models/update_user_response.rs index 766615f2..cc7e12bf 100644 --- a/crates/tower-api/src/models/update_user_response.rs +++ b/crates/tower-api/src/models/update_user_response.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateUserResponse { @@ -17,14 +17,14 @@ pub struct UpdateUserResponse { #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] pub schema: Option, #[serde(rename = "user")] - pub user: Box, + pub user: models::User, } impl UpdateUserResponse { pub fn new(user: models::User) -> UpdateUserResponse { UpdateUserResponse { schema: None, - user: Box::new(user), + user, } } } diff --git a/crates/tower-api/src/models/user.rs b/crates/tower-api/src/models/user.rs index 6a483fab..d4724aee 100644 --- a/crates/tower-api/src/models/user.rs +++ b/crates/tower-api/src/models/user.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { diff --git a/crates/tower-api/src/models/verified_authenticator.rs b/crates/tower-api/src/models/verified_authenticator.rs index 6fee1fc4..6cc8b86b 100644 --- a/crates/tower-api/src/models/verified_authenticator.rs +++ b/crates/tower-api/src/models/verified_authenticator.rs @@ -3,13 +3,13 @@ * * REST API to interact with Tower Services. * - * The version of the OpenAPI document: v0.6.19 + * The version of the OpenAPI document: v0.6.27 * Contact: hello@tower.dev * Generated by: https://openapi-generator.tech */ use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct VerifiedAuthenticator { diff --git a/crates/tower-cmd/Cargo.toml b/crates/tower-cmd/Cargo.toml index 4a973752..afa661aa 100644 --- a/crates/tower-cmd/Cargo.toml +++ b/crates/tower-cmd/Cargo.toml @@ -12,11 +12,13 @@ cli-table = { workspace = true } colored = { workspace = true } config = { workspace = true } crypto = { workspace = true } +ctrlc = { workspace = true } futures-util = { workspace = true } http = { workspace = true } indicatif = { workspace = true } promptly = { workspace = true } reqwest = { workspace = true } +reqwest-eventsource = { workspace = true } rpassword = { workspace = true } rsa = { workspace = true } serde = { workspace = true } diff --git a/crates/tower-cmd/src/api.rs b/crates/tower-cmd/src/api.rs index 9bed6be2..8930f89d 100644 --- a/crates/tower-cmd/src/api.rs +++ b/crates/tower-cmd/src/api.rs @@ -4,6 +4,10 @@ use http::StatusCode; use std::collections::HashMap; use tower_api::apis::ResponseContent; use tower_telemetry::debug; +use tokio::sync::mpsc; +use reqwest_eventsource::{Event, EventSource}; +use tower_api::apis::configuration; +use futures_util::StreamExt; /// Helper trait to extract the successful response data from API responses pub trait ResponseEntity { @@ -14,11 +18,11 @@ pub trait ResponseEntity { fn extract_data(self) -> Option; } -pub async fn describe_app(config: &Config, slug: &str) -> Result> { +pub async fn describe_app(config: &Config, name: &str) -> Result> { let api_config = &config.into(); let params = tower_api::apis::default_api::DescribeAppParams { - slug: slug.to_string(), + name: name.to_string(), runs: None, start_at: None, end_at: None, @@ -43,47 +47,58 @@ pub async fn list_apps(config: &Config) -> Result Result> { +pub async fn create_app(config: &Config, name: &str, description: &str) -> Result> { let api_config = &config.into(); let params = tower_api::apis::default_api::CreateAppParams { create_app_params: tower_api::models::CreateAppParams{ name: name.to_string(), - slug: Some(slug.to_string()), short_description: Some(description.to_string()), schema: None, + slug: None, }, }; unwrap_api_response(tower_api::apis::default_api::create_app(api_config, params)).await } -pub async fn delete_app(config: &Config, slug: &str) -> Result> { +pub async fn delete_app(config: &Config, name: &str) -> Result> { let api_config = &config.into(); let params = tower_api::apis::default_api::DeleteAppParams { - slug: slug.to_string(), + name: name.to_string(), }; unwrap_api_response(tower_api::apis::default_api::delete_app(api_config, params)).await } -pub async fn describe_run_logs(config: &Config, slug: &str, seq: i64) -> Result> { +pub async fn describe_run(config: &Config, app_name: &str, seq: i64) -> Result> { + let api_config = &config.into(); + + let params = tower_api::apis::default_api::DescribeRunParams { + name: app_name.to_string(), + seq, + }; + + unwrap_api_response(tower_api::apis::default_api::describe_run(api_config, params)).await +} + +pub async fn describe_run_logs(config: &Config, name: &str, seq: i64) -> Result> { let api_config = &config.into(); let params = tower_api::apis::default_api::DescribeRunLogsParams { - slug: slug.to_string(), + name: name.to_string(), seq, }; unwrap_api_response(tower_api::apis::default_api::describe_run_logs(api_config, params)).await } -pub async fn run_app(config: &Config, slug: &str, env: &str, params: HashMap) -> Result> { +pub async fn run_app(config: &Config, name: &str, env: &str, params: HashMap) -> Result> { let api_config = &config.into(); let params = tower_api::apis::default_api::RunAppParams { - slug: slug.to_string(), + name: name.to_string(), run_app_params: tower_api::models::RunAppParams { schema: None, environment: env.to_string(), @@ -205,6 +220,119 @@ pub async fn refresh_session(config: &Config) -> Result for LogStreamError { + fn from(err: reqwest_eventsource::CannotCloneRequestError) -> Self { + debug!("Failed to clone request {:?}", err); + LogStreamError::Unknown + } +} + +async fn drain_run_logs_stream(mut source: EventSource, tx: mpsc::Sender) { + while let Some(event) = source.next().await { + match event { + Ok(reqwest_eventsource::Event::Open) => { + panic!("Received unexpected open event in log stream. This shouldn't happen."); + } + Ok(Event::Message(message)) => { + match message.event.as_str() { + "log" => { + let event_log = serde_json::from_str(&message.data); + + match event_log { + Ok(event) => { + tx.send(LogStreamEvent::EventLog(event)).await.ok(); + }, + Err(err) => { + debug!("Failed to parse log message: {}. Error: {}", message.data, err); + } + }; + }, + "warning" => { + let event_warning = serde_json::from_str(&message.data); + if let Ok(event) = event_warning { + tx.send(LogStreamEvent::EventWarning(event)).await.ok(); + } else { + debug!("Failed to parse warning message: {:?}", message.data); + } + } + _ => { + debug!("Unknown or unsupported log message: {:?}", message); + } + }; + }, + Err(err) => { + debug!("Error in log stream: {}", err); + break; // Exit on error + } + } + } +} + +pub async fn stream_run_logs(config: &Config, app_name: &str, seq: i64) -> Result, LogStreamError> { + let api_config: configuration::Configuration = config.into(); + + // These represent the messages that we'll stream to the client. + let (tx, rx) = mpsc::channel(1); + + // This code is copied from tower-api. Since that code is generated, there's not really a good + // way to share this code between here and the rest of the app. + let name = tower_api::apis::urlencode(app_name); + let uri = format!("{}/apps/{name}/runs/{seq}/logs/stream", api_config.base_path, name=name, seq=seq); + let mut builder = api_config.client.request(reqwest::Method::GET, &uri); + + if let Some(ref user_agent) = api_config.user_agent { + builder = builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + if let Some(ref token) = api_config.bearer_access_token { + builder = builder.bearer_auth(token.to_owned()); + }; + + // Now let's try to open the event source with the server. + let mut source = EventSource::new(builder)?; + + if let Some(event) = source.next().await { + match event { + Ok(Event::Open) => { + tokio::spawn(drain_run_logs_stream(source, tx)); + Ok(rx) + }, + Ok(Event::Message(message)) => { + // This is a bug in the program and should never happen. + panic!("Received message when expected an open event. Message: {:?}", message); + }, + Err(err) => { + match err { + reqwest_eventsource::Error::Transport(e) => { + Err(LogStreamError::Reqwest(e)) + }, + reqwest_eventsource::Error::StreamEnded => { + drop(tx); + Ok(rx) + }, + _ => { + Err(LogStreamError::Unknown) + } + } + } + } + } else { + // If we didn't get an event, we can't stream logs. + Err(LogStreamError::Unknown) + } +} + /// Helper function to handle Tower API responses and extract the relevant data async fn unwrap_api_response(api_call: F) -> Result> where @@ -431,3 +559,14 @@ impl ResponseEntity for tower_api::apis::default_api::DescribeSessionSuccess { } } } + +impl ResponseEntity for tower_api::apis::default_api::DescribeRunSuccess { + type Data = tower_api::models::DescribeRunResponse; + + fn extract_data(self) -> Option { + match self { + Self::Status200(resp) => Some(resp), + Self::UnknownValue(_) => None, + } + } +} diff --git a/crates/tower-cmd/src/apps.rs b/crates/tower-cmd/src/apps.rs index bf2de986..6ad153ef 100644 --- a/crates/tower-cmd/src/apps.rs +++ b/crates/tower-cmd/src/apps.rs @@ -5,6 +5,7 @@ use config::Config; use tower_api::models::Run; use crate::{ + util::dates, output, api, }; @@ -34,14 +35,6 @@ pub fn apps_cmd() -> Command { .required(true) .action(clap::ArgAction::Set), ) - .arg( - Arg::new("slug") - .short('s') - .long("slug") - .value_parser(value_parser!(String)) - .default_value("") - .action(clap::ArgAction::Set), - ) .arg( Arg::new("description") .long("description") @@ -59,19 +52,20 @@ pub fn apps_cmd() -> Command { } pub async fn do_logs(config: Config, cmd: &ArgMatches) { - let (slug, seq) = extract_app_slug_and_run("logs", cmd.subcommand()); + let (name, seq) = extract_app_name_and_run("logs", cmd.subcommand()); - if let Ok(resp) = api::describe_run_logs(&config, &slug, seq).await { + if let Ok(resp) = api::describe_run_logs(&config, &name, seq).await { for line in resp.log_lines { - output::log_line(&line.timestamp, &line.message, output::LogLineType::Remote); + let ts = dates::format_str(&line.timestamp); + output::log_line(&ts, &line.message, output::LogLineType::Remote); } } } pub async fn do_show(config: Config, cmd: &ArgMatches) { - let slug = extract_app_slug("show", cmd.subcommand()); + let name = extract_app_name("show", cmd.subcommand()); - match api::describe_app(&config, &slug).await { + match api::describe_app(&config, &name).await { Ok(app_response) => { let app = app_response.app; let runs = app_response.runs; @@ -190,12 +184,10 @@ pub async fn do_create(config: Config, args: &ArgMatches) { output::die("App name (--name) is required"); }); - let slug = args.get_one::("slug").unwrap(); - let description = args.get_one::("description").unwrap(); let mut spinner = output::spinner("Creating app"); - if let Err(err) = api::create_app(&config, name, slug, description).await { + if let Err(err) = api::create_app(&config, name, description).await { spinner.failure(); output::tower_error(err); } else { @@ -206,10 +198,10 @@ pub async fn do_create(config: Config, args: &ArgMatches) { } pub async fn do_delete(config: Config, cmd: &ArgMatches) { - let slug = extract_app_slug("delete", cmd.subcommand()); + let name = extract_app_name("delete", cmd.subcommand()); let mut spinner = output::spinner("Deleting app"); - if let Err(err) = api::delete_app(&config, &slug).await { + if let Err(err) = api::delete_app(&config, &name).await { spinner.failure(); output::tower_error(err); } else { @@ -218,11 +210,11 @@ pub async fn do_delete(config: Config, cmd: &ArgMatches) { } /// Extract app name and run number from command -fn extract_app_slug_and_run(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> (String, i64) { - if let Some((slug, _)) = cmd { - if let Some((slug, num)) = slug.split_once('#') { +fn extract_app_name_and_run(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> (String, i64) { + if let Some((name, _)) = cmd { + if let Some((name, num)) = name.split_once('#') { return ( - slug.to_string(), + name.to_string(), num.parse::().unwrap_or_else(|_| { output::die("Run number must be an actual number"); }), @@ -232,15 +224,15 @@ fn extract_app_slug_and_run(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> ( let line = format!("Run number is required. Example: tower apps {} #", subcmd); output::die(&line); } - let line = format!("App slug is required. Example: tower apps {} #", subcmd); + let line = format!("App name is required. Example: tower apps {} #", subcmd); output::die(&line) } -fn extract_app_slug(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> String { - if let Some((slug, _)) = cmd { - return slug.to_string(); +fn extract_app_name(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> String { + if let Some((name, _)) = cmd { + return name.to_string(); } - let line = format!("App slug is required. Example: tower apps {} ", subcmd); + let line = format!("App name is required. Example: tower apps {} ", subcmd); output::die(&line); } diff --git a/crates/tower-cmd/src/error.rs b/crates/tower-cmd/src/error.rs index fab554d3..1eb80c67 100644 --- a/crates/tower-cmd/src/error.rs +++ b/crates/tower-cmd/src/error.rs @@ -1,5 +1,6 @@ use snafu::prelude::*; use tower_telemetry::debug; +use tower_api::apis::default_api::DescribeRunError; #[derive(Debug, Snafu)] pub enum Error { @@ -11,6 +12,12 @@ pub enum Error { #[snafu(display("cryptography error"))] CryptographyError, + + #[snafu(display("run completed"))] + RunCompleted, + + #[snafu(display("unknown error"))] + UnknownError, } impl From for Error { @@ -19,3 +26,10 @@ impl From for Error { Self::CryptographyError } } + +impl From> for Error { + fn from(err: tower_api::apis::Error) -> Self { + debug!("API error: {:?}", err); + Self::UnknownError + } +} diff --git a/crates/tower-cmd/src/output.rs b/crates/tower-cmd/src/output.rs index c60a11f0..9b2f9831 100644 --- a/crates/tower-cmd/src/output.rs +++ b/crates/tower-cmd/src/output.rs @@ -87,8 +87,8 @@ pub fn config_error(err: config::Error) { config::Error::MissingRequiredAppField { ref field } => { format!("Missing required app field `{}` in Towerfile", field) } - config::Error::TeamNotFound { ref team_slug } => { - format!("Team with slug `{}` not found!", team_slug) + config::Error::TeamNotFound { ref team_name } => { + format!("Team with name `{}` not found!", team_name) } config::Error::UnknownDescribeSessionValue { value: _ } => { "An error occured while describing the session associated with the JWT you provided. Maybe your CLI is out of date?".to_string() diff --git a/crates/tower-cmd/src/run.rs b/crates/tower-cmd/src/run.rs index f1f72681..12b5e3e0 100644 --- a/crates/tower-cmd/src/run.rs +++ b/crates/tower-cmd/src/run.rs @@ -5,10 +5,15 @@ use std::path::PathBuf; use tower_package::{Package, PackageSpec}; use tower_runtime::{local::LocalApp, App, AppLauncher, OutputReceiver}; use tower_telemetry::{Context, debug}; +use tower_api::models::Run; -use tokio::sync::mpsc::unbounded_channel; +use tokio::sync::{ + oneshot::self, + mpsc::unbounded_channel, +}; use crate::{ + util::dates, output, api, Error, @@ -20,7 +25,6 @@ pub fn run_cmd() -> Command { .arg( Arg::new("dir") .long("dir") - .short('d') .help("The directory containing the Towerfile") .default_value("."), ) @@ -33,8 +37,8 @@ pub fn run_cmd() -> Command { ) .arg( Arg::new("environment") - .short('e') .long("environment") + .short('e') .help("The environment to invoke the app in") .default_value("default"), ) @@ -45,6 +49,13 @@ pub fn run_cmd() -> Command { .help("Parameters (key=value) to pass to the app") .action(clap::ArgAction::Append), ) + .arg( + Arg::new("detached") + .long("detached") + .short('d') + .help("Don't follow the run output in your CLI") + .action(clap::ArgAction::SetTrue), + ) .about("Run your code in Tower or locally") } @@ -73,7 +84,8 @@ pub async fn do_run(config: Config, args: &ArgMatches, cmd: Option<(&str, &ArgMa do_run_local(config, path, env, params).await; } } else { - do_run_remote(config, path, env, params, app_name).await; + let follow = should_follow_run(args); + do_run_remote(config, path, env, params, app_name, follow).await; } } Err(err) => { @@ -169,6 +181,7 @@ async fn do_run_remote( env: &str, params: HashMap, app_name: Option, + should_follow_run: bool, ) { let app_slug = app_name.unwrap_or_else(|| { // Load the Towerfile @@ -188,15 +201,103 @@ async fn do_run_remote( Ok(res) => { spinner.success(); - let line = format!( - "Run #{} for app `{}` has been scheduled", - res.run.number, app_slug - ); - output::success(&line); + let run = res.run; + + if should_follow_run { + do_follow_run(config, &run).await; + } else { + let line = format!( + "Run #{} for app `{}` has been scheduled", + run.number, app_slug + ); + output::success(&line); + + let link_line = format!(" See more: {}", run.dollar_link); + output::write(&link_line); + output::newline(); + } } } } +async fn do_follow_run( + config: Config, + run: &Run, +) { + let mut spinner = output::spinner("Waiting for run to start..."); + + match wait_for_run_start(&config, &run).await { + Err(err) => { + spinner.failure(); + debug!("Failed to wait for run to start: {}", err); + let msg = format!("An error occurred while waiting for the run to start. This shouldn't happen! You can get more details at {:?} or by contacting support.", run.dollar_link); + output::failure(&msg); + }, + Ok(()) => { + spinner.success(); + + // We do this here, explicitly, to not double-monitor our API via the + // `wait_for_run_start` function above. + let mut run_complete = monitor_run_completion(&config, run); + + // We set a Ctrl+C handler here, if invoked it will print a message that shows where + // the user can follow the run. + let run_copy = run.clone(); + + ctrlc::set_handler(move || { + output::newline(); + + let msg = format!( + "Run #{} for app `{}` is still running.", + run_copy.number, run_copy.app_name + ); + output::write(&msg); + output::newline(); + + let msg = format!( + "You can follow it at {}", + run_copy.dollar_link + ); + output::write(&msg); + output::newline(); + + // According to + // https://www.agileconnection.com/article/overview-linux-exit-codes... + std::process::exit(130); + }).expect("Failed to set Ctrl+C handler"); + + // Now we follow the logs from the run. We can stream them from the cloud to here using + // the stream_logs API endpoint. + match api::stream_run_logs(&config, &run.app_name, run.number).await { + Ok(mut output) => { + loop { + tokio::select! { + Some(event) = output.recv() => print_log_stream_event(event), + res = &mut run_complete => { + match res { + Ok(run) => print_run_completion(&run), + Err(err) => { + debug!("Failed to monitor run completion: {:?}", err); + let msg = format!("An error occurred while waiting for the run to complete. This shouldn't happen! You can get more details at {:?} or by contacting support.", run.dollar_link); + output::failure(&msg); + } + } + + break; + }, + }; + } + }, + Err(err) => { + debug!("Failed to stream run logs: {:?}", err); + let msg = format!("An error occurred while streaming logs from Tower to your console. You can get more details at {:?} or by contacting support.", run.dollar_link); + output::failure(&msg); + } + } + } + }; +} + /// get_run_parameters takes care of all the hairy bits around digging about in the `clap` /// internals to figure out what the user is requesting. In the end, it determines if we are meant /// to do a local run or a remote run, and it determines the path to the relevant Towerfile that @@ -213,6 +314,13 @@ fn get_run_parameters( Ok((local, path, params, app_name)) } +fn should_follow_run( + args: &ArgMatches, +) -> bool { + let local = *args.get_one::("detached").unwrap(); + !local +} + /// Parses `--parameter` arguments into a HashMap of key-value pairs. /// Handles format like "--parameter key=value" fn parse_parameters(args: &ArgMatches) -> HashMap { @@ -347,9 +455,9 @@ async fn build_package(towerfile: &Towerfile) -> Package { async fn monitor_output(mut output: OutputReceiver) { loop { if let Some(line) = output.recv().await { - let ts = &line.time; + let ts = dates::format(line.time); let msg = &line.line; - output::log_line(&ts.to_rfc3339(), msg, output::LogLineType::Local); + output::log_line(&ts, msg, output::LogLineType::Local); } else { break; } @@ -383,3 +491,129 @@ fn create_pyiceberg_catalog_property_name(catalog_name: &str, property_name: &st format!("PYICEBERG_CATALOG__{}__{}", catalog_name, property_name) } +/// wait_for_run_start waits for the run to enter a "running" state. It polls the API every 500ms to see +/// if it's started yet. +async fn wait_for_run_start(config: &Config, run: &Run) -> Result<(), Error> { + loop { + let res = api::describe_run(config, &run.app_name, run.number).await?; + + if is_run_started(&res.run)? { + break + } else { + // Wait half a second to to try again. + tokio::time::sleep(tokio::time::Duration::from_millis(500)).await; + } + } + + Ok(()) +} + +/// wait_for_run_completion waits for the run to enter an terminal state. It polls the API every +/// 500ms to see if it's started yet. +async fn wait_for_run_completion(config: &Config, run: &Run) -> Result { + loop { + let res = api::describe_run(config, &run.app_name, run.number).await?; + + if is_run_finished(&res.run) { + return Ok(res.run) + } else { + // Wait half a second to to try again. + tokio::time::sleep(tokio::time::Duration::from_millis(500)).await; + } + } +} + +/// is_run_started checks if the run has started by looking at its status. +fn is_run_started(run: &Run) -> Result { + match run.status { + tower_api::models::run::Status::Scheduled => Ok(false), + tower_api::models::run::Status::Pending => Ok(false), + tower_api::models::run::Status::Running => Ok(true), + _ => Err(Error::RunCompleted), + } +} + +/// is_run_finished checks if the run has finished by looking at its status. +fn is_run_finished(run: &Run) -> bool { + match run.status { + tower_api::models::run::Status::Scheduled => false, + tower_api::models::run::Status::Pending => false, + tower_api::models::run::Status::Running => false, + _ => true, + } +} + +fn monitor_run_completion(config: &Config, run: &Run) -> oneshot::Receiver { + // we'll use this as a way of monitoring for when the run has reached a terminal state. + let (tx, rx) = oneshot::channel(); + + // We need to spawn a task that will wait for run completion, and we need copies of these + // objects in order for them to run elsewhere. + let config_clone = config.clone(); + let run_clone = run.clone(); + + tokio::spawn(async move { + let run = wait_for_run_completion(&config_clone, &run_clone). + await. + unwrap(); + + let _ = tx.send(run); + }); + + rx +} + +fn print_log_stream_event(event: api::LogStreamEvent) { + match event { + api::LogStreamEvent::EventLog(log) => { + let ts = dates::format_str(&log.reported_at); + + output::log_line( + &ts, + &log.content, + output::LogLineType::Remote, + ); + } + api::LogStreamEvent::EventWarning(warning) => { + debug!("warning: {:?}", warning); + } + } +} + +fn print_run_completion(run: &Run) { + let link_line = format!(" See more: {}", run.dollar_link); + + match run.status { + tower_api::models::run::Status::Errored => { + let line = format!( + "Run #{} for app `{}` had an error", + run.number, run.app_name + ); + output::failure(&line); + }, + tower_api::models::run::Status::Crashed => { + let line = format!( + "Run #{} for app `{}` crashed", + run.number, run.app_name + ); + output::failure(&line); + }, + tower_api::models::run::Status::Cancelled => { + let line = format!( + "Run #{} for app `{}` was cancelled", + run.number, run.app_name + ); + output::failure(&line); + }, + _ => { + let line = format!( + "Run #{} for app `{}` has exited successfully", + run.number, run.app_name + ); + output::success(&line); + } + } + + output::write(&link_line); + output::newline(); +} diff --git a/crates/tower-cmd/src/teams.rs b/crates/tower-cmd/src/teams.rs index 121bdf8b..2d8064ed 100644 --- a/crates/tower-cmd/src/teams.rs +++ b/crates/tower-cmd/src/teams.rs @@ -63,10 +63,10 @@ pub async fn do_list(config: Config) { // Get the current active team from the session let active_team = session.active_team.clone(); - let active_team_slug = active_team.map(|team| team.slug.clone()); + let active_team_name = active_team.map(|team| team.name.clone()); // Create headers for the table - let headers = vec!["", "Slug", "Team Name"] + let headers = vec!["", "Name"] .into_iter() .map(|h| h.yellow().to_string()) .collect(); @@ -77,34 +77,13 @@ pub async fn do_list(config: Config) { .iter() .map(|team| { // Create the active indicator in its own column - let active_indicator = if Some(&team.slug) == active_team_slug.as_ref() { + let active_indicator = if Some(&team.name) == active_team_name.as_ref() { "*".to_string() } else { "".to_string() }; - // Use the plain slug without asterisk - let slug_display = team.slug.clone(); - - // Check if team name is blank and use user's name instead - let display_name = if team.name.trim().is_empty() { - // Get the user's first and last name from the session - let user = &session.user; - let first_name = user.first_name.trim(); - let last_name = user.last_name.trim(); - - if !first_name.is_empty() || !last_name.is_empty() { - // Use first and last name if available - format!("{} {}", first_name, last_name).trim().to_string() - } else { - // Fall back to "Personal Workspace" if both names are empty - "Personal Workspace".to_string() - } - } else { - team.name.clone() - }; - - vec![active_indicator, slug_display, display_name] + vec![active_indicator, team.name.clone()] }) .collect(); @@ -119,18 +98,18 @@ pub async fn do_list(config: Config) { } pub async fn do_switch(config: Config, args: &ArgMatches) { - let slug = extract_team_slug("switch", args.subcommand()); + let name = extract_team_name("switch", args.subcommand()); // Refresh the session first to ensure we have the latest teams data let session = refresh_session(&config).await; - // Check if the provided team slug exists in the refreshed session - let team = session.teams.iter().find(|team| team.slug == slug); + // Check if the provided team name exists in the refreshed session + let team = session.teams.iter().find(|team| team.name == name); match team { Some(team) => { // Team found, set it as active - match config.set_active_team_by_slug(&slug) { + match config.set_active_team_by_name(&name) { Ok(_) => { output::success(&format!("Switched to team: {}", team.name)); } @@ -144,18 +123,18 @@ pub async fn do_switch(config: Config, args: &ArgMatches) { // Team not found output::failure(&format!( "Team '{}' not found. Use 'tower teams list' to see all your teams.", - slug + name, )); std::process::exit(1); } } } -fn extract_team_slug(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> String { - if let Some((slug, _)) = cmd { - return slug.to_string(); +fn extract_team_name(subcmd: &str, cmd: Option<(&str, &ArgMatches)>) -> String { + if let Some((name, _)) = cmd { + return name.to_string(); } - let line = format!("Team slug is required. Example: tower teams {} ", subcmd); + let line = format!("Team name is required. Example: tower teams {} ", subcmd); output::die(&line); } diff --git a/crates/tower-cmd/src/util/apps.rs b/crates/tower-cmd/src/util/apps.rs index c0f3330b..21d0e6c7 100644 --- a/crates/tower-cmd/src/util/apps.rs +++ b/crates/tower-cmd/src/util/apps.rs @@ -9,14 +9,14 @@ use tower_api::models::CreateAppParams as CreateAppParamsModel; pub async fn ensure_app_exists( api_config: &Configuration, - app_slug: &str, + app_name: &str, description: &str, ) -> Result<(), tower_api::apis::Error> { // Try to describe the app first let describe_result = default_api::describe_app( api_config, DescribeAppParams { - slug: app_slug.to_string(), + name: app_name.to_string(), runs: None, start_at: None, end_at: None, @@ -52,7 +52,7 @@ pub async fn ensure_app_exists( let create_app = prompt_default( format!( "App '{}' does not exist. Would you like to create it?", - app_slug + app_name ), false, ) @@ -69,9 +69,9 @@ pub async fn ensure_app_exists( CreateAppParams { create_app_params: CreateAppParamsModel { schema: None, - name: app_slug.to_string(), - slug: Some(app_slug.to_string()), + name: app_name.to_string(), short_description: Some(description.to_string()), + slug: None, }, }, ) @@ -79,7 +79,7 @@ pub async fn ensure_app_exists( match create_result { Ok(_) => { - output::success(&format!("Created app '{}'", app_slug)); + output::success(&format!("Created app '{}'", app_name)); Ok(()) } Err(create_err) => { diff --git a/crates/tower-cmd/src/util/dates.rs b/crates/tower-cmd/src/util/dates.rs new file mode 100644 index 00000000..a1984f16 --- /dev/null +++ b/crates/tower-cmd/src/util/dates.rs @@ -0,0 +1,12 @@ +use chrono::{DateTime, Utc}; + +pub fn format_str(ts: &str) -> String { + let dt: DateTime = DateTime::parse_from_rfc3339(ts) + .unwrap() + .with_timezone(&Utc); + + format(dt) +} +pub fn format(dt: DateTime) -> String { + dt.format("%F %T").to_string() +} diff --git a/crates/tower-cmd/src/util/mod.rs b/crates/tower-cmd/src/util/mod.rs index 23a6bb3f..4424a057 100644 --- a/crates/tower-cmd/src/util/mod.rs +++ b/crates/tower-cmd/src/util/mod.rs @@ -2,3 +2,4 @@ pub mod apps; pub mod deploy; pub mod progress; pub mod cmd; +pub mod dates; diff --git a/crates/tower-uv/src/lib.rs b/crates/tower-uv/src/lib.rs index 1ebf0aee..c25d02e5 100644 --- a/crates/tower-uv/src/lib.rs +++ b/crates/tower-uv/src/lib.rs @@ -62,9 +62,16 @@ pub struct Uv { impl Uv { pub async fn new() -> Result { - let uv_path = install::find_or_setup_uv().await?; - test_uv_path(&uv_path).await?; - Ok(Uv { uv_path }) + match install::find_or_setup_uv().await { + Ok(uv_path) => { + test_uv_path(&uv_path).await?; + Ok(Uv { uv_path }) + }, + Err(e) => { + debug!("Error setting up UV: {:?}", e); + Err(e.into()) + } + } } pub async fn venv(&self, cwd: &PathBuf, env_vars: &HashMap) -> Result { diff --git a/pyproject.toml b/pyproject.toml index 5d84ebbd..ded62c30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,8 @@ build-backend = "maturin" [project] name = "tower" -version = "0.3.22" +version = "0.3.23" + description = "Tower CLI and runtime environment for Tower." diff --git a/scripts/rust-api-client-generator-config.yaml b/scripts/rust-api-client-generator-config.yaml index 703d3f05..0c93a61c 100644 --- a/scripts/rust-api-client-generator-config.yaml +++ b/scripts/rust-api-client-generator-config.yaml @@ -24,3 +24,4 @@ additionalProperties: dateLibrary: chrono useRustLogging: true rustfmt: true + avoidBoxedModels: true diff --git a/scripts/rust-client-templates/model.mustache b/scripts/rust-client-templates/model.mustache index a4970abf..3de0dad7 100644 --- a/scripts/rust-client-templates/model.mustache +++ b/scripts/rust-client-templates/model.mustache @@ -1,6 +1,6 @@ {{>partial_header}} use crate::models; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, Deserializer}; {{#models}} {{#model}} {{^isEnum}}{{#vendorExtensions.x-rust-has-byte-array}} @@ -65,6 +65,26 @@ impl std::fmt::Display for {{{classname}}} { } } +impl<'de> Deserialize<'de> for {{{classname}}} { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + {{#allowableValues}} + {{#enumVars}} + "{{{value}}}" => Self::{{{name}}}, + {{/enumVars}} + {{/allowableValues}} + _ => Err(serde::de::Error::unknown_variant( + &s, + &[{{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}], + )), + } + } +} + {{/isInteger}} impl Default for {{{classname}}} { fn default() -> {{{classname}}} { @@ -201,7 +221,7 @@ impl Default for {{classname}} { {{#vars}} {{#isEnum}} /// {{{description}}} -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub enum {{{enumName}}} { {{#allowableValues}} {{#enumVars}} @@ -218,6 +238,26 @@ impl Default for {{{enumName}}} { {{/allowableValues}} } } + +impl<'de> Deserialize<'de> for {{{enumName}}} { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.to_lowercase().as_str() { + {{#allowableValues}} + {{#enumVars}} + "{{{value}}}" => Ok(Self::{{{name}}}), + {{/enumVars}} + {{/allowableValues}} + _ => Err(serde::de::Error::unknown_variant( + &s, + &[{{#allowableValues}}{{#enumVars}}"{{{value}}}"{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}], + )), + } + } +} {{/isEnum}} {{/vars}} diff --git a/src/tower/_client.py b/src/tower/_client.py index daa9b7e4..2eefb905 100644 --- a/src/tower/_client.py +++ b/src/tower/_client.py @@ -45,19 +45,19 @@ def run_app( - slug: str, + name: str, environment: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, ) -> Run: """ Run a Tower application with specified parameters and environment. - This function initiates a new run of a Tower application identified by its slug. + This function initiates a new run of a Tower application identified by its name. The run can be configured with an optional environment override and runtime parameters. If no environment is specified, the default environment from the Tower context is used. Args: - slug (str): The unique identifier of the application to run. + name (str): The unique identifier of the application to run. environment (Optional[str]): The environment to run the application in. If not provided, uses the default environment from the Tower context. parameters (Optional[Dict[str, str]]): A dictionary of key-value pairs @@ -65,7 +65,7 @@ def run_app( Returns: Run: A Run object containing information about the initiated application run, - including the app_slug and run number. + including the app_name and run number. Raises: RuntimeError: If there is an error initiating the run or if the Tower API @@ -88,7 +88,7 @@ def run_app( try: output: Optional[Union[ErrorModel, RunAppResponse]] = run_app_api.sync( - slug=slug, client=client, body=input_body + name=name, client=client, body=input_body ) if output is None: @@ -101,9 +101,9 @@ def run_app( except UnexpectedStatus as e: # Raise an AppNotFoundError here if the app was, indeed, not found. if e.status_code == 404: - raise AppNotFoundError(slug) + raise AppNotFoundError(name) else: - raise UnknownException(f"Unexpected status code {e.status_code} when running app {slug}") + raise UnknownException(f"Unexpected status code {e.status_code} when running app {name}") def wait_for_run( run: Run, @@ -118,7 +118,7 @@ def wait_for_run( a terminal state (exited, errored, cancelled, or crashed). Args: - run (Run): The Run object containing the app_slug and number of the run to monitor. + run (Run): The Run object containing the app_name and number of the run to monitor. timeout (Optional[float]): Maximum time to wait in seconds before raising a TimeoutException. Defaults to one day (86,400 seconds). raise_on_failure (bool): If True, raises a RunFailedError when the run fails. @@ -158,7 +158,7 @@ def wait_for_run( return desc elif _is_failed_run(desc): if raise_on_failure: - raise RunFailedError(desc.app_slug, desc.number, desc.status) + raise RunFailedError(desc.app_name, desc.number, desc.status) else: return desc @@ -235,7 +235,7 @@ def wait_for_runs( successful_runs.append(desc) elif _is_failed_run(desc): if raise_on_failure: - raise RunFailedError(desc.app_slug, desc.number, desc.status) + raise RunFailedError(desc.app_name, desc.number, desc.status) else: failed_runs.append(desc) @@ -344,7 +344,7 @@ def _check_run_status( try: output: Optional[Union[DescribeRunResponse, ErrorModel]] = describe_run_api.sync( - slug=run.app_slug, + name=run.app_name, seq=run.number, client=client ) diff --git a/src/tower/tower_api_client/api/default/cancel_run.py b/src/tower/tower_api_client/api/default/cancel_run.py index ab709898..2dbc22e1 100644 --- a/src/tower/tower_api_client/api/default/cancel_run.py +++ b/src/tower/tower_api_client/api/default/cancel_run.py @@ -10,13 +10,13 @@ def _get_kwargs( - slug: str, + name: str, seq: int, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "post", - "url": "/apps/{slug}/runs/{seq}".format( - slug=slug, + "url": "/apps/{name}/runs/{seq}".format( + name=name, seq=seq, ), } @@ -49,7 +49,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -59,7 +59,7 @@ def sync_detailed( Cancel a run Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -71,7 +71,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -83,7 +83,7 @@ def sync_detailed( def sync( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -93,7 +93,7 @@ def sync( Cancel a run Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -105,14 +105,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, seq=seq, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -122,7 +122,7 @@ async def asyncio_detailed( Cancel a run Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -134,7 +134,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -144,7 +144,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -154,7 +154,7 @@ async def asyncio( Cancel a run Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -167,7 +167,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, seq=seq, client=client, ) diff --git a/src/tower/tower_api_client/api/default/create_schedule.py b/src/tower/tower_api_client/api/default/create_schedule.py new file mode 100644 index 00000000..2b65f22b --- /dev/null +++ b/src/tower/tower_api_client/api/default/create_schedule.py @@ -0,0 +1,168 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_schedule_params import CreateScheduleParams +from ...models.create_schedule_response import CreateScheduleResponse +from ...types import Response + + +def _get_kwargs( + *, + body: CreateScheduleParams, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/schedules", + } + + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[CreateScheduleResponse]: + if response.status_code == 200: + response_200 = CreateScheduleResponse.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[CreateScheduleResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: CreateScheduleParams, +) -> Response[CreateScheduleResponse]: + """Create schedule + + Create a new schedule for an app. + + Args: + body (CreateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CreateScheduleResponse] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: CreateScheduleParams, +) -> Optional[CreateScheduleResponse]: + """Create schedule + + Create a new schedule for an app. + + Args: + body (CreateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CreateScheduleResponse + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: CreateScheduleParams, +) -> Response[CreateScheduleResponse]: + """Create schedule + + Create a new schedule for an app. + + Args: + body (CreateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CreateScheduleResponse] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: CreateScheduleParams, +) -> Optional[CreateScheduleResponse]: + """Create schedule + + Create a new schedule for an app. + + Args: + body (CreateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CreateScheduleResponse + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/src/tower/tower_api_client/api/default/delete_app.py b/src/tower/tower_api_client/api/default/delete_app.py index ad9bdf2f..ec3d0de6 100644 --- a/src/tower/tower_api_client/api/default/delete_app.py +++ b/src/tower/tower_api_client/api/default/delete_app.py @@ -10,12 +10,12 @@ def _get_kwargs( - slug: str, + name: str, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "delete", - "url": "/apps/{slug}".format( - slug=slug, + "url": "/apps/{name}".format( + name=name, ), } @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[DeleteAppResponse]: @@ -56,7 +56,7 @@ def sync_detailed( Delete one of your apps, the associated code, and all the runs as well. Args: - slug (str): The slug of the app to delete. + name (str): The name of the app to delete. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -67,7 +67,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = client.get_httpx_client().request( @@ -78,7 +78,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[DeleteAppResponse]: @@ -87,7 +87,7 @@ def sync( Delete one of your apps, the associated code, and all the runs as well. Args: - slug (str): The slug of the app to delete. + name (str): The name of the app to delete. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -98,13 +98,13 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[DeleteAppResponse]: @@ -113,7 +113,7 @@ async def asyncio_detailed( Delete one of your apps, the associated code, and all the runs as well. Args: - slug (str): The slug of the app to delete. + name (str): The name of the app to delete. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -124,7 +124,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -133,7 +133,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[DeleteAppResponse]: @@ -142,7 +142,7 @@ async def asyncio( Delete one of your apps, the associated code, and all the runs as well. Args: - slug (str): The slug of the app to delete. + name (str): The name of the app to delete. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -154,7 +154,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, ) ).parsed diff --git a/src/tower/tower_api_client/api/default/delete_catalog.py b/src/tower/tower_api_client/api/default/delete_catalog.py index 85ca4995..b19f3355 100644 --- a/src/tower/tower_api_client/api/default/delete_catalog.py +++ b/src/tower/tower_api_client/api/default/delete_catalog.py @@ -6,17 +6,26 @@ from ... import errors from ...client import AuthenticatedClient, Client from ...models.delete_catalog_response import DeleteCatalogResponse -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( - slug: str, + name: str, + *, + environment: Union[Unset, str] = "default", ) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["environment"] = environment + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + _kwargs: dict[str, Any] = { "method": "delete", - "url": "/catalogs/{slug}".format( - slug=slug, + "url": "/catalogs/{name}".format( + name=name, ), + "params": params, } return _kwargs @@ -47,16 +56,19 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, + environment: Union[Unset, str] = "default", ) -> Response[DeleteCatalogResponse]: """Delete catalog Delete a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. + environment (Union[Unset, str]): The environment of the catalog to delete. Default: + 'default'. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -67,7 +79,8 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, + environment=environment, ) response = client.get_httpx_client().request( @@ -78,16 +91,19 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, + environment: Union[Unset, str] = "default", ) -> Optional[DeleteCatalogResponse]: """Delete catalog Delete a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. + environment (Union[Unset, str]): The environment of the catalog to delete. Default: + 'default'. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -98,22 +114,26 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, + environment=environment, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, + environment: Union[Unset, str] = "default", ) -> Response[DeleteCatalogResponse]: """Delete catalog Delete a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. + environment (Union[Unset, str]): The environment of the catalog to delete. Default: + 'default'. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -124,7 +144,8 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, + environment=environment, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -133,16 +154,19 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, + environment: Union[Unset, str] = "default", ) -> Optional[DeleteCatalogResponse]: """Delete catalog Delete a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. + environment (Union[Unset, str]): The environment of the catalog to delete. Default: + 'default'. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -154,7 +178,8 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, + environment=environment, ) ).parsed diff --git a/src/tower/tower_api_client/api/default/delete_schedule.py b/src/tower/tower_api_client/api/default/delete_schedule.py new file mode 100644 index 00000000..dafcee8e --- /dev/null +++ b/src/tower/tower_api_client/api/default/delete_schedule.py @@ -0,0 +1,160 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.delete_schedule_response import DeleteScheduleResponse +from ...types import Response + + +def _get_kwargs( + id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/schedules/{id}".format( + id=id, + ), + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[DeleteScheduleResponse]: + if response.status_code == 200: + response_200 = DeleteScheduleResponse.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[DeleteScheduleResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[DeleteScheduleResponse]: + """Delete schedule + + Delete an existing schedule for an app. + + Args: + id (str): The ID of the schedule to delete. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[DeleteScheduleResponse] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[DeleteScheduleResponse]: + """Delete schedule + + Delete an existing schedule for an app. + + Args: + id (str): The ID of the schedule to delete. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + DeleteScheduleResponse + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[DeleteScheduleResponse]: + """Delete schedule + + Delete an existing schedule for an app. + + Args: + id (str): The ID of the schedule to delete. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[DeleteScheduleResponse] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[DeleteScheduleResponse]: + """Delete schedule + + Delete an existing schedule for an app. + + Args: + id (str): The ID of the schedule to delete. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + DeleteScheduleResponse + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/src/tower/tower_api_client/api/default/delete_team_invitation.py b/src/tower/tower_api_client/api/default/delete_team_invitation.py index f15cbc89..7b2d1511 100644 --- a/src/tower/tower_api_client/api/default/delete_team_invitation.py +++ b/src/tower/tower_api_client/api/default/delete_team_invitation.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: DeleteTeamInvitationParams, ) -> dict[str, Any]: @@ -19,8 +19,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", - "url": "/teams/{slug}/invites".format( - slug=slug, + "url": "/teams/{name}/invites".format( + name=name, ), } @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: DeleteTeamInvitationParams, @@ -68,7 +68,7 @@ def sync_detailed( Delete a pending team invitation that you have previously sent Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (DeleteTeamInvitationParams): Raises: @@ -80,7 +80,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -92,7 +92,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: DeleteTeamInvitationParams, @@ -102,7 +102,7 @@ def sync( Delete a pending team invitation that you have previously sent Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (DeleteTeamInvitationParams): Raises: @@ -114,14 +114,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: DeleteTeamInvitationParams, @@ -131,7 +131,7 @@ async def asyncio_detailed( Delete a pending team invitation that you have previously sent Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (DeleteTeamInvitationParams): Raises: @@ -143,7 +143,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: DeleteTeamInvitationParams, @@ -163,7 +163,7 @@ async def asyncio( Delete a pending team invitation that you have previously sent Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (DeleteTeamInvitationParams): Raises: @@ -176,7 +176,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/deploy_app.py b/src/tower/tower_api_client/api/default/deploy_app.py index a9698164..9547e5d1 100644 --- a/src/tower/tower_api_client/api/default/deploy_app.py +++ b/src/tower/tower_api_client/api/default/deploy_app.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, content_encoding: Union[Unset, str] = UNSET, ) -> dict[str, Any]: @@ -21,8 +21,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/apps/{slug}/deploy".format( - slug=slug, + "url": "/apps/{name}/deploy".format( + name=name, ), } @@ -67,7 +67,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, content_encoding: Union[Unset, str] = UNSET, @@ -78,7 +78,7 @@ def sync_detailed( and creates a new deployment for an app based on that file. Args: - slug (str): The slug of the app to deploy. + name (str): The name of the app to deploy. content_encoding (Union[Unset, str]): The encoding of the content. Raises: @@ -90,7 +90,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, content_encoding=content_encoding, ) @@ -102,7 +102,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, content_encoding: Union[Unset, str] = UNSET, @@ -113,7 +113,7 @@ def sync( and creates a new deployment for an app based on that file. Args: - slug (str): The slug of the app to deploy. + name (str): The name of the app to deploy. content_encoding (Union[Unset, str]): The encoding of the content. Raises: @@ -125,14 +125,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, content_encoding=content_encoding, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, content_encoding: Union[Unset, str] = UNSET, @@ -143,7 +143,7 @@ async def asyncio_detailed( and creates a new deployment for an app based on that file. Args: - slug (str): The slug of the app to deploy. + name (str): The name of the app to deploy. content_encoding (Union[Unset, str]): The encoding of the content. Raises: @@ -155,7 +155,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, content_encoding=content_encoding, ) @@ -165,7 +165,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, content_encoding: Union[Unset, str] = UNSET, @@ -176,7 +176,7 @@ async def asyncio( and creates a new deployment for an app based on that file. Args: - slug (str): The slug of the app to deploy. + name (str): The name of the app to deploy. content_encoding (Union[Unset, str]): The encoding of the content. Raises: @@ -189,7 +189,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, content_encoding=content_encoding, ) diff --git a/src/tower/tower_api_client/api/default/describe_app.py b/src/tower/tower_api_client/api/default/describe_app.py index 90f86acf..ffb746d4 100644 --- a/src/tower/tower_api_client/api/default/describe_app.py +++ b/src/tower/tower_api_client/api/default/describe_app.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, runs: Union[Unset, int] = UNSET, start_at: Union[Unset, datetime.datetime] = UNSET, @@ -38,8 +38,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/apps/{slug}".format( - slug=slug, + "url": "/apps/{name}".format( + name=name, ), "params": params, } @@ -72,7 +72,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, runs: Union[Unset, int] = UNSET, @@ -85,7 +85,7 @@ def sync_detailed( Get all the runs for the current account. Args: - slug (str): The slug of the app to fetch. + name (str): The name of the app to fetch. runs (Union[Unset, int]): The number of recent runs to fetch for the app. start_at (Union[Unset, datetime.datetime]): Filter runs scheduled after this datetime (inclusive). Provide timestamps in ISO-8601 format. @@ -103,7 +103,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, runs=runs, start_at=start_at, end_at=end_at, @@ -118,7 +118,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, runs: Union[Unset, int] = UNSET, @@ -131,7 +131,7 @@ def sync( Get all the runs for the current account. Args: - slug (str): The slug of the app to fetch. + name (str): The name of the app to fetch. runs (Union[Unset, int]): The number of recent runs to fetch for the app. start_at (Union[Unset, datetime.datetime]): Filter runs scheduled after this datetime (inclusive). Provide timestamps in ISO-8601 format. @@ -149,7 +149,7 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, runs=runs, start_at=start_at, @@ -159,7 +159,7 @@ def sync( async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, runs: Union[Unset, int] = UNSET, @@ -172,7 +172,7 @@ async def asyncio_detailed( Get all the runs for the current account. Args: - slug (str): The slug of the app to fetch. + name (str): The name of the app to fetch. runs (Union[Unset, int]): The number of recent runs to fetch for the app. start_at (Union[Unset, datetime.datetime]): Filter runs scheduled after this datetime (inclusive). Provide timestamps in ISO-8601 format. @@ -190,7 +190,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, runs=runs, start_at=start_at, end_at=end_at, @@ -203,7 +203,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, runs: Union[Unset, int] = UNSET, @@ -216,7 +216,7 @@ async def asyncio( Get all the runs for the current account. Args: - slug (str): The slug of the app to fetch. + name (str): The name of the app to fetch. runs (Union[Unset, int]): The number of recent runs to fetch for the app. start_at (Union[Unset, datetime.datetime]): Filter runs scheduled after this datetime (inclusive). Provide timestamps in ISO-8601 format. @@ -235,7 +235,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, runs=runs, start_at=start_at, diff --git a/src/tower/tower_api_client/api/default/describe_run.py b/src/tower/tower_api_client/api/default/describe_run.py index 0e1818ed..c29f1532 100644 --- a/src/tower/tower_api_client/api/default/describe_run.py +++ b/src/tower/tower_api_client/api/default/describe_run.py @@ -11,13 +11,13 @@ def _get_kwargs( - slug: str, + name: str, seq: int, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": "/apps/{slug}/runs/{seq}".format( - slug=slug, + "url": "/apps/{name}/runs/{seq}".format( + name=name, seq=seq, ), } @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -68,7 +68,7 @@ def sync_detailed( Describe a run of an app. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -80,7 +80,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -92,7 +92,7 @@ def sync_detailed( def sync( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -102,7 +102,7 @@ def sync( Describe a run of an app. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -114,14 +114,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, seq=seq, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -131,7 +131,7 @@ async def asyncio_detailed( Describe a run of an app. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -143,7 +143,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -163,7 +163,7 @@ async def asyncio( Describe a run of an app. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. seq (int): The number of the run to fetch. Raises: @@ -176,7 +176,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, seq=seq, client=client, ) diff --git a/src/tower/tower_api_client/api/default/describe_run_logs.py b/src/tower/tower_api_client/api/default/describe_run_logs.py index 70305f64..1e1d81e3 100644 --- a/src/tower/tower_api_client/api/default/describe_run_logs.py +++ b/src/tower/tower_api_client/api/default/describe_run_logs.py @@ -10,13 +10,13 @@ def _get_kwargs( - slug: str, + name: str, seq: int, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": "/apps/{slug}/runs/{seq}/logs".format( - slug=slug, + "url": "/apps/{name}/runs/{seq}/logs".format( + name=name, seq=seq, ), } @@ -49,7 +49,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -59,7 +59,7 @@ def sync_detailed( Retrieves the logs associated with a particular run of an app. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -71,7 +71,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -83,7 +83,7 @@ def sync_detailed( def sync( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -93,7 +93,7 @@ def sync( Retrieves the logs associated with a particular run of an app. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -105,14 +105,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, seq=seq, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -122,7 +122,7 @@ async def asyncio_detailed( Retrieves the logs associated with a particular run of an app. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -134,7 +134,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -144,7 +144,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -154,7 +154,7 @@ async def asyncio( Retrieves the logs associated with a particular run of an app. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -167,7 +167,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, seq=seq, client=client, ) diff --git a/src/tower/tower_api_client/api/default/generate_runner_credentials.py b/src/tower/tower_api_client/api/default/generate_runner_credentials.py new file mode 100644 index 00000000..0e5a95b0 --- /dev/null +++ b/src/tower/tower_api_client/api/default/generate_runner_credentials.py @@ -0,0 +1,140 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.generate_runner_credentials_response import ( + GenerateRunnerCredentialsResponse, +) +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/runners/credentials", + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[GenerateRunnerCredentialsResponse]: + if response.status_code == 200: + response_200 = GenerateRunnerCredentialsResponse.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[GenerateRunnerCredentialsResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[GenerateRunnerCredentialsResponse]: + """Generate runner credentials + + Uses your current authentication context to generate runner credentials that are used for + authenticating runner requests + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GenerateRunnerCredentialsResponse] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Optional[GenerateRunnerCredentialsResponse]: + """Generate runner credentials + + Uses your current authentication context to generate runner credentials that are used for + authenticating runner requests + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GenerateRunnerCredentialsResponse + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[GenerateRunnerCredentialsResponse]: + """Generate runner credentials + + Uses your current authentication context to generate runner credentials that are used for + authenticating runner requests + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GenerateRunnerCredentialsResponse] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Optional[GenerateRunnerCredentialsResponse]: + """Generate runner credentials + + Uses your current authentication context to generate runner credentials that are used for + authenticating runner requests + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GenerateRunnerCredentialsResponse + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/src/tower/tower_api_client/api/default/invite_team_member.py b/src/tower/tower_api_client/api/default/invite_team_member.py index 8d0e6f5f..11863b6e 100644 --- a/src/tower/tower_api_client/api/default/invite_team_member.py +++ b/src/tower/tower_api_client/api/default/invite_team_member.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: InviteTeamMemberParams, ) -> dict[str, Any]: @@ -19,8 +19,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/teams/{slug}/invites".format( - slug=slug, + "url": "/teams/{name}/invites".format( + name=name, ), } @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: InviteTeamMemberParams, @@ -68,7 +68,7 @@ def sync_detailed( Invite a new team Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (InviteTeamMemberParams): Raises: @@ -80,7 +80,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -92,7 +92,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: InviteTeamMemberParams, @@ -102,7 +102,7 @@ def sync( Invite a new team Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (InviteTeamMemberParams): Raises: @@ -114,14 +114,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: InviteTeamMemberParams, @@ -131,7 +131,7 @@ async def asyncio_detailed( Invite a new team Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (InviteTeamMemberParams): Raises: @@ -143,7 +143,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: InviteTeamMemberParams, @@ -163,7 +163,7 @@ async def asyncio( Invite a new team Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (InviteTeamMemberParams): Raises: @@ -176,7 +176,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/leave_team.py b/src/tower/tower_api_client/api/default/leave_team.py index 99738087..8024b09c 100644 --- a/src/tower/tower_api_client/api/default/leave_team.py +++ b/src/tower/tower_api_client/api/default/leave_team.py @@ -10,12 +10,12 @@ def _get_kwargs( - slug: str, + name: str, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "post", - "url": "/teams/{slug}/leave".format( - slug=slug, + "url": "/teams/{name}/leave".format( + name=name, ), } @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[LeaveTeamResponse]: @@ -57,7 +57,7 @@ def sync_detailed( last member of a team, you cannot remove yourself. You should delete the team instead. Args: - slug (str): The slug of the team to leave + name (str): The name of the team to leave Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -68,7 +68,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = client.get_httpx_client().request( @@ -79,7 +79,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[LeaveTeamResponse]: @@ -89,7 +89,7 @@ def sync( last member of a team, you cannot remove yourself. You should delete the team instead. Args: - slug (str): The slug of the team to leave + name (str): The name of the team to leave Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -100,13 +100,13 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[LeaveTeamResponse]: @@ -116,7 +116,7 @@ async def asyncio_detailed( last member of a team, you cannot remove yourself. You should delete the team instead. Args: - slug (str): The slug of the team to leave + name (str): The name of the team to leave Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -127,7 +127,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -136,7 +136,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[LeaveTeamResponse]: @@ -146,7 +146,7 @@ async def asyncio( last member of a team, you cannot remove yourself. You should delete the team instead. Args: - slug (str): The slug of the team to leave + name (str): The name of the team to leave Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -158,7 +158,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, ) ).parsed diff --git a/src/tower/tower_api_client/api/default/list_app_environments.py b/src/tower/tower_api_client/api/default/list_app_environments.py index df48cb09..27d26443 100644 --- a/src/tower/tower_api_client/api/default/list_app_environments.py +++ b/src/tower/tower_api_client/api/default/list_app_environments.py @@ -10,12 +10,12 @@ def _get_kwargs( - slug: str, + name: str, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": "/apps/{slug}/environments".format( - slug=slug, + "url": "/apps/{name}/environments".format( + name=name, ), } @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[ListAppEnvironmentsResponse]: @@ -56,7 +56,7 @@ def sync_detailed( Generates a list of all the known environments for a given app in the current account. Args: - slug (str): The name of the app to get the version for. + name (str): The name of the app to get the version for. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -67,7 +67,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = client.get_httpx_client().request( @@ -78,7 +78,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[ListAppEnvironmentsResponse]: @@ -87,7 +87,7 @@ def sync( Generates a list of all the known environments for a given app in the current account. Args: - slug (str): The name of the app to get the version for. + name (str): The name of the app to get the version for. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -98,13 +98,13 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[ListAppEnvironmentsResponse]: @@ -113,7 +113,7 @@ async def asyncio_detailed( Generates a list of all the known environments for a given app in the current account. Args: - slug (str): The name of the app to get the version for. + name (str): The name of the app to get the version for. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -124,7 +124,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -133,7 +133,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[ListAppEnvironmentsResponse]: @@ -142,7 +142,7 @@ async def asyncio( Generates a list of all the known environments for a given app in the current account. Args: - slug (str): The name of the app to get the version for. + name (str): The name of the app to get the version for. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -154,7 +154,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, ) ).parsed diff --git a/src/tower/tower_api_client/api/default/list_runs.py b/src/tower/tower_api_client/api/default/list_runs.py index 88c4cc49..11d31a1a 100644 --- a/src/tower/tower_api_client/api/default/list_runs.py +++ b/src/tower/tower_api_client/api/default/list_runs.py @@ -12,7 +12,7 @@ def _get_kwargs( - slug: str, + name: str, *, page: Union[Unset, int] = 1, page_size: Union[Unset, int] = 20, @@ -49,8 +49,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/apps/{slug}/runs".format( - slug=slug, + "url": "/apps/{name}/runs".format( + name=name, ), "params": params, } @@ -83,7 +83,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, page: Union[Unset, int] = 1, @@ -98,7 +98,7 @@ def sync_detailed( parameters passed in. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. page (Union[Unset, int]): The page number to fetch. Default: 1. page_size (Union[Unset, int]): The number of records to fetch on each page. Default: 20. status (Union[Unset, list[ListRunsStatusItem]]): Filter runs by status(es) (comma @@ -117,7 +117,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, page=page, page_size=page_size, status=status, @@ -133,7 +133,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, page: Union[Unset, int] = 1, @@ -148,7 +148,7 @@ def sync( parameters passed in. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. page (Union[Unset, int]): The page number to fetch. Default: 1. page_size (Union[Unset, int]): The number of records to fetch on each page. Default: 20. status (Union[Unset, list[ListRunsStatusItem]]): Filter runs by status(es) (comma @@ -167,7 +167,7 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, page=page, page_size=page_size, @@ -178,7 +178,7 @@ def sync( async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, page: Union[Unset, int] = 1, @@ -193,7 +193,7 @@ async def asyncio_detailed( parameters passed in. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. page (Union[Unset, int]): The page number to fetch. Default: 1. page_size (Union[Unset, int]): The number of records to fetch on each page. Default: 20. status (Union[Unset, list[ListRunsStatusItem]]): Filter runs by status(es) (comma @@ -212,7 +212,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, page=page, page_size=page_size, status=status, @@ -226,7 +226,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, page: Union[Unset, int] = 1, @@ -241,7 +241,7 @@ async def asyncio( parameters passed in. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. page (Union[Unset, int]): The page number to fetch. Default: 1. page_size (Union[Unset, int]): The number of records to fetch on each page. Default: 20. status (Union[Unset, list[ListRunsStatusItem]]): Filter runs by status(es) (comma @@ -261,7 +261,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, page=page, page_size=page_size, diff --git a/src/tower/tower_api_client/api/default/list_schedules.py b/src/tower/tower_api_client/api/default/list_schedules.py new file mode 100644 index 00000000..23ac9983 --- /dev/null +++ b/src/tower/tower_api_client/api/default/list_schedules.py @@ -0,0 +1,181 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.list_schedules_response import ListSchedulesResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + page: Union[Unset, int] = UNSET, + page_size: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["page"] = page + + params["page_size"] = page_size + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/schedules", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[ListSchedulesResponse]: + if response.status_code == 200: + response_200 = ListSchedulesResponse.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[ListSchedulesResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + page: Union[Unset, int] = UNSET, + page_size: Union[Unset, int] = UNSET, +) -> Response[ListSchedulesResponse]: + """List schedules + + List all schedules for an app. + + Args: + page (Union[Unset, int]): The page number to fetch. + page_size (Union[Unset, int]): The number of records to fetch on each page. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ListSchedulesResponse] + """ + + kwargs = _get_kwargs( + page=page, + page_size=page_size, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + page: Union[Unset, int] = UNSET, + page_size: Union[Unset, int] = UNSET, +) -> Optional[ListSchedulesResponse]: + """List schedules + + List all schedules for an app. + + Args: + page (Union[Unset, int]): The page number to fetch. + page_size (Union[Unset, int]): The number of records to fetch on each page. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ListSchedulesResponse + """ + + return sync_detailed( + client=client, + page=page, + page_size=page_size, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + page: Union[Unset, int] = UNSET, + page_size: Union[Unset, int] = UNSET, +) -> Response[ListSchedulesResponse]: + """List schedules + + List all schedules for an app. + + Args: + page (Union[Unset, int]): The page number to fetch. + page_size (Union[Unset, int]): The number of records to fetch on each page. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ListSchedulesResponse] + """ + + kwargs = _get_kwargs( + page=page, + page_size=page_size, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + page: Union[Unset, int] = UNSET, + page_size: Union[Unset, int] = UNSET, +) -> Optional[ListSchedulesResponse]: + """List schedules + + List all schedules for an app. + + Args: + page (Union[Unset, int]): The page number to fetch. + page_size (Union[Unset, int]): The number of records to fetch on each page. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ListSchedulesResponse + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + page_size=page_size, + ) + ).parsed diff --git a/src/tower/tower_api_client/api/default/list_team_invitations.py b/src/tower/tower_api_client/api/default/list_team_invitations.py index 85930b0e..4e48640e 100644 --- a/src/tower/tower_api_client/api/default/list_team_invitations.py +++ b/src/tower/tower_api_client/api/default/list_team_invitations.py @@ -10,12 +10,12 @@ def _get_kwargs( - slug: str, + name: str, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": "/teams/{slug}/invites".format( - slug=slug, + "url": "/teams/{name}/invites".format( + name=name, ), } @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[ListTeamInvitationsResponse]: @@ -56,7 +56,7 @@ def sync_detailed( List the pending invitations for a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -67,7 +67,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = client.get_httpx_client().request( @@ -78,7 +78,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[ListTeamInvitationsResponse]: @@ -87,7 +87,7 @@ def sync( List the pending invitations for a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -98,13 +98,13 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[ListTeamInvitationsResponse]: @@ -113,7 +113,7 @@ async def asyncio_detailed( List the pending invitations for a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -124,7 +124,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -133,7 +133,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[ListTeamInvitationsResponse]: @@ -142,7 +142,7 @@ async def asyncio( List the pending invitations for a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -154,7 +154,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, ) ).parsed diff --git a/src/tower/tower_api_client/api/default/list_team_members.py b/src/tower/tower_api_client/api/default/list_team_members.py index e74bbc66..6014f50b 100644 --- a/src/tower/tower_api_client/api/default/list_team_members.py +++ b/src/tower/tower_api_client/api/default/list_team_members.py @@ -10,12 +10,12 @@ def _get_kwargs( - slug: str, + name: str, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": "/teams/{slug}/members".format( - slug=slug, + "url": "/teams/{name}/members".format( + name=name, ), } @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[ListTeamMembersResponse]: @@ -56,7 +56,7 @@ def sync_detailed( List the members of a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -67,7 +67,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = client.get_httpx_client().request( @@ -78,7 +78,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[ListTeamMembersResponse]: @@ -87,7 +87,7 @@ def sync( List the members of a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -98,13 +98,13 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Response[ListTeamMembersResponse]: @@ -113,7 +113,7 @@ async def asyncio_detailed( List the members of a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -124,7 +124,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -133,7 +133,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, ) -> Optional[ListTeamMembersResponse]: @@ -142,7 +142,7 @@ async def asyncio( List the members of a team Args: - slug (str): The slug of the team to list members for + name (str): The name of the team to list members for Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -154,7 +154,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, ) ).parsed diff --git a/src/tower/tower_api_client/api/default/remove_team_member.py b/src/tower/tower_api_client/api/default/remove_team_member.py index df782461..a8d41ac2 100644 --- a/src/tower/tower_api_client/api/default/remove_team_member.py +++ b/src/tower/tower_api_client/api/default/remove_team_member.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: RemoveTeamMemberParams, ) -> dict[str, Any]: @@ -19,8 +19,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", - "url": "/teams/{slug}/members".format( - slug=slug, + "url": "/teams/{name}/members".format( + name=name, ), } @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: RemoveTeamMemberParams, @@ -68,7 +68,7 @@ def sync_detailed( Remove a new team Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (RemoveTeamMemberParams): Raises: @@ -80,7 +80,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -92,7 +92,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: RemoveTeamMemberParams, @@ -102,7 +102,7 @@ def sync( Remove a new team Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (RemoveTeamMemberParams): Raises: @@ -114,14 +114,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: RemoveTeamMemberParams, @@ -131,7 +131,7 @@ async def asyncio_detailed( Remove a new team Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (RemoveTeamMemberParams): Raises: @@ -143,7 +143,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: RemoveTeamMemberParams, @@ -163,7 +163,7 @@ async def asyncio( Remove a new team Args: - slug (str): The slug of the team to remove someone from + name (str): The name of the team to remove someone from body (RemoveTeamMemberParams): Raises: @@ -176,7 +176,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/resend_team_invitation.py b/src/tower/tower_api_client/api/default/resend_team_invitation.py index e0be72c3..cf60d6e2 100644 --- a/src/tower/tower_api_client/api/default/resend_team_invitation.py +++ b/src/tower/tower_api_client/api/default/resend_team_invitation.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: ResendTeamInvitationParams, ) -> dict[str, Any]: @@ -19,8 +19,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/teams/{slug}/invites/resend".format( - slug=slug, + "url": "/teams/{name}/invites/resend".format( + name=name, ), } @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: ResendTeamInvitationParams, @@ -68,7 +68,7 @@ def sync_detailed( Resend a team invitation to a user if they need a reminder or if they lost it Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (ResendTeamInvitationParams): Raises: @@ -80,7 +80,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -92,7 +92,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: ResendTeamInvitationParams, @@ -102,7 +102,7 @@ def sync( Resend a team invitation to a user if they need a reminder or if they lost it Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (ResendTeamInvitationParams): Raises: @@ -114,14 +114,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: ResendTeamInvitationParams, @@ -131,7 +131,7 @@ async def asyncio_detailed( Resend a team invitation to a user if they need a reminder or if they lost it Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (ResendTeamInvitationParams): Raises: @@ -143,7 +143,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: ResendTeamInvitationParams, @@ -163,7 +163,7 @@ async def asyncio( Resend a team invitation to a user if they need a reminder or if they lost it Args: - slug (str): The slug of the team to invite someone to + name (str): The name of the team to invite someone to body (ResendTeamInvitationParams): Raises: @@ -176,7 +176,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/run_app.py b/src/tower/tower_api_client/api/default/run_app.py index 6213b686..6aabf401 100644 --- a/src/tower/tower_api_client/api/default/run_app.py +++ b/src/tower/tower_api_client/api/default/run_app.py @@ -12,7 +12,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: RunAppParams, ) -> dict[str, Any]: @@ -20,8 +20,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/apps/{slug}/runs".format( - slug=slug, + "url": "/apps/{name}/runs".format( + name=name, ), } @@ -67,7 +67,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: RunAppParams, @@ -77,7 +77,7 @@ def sync_detailed( Runs an app with the supplied parameters. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. body (RunAppParams): Raises: @@ -89,7 +89,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -101,7 +101,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: RunAppParams, @@ -111,7 +111,7 @@ def sync( Runs an app with the supplied parameters. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. body (RunAppParams): Raises: @@ -123,14 +123,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: RunAppParams, @@ -140,7 +140,7 @@ async def asyncio_detailed( Runs an app with the supplied parameters. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. body (RunAppParams): Raises: @@ -152,7 +152,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -162,7 +162,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: RunAppParams, @@ -172,7 +172,7 @@ async def asyncio( Runs an app with the supplied parameters. Args: - slug (str): The slug of the app to fetch runs for. + name (str): The name of the app to fetch runs for. body (RunAppParams): Raises: @@ -185,7 +185,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/stream_run_logs.py b/src/tower/tower_api_client/api/default/stream_run_logs.py index 9888ffef..15e46a38 100644 --- a/src/tower/tower_api_client/api/default/stream_run_logs.py +++ b/src/tower/tower_api_client/api/default/stream_run_logs.py @@ -11,13 +11,13 @@ def _get_kwargs( - slug: str, + name: str, seq: int, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": "/apps/{slug}/runs/{seq}/logs/stream".format( - slug=slug, + "url": "/apps/{name}/runs/{seq}/logs/stream".format( + name=name, seq=seq, ), } @@ -73,7 +73,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -83,7 +83,7 @@ def sync_detailed( Streams the logs associated with a particular run of an app in real-time. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -95,7 +95,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -107,7 +107,7 @@ def sync_detailed( def sync( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -117,7 +117,7 @@ def sync( Streams the logs associated with a particular run of an app in real-time. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -129,14 +129,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, seq=seq, client=client, ).parsed async def asyncio_detailed( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -146,7 +146,7 @@ async def asyncio_detailed( Streams the logs associated with a particular run of an app in real-time. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -158,7 +158,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, seq=seq, ) @@ -168,7 +168,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, seq: int, *, client: AuthenticatedClient, @@ -178,7 +178,7 @@ async def asyncio( Streams the logs associated with a particular run of an app in real-time. Args: - slug (str): The slug of the app to get logs for. + name (str): The name of the app to get logs for. seq (int): The sequence number of the run to get logs for. Raises: @@ -191,7 +191,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, seq=seq, client=client, ) diff --git a/src/tower/tower_api_client/api/default/update_account_slug.py b/src/tower/tower_api_client/api/default/update_account_name.py similarity index 64% rename from src/tower/tower_api_client/api/default/update_account_slug.py rename to src/tower/tower_api_client/api/default/update_account_name.py index cc7043c6..47ea3048 100644 --- a/src/tower/tower_api_client/api/default/update_account_slug.py +++ b/src/tower/tower_api_client/api/default/update_account_name.py @@ -5,22 +5,22 @@ from ... import errors from ...client import AuthenticatedClient, Client -from ...models.update_account_slug_params import UpdateAccountSlugParams -from ...models.update_account_slug_response import UpdateAccountSlugResponse +from ...models.update_account_name_params import UpdateAccountNameParams +from ...models.update_account_name_response import UpdateAccountNameResponse from ...types import Response def _get_kwargs( - slug: str, + name: str, *, - body: UpdateAccountSlugParams, + body: UpdateAccountNameParams, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "put", - "url": "/accounts/{slug}".format( - slug=slug, + "url": "/accounts/{name}".format( + name=name, ), } @@ -35,9 +35,9 @@ def _get_kwargs( def _parse_response( *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[UpdateAccountSlugResponse]: +) -> Optional[UpdateAccountNameResponse]: if response.status_code == 200: - response_200 = UpdateAccountSlugResponse.from_dict(response.json()) + response_200 = UpdateAccountNameResponse.from_dict(response.json()) return response_200 if client.raise_on_unexpected_status: @@ -48,7 +48,7 @@ def _parse_response( def _build_response( *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[UpdateAccountSlugResponse]: +) -> Response[UpdateAccountNameResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,29 +58,29 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, - body: UpdateAccountSlugParams, -) -> Response[UpdateAccountSlugResponse]: - """Update account slug + body: UpdateAccountNameParams, +) -> Response[UpdateAccountNameResponse]: + """Update account name - Update the slug for an account + Update the name for an account Args: - slug (str): The slug of the account to update - body (UpdateAccountSlugParams): + name (str): The name of the account to update + body (UpdateAccountNameParams): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[UpdateAccountSlugResponse] + Response[UpdateAccountNameResponse] """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -92,58 +92,58 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, - body: UpdateAccountSlugParams, -) -> Optional[UpdateAccountSlugResponse]: - """Update account slug + body: UpdateAccountNameParams, +) -> Optional[UpdateAccountNameResponse]: + """Update account name - Update the slug for an account + Update the name for an account Args: - slug (str): The slug of the account to update - body (UpdateAccountSlugParams): + name (str): The name of the account to update + body (UpdateAccountNameParams): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - UpdateAccountSlugResponse + UpdateAccountNameResponse """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, - body: UpdateAccountSlugParams, -) -> Response[UpdateAccountSlugResponse]: - """Update account slug + body: UpdateAccountNameParams, +) -> Response[UpdateAccountNameResponse]: + """Update account name - Update the slug for an account + Update the name for an account Args: - slug (str): The slug of the account to update - body (UpdateAccountSlugParams): + name (str): The name of the account to update + body (UpdateAccountNameParams): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[UpdateAccountSlugResponse] + Response[UpdateAccountNameResponse] """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -153,30 +153,30 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, - body: UpdateAccountSlugParams, -) -> Optional[UpdateAccountSlugResponse]: - """Update account slug + body: UpdateAccountNameParams, +) -> Optional[UpdateAccountNameResponse]: + """Update account name - Update the slug for an account + Update the name for an account Args: - slug (str): The slug of the account to update - body (UpdateAccountSlugParams): + name (str): The name of the account to update + body (UpdateAccountNameParams): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - UpdateAccountSlugResponse + UpdateAccountNameResponse """ return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/update_catalog.py b/src/tower/tower_api_client/api/default/update_catalog.py index 97698867..e0f76737 100644 --- a/src/tower/tower_api_client/api/default/update_catalog.py +++ b/src/tower/tower_api_client/api/default/update_catalog.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: UpdateCatalogParams, ) -> dict[str, Any]: @@ -19,8 +19,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "put", - "url": "/catalogs/{slug}".format( - slug=slug, + "url": "/catalogs/{name}".format( + name=name, ), } @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateCatalogParams, @@ -68,7 +68,7 @@ def sync_detailed( Update a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. body (UpdateCatalogParams): Raises: @@ -80,7 +80,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -92,7 +92,7 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateCatalogParams, @@ -102,7 +102,7 @@ def sync( Update a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. body (UpdateCatalogParams): Raises: @@ -114,14 +114,14 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateCatalogParams, @@ -131,7 +131,7 @@ async def asyncio_detailed( Update a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. body (UpdateCatalogParams): Raises: @@ -143,7 +143,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateCatalogParams, @@ -163,7 +163,7 @@ async def asyncio( Update a new catalog object in the currently authenticated account. Args: - slug (str): The slug of the catalog to update. + name (str): The name of the catalog to update. body (UpdateCatalogParams): Raises: @@ -176,7 +176,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/api/default/update_schedule.py b/src/tower/tower_api_client/api/default/update_schedule.py new file mode 100644 index 00000000..00ca07a6 --- /dev/null +++ b/src/tower/tower_api_client/api/default/update_schedule.py @@ -0,0 +1,183 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.update_schedule_params import UpdateScheduleParams +from ...models.update_schedule_response import UpdateScheduleResponse +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: UpdateScheduleParams, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/schedules/{id}".format( + id=id, + ), + } + + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[UpdateScheduleResponse]: + if response.status_code == 200: + response_200 = UpdateScheduleResponse.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[UpdateScheduleResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: UpdateScheduleParams, +) -> Response[UpdateScheduleResponse]: + """Update schedule + + Update an existing schedule for an app. + + Args: + id (str): The ID of the schedule to update. + body (UpdateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[UpdateScheduleResponse] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: UpdateScheduleParams, +) -> Optional[UpdateScheduleResponse]: + """Update schedule + + Update an existing schedule for an app. + + Args: + id (str): The ID of the schedule to update. + body (UpdateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + UpdateScheduleResponse + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: UpdateScheduleParams, +) -> Response[UpdateScheduleResponse]: + """Update schedule + + Update an existing schedule for an app. + + Args: + id (str): The ID of the schedule to update. + body (UpdateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[UpdateScheduleResponse] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: UpdateScheduleParams, +) -> Optional[UpdateScheduleResponse]: + """Update schedule + + Update an existing schedule for an app. + + Args: + id (str): The ID of the schedule to update. + body (UpdateScheduleParams): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + UpdateScheduleResponse + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/src/tower/tower_api_client/api/default/update_team.py b/src/tower/tower_api_client/api/default/update_team.py index cce35396..9d094fce 100644 --- a/src/tower/tower_api_client/api/default/update_team.py +++ b/src/tower/tower_api_client/api/default/update_team.py @@ -11,7 +11,7 @@ def _get_kwargs( - slug: str, + name: str, *, body: UpdateTeamParams, ) -> dict[str, Any]: @@ -19,8 +19,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "put", - "url": "/teams/{slug}".format( - slug=slug, + "url": "/teams/{name}".format( + name=name, ), } @@ -58,18 +58,18 @@ def _build_response( def sync_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateTeamParams, ) -> Response[UpdateTeamResponse]: """Update team - Update a team with a new name or slug. Note that updating the team with a new slug will cause all + Update a team with a new name or name. Note that updating the team with a new name will cause all your URLs to change! Args: - slug (str): The slug of the team to update + name (str): The name of the team to update body (UpdateTeamParams): Raises: @@ -81,7 +81,7 @@ def sync_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -93,18 +93,18 @@ def sync_detailed( def sync( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateTeamParams, ) -> Optional[UpdateTeamResponse]: """Update team - Update a team with a new name or slug. Note that updating the team with a new slug will cause all + Update a team with a new name or name. Note that updating the team with a new name will cause all your URLs to change! Args: - slug (str): The slug of the team to update + name (str): The name of the team to update body (UpdateTeamParams): Raises: @@ -116,25 +116,25 @@ def sync( """ return sync_detailed( - slug=slug, + name=name, client=client, body=body, ).parsed async def asyncio_detailed( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateTeamParams, ) -> Response[UpdateTeamResponse]: """Update team - Update a team with a new name or slug. Note that updating the team with a new slug will cause all + Update a team with a new name or name. Note that updating the team with a new name will cause all your URLs to change! Args: - slug (str): The slug of the team to update + name (str): The name of the team to update body (UpdateTeamParams): Raises: @@ -146,7 +146,7 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - slug=slug, + name=name, body=body, ) @@ -156,18 +156,18 @@ async def asyncio_detailed( async def asyncio( - slug: str, + name: str, *, client: AuthenticatedClient, body: UpdateTeamParams, ) -> Optional[UpdateTeamResponse]: """Update team - Update a team with a new name or slug. Note that updating the team with a new slug will cause all + Update a team with a new name or name. Note that updating the team with a new name will cause all your URLs to change! Args: - slug (str): The slug of the team to update + name (str): The name of the team to update body (UpdateTeamParams): Raises: @@ -180,7 +180,7 @@ async def asyncio( return ( await asyncio_detailed( - slug=slug, + name=name, client=client, body=body, ) diff --git a/src/tower/tower_api_client/models/__init__.py b/src/tower/tower_api_client/models/__init__.py index 55a12836..135ab035 100644 --- a/src/tower/tower_api_client/models/__init__.py +++ b/src/tower/tower_api_client/models/__init__.py @@ -33,6 +33,8 @@ from .create_device_login_ticket_response import CreateDeviceLoginTicketResponse from .create_password_reset_params import CreatePasswordResetParams from .create_password_reset_response import CreatePasswordResetResponse +from .create_schedule_params import CreateScheduleParams +from .create_schedule_response import CreateScheduleResponse from .create_secret_params import CreateSecretParams from .create_secret_response import CreateSecretResponse from .create_session_params import CreateSessionParams @@ -45,6 +47,7 @@ from .delete_authenticator_params import DeleteAuthenticatorParams from .delete_authenticator_response import DeleteAuthenticatorResponse from .delete_catalog_response import DeleteCatalogResponse +from .delete_schedule_response import DeleteScheduleResponse from .delete_secret_response import DeleteSecretResponse from .delete_team_invitation_params import DeleteTeamInvitationParams from .delete_team_invitation_response import DeleteTeamInvitationResponse @@ -73,6 +76,7 @@ from .generate_authenticator_response import GenerateAuthenticatorResponse from .generate_run_statistics_response import GenerateRunStatisticsResponse from .generate_run_statistics_status_item import GenerateRunStatisticsStatusItem +from .generate_runner_credentials_response import GenerateRunnerCredentialsResponse from .invite_team_member_params import InviteTeamMemberParams from .invite_team_member_response import InviteTeamMemberResponse from .leave_team_response import LeaveTeamResponse @@ -88,6 +92,7 @@ from .list_my_team_invitations_response import ListMyTeamInvitationsResponse from .list_runs_response import ListRunsResponse from .list_runs_status_item import ListRunsStatusItem +from .list_schedules_response import ListSchedulesResponse from .list_secret_environments_response import ListSecretEnvironmentsResponse from .list_secrets_response import ListSecretsResponse from .list_team_invitations_response import ListTeamInvitationsResponse @@ -115,6 +120,8 @@ from .run_status import RunStatus from .run_status_group import RunStatusGroup from .run_timeseries_point import RunTimeseriesPoint +from .runner_credentials import RunnerCredentials +from .schedule import Schedule from .search_runs_response import SearchRunsResponse from .search_runs_status_item import SearchRunsStatusItem from .secret import Secret @@ -126,8 +133,8 @@ from .team_invitation import TeamInvitation from .token import Token from .unverified_authenticator import UnverifiedAuthenticator -from .update_account_slug_params import UpdateAccountSlugParams -from .update_account_slug_response import UpdateAccountSlugResponse +from .update_account_name_params import UpdateAccountNameParams +from .update_account_name_response import UpdateAccountNameResponse from .update_app_params import UpdateAppParams from .update_app_response import UpdateAppResponse from .update_catalog_params import UpdateCatalogParams @@ -136,6 +143,8 @@ from .update_my_team_invitation_response import UpdateMyTeamInvitationResponse from .update_password_reset_params import UpdatePasswordResetParams from .update_password_reset_response import UpdatePasswordResetResponse +from .update_schedule_params import UpdateScheduleParams +from .update_schedule_response import UpdateScheduleResponse from .update_secret_params import UpdateSecretParams from .update_secret_response import UpdateSecretResponse from .update_team_params import UpdateTeamParams @@ -179,6 +188,8 @@ "CreateDeviceLoginTicketResponse", "CreatePasswordResetParams", "CreatePasswordResetResponse", + "CreateScheduleParams", + "CreateScheduleResponse", "CreateSecretParams", "CreateSecretResponse", "CreateSessionParams", @@ -191,6 +202,7 @@ "DeleteAuthenticatorParams", "DeleteAuthenticatorResponse", "DeleteCatalogResponse", + "DeleteScheduleResponse", "DeleteSecretResponse", "DeleteTeamInvitationParams", "DeleteTeamInvitationResponse", @@ -217,6 +229,7 @@ "FeaturebaseIdentity", "GenerateAppStatisticsResponse", "GenerateAuthenticatorResponse", + "GenerateRunnerCredentialsResponse", "GenerateRunStatisticsResponse", "GenerateRunStatisticsStatusItem", "InviteTeamMemberParams", @@ -234,6 +247,7 @@ "ListMyTeamInvitationsResponse", "ListRunsResponse", "ListRunsStatusItem", + "ListSchedulesResponse", "ListSecretEnvironmentsResponse", "ListSecretsResponse", "ListTeamInvitationsResponse", @@ -255,12 +269,14 @@ "RunAppResponse", "RunFailureAlert", "RunLogLine", + "RunnerCredentials", "RunParameter", "RunResults", "RunStatistics", "RunStatus", "RunStatusGroup", "RunTimeseriesPoint", + "Schedule", "SearchRunsResponse", "SearchRunsStatusItem", "Secret", @@ -272,8 +288,8 @@ "TeamInvitation", "Token", "UnverifiedAuthenticator", - "UpdateAccountSlugParams", - "UpdateAccountSlugResponse", + "UpdateAccountNameParams", + "UpdateAccountNameResponse", "UpdateAppParams", "UpdateAppResponse", "UpdateCatalogParams", @@ -282,6 +298,8 @@ "UpdateMyTeamInvitationResponse", "UpdatePasswordResetParams", "UpdatePasswordResetResponse", + "UpdateScheduleParams", + "UpdateScheduleResponse", "UpdateSecretParams", "UpdateSecretResponse", "UpdateTeamParams", diff --git a/src/tower/tower_api_client/models/account.py b/src/tower/tower_api_client/models/account.py index eee02418..76e81498 100644 --- a/src/tower/tower_api_client/models/account.py +++ b/src/tower/tower_api_client/models/account.py @@ -1,8 +1,10 @@ from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define +from ..types import UNSET, Unset + T = TypeVar("T", bound="Account") @@ -11,11 +13,11 @@ class Account: """ Attributes: name (str): - slug (str): + slug (Union[Unset, str]): This property is deprecated. Please use name instead. """ name: str - slug: str + slug: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: name = self.name @@ -26,9 +28,10 @@ def to_dict(self) -> dict[str, Any]: field_dict.update( { "name": name, - "slug": slug, } ) + if slug is not UNSET: + field_dict["slug"] = slug return field_dict @@ -37,7 +40,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) name = d.pop("name") - slug = d.pop("slug") + slug = d.pop("slug", UNSET) account = cls( name=name, diff --git a/src/tower/tower_api_client/models/app.py b/src/tower/tower_api_client/models/app.py index 6c2240f3..c2aaf2e2 100644 --- a/src/tower/tower_api_client/models/app.py +++ b/src/tower/tower_api_client/models/app.py @@ -29,10 +29,10 @@ class App: owner (str): The account slug that owns this app schedule (Union[None, str]): The schedule associated with this app, null if none. short_description (str): A short description of the app. Can be empty. - slug (str): The unique slug of the app. version (Union[None, str]): The current version of this app, null if none. last_run (Union[Unset, Run]): run_results (Union[Unset, RunResults]): + slug (Union[Unset, str]): This property is deprecated. Please use name instead. status (Union[Unset, AppStatus]): The status of the app """ @@ -43,10 +43,10 @@ class App: owner: str schedule: Union[None, str] short_description: str - slug: str version: Union[None, str] last_run: Union[Unset, "Run"] = UNSET run_results: Union[Unset, "RunResults"] = UNSET + slug: Union[Unset, str] = UNSET status: Union[Unset, AppStatus] = UNSET def to_dict(self) -> dict[str, Any]: @@ -69,8 +69,6 @@ def to_dict(self) -> dict[str, Any]: short_description = self.short_description - slug = self.slug - version: Union[None, str] version = self.version @@ -82,6 +80,8 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.run_results, Unset): run_results = self.run_results.to_dict() + slug = self.slug + status: Union[Unset, str] = UNSET if not isinstance(self.status, Unset): status = self.status.value @@ -96,7 +96,6 @@ def to_dict(self) -> dict[str, Any]: "owner": owner, "schedule": schedule, "short_description": short_description, - "slug": slug, "version": version, } ) @@ -104,6 +103,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["last_run"] = last_run if run_results is not UNSET: field_dict["run_results"] = run_results + if slug is not UNSET: + field_dict["slug"] = slug if status is not UNSET: field_dict["status"] = status @@ -147,8 +148,6 @@ def _parse_schedule(data: object) -> Union[None, str]: short_description = d.pop("short_description") - slug = d.pop("slug") - def _parse_version(data: object) -> Union[None, str]: if data is None: return data @@ -170,6 +169,8 @@ def _parse_version(data: object) -> Union[None, str]: else: run_results = RunResults.from_dict(_run_results) + slug = d.pop("slug", UNSET) + _status = d.pop("status", UNSET) status: Union[Unset, AppStatus] if isinstance(_status, Unset): @@ -185,10 +186,10 @@ def _parse_version(data: object) -> Union[None, str]: owner=owner, schedule=schedule, short_description=short_description, - slug=slug, version=version, last_run=last_run, run_results=run_results, + slug=slug, status=status, ) diff --git a/src/tower/tower_api_client/models/catalog.py b/src/tower/tower_api_client/models/catalog.py index e75bdf13..d366be4b 100644 --- a/src/tower/tower_api_client/models/catalog.py +++ b/src/tower/tower_api_client/models/catalog.py @@ -1,10 +1,12 @@ import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar +from typing import TYPE_CHECKING, Any, TypeVar, Union from attrs import define as _attrs_define from dateutil.parser import isoparse +from ..types import UNSET, Unset + if TYPE_CHECKING: from ..models.catalog_property import CatalogProperty @@ -20,16 +22,16 @@ class Catalog: environment (str): name (str): properties (list['CatalogProperty']): - slug (str): type_ (str): + slug (Union[Unset, str]): This property is deprecated. Please use name instead. """ created_at: datetime.datetime environment: str name: str properties: list["CatalogProperty"] - slug: str type_: str + slug: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() @@ -43,10 +45,10 @@ def to_dict(self) -> dict[str, Any]: properties_item = properties_item_data.to_dict() properties.append(properties_item) - slug = self.slug - type_ = self.type_ + slug = self.slug + field_dict: dict[str, Any] = {} field_dict.update( { @@ -54,10 +56,11 @@ def to_dict(self) -> dict[str, Any]: "environment": environment, "name": name, "properties": properties, - "slug": slug, "type": type_, } ) + if slug is not UNSET: + field_dict["slug"] = slug return field_dict @@ -79,17 +82,17 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: properties.append(properties_item) - slug = d.pop("slug") - type_ = d.pop("type") + slug = d.pop("slug", UNSET) + catalog = cls( created_at=created_at, environment=environment, name=name, properties=properties, - slug=slug, type_=type_, + slug=slug, ) return catalog diff --git a/src/tower/tower_api_client/models/create_app_params.py b/src/tower/tower_api_client/models/create_app_params.py index c37e8fcd..6f54a0f9 100644 --- a/src/tower/tower_api_client/models/create_app_params.py +++ b/src/tower/tower_api_client/models/create_app_params.py @@ -16,7 +16,7 @@ class CreateAppParams: schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/CreateAppParams.json. short_description (Union[Unset, str]): A description of the app. - slug (Union[Unset, str]): A slug for the app. + slug (Union[Unset, str]): The slug of the app. Legacy CLI will send it but we don't need it. """ name: str diff --git a/src/tower/tower_api_client/models/create_catalog_params.py b/src/tower/tower_api_client/models/create_catalog_params.py index 2df3e349..b70c4653 100644 --- a/src/tower/tower_api_client/models/create_catalog_params.py +++ b/src/tower/tower_api_client/models/create_catalog_params.py @@ -20,7 +20,6 @@ class CreateCatalogParams: environment (str): name (str): properties (list['EncryptedCatalogProperty']): - slug (str): type_ (CreateCatalogParamsType): schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/CreateCatalogParams.json. @@ -29,7 +28,6 @@ class CreateCatalogParams: environment: str name: str properties: list["EncryptedCatalogProperty"] - slug: str type_: CreateCatalogParamsType schema: Union[Unset, str] = UNSET @@ -43,8 +41,6 @@ def to_dict(self) -> dict[str, Any]: properties_item = properties_item_data.to_dict() properties.append(properties_item) - slug = self.slug - type_ = self.type_.value schema = self.schema @@ -55,7 +51,6 @@ def to_dict(self) -> dict[str, Any]: "environment": environment, "name": name, "properties": properties, - "slug": slug, "type": type_, } ) @@ -80,8 +75,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: properties.append(properties_item) - slug = d.pop("slug") - type_ = CreateCatalogParamsType(d.pop("type")) schema = d.pop("$schema", UNSET) @@ -90,7 +83,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: environment=environment, name=name, properties=properties, - slug=slug, type_=type_, schema=schema, ) diff --git a/src/tower/tower_api_client/models/create_schedule_params.py b/src/tower/tower_api_client/models/create_schedule_params.py new file mode 100644 index 00000000..19992456 --- /dev/null +++ b/src/tower/tower_api_client/models/create_schedule_params.py @@ -0,0 +1,114 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.run_parameter import RunParameter + + +T = TypeVar("T", bound="CreateScheduleParams") + + +@_attrs_define +class CreateScheduleParams: + """ + Attributes: + app_name (str): The name of the app to create a schedule for + cron_string (str): The cron expression defining when the app should run + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/CreateScheduleParams.json. + app_version (Union[None, Unset, str]): The specific app version to run (if omitted, will use the app's default + version) + environment (Union[Unset, str]): The environment to run the app in Default: 'default'. + parameters (Union[Unset, list['RunParameter']]): Parameters to pass when running the app + """ + + app_name: str + cron_string: str + schema: Union[Unset, str] = UNSET + app_version: Union[None, Unset, str] = UNSET + environment: Union[Unset, str] = "default" + parameters: Union[Unset, list["RunParameter"]] = UNSET + + def to_dict(self) -> dict[str, Any]: + app_name = self.app_name + + cron_string = self.cron_string + + schema = self.schema + + app_version: Union[None, Unset, str] + if isinstance(self.app_version, Unset): + app_version = UNSET + else: + app_version = self.app_version + + environment = self.environment + + parameters: Union[Unset, list[dict[str, Any]]] = UNSET + if not isinstance(self.parameters, Unset): + parameters = [] + for parameters_item_data in self.parameters: + parameters_item = parameters_item_data.to_dict() + parameters.append(parameters_item) + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "app_name": app_name, + "cron_string": cron_string, + } + ) + if schema is not UNSET: + field_dict["$schema"] = schema + if app_version is not UNSET: + field_dict["app_version"] = app_version + if environment is not UNSET: + field_dict["environment"] = environment + if parameters is not UNSET: + field_dict["parameters"] = parameters + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.run_parameter import RunParameter + + d = dict(src_dict) + app_name = d.pop("app_name") + + cron_string = d.pop("cron_string") + + schema = d.pop("$schema", UNSET) + + def _parse_app_version(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + app_version = _parse_app_version(d.pop("app_version", UNSET)) + + environment = d.pop("environment", UNSET) + + parameters = [] + _parameters = d.pop("parameters", UNSET) + for parameters_item_data in _parameters or []: + parameters_item = RunParameter.from_dict(parameters_item_data) + + parameters.append(parameters_item) + + create_schedule_params = cls( + app_name=app_name, + cron_string=cron_string, + schema=schema, + app_version=app_version, + environment=environment, + parameters=parameters, + ) + + return create_schedule_params diff --git a/src/tower/tower_api_client/models/create_schedule_response.py b/src/tower/tower_api_client/models/create_schedule_response.py new file mode 100644 index 00000000..5e53c2dc --- /dev/null +++ b/src/tower/tower_api_client/models/create_schedule_response.py @@ -0,0 +1,57 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.schedule import Schedule + + +T = TypeVar("T", bound="CreateScheduleResponse") + + +@_attrs_define +class CreateScheduleResponse: + """ + Attributes: + schedule (Schedule): + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/CreateScheduleResponse.json. + """ + + schedule: "Schedule" + schema: Union[Unset, str] = UNSET + + def to_dict(self) -> dict[str, Any]: + schedule = self.schedule.to_dict() + + schema = self.schema + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "schedule": schedule, + } + ) + if schema is not UNSET: + field_dict["$schema"] = schema + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.schedule import Schedule + + d = dict(src_dict) + schedule = Schedule.from_dict(d.pop("schedule")) + + schema = d.pop("$schema", UNSET) + + create_schedule_response = cls( + schedule=schedule, + schema=schema, + ) + + return create_schedule_response diff --git a/src/tower/tower_api_client/models/create_team_params.py b/src/tower/tower_api_client/models/create_team_params.py index 90c1ca59..133b67a9 100644 --- a/src/tower/tower_api_client/models/create_team_params.py +++ b/src/tower/tower_api_client/models/create_team_params.py @@ -13,27 +13,22 @@ class CreateTeamParams: """ Attributes: name (str): The name of the team to create - slug (str): The slug of the team to create schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/CreateTeamParams.json. """ name: str - slug: str schema: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: name = self.name - slug = self.slug - schema = self.schema field_dict: dict[str, Any] = {} field_dict.update( { "name": name, - "slug": slug, } ) if schema is not UNSET: @@ -46,13 +41,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) name = d.pop("name") - slug = d.pop("slug") - schema = d.pop("$schema", UNSET) create_team_params = cls( name=name, - slug=slug, schema=schema, ) diff --git a/src/tower/tower_api_client/models/delete_schedule_response.py b/src/tower/tower_api_client/models/delete_schedule_response.py new file mode 100644 index 00000000..5da8741f --- /dev/null +++ b/src/tower/tower_api_client/models/delete_schedule_response.py @@ -0,0 +1,51 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="DeleteScheduleResponse") + + +@_attrs_define +class DeleteScheduleResponse: + """ + Attributes: + id (str): The ID of the deleted schedule. + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/DeleteScheduleResponse.json. + """ + + id: str + schema: Union[Unset, str] = UNSET + + def to_dict(self) -> dict[str, Any]: + id = self.id + + schema = self.schema + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "id": id, + } + ) + if schema is not UNSET: + field_dict["$schema"] = schema + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = d.pop("id") + + schema = d.pop("$schema", UNSET) + + delete_schedule_response = cls( + id=id, + schema=schema, + ) + + return delete_schedule_response diff --git a/src/tower/tower_api_client/models/delete_team_params.py b/src/tower/tower_api_client/models/delete_team_params.py index 2af8bbb4..379b45b6 100644 --- a/src/tower/tower_api_client/models/delete_team_params.py +++ b/src/tower/tower_api_client/models/delete_team_params.py @@ -12,23 +12,23 @@ class DeleteTeamParams: """ Attributes: - slug (str): The slug of the team to delete + name (str): The name of the team to delete schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/DeleteTeamParams.json. """ - slug: str + name: str schema: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: - slug = self.slug + name = self.name schema = self.schema field_dict: dict[str, Any] = {} field_dict.update( { - "slug": slug, + "name": name, } ) if schema is not UNSET: @@ -39,12 +39,12 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - slug = d.pop("slug") + name = d.pop("name") schema = d.pop("$schema", UNSET) delete_team_params = cls( - slug=slug, + name=name, schema=schema, ) diff --git a/src/tower/tower_api_client/models/exported_catalog.py b/src/tower/tower_api_client/models/exported_catalog.py index 79dedf88..183a169a 100644 --- a/src/tower/tower_api_client/models/exported_catalog.py +++ b/src/tower/tower_api_client/models/exported_catalog.py @@ -1,10 +1,12 @@ import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar +from typing import TYPE_CHECKING, Any, TypeVar, Union from attrs import define as _attrs_define from dateutil.parser import isoparse +from ..types import UNSET, Unset + if TYPE_CHECKING: from ..models.exported_catalog_property import ExportedCatalogProperty @@ -20,16 +22,16 @@ class ExportedCatalog: environment (str): name (str): properties (list['ExportedCatalogProperty']): - slug (str): type_ (str): + slug (Union[Unset, str]): This property is deprecated. Please use name instead. """ created_at: datetime.datetime environment: str name: str properties: list["ExportedCatalogProperty"] - slug: str type_: str + slug: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() @@ -43,10 +45,10 @@ def to_dict(self) -> dict[str, Any]: properties_item = properties_item_data.to_dict() properties.append(properties_item) - slug = self.slug - type_ = self.type_ + slug = self.slug + field_dict: dict[str, Any] = {} field_dict.update( { @@ -54,10 +56,11 @@ def to_dict(self) -> dict[str, Any]: "environment": environment, "name": name, "properties": properties, - "slug": slug, "type": type_, } ) + if slug is not UNSET: + field_dict["slug"] = slug return field_dict @@ -79,17 +82,17 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: properties.append(properties_item) - slug = d.pop("slug") - type_ = d.pop("type") + slug = d.pop("slug", UNSET) + exported_catalog = cls( created_at=created_at, environment=environment, name=name, properties=properties, - slug=slug, type_=type_, + slug=slug, ) return exported_catalog diff --git a/src/tower/tower_api_client/models/generate_runner_credentials_response.py b/src/tower/tower_api_client/models/generate_runner_credentials_response.py new file mode 100644 index 00000000..928b6cd6 --- /dev/null +++ b/src/tower/tower_api_client/models/generate_runner_credentials_response.py @@ -0,0 +1,57 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.runner_credentials import RunnerCredentials + + +T = TypeVar("T", bound="GenerateRunnerCredentialsResponse") + + +@_attrs_define +class GenerateRunnerCredentialsResponse: + """ + Attributes: + credentials (RunnerCredentials): + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/GenerateRunnerCredentialsResponse.json. + """ + + credentials: "RunnerCredentials" + schema: Union[Unset, str] = UNSET + + def to_dict(self) -> dict[str, Any]: + credentials = self.credentials.to_dict() + + schema = self.schema + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "credentials": credentials, + } + ) + if schema is not UNSET: + field_dict["$schema"] = schema + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.runner_credentials import RunnerCredentials + + d = dict(src_dict) + credentials = RunnerCredentials.from_dict(d.pop("credentials")) + + schema = d.pop("$schema", UNSET) + + generate_runner_credentials_response = cls( + credentials=credentials, + schema=schema, + ) + + return generate_runner_credentials_response diff --git a/src/tower/tower_api_client/models/list_schedules_response.py b/src/tower/tower_api_client/models/list_schedules_response.py new file mode 100644 index 00000000..93d717f5 --- /dev/null +++ b/src/tower/tower_api_client/models/list_schedules_response.py @@ -0,0 +1,75 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.pagination import Pagination + from ..models.schedule import Schedule + + +T = TypeVar("T", bound="ListSchedulesResponse") + + +@_attrs_define +class ListSchedulesResponse: + """ + Attributes: + pages (Pagination): + schedules (list['Schedule']): + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/ListSchedulesResponse.json. + """ + + pages: "Pagination" + schedules: list["Schedule"] + schema: Union[Unset, str] = UNSET + + def to_dict(self) -> dict[str, Any]: + pages = self.pages.to_dict() + + schedules = [] + for schedules_item_data in self.schedules: + schedules_item = schedules_item_data.to_dict() + schedules.append(schedules_item) + + schema = self.schema + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "pages": pages, + "schedules": schedules, + } + ) + if schema is not UNSET: + field_dict["$schema"] = schema + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination import Pagination + from ..models.schedule import Schedule + + d = dict(src_dict) + pages = Pagination.from_dict(d.pop("pages")) + + schedules = [] + _schedules = d.pop("schedules") + for schedules_item_data in _schedules: + schedules_item = Schedule.from_dict(schedules_item_data) + + schedules.append(schedules_item) + + schema = d.pop("$schema", UNSET) + + list_schedules_response = cls( + pages=pages, + schedules=schedules, + schema=schema, + ) + + return list_schedules_response diff --git a/src/tower/tower_api_client/models/run.py b/src/tower/tower_api_client/models/run.py index d23ceeda..c017ae5c 100644 --- a/src/tower/tower_api_client/models/run.py +++ b/src/tower/tower_api_client/models/run.py @@ -7,6 +7,7 @@ from ..models.run_status import RunStatus from ..models.run_status_group import RunStatusGroup +from ..types import UNSET, Unset if TYPE_CHECKING: from ..models.run_parameter import RunParameter @@ -20,7 +21,6 @@ class Run: """ Attributes: app_name (str): - app_slug (str): app_version (str): cancelled_at (Union[None, datetime.datetime]): created_at (datetime.datetime): @@ -34,10 +34,10 @@ class Run: started_at (Union[None, datetime.datetime]): status (RunStatus): status_group (RunStatusGroup): + app_slug (Union[Unset, str]): This property is deprecated. Please use app_name instead. """ app_name: str - app_slug: str app_version: str cancelled_at: Union[None, datetime.datetime] created_at: datetime.datetime @@ -51,12 +51,11 @@ class Run: started_at: Union[None, datetime.datetime] status: RunStatus status_group: RunStatusGroup + app_slug: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: app_name = self.app_name - app_slug = self.app_slug - app_version = self.app_version cancelled_at: Union[None, str] @@ -99,11 +98,12 @@ def to_dict(self) -> dict[str, Any]: status_group = self.status_group.value + app_slug = self.app_slug + field_dict: dict[str, Any] = {} field_dict.update( { "app_name": app_name, - "app_slug": app_slug, "app_version": app_version, "cancelled_at": cancelled_at, "created_at": created_at, @@ -119,6 +119,8 @@ def to_dict(self) -> dict[str, Any]: "status_group": status_group, } ) + if app_slug is not UNSET: + field_dict["app_slug"] = app_slug return field_dict @@ -129,8 +131,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) app_name = d.pop("app_name") - app_slug = d.pop("app_slug") - app_version = d.pop("app_version") def _parse_cancelled_at(data: object) -> Union[None, datetime.datetime]: @@ -206,9 +206,10 @@ def _parse_started_at(data: object) -> Union[None, datetime.datetime]: status_group = RunStatusGroup(d.pop("status_group")) + app_slug = d.pop("app_slug", UNSET) + run = cls( app_name=app_name, - app_slug=app_slug, app_version=app_version, cancelled_at=cancelled_at, created_at=created_at, @@ -222,6 +223,7 @@ def _parse_started_at(data: object) -> Union[None, datetime.datetime]: started_at=started_at, status=status, status_group=status_group, + app_slug=app_slug, ) return run diff --git a/src/tower/tower_api_client/models/runner_credentials.py b/src/tower/tower_api_client/models/runner_credentials.py new file mode 100644 index 00000000..f99ae433 --- /dev/null +++ b/src/tower/tower_api_client/models/runner_credentials.py @@ -0,0 +1,71 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define + +T = TypeVar("T", bound="RunnerCredentials") + + +@_attrs_define +class RunnerCredentials: + """ + Attributes: + certificate (str): The signed certificate used by the runner to authenticate itself to Tower. + private_key (str): The private key used by the runner to authenticate itself to Tower. + root_ca (Union[None, str]): The PEM encoded root CA certificate that is used to verify the runner's certificate + when Tower is responsible for signing server certs. + runner_service_url (str): The host of the runner service that this runner will connect to. This is typically the + Tower service host. + """ + + certificate: str + private_key: str + root_ca: Union[None, str] + runner_service_url: str + + def to_dict(self) -> dict[str, Any]: + certificate = self.certificate + + private_key = self.private_key + + root_ca: Union[None, str] + root_ca = self.root_ca + + runner_service_url = self.runner_service_url + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "certificate": certificate, + "private_key": private_key, + "root_ca": root_ca, + "runner_service_url": runner_service_url, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + certificate = d.pop("certificate") + + private_key = d.pop("private_key") + + def _parse_root_ca(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + root_ca = _parse_root_ca(d.pop("root_ca")) + + runner_service_url = d.pop("runner_service_url") + + runner_credentials = cls( + certificate=certificate, + private_key=private_key, + root_ca=root_ca, + runner_service_url=runner_service_url, + ) + + return runner_credentials diff --git a/src/tower/tower_api_client/models/schedule.py b/src/tower/tower_api_client/models/schedule.py new file mode 100644 index 00000000..0be0f015 --- /dev/null +++ b/src/tower/tower_api_client/models/schedule.py @@ -0,0 +1,99 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.run_parameter import RunParameter + + +T = TypeVar("T", bound="Schedule") + + +@_attrs_define +class Schedule: + """ + Attributes: + app_name (str): The name of the app that will be executed + cron (str): The cron expression defining when the app should run + environment (str): The environment to run the app in + id (str): The unique identifier for the schedule + app_version (Union[Unset, str]): The specific app version to run, or null for the default version + parameters (Union[Unset, list['RunParameter']]): The parameters to pass when running the app + """ + + app_name: str + cron: str + environment: str + id: str + app_version: Union[Unset, str] = UNSET + parameters: Union[Unset, list["RunParameter"]] = UNSET + + def to_dict(self) -> dict[str, Any]: + app_name = self.app_name + + cron = self.cron + + environment = self.environment + + id = self.id + + app_version = self.app_version + + parameters: Union[Unset, list[dict[str, Any]]] = UNSET + if not isinstance(self.parameters, Unset): + parameters = [] + for parameters_item_data in self.parameters: + parameters_item = parameters_item_data.to_dict() + parameters.append(parameters_item) + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "app_name": app_name, + "cron": cron, + "environment": environment, + "id": id, + } + ) + if app_version is not UNSET: + field_dict["app_version"] = app_version + if parameters is not UNSET: + field_dict["parameters"] = parameters + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.run_parameter import RunParameter + + d = dict(src_dict) + app_name = d.pop("app_name") + + cron = d.pop("cron") + + environment = d.pop("environment") + + id = d.pop("id") + + app_version = d.pop("app_version", UNSET) + + parameters = [] + _parameters = d.pop("parameters", UNSET) + for parameters_item_data in _parameters or []: + parameters_item = RunParameter.from_dict(parameters_item_data) + + parameters.append(parameters_item) + + schedule = cls( + app_name=app_name, + cron=cron, + environment=environment, + id=id, + app_version=app_version, + parameters=parameters, + ) + + return schedule diff --git a/src/tower/tower_api_client/models/team.py b/src/tower/tower_api_client/models/team.py index b852cdcb..869598e9 100644 --- a/src/tower/tower_api_client/models/team.py +++ b/src/tower/tower_api_client/models/team.py @@ -17,23 +17,23 @@ class Team: """ Attributes: name (str): - slug (str): type_ (str): The type of team, either 'personal' or 'team'. + slug (Union[Unset, str]): This property is deprecated. Please use name instead. token (Union[Unset, Token]): """ name: str - slug: str type_: str + slug: Union[Unset, str] = UNSET token: Union[Unset, "Token"] = UNSET def to_dict(self) -> dict[str, Any]: name = self.name - slug = self.slug - type_ = self.type_ + slug = self.slug + token: Union[Unset, dict[str, Any]] = UNSET if not isinstance(self.token, Unset): token = self.token.to_dict() @@ -42,10 +42,11 @@ def to_dict(self) -> dict[str, Any]: field_dict.update( { "name": name, - "slug": slug, "type": type_, } ) + if slug is not UNSET: + field_dict["slug"] = slug if token is not UNSET: field_dict["token"] = token @@ -58,10 +59,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) name = d.pop("name") - slug = d.pop("slug") - type_ = d.pop("type") + slug = d.pop("slug", UNSET) + _token = d.pop("token", UNSET) token: Union[Unset, Token] if isinstance(_token, Unset): @@ -71,8 +72,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: team = cls( name=name, - slug=slug, type_=type_, + slug=slug, token=token, ) diff --git a/src/tower/tower_api_client/models/update_account_slug_params.py b/src/tower/tower_api_client/models/update_account_name_params.py similarity index 64% rename from src/tower/tower_api_client/models/update_account_slug_params.py rename to src/tower/tower_api_client/models/update_account_name_params.py index f47ba402..dc418452 100644 --- a/src/tower/tower_api_client/models/update_account_slug_params.py +++ b/src/tower/tower_api_client/models/update_account_name_params.py @@ -5,30 +5,30 @@ from ..types import UNSET, Unset -T = TypeVar("T", bound="UpdateAccountSlugParams") +T = TypeVar("T", bound="UpdateAccountNameParams") @_attrs_define -class UpdateAccountSlugParams: +class UpdateAccountNameParams: """ Attributes: - new_slug (str): The new slug for the account + name (str): The new name for the account schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: - https://api.tower.dev/v1/schemas/UpdateAccountSlugParams.json. + https://api.tower.dev/v1/schemas/UpdateAccountNameParams.json. """ - new_slug: str + name: str schema: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: - new_slug = self.new_slug + name = self.name schema = self.schema field_dict: dict[str, Any] = {} field_dict.update( { - "new_slug": new_slug, + "name": name, } ) if schema is not UNSET: @@ -39,13 +39,13 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - new_slug = d.pop("new_slug") + name = d.pop("name") schema = d.pop("$schema", UNSET) - update_account_slug_params = cls( - new_slug=new_slug, + update_account_name_params = cls( + name=name, schema=schema, ) - return update_account_slug_params + return update_account_name_params diff --git a/src/tower/tower_api_client/models/update_account_slug_response.py b/src/tower/tower_api_client/models/update_account_name_response.py similarity index 82% rename from src/tower/tower_api_client/models/update_account_slug_response.py rename to src/tower/tower_api_client/models/update_account_name_response.py index 36dfe83e..993a27bb 100644 --- a/src/tower/tower_api_client/models/update_account_slug_response.py +++ b/src/tower/tower_api_client/models/update_account_name_response.py @@ -9,16 +9,16 @@ from ..models.account import Account -T = TypeVar("T", bound="UpdateAccountSlugResponse") +T = TypeVar("T", bound="UpdateAccountNameResponse") @_attrs_define -class UpdateAccountSlugResponse: +class UpdateAccountNameResponse: """ Attributes: account (Account): schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: - https://api.tower.dev/v1/schemas/UpdateAccountSlugResponse.json. + https://api.tower.dev/v1/schemas/UpdateAccountNameResponse.json. """ account: "Account" @@ -49,9 +49,9 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: schema = d.pop("$schema", UNSET) - update_account_slug_response = cls( + update_account_name_response = cls( account=account, schema=schema, ) - return update_account_slug_response + return update_account_name_response diff --git a/src/tower/tower_api_client/models/update_catalog_params.py b/src/tower/tower_api_client/models/update_catalog_params.py index ede84c92..a313c0f7 100644 --- a/src/tower/tower_api_client/models/update_catalog_params.py +++ b/src/tower/tower_api_client/models/update_catalog_params.py @@ -17,22 +17,18 @@ class UpdateCatalogParams: """ Attributes: environment (str): New environment for the catalog - name (str): New name for the catalog properties (list['EncryptedCatalogProperty']): schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/UpdateCatalogParams.json. """ environment: str - name: str properties: list["EncryptedCatalogProperty"] schema: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: environment = self.environment - name = self.name - properties = [] for properties_item_data in self.properties: properties_item = properties_item_data.to_dict() @@ -44,7 +40,6 @@ def to_dict(self) -> dict[str, Any]: field_dict.update( { "environment": environment, - "name": name, "properties": properties, } ) @@ -60,8 +55,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) environment = d.pop("environment") - name = d.pop("name") - properties = [] _properties = d.pop("properties") for properties_item_data in _properties: @@ -73,7 +66,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: update_catalog_params = cls( environment=environment, - name=name, properties=properties, schema=schema, ) diff --git a/src/tower/tower_api_client/models/update_my_team_invitation_params.py b/src/tower/tower_api_client/models/update_my_team_invitation_params.py index dd79f98f..2ae654ae 100644 --- a/src/tower/tower_api_client/models/update_my_team_invitation_params.py +++ b/src/tower/tower_api_client/models/update_my_team_invitation_params.py @@ -13,19 +13,19 @@ class UpdateMyTeamInvitationParams: """ Attributes: accepted (bool): Whether or not the invitation was accepted. If false, it's considered rejected. - slug (str): The slug of the team invitation to update + name (str): The name of the team invitation to update schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/UpdateMyTeamInvitationParams.json. """ accepted: bool - slug: str + name: str schema: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: accepted = self.accepted - slug = self.slug + name = self.name schema = self.schema @@ -33,7 +33,7 @@ def to_dict(self) -> dict[str, Any]: field_dict.update( { "accepted": accepted, - "slug": slug, + "name": name, } ) if schema is not UNSET: @@ -46,13 +46,13 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) accepted = d.pop("accepted") - slug = d.pop("slug") + name = d.pop("name") schema = d.pop("$schema", UNSET) update_my_team_invitation_params = cls( accepted=accepted, - slug=slug, + name=name, schema=schema, ) diff --git a/src/tower/tower_api_client/models/update_schedule_params.py b/src/tower/tower_api_client/models/update_schedule_params.py new file mode 100644 index 00000000..85da8fb4 --- /dev/null +++ b/src/tower/tower_api_client/models/update_schedule_params.py @@ -0,0 +1,124 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.run_parameter import RunParameter + + +T = TypeVar("T", bound="UpdateScheduleParams") + + +@_attrs_define +class UpdateScheduleParams: + """ + Attributes: + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/UpdateScheduleParams.json. + app_name (Union[None, Unset, str]): The name of the app that this schedule runs + app_version (Union[None, Unset, str]): The specific app version to run (if omitted, will use the app's default + version) + cron (Union[Unset, str]): The cron expression defining when the app should run + environment (Union[Unset, str]): The environment to run the app in + parameters (Union[Unset, list['RunParameter']]): Parameters to pass when running the app + """ + + schema: Union[Unset, str] = UNSET + app_name: Union[None, Unset, str] = UNSET + app_version: Union[None, Unset, str] = UNSET + cron: Union[Unset, str] = UNSET + environment: Union[Unset, str] = UNSET + parameters: Union[Unset, list["RunParameter"]] = UNSET + + def to_dict(self) -> dict[str, Any]: + schema = self.schema + + app_name: Union[None, Unset, str] + if isinstance(self.app_name, Unset): + app_name = UNSET + else: + app_name = self.app_name + + app_version: Union[None, Unset, str] + if isinstance(self.app_version, Unset): + app_version = UNSET + else: + app_version = self.app_version + + cron = self.cron + + environment = self.environment + + parameters: Union[Unset, list[dict[str, Any]]] = UNSET + if not isinstance(self.parameters, Unset): + parameters = [] + for parameters_item_data in self.parameters: + parameters_item = parameters_item_data.to_dict() + parameters.append(parameters_item) + + field_dict: dict[str, Any] = {} + field_dict.update({}) + if schema is not UNSET: + field_dict["$schema"] = schema + if app_name is not UNSET: + field_dict["app_name"] = app_name + if app_version is not UNSET: + field_dict["app_version"] = app_version + if cron is not UNSET: + field_dict["cron"] = cron + if environment is not UNSET: + field_dict["environment"] = environment + if parameters is not UNSET: + field_dict["parameters"] = parameters + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.run_parameter import RunParameter + + d = dict(src_dict) + schema = d.pop("$schema", UNSET) + + def _parse_app_name(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + app_name = _parse_app_name(d.pop("app_name", UNSET)) + + def _parse_app_version(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + app_version = _parse_app_version(d.pop("app_version", UNSET)) + + cron = d.pop("cron", UNSET) + + environment = d.pop("environment", UNSET) + + parameters = [] + _parameters = d.pop("parameters", UNSET) + for parameters_item_data in _parameters or []: + parameters_item = RunParameter.from_dict(parameters_item_data) + + parameters.append(parameters_item) + + update_schedule_params = cls( + schema=schema, + app_name=app_name, + app_version=app_version, + cron=cron, + environment=environment, + parameters=parameters, + ) + + return update_schedule_params diff --git a/src/tower/tower_api_client/models/update_schedule_response.py b/src/tower/tower_api_client/models/update_schedule_response.py new file mode 100644 index 00000000..94e8496a --- /dev/null +++ b/src/tower/tower_api_client/models/update_schedule_response.py @@ -0,0 +1,57 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.schedule import Schedule + + +T = TypeVar("T", bound="UpdateScheduleResponse") + + +@_attrs_define +class UpdateScheduleResponse: + """ + Attributes: + schedule (Schedule): + schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: + https://api.tower.dev/v1/schemas/UpdateScheduleResponse.json. + """ + + schedule: "Schedule" + schema: Union[Unset, str] = UNSET + + def to_dict(self) -> dict[str, Any]: + schedule = self.schedule.to_dict() + + schema = self.schema + + field_dict: dict[str, Any] = {} + field_dict.update( + { + "schedule": schedule, + } + ) + if schema is not UNSET: + field_dict["$schema"] = schema + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.schedule import Schedule + + d = dict(src_dict) + schedule = Schedule.from_dict(d.pop("schedule")) + + schema = d.pop("$schema", UNSET) + + update_schedule_response = cls( + schedule=schedule, + schema=schema, + ) + + return update_schedule_response diff --git a/src/tower/tower_api_client/models/update_team_params.py b/src/tower/tower_api_client/models/update_team_params.py index d1931a2d..d06faee6 100644 --- a/src/tower/tower_api_client/models/update_team_params.py +++ b/src/tower/tower_api_client/models/update_team_params.py @@ -12,32 +12,25 @@ class UpdateTeamParams: """ Attributes: - name (Union[None, str]): The name of the team to create. This is optional, if you supply null it will not update - the team name. - slug (Union[None, str]): The new slug that you want the team to use. This is optional, if you supply null it - will not update the slug. + name (Union[None, str]): The name of the team to update. This is optional, if you supply null it will not + update the team name. schema (Union[Unset, str]): A URL to the JSON Schema for this object. Example: https://api.tower.dev/v1/schemas/UpdateTeamParams.json. """ name: Union[None, str] - slug: Union[None, str] schema: Union[Unset, str] = UNSET def to_dict(self) -> dict[str, Any]: name: Union[None, str] name = self.name - slug: Union[None, str] - slug = self.slug - schema = self.schema field_dict: dict[str, Any] = {} field_dict.update( { "name": name, - "slug": slug, } ) if schema is not UNSET: @@ -56,18 +49,10 @@ def _parse_name(data: object) -> Union[None, str]: name = _parse_name(d.pop("name")) - def _parse_slug(data: object) -> Union[None, str]: - if data is None: - return data - return cast(Union[None, str], data) - - slug = _parse_slug(d.pop("slug")) - schema = d.pop("$schema", UNSET) update_team_params = cls( name=name, - slug=slug, schema=schema, ) diff --git a/tests/tower/test_client.py b/tests/tower/test_client.py index 964cd09f..c54135ae 100644 --- a/tests/tower/test_client.py +++ b/tests/tower/test_client.py @@ -25,7 +25,6 @@ def mock_api_config(): def mock_run_response_factory(): """Factory to create consistent run response objects.""" def _create_run_response( - app_slug: str = "my-app", app_version: str = "v6", number: int = 0, run_id: str = "50ac9bc1-c783-4359-9917-a706f20dc02c", @@ -40,7 +39,6 @@ def _create_run_response( return { "run": { "app_name": "my-app", - "app_slug": app_slug, "app_version": app_version, "cancelled_at": None, "created_at": "2025-04-25T20:54:58.762547Z", @@ -64,7 +62,6 @@ def _create_run_response( def create_run_object(): """Factory to create Run objects for testing.""" def _create_run( - app_slug: str = "my-app", app_version: str = "v6", number: int = 0, run_id: str = "50ac9bc1-c783-4359-9917-a706f20dc02c", @@ -79,7 +76,6 @@ def _create_run( return Run( app_name="my-app", exit_code=None, - app_slug=app_slug, app_version=app_version, cancelled_at=None, created_at="2025-04-25T20:54:58.762547Z", @@ -112,7 +108,6 @@ def test_running_apps(httpx_mock, mock_api_config, mock_run_response_factory): # Assert the response assert run is not None - assert run.app_slug == "my-app" assert run.status == "pending" diff --git a/uv.lock b/uv.lock index bec8211e..242037b6 100644 --- a/uv.lock +++ b/uv.lock @@ -1201,7 +1201,7 @@ wheels = [ [[package]] name = "tower" -version = "0.3.22" +version = "0.3.23" source = { editable = "." } dependencies = [ { name = "attrs" },