render_api/request/
update_environment_variables.rs1use serde_json::json;
2use crate::model::*;
3use crate::RenderClient;
4use httpclient::InMemoryResponseExt;
5#[derive(Clone)]
9pub struct UpdateEnvironmentVariablesRequest<'a> {
10 pub(crate) http_client: &'a RenderClient,
11 pub body: Vec<EnvVar>,
12 pub service_id: String,
13}
14impl<'a> UpdateEnvironmentVariablesRequest<'a> {
15 pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<EnvVarCursor>> {
16 let mut r = self
17 .http_client
18 .client
19 .put(
20 &format!("/services/{service_id}/env-vars", service_id = self.service_id),
21 );
22 r = r.json(json!({ "body" : self.body }));
23 r = self.http_client.authenticate(r);
24 let res = r.await?;
25 res.json().map_err(Into::into)
26 }
27}
28impl<'a> ::std::future::IntoFuture for UpdateEnvironmentVariablesRequest<'a> {
29 type Output = httpclient::InMemoryResult<Vec<EnvVarCursor>>;
30 type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
31 fn into_future(self) -> Self::IntoFuture {
32 Box::pin(self.send())
33 }
34}