diff --git a/cli/src/main.rs b/cli/src/main.rs index 8611899..a8b0bfe 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -766,6 +766,7 @@ enum ClustersCommand { Update(UpdateCluster), Delete(DeleteCluster), Expand(ExpandCluster), + Restart(RestartCluster), } #[derive(Debug, StructOpt)] @@ -898,6 +899,19 @@ struct ExpandCluster { disk_type: Option, } +#[derive(Debug, StructOpt)] +#[structopt(about = "Restarts a cluster")] +struct RestartCluster { + #[structopt(long, parse(try_from_str = parse_org_id), default_value = "", help = "The organization id the cluster relates to")] + org_id: OrgId, + + #[structopt(long, parse(try_from_str = parse_project_id), default_value = "", help = "The project id the cluster relates to")] + project_id: esc_api::resources::ProjectId, + + #[structopt(long, short, parse(try_from_str = parse_cluster_id), help = "Id of the cluster you want to expand")] + id: esc_api::ClusterId, +} + #[derive(Debug, StructOpt)] #[structopt(about = "Gathers backup management commands")] struct Backups { @@ -2211,6 +2225,17 @@ async fn call_api<'a, 'b>( ) .await?; } + + ClustersCommand::Restart(params) => { + let client = client_builder.create().await?; + esc_api::mesdb::restart_cluster( + &client, + params.org_id, + params.project_id, + params.id, + ) + .await?; + } }, MesdbCommand::Backups(clusters) => match clusters.backups_command { BackupsCommand::Create(params) => { diff --git a/generated/src/mesdb/operations.rs b/generated/src/mesdb/operations.rs index fe5c934..1ab9f93 100644 --- a/generated/src/mesdb/operations.rs +++ b/generated/src/mesdb/operations.rs @@ -234,6 +234,30 @@ pub async fn list_clusters( .await } +/// restart a cluster +/// +/// # Arguments +/// +/// * `organization_id` - The id of the organization the cluster is owned by +/// * `project_id` - The id of the project the cluster is organized by +/// * `cluster_id` - The id of the cluster +pub async fn restart_cluster( + client: &Client, + organization_id: OrganizationId, + project_id: ProjectId, + cluster_id: ClusterId, +) -> Result { + let url = format!( + "/mesdb/v1/organizations/{organizationId}/projects/{projectId}/clusters/{clusterId}/commands/restart", + organizationId = urlencode(organization_id), + projectId = urlencode(project_id), + clusterId = urlencode(cluster_id), + ); + client + .send_request::<(), RestartClusterResponse>(Method::PUT, url, None, None) + .await +} + /// Updates a cluster /// /// # Arguments diff --git a/generated/src/mesdb/schemas.rs b/generated/src/mesdb/schemas.rs index 3eda6be..c73e623 100644 --- a/generated/src/mesdb/schemas.rs +++ b/generated/src/mesdb/schemas.rs @@ -176,6 +176,12 @@ impl std::fmt::Display for ProjectionLevel { } } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RestartClusterResponse { + pub id: String, +} + /// Either single-node or three-node-multi-zone #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum Topology {