Skip to content

Commit 677b1de

Browse files
committed
Update deploy api
1 parent 4009668 commit 677b1de

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

src/cli.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ pub enum DeployCommands {
389389
Trigger {
390390
/// Environment ID
391391
env_id: String,
392+
/// Include wp-content/uploads in the deployment
393+
#[arg(long)]
394+
include_uploads: bool,
392395
},
393396
/// Rollback to a previous deployment
394397
Rollback {

src/commands/deploy.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ struct PaginationQuery {
1313
per_page: u32,
1414
}
1515

16+
#[derive(Debug, Serialize)]
17+
struct TriggerRequest {
18+
#[serde(skip_serializing_if = "std::ops::Not::not")]
19+
include_uploads: bool,
20+
}
21+
1622
#[derive(Debug, Serialize)]
1723
struct RollbackRequest {
1824
#[serde(skip_serializing_if = "Option::is_none")]
@@ -112,11 +118,17 @@ pub fn show(client: &ApiClient, deploy_id: &str, format: OutputFormat) -> Result
112118
Ok(())
113119
}
114120

115-
pub fn trigger(client: &ApiClient, env_id: &str, format: OutputFormat) -> Result<(), ApiError> {
116-
let response: Value = client.post_empty(&format!(
117-
"/api/v1/vector/environments/{}/deployments",
118-
env_id
119-
))?;
121+
pub fn trigger(
122+
client: &ApiClient,
123+
env_id: &str,
124+
include_uploads: bool,
125+
format: OutputFormat,
126+
) -> Result<(), ApiError> {
127+
let body = TriggerRequest { include_uploads };
128+
let response: Value = client.post(
129+
&format!("/api/v1/vector/environments/{}/deployments", env_id),
130+
&body,
131+
)?;
120132

121133
if format == OutputFormat::Json {
122134
print_json(&response);

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ fn run_deploy(command: DeployCommands, format: OutputFormat) -> Result<(), ApiEr
223223
per_page,
224224
} => deploy::list(&client, &env_id, page, per_page, format),
225225
DeployCommands::Show { deploy_id } => deploy::show(&client, &deploy_id, format),
226-
DeployCommands::Trigger { env_id } => deploy::trigger(&client, &env_id, format),
226+
DeployCommands::Trigger {
227+
env_id,
228+
include_uploads,
229+
} => deploy::trigger(&client, &env_id, include_uploads, format),
227230
DeployCommands::Rollback {
228231
env_id,
229232
target_deployment_id,

0 commit comments

Comments
 (0)