MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / create_region

Method create_region

src/cloud-api/src/client/region.rs:118–162  ·  view source on GitHub ↗

Creates a customer region in a particular cloud region for the current user

(
        &self,
        version: Option<String>,
        environmentd_extra_args: Vec<String>,
        environmentd_cpu_allocation: Option<String>,
        environmentd_memory_allocation: Option<Stri

Source from the content-addressed store, hash-verified

116
117 /// Creates a customer region in a particular cloud region for the current user
118 pub async fn create_region(
119 &self,
120 version: Option<String>,
121 environmentd_extra_args: Vec<String>,
122 environmentd_cpu_allocation: Option<String>,
123 environmentd_memory_allocation: Option<String>,
124 cloud_provider: CloudProvider,
125 ) -> Result<Region, Error> {
126 #[derive(Serialize)]
127 #[serde(rename_all = "camelCase")]
128 struct Body {
129 #[serde(skip_serializing_if = "Option::is_none")]
130 environmentd_image_ref: Option<String>,
131 #[serde(skip_serializing_if = "Vec::is_empty")]
132 environmentd_extra_args: Vec<String>,
133 #[serde(skip_serializing_if = "Option::is_none")]
134 environmentd_cpu_allocation: Option<String>,
135 #[serde(skip_serializing_if = "Option::is_none")]
136 environmentd_memory_allocation: Option<String>,
137 }
138
139 let body = Body {
140 environmentd_image_ref: version.map(|v| match v.split_once(':') {
141 None => format!("materialize/environmentd:{v}"),
142 Some((user, v)) => format!("{user}/environmentd:{v}"),
143 }),
144 environmentd_extra_args,
145 environmentd_cpu_allocation,
146 environmentd_memory_allocation,
147 };
148
149 let req = self
150 .build_region_request(
151 Method::PATCH,
152 ["api", "region"],
153 None,
154 &cloud_provider,
155 Some(1),
156 )
157 .await?;
158 let req = req.json(&body);
159 // Creating a region can take some time
160 let req = req.timeout(Duration::from_secs(60));
161 self.send_request(req).await
162 }
163
164 /// Deletes a customer region in a particular cloud region for the current user.
165 ///

Callers 1

enableFunction · 0.80

Calls 5

build_region_requestMethod · 0.80
timeoutMethod · 0.80
mapMethod · 0.45
jsonMethod · 0.45
send_requestMethod · 0.45

Tested by

no test coverage detected