1#![allow(unused_mut)]
2#![allow(unused_variables)]
3#![allow(unused_imports)]
4#![allow(clippy::redundant_clone)]
5pub mod models;
6#[derive(Clone)]
7pub struct Client {
8 endpoint: azure_core::Url,
9 credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
10 scopes: Vec<String>,
11 pipeline: azure_core::Pipeline,
12}
13#[derive(Clone)]
14pub struct ClientBuilder {
15 credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
16 endpoint: Option<azure_core::Url>,
17 scopes: Option<Vec<String>>,
18 options: azure_core::ClientOptions,
19}
20pub use azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD as DEFAULT_ENDPOINT;
21impl ClientBuilder {
22 #[doc = "Create a new instance of `ClientBuilder`."]
23 #[must_use]
24 pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> Self {
25 Self {
26 credential,
27 endpoint: None,
28 scopes: None,
29 options: azure_core::ClientOptions::default(),
30 }
31 }
32 #[doc = "Set the endpoint."]
33 #[must_use]
34 pub fn endpoint(mut self, endpoint: impl Into<azure_core::Url>) -> Self {
35 self.endpoint = Some(endpoint.into());
36 self
37 }
38 #[doc = "Set the scopes."]
39 #[must_use]
40 pub fn scopes(mut self, scopes: &[&str]) -> Self {
41 self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
42 self
43 }
44 #[doc = "Set the retry options."]
45 #[must_use]
46 pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
47 self.options = self.options.retry(retry);
48 self
49 }
50 #[doc = "Set the transport options."]
51 #[must_use]
52 pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
53 self.options = self.options.transport(transport);
54 self
55 }
56 #[doc = "Convert the builder into a `Client` instance."]
57 pub fn build(self) -> azure_core::Result<Client> {
58 let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
59 let scopes = if let Some(scopes) = self.scopes {
60 scopes
61 } else {
62 vec![endpoint.join(azure_core::auth::DEFAULT_SCOPE_SUFFIX)?.to_string()]
63 };
64 Ok(Client::new(endpoint, self.credential, scopes, self.options))
65 }
66}
67impl Client {
68 pub(crate) async fn bearer_token(&self) -> azure_core::Result<azure_core::auth::Secret> {
69 let credential = self.token_credential();
70 let response = credential.get_token(&self.scopes()).await?;
71 Ok(response.token)
72 }
73 pub(crate) fn endpoint(&self) -> &azure_core::Url {
74 &self.endpoint
75 }
76 pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
77 self.credential.as_ref()
78 }
79 pub(crate) fn scopes(&self) -> Vec<&str> {
80 self.scopes.iter().map(String::as_str).collect()
81 }
82 pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
83 let context = azure_core::Context::default();
84 self.pipeline.send(&context, request).await
85 }
86 #[doc = "Create a new `ClientBuilder`."]
87 #[must_use]
88 pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
89 ClientBuilder::new(credential)
90 }
91 #[doc = "Create a new `Client`."]
92 #[must_use]
93 pub fn new(
94 endpoint: impl Into<azure_core::Url>,
95 credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
96 scopes: Vec<String>,
97 options: azure_core::ClientOptions,
98 ) -> Self {
99 let endpoint = endpoint.into();
100 let pipeline = azure_core::Pipeline::new(
101 option_env!("CARGO_PKG_NAME"),
102 option_env!("CARGO_PKG_VERSION"),
103 options,
104 Vec::new(),
105 Vec::new(),
106 );
107 Self {
108 endpoint,
109 credential,
110 scopes,
111 pipeline,
112 }
113 }
114 pub fn files_client(&self) -> files::Client {
115 files::Client(self.clone())
116 }
117 pub fn operations_client(&self) -> operations::Client {
118 operations::Client(self.clone())
119 }
120 pub fn projects_client(&self) -> projects::Client {
121 projects::Client(self.clone())
122 }
123 pub fn resource_skus_client(&self) -> resource_skus::Client {
124 resource_skus::Client(self.clone())
125 }
126 pub fn service_tasks_client(&self) -> service_tasks::Client {
127 service_tasks::Client(self.clone())
128 }
129 pub fn services_client(&self) -> services::Client {
130 services::Client(self.clone())
131 }
132 pub fn tasks_client(&self) -> tasks::Client {
133 tasks::Client(self.clone())
134 }
135 pub fn usages_client(&self) -> usages::Client {
136 usages::Client(self.clone())
137 }
138}
139pub mod resource_skus {
140 use super::models;
141 #[cfg(not(target_arch = "wasm32"))]
142 use futures::future::BoxFuture;
143 #[cfg(target_arch = "wasm32")]
144 use futures::future::LocalBoxFuture as BoxFuture;
145 pub struct Client(pub(crate) super::Client);
146 impl Client {
147 #[doc = "Get supported SKUs"]
148 #[doc = "The skus action returns the list of SKUs that DMS supports."]
149 #[doc = ""]
150 #[doc = "Arguments:"]
151 #[doc = "* `subscription_id`: Identifier of the subscription"]
152 pub fn list_skus(&self, subscription_id: impl Into<String>) -> list_skus::RequestBuilder {
153 list_skus::RequestBuilder {
154 client: self.0.clone(),
155 subscription_id: subscription_id.into(),
156 }
157 }
158 }
159 pub mod list_skus {
160 use super::models;
161 #[cfg(not(target_arch = "wasm32"))]
162 use futures::future::BoxFuture;
163 #[cfg(target_arch = "wasm32")]
164 use futures::future::LocalBoxFuture as BoxFuture;
165 #[derive(Debug)]
166 pub struct Response(azure_core::Response);
167 impl Response {
168 pub async fn into_body(self) -> azure_core::Result<models::ResourceSkusResult> {
169 let bytes = self.0.into_body().collect().await?;
170 let body: models::ResourceSkusResult = serde_json::from_slice(&bytes)?;
171 Ok(body)
172 }
173 pub fn into_raw_response(self) -> azure_core::Response {
174 self.0
175 }
176 pub fn as_raw_response(&self) -> &azure_core::Response {
177 &self.0
178 }
179 }
180 impl From<Response> for azure_core::Response {
181 fn from(rsp: Response) -> Self {
182 rsp.into_raw_response()
183 }
184 }
185 impl AsRef<azure_core::Response> for Response {
186 fn as_ref(&self) -> &azure_core::Response {
187 self.as_raw_response()
188 }
189 }
190 #[derive(Clone)]
191 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
192 #[doc = r""]
193 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
194 #[doc = r" parameters can be chained."]
195 #[doc = r""]
196 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
197 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
198 #[doc = r" executes the request and returns a `Result` with the parsed"]
199 #[doc = r" response."]
200 #[doc = r""]
201 #[doc = r" In order to execute the request without polling the service"]
202 #[doc = r" until the operation completes, use `.send().await` instead."]
203 #[doc = r""]
204 #[doc = r" If you need lower-level access to the raw response details"]
205 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
206 #[doc = r" can finalize the request using the"]
207 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
208 #[doc = r" that resolves to a lower-level [`Response`] value."]
209 pub struct RequestBuilder {
210 pub(crate) client: super::super::Client,
211 pub(crate) subscription_id: String,
212 }
213 impl RequestBuilder {
214 pub fn into_stream(self) -> azure_core::Pageable<models::ResourceSkusResult, azure_core::error::Error> {
215 let make_request = move |continuation: Option<String>| {
216 let this = self.clone();
217 async move {
218 let mut url = this.url()?;
219 let rsp = match continuation {
220 Some(value) => {
221 url.set_path("");
222 url = url.join(&value)?;
223 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
224 let bearer_token = this.client.bearer_token().await?;
225 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
226 let has_api_version_already =
227 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
228 if !has_api_version_already {
229 req.url_mut()
230 .query_pairs_mut()
231 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
232 }
233 let req_body = azure_core::EMPTY_BODY;
234 req.set_body(req_body);
235 this.client.send(&mut req).await?
236 }
237 None => {
238 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
239 let bearer_token = this.client.bearer_token().await?;
240 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
241 let req_body = azure_core::EMPTY_BODY;
242 req.set_body(req_body);
243 this.client.send(&mut req).await?
244 }
245 };
246 let rsp = match rsp.status() {
247 azure_core::StatusCode::Ok => Ok(Response(rsp)),
248 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
249 status: status_code,
250 error_code: None,
251 })),
252 };
253 rsp?.into_body().await
254 }
255 };
256 azure_core::Pageable::new(make_request)
257 }
258 fn url(&self) -> azure_core::Result<azure_core::Url> {
259 let mut url = self.client.endpoint().clone();
260 url.set_path(&format!(
261 "/subscriptions/{}/providers/Microsoft.DataMigration/skus",
262 &self.subscription_id
263 ));
264 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
265 if !has_api_version_already {
266 url.query_pairs_mut()
267 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
268 }
269 Ok(url)
270 }
271 }
272 }
273}
274pub mod services {
275 use super::models;
276 #[cfg(not(target_arch = "wasm32"))]
277 use futures::future::BoxFuture;
278 #[cfg(target_arch = "wasm32")]
279 use futures::future::LocalBoxFuture as BoxFuture;
280 pub struct Client(pub(crate) super::Client);
281 impl Client {
282 #[doc = "Get DMS Service Instance"]
283 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance."]
284 #[doc = ""]
285 #[doc = "Arguments:"]
286 #[doc = "* `subscription_id`: Identifier of the subscription"]
287 #[doc = "* `group_name`: Name of the resource group"]
288 #[doc = "* `service_name`: Name of the service"]
289 pub fn get(
290 &self,
291 subscription_id: impl Into<String>,
292 group_name: impl Into<String>,
293 service_name: impl Into<String>,
294 ) -> get::RequestBuilder {
295 get::RequestBuilder {
296 client: self.0.clone(),
297 subscription_id: subscription_id.into(),
298 group_name: group_name.into(),
299 service_name: service_name.into(),
300 }
301 }
302 #[doc = "Create or update DMS Instance"]
303 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, \"vm\", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (\"ServiceIsBusy\"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property."]
304 #[doc = ""]
305 #[doc = "Arguments:"]
306 #[doc = "* `subscription_id`: Identifier of the subscription"]
307 #[doc = "* `group_name`: Name of the resource group"]
308 #[doc = "* `service_name`: Name of the service"]
309 #[doc = "* `parameters`: Information about the service"]
310 pub fn create_or_update(
311 &self,
312 subscription_id: impl Into<String>,
313 group_name: impl Into<String>,
314 service_name: impl Into<String>,
315 parameters: impl Into<models::DataMigrationService>,
316 ) -> create_or_update::RequestBuilder {
317 create_or_update::RequestBuilder {
318 client: self.0.clone(),
319 subscription_id: subscription_id.into(),
320 group_name: group_name.into(),
321 service_name: service_name.into(),
322 parameters: parameters.into(),
323 }
324 }
325 #[doc = "Create or update DMS Service Instance"]
326 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request (\"ServiceIsBusy\")."]
327 #[doc = ""]
328 #[doc = "Arguments:"]
329 #[doc = "* `subscription_id`: Identifier of the subscription"]
330 #[doc = "* `group_name`: Name of the resource group"]
331 #[doc = "* `service_name`: Name of the service"]
332 #[doc = "* `parameters`: Information about the service"]
333 pub fn update(
334 &self,
335 subscription_id: impl Into<String>,
336 group_name: impl Into<String>,
337 service_name: impl Into<String>,
338 parameters: impl Into<models::DataMigrationService>,
339 ) -> update::RequestBuilder {
340 update::RequestBuilder {
341 client: self.0.clone(),
342 subscription_id: subscription_id.into(),
343 group_name: group_name.into(),
344 service_name: service_name.into(),
345 parameters: parameters.into(),
346 }
347 }
348 #[doc = "Delete DMS Service Instance"]
349 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. The DELETE method deletes a service. Any running tasks will be canceled."]
350 #[doc = ""]
351 #[doc = "Arguments:"]
352 #[doc = "* `subscription_id`: Identifier of the subscription"]
353 #[doc = "* `group_name`: Name of the resource group"]
354 #[doc = "* `service_name`: Name of the service"]
355 pub fn delete(
356 &self,
357 subscription_id: impl Into<String>,
358 group_name: impl Into<String>,
359 service_name: impl Into<String>,
360 ) -> delete::RequestBuilder {
361 delete::RequestBuilder {
362 client: self.0.clone(),
363 subscription_id: subscription_id.into(),
364 group_name: group_name.into(),
365 service_name: service_name.into(),
366 delete_running_tasks: None,
367 }
368 }
369 #[doc = "Check service health status"]
370 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. This action performs a health check and returns the status of the service and virtual machine size."]
371 #[doc = ""]
372 #[doc = "Arguments:"]
373 #[doc = "* `subscription_id`: Identifier of the subscription"]
374 #[doc = "* `group_name`: Name of the resource group"]
375 #[doc = "* `service_name`: Name of the service"]
376 pub fn check_status(
377 &self,
378 subscription_id: impl Into<String>,
379 group_name: impl Into<String>,
380 service_name: impl Into<String>,
381 ) -> check_status::RequestBuilder {
382 check_status::RequestBuilder {
383 client: self.0.clone(),
384 subscription_id: subscription_id.into(),
385 group_name: group_name.into(),
386 service_name: service_name.into(),
387 }
388 }
389 #[doc = "Start service"]
390 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. This action starts the service and the service can be used for data migration."]
391 #[doc = ""]
392 #[doc = "Arguments:"]
393 #[doc = "* `subscription_id`: Identifier of the subscription"]
394 #[doc = "* `group_name`: Name of the resource group"]
395 #[doc = "* `service_name`: Name of the service"]
396 pub fn start(
397 &self,
398 subscription_id: impl Into<String>,
399 group_name: impl Into<String>,
400 service_name: impl Into<String>,
401 ) -> start::RequestBuilder {
402 start::RequestBuilder {
403 client: self.0.clone(),
404 subscription_id: subscription_id.into(),
405 group_name: group_name.into(),
406 service_name: service_name.into(),
407 }
408 }
409 #[doc = "Stop service"]
410 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped."]
411 #[doc = ""]
412 #[doc = "Arguments:"]
413 #[doc = "* `subscription_id`: Identifier of the subscription"]
414 #[doc = "* `group_name`: Name of the resource group"]
415 #[doc = "* `service_name`: Name of the service"]
416 pub fn stop(
417 &self,
418 subscription_id: impl Into<String>,
419 group_name: impl Into<String>,
420 service_name: impl Into<String>,
421 ) -> stop::RequestBuilder {
422 stop::RequestBuilder {
423 client: self.0.clone(),
424 subscription_id: subscription_id.into(),
425 group_name: group_name.into(),
426 service_name: service_name.into(),
427 }
428 }
429 #[doc = "Get compatible SKUs"]
430 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. The skus action returns the list of SKUs that a service resource can be updated to."]
431 #[doc = ""]
432 #[doc = "Arguments:"]
433 #[doc = "* `subscription_id`: Identifier of the subscription"]
434 #[doc = "* `group_name`: Name of the resource group"]
435 #[doc = "* `service_name`: Name of the service"]
436 pub fn list_skus(
437 &self,
438 subscription_id: impl Into<String>,
439 group_name: impl Into<String>,
440 service_name: impl Into<String>,
441 ) -> list_skus::RequestBuilder {
442 list_skus::RequestBuilder {
443 client: self.0.clone(),
444 subscription_id: subscription_id.into(),
445 group_name: group_name.into(),
446 service_name: service_name.into(),
447 }
448 }
449 #[doc = "Check nested resource name validity and availability"]
450 #[doc = "This method checks whether a proposed nested resource name is valid and available."]
451 #[doc = ""]
452 #[doc = "Arguments:"]
453 #[doc = "* `subscription_id`: Identifier of the subscription"]
454 #[doc = "* `group_name`: Name of the resource group"]
455 #[doc = "* `service_name`: Name of the service"]
456 #[doc = "* `parameters`: Requested name to validate"]
457 pub fn check_children_name_availability(
458 &self,
459 subscription_id: impl Into<String>,
460 group_name: impl Into<String>,
461 service_name: impl Into<String>,
462 parameters: impl Into<models::NameAvailabilityRequest>,
463 ) -> check_children_name_availability::RequestBuilder {
464 check_children_name_availability::RequestBuilder {
465 client: self.0.clone(),
466 subscription_id: subscription_id.into(),
467 group_name: group_name.into(),
468 service_name: service_name.into(),
469 parameters: parameters.into(),
470 }
471 }
472 #[doc = "Get services in resource group"]
473 #[doc = "The Services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a resource group."]
474 #[doc = ""]
475 #[doc = "Arguments:"]
476 #[doc = "* `subscription_id`: Identifier of the subscription"]
477 #[doc = "* `group_name`: Name of the resource group"]
478 pub fn list_by_resource_group(
479 &self,
480 subscription_id: impl Into<String>,
481 group_name: impl Into<String>,
482 ) -> list_by_resource_group::RequestBuilder {
483 list_by_resource_group::RequestBuilder {
484 client: self.0.clone(),
485 subscription_id: subscription_id.into(),
486 group_name: group_name.into(),
487 }
488 }
489 #[doc = "Get services in subscription"]
490 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription."]
491 #[doc = ""]
492 #[doc = "Arguments:"]
493 #[doc = "* `subscription_id`: Identifier of the subscription"]
494 pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
495 list::RequestBuilder {
496 client: self.0.clone(),
497 subscription_id: subscription_id.into(),
498 }
499 }
500 #[doc = "Check name validity and availability"]
501 #[doc = "This method checks whether a proposed top-level resource name is valid and available."]
502 #[doc = ""]
503 #[doc = "Arguments:"]
504 #[doc = "* `subscription_id`: Identifier of the subscription"]
505 #[doc = "* `location`: The Azure region of the operation"]
506 #[doc = "* `parameters`: Requested name to validate"]
507 pub fn check_name_availability(
508 &self,
509 subscription_id: impl Into<String>,
510 location: impl Into<String>,
511 parameters: impl Into<models::NameAvailabilityRequest>,
512 ) -> check_name_availability::RequestBuilder {
513 check_name_availability::RequestBuilder {
514 client: self.0.clone(),
515 subscription_id: subscription_id.into(),
516 location: location.into(),
517 parameters: parameters.into(),
518 }
519 }
520 }
521 pub mod get {
522 use super::models;
523 #[cfg(not(target_arch = "wasm32"))]
524 use futures::future::BoxFuture;
525 #[cfg(target_arch = "wasm32")]
526 use futures::future::LocalBoxFuture as BoxFuture;
527 #[derive(Debug)]
528 pub struct Response(azure_core::Response);
529 impl Response {
530 pub async fn into_body(self) -> azure_core::Result<models::DataMigrationService> {
531 let bytes = self.0.into_body().collect().await?;
532 let body: models::DataMigrationService = serde_json::from_slice(&bytes)?;
533 Ok(body)
534 }
535 pub fn into_raw_response(self) -> azure_core::Response {
536 self.0
537 }
538 pub fn as_raw_response(&self) -> &azure_core::Response {
539 &self.0
540 }
541 }
542 impl From<Response> for azure_core::Response {
543 fn from(rsp: Response) -> Self {
544 rsp.into_raw_response()
545 }
546 }
547 impl AsRef<azure_core::Response> for Response {
548 fn as_ref(&self) -> &azure_core::Response {
549 self.as_raw_response()
550 }
551 }
552 #[derive(Clone)]
553 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
554 #[doc = r""]
555 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
556 #[doc = r" parameters can be chained."]
557 #[doc = r""]
558 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
559 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
560 #[doc = r" executes the request and returns a `Result` with the parsed"]
561 #[doc = r" response."]
562 #[doc = r""]
563 #[doc = r" In order to execute the request without polling the service"]
564 #[doc = r" until the operation completes, use `.send().await` instead."]
565 #[doc = r""]
566 #[doc = r" If you need lower-level access to the raw response details"]
567 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
568 #[doc = r" can finalize the request using the"]
569 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
570 #[doc = r" that resolves to a lower-level [`Response`] value."]
571 pub struct RequestBuilder {
572 pub(crate) client: super::super::Client,
573 pub(crate) subscription_id: String,
574 pub(crate) group_name: String,
575 pub(crate) service_name: String,
576 }
577 impl RequestBuilder {
578 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
579 #[doc = ""]
580 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
581 #[doc = "However, this function can provide more flexibility when required."]
582 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
583 Box::pin({
584 let this = self.clone();
585 async move {
586 let url = this.url()?;
587 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
588 let bearer_token = this.client.bearer_token().await?;
589 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
590 let req_body = azure_core::EMPTY_BODY;
591 req.set_body(req_body);
592 Ok(Response(this.client.send(&mut req).await?))
593 }
594 })
595 }
596 fn url(&self) -> azure_core::Result<azure_core::Url> {
597 let mut url = self.client.endpoint().clone();
598 url.set_path(&format!(
599 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}",
600 &self.subscription_id, &self.group_name, &self.service_name
601 ));
602 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
603 if !has_api_version_already {
604 url.query_pairs_mut()
605 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
606 }
607 Ok(url)
608 }
609 }
610 impl std::future::IntoFuture for RequestBuilder {
611 type Output = azure_core::Result<models::DataMigrationService>;
612 type IntoFuture = BoxFuture<'static, azure_core::Result<models::DataMigrationService>>;
613 #[doc = "Returns a future that sends the request and returns the parsed response body."]
614 #[doc = ""]
615 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
616 #[doc = ""]
617 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
618 fn into_future(self) -> Self::IntoFuture {
619 Box::pin(async move { self.send().await?.into_body().await })
620 }
621 }
622 }
623 pub mod create_or_update {
624 use super::models;
625 #[cfg(not(target_arch = "wasm32"))]
626 use futures::future::BoxFuture;
627 #[cfg(target_arch = "wasm32")]
628 use futures::future::LocalBoxFuture as BoxFuture;
629 #[derive(Debug)]
630 pub struct Response(azure_core::Response);
631 impl Response {
632 pub async fn into_body(self) -> azure_core::Result<models::DataMigrationService> {
633 let bytes = self.0.into_body().collect().await?;
634 let body: models::DataMigrationService = serde_json::from_slice(&bytes)?;
635 Ok(body)
636 }
637 pub fn into_raw_response(self) -> azure_core::Response {
638 self.0
639 }
640 pub fn as_raw_response(&self) -> &azure_core::Response {
641 &self.0
642 }
643 }
644 impl From<Response> for azure_core::Response {
645 fn from(rsp: Response) -> Self {
646 rsp.into_raw_response()
647 }
648 }
649 impl AsRef<azure_core::Response> for Response {
650 fn as_ref(&self) -> &azure_core::Response {
651 self.as_raw_response()
652 }
653 }
654 #[derive(Clone)]
655 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
656 #[doc = r""]
657 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
658 #[doc = r" parameters can be chained."]
659 #[doc = r""]
660 #[doc = r" This `RequestBuilder` implements a Long Running Operation"]
661 #[doc = r" (LRO)."]
662 #[doc = r""]
663 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
664 #[doc = r" which will convert the `RequestBuilder` into a future"]
665 #[doc = r" executes the request and polls the service until the"]
666 #[doc = r" operation completes."]
667 #[doc = r""]
668 #[doc = r" In order to execute the request without polling the service"]
669 #[doc = r" until the operation completes, use"]
670 #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
671 #[doc = r" [`Response`] value."]
672 pub struct RequestBuilder {
673 pub(crate) client: super::super::Client,
674 pub(crate) subscription_id: String,
675 pub(crate) group_name: String,
676 pub(crate) service_name: String,
677 pub(crate) parameters: models::DataMigrationService,
678 }
679 impl RequestBuilder {
680 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
681 #[doc = ""]
682 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
683 #[doc = "However, this function can provide more flexibility when required."]
684 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
685 Box::pin({
686 let this = self.clone();
687 async move {
688 let url = this.url()?;
689 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
690 let bearer_token = this.client.bearer_token().await?;
691 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
692 req.insert_header("content-type", "application/json");
693 let req_body = azure_core::to_json(&this.parameters)?;
694 req.set_body(req_body);
695 Ok(Response(this.client.send(&mut req).await?))
696 }
697 })
698 }
699 fn url(&self) -> azure_core::Result<azure_core::Url> {
700 let mut url = self.client.endpoint().clone();
701 url.set_path(&format!(
702 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}",
703 &self.subscription_id, &self.group_name, &self.service_name
704 ));
705 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
706 if !has_api_version_already {
707 url.query_pairs_mut()
708 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
709 }
710 Ok(url)
711 }
712 }
713 impl std::future::IntoFuture for RequestBuilder {
714 type Output = azure_core::Result<models::DataMigrationService>;
715 type IntoFuture = BoxFuture<'static, azure_core::Result<models::DataMigrationService>>;
716 #[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
717 #[doc = ""]
718 #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
719 #[doc = ""]
720 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
721 #[doc = ""]
722 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
723 fn into_future(self) -> Self::IntoFuture {
724 Box::pin(async move {
725 use azure_core::{
726 error::{Error, ErrorKind},
727 lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
728 sleep::sleep,
729 };
730 use std::time::Duration;
731 loop {
732 let this = self.clone();
733 let response = this.send().await?;
734 let retry_after = get_retry_after(response.as_raw_response().headers());
735 let status = response.as_raw_response().status();
736 let body = response.into_body().await?;
737 let provisioning_state = get_provisioning_state(status, &body)?;
738 log::trace!("current provisioning_state: {provisioning_state:?}");
739 match provisioning_state {
740 LroStatus::Succeeded => return Ok(body),
741 LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
742 LroStatus::Canceled => {
743 return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
744 }
745 _ => {
746 sleep(retry_after).await;
747 }
748 }
749 }
750 })
751 }
752 }
753 }
754 pub mod update {
755 use super::models;
756 #[cfg(not(target_arch = "wasm32"))]
757 use futures::future::BoxFuture;
758 #[cfg(target_arch = "wasm32")]
759 use futures::future::LocalBoxFuture as BoxFuture;
760 #[derive(Debug)]
761 pub struct Response(azure_core::Response);
762 impl Response {
763 pub async fn into_body(self) -> azure_core::Result<models::DataMigrationService> {
764 let bytes = self.0.into_body().collect().await?;
765 let body: models::DataMigrationService = serde_json::from_slice(&bytes)?;
766 Ok(body)
767 }
768 pub fn into_raw_response(self) -> azure_core::Response {
769 self.0
770 }
771 pub fn as_raw_response(&self) -> &azure_core::Response {
772 &self.0
773 }
774 }
775 impl From<Response> for azure_core::Response {
776 fn from(rsp: Response) -> Self {
777 rsp.into_raw_response()
778 }
779 }
780 impl AsRef<azure_core::Response> for Response {
781 fn as_ref(&self) -> &azure_core::Response {
782 self.as_raw_response()
783 }
784 }
785 #[derive(Clone)]
786 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
787 #[doc = r""]
788 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
789 #[doc = r" parameters can be chained."]
790 #[doc = r""]
791 #[doc = r" This `RequestBuilder` implements a Long Running Operation"]
792 #[doc = r" (LRO)."]
793 #[doc = r""]
794 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
795 #[doc = r" which will convert the `RequestBuilder` into a future"]
796 #[doc = r" executes the request and polls the service until the"]
797 #[doc = r" operation completes."]
798 #[doc = r""]
799 #[doc = r" In order to execute the request without polling the service"]
800 #[doc = r" until the operation completes, use"]
801 #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
802 #[doc = r" [`Response`] value."]
803 pub struct RequestBuilder {
804 pub(crate) client: super::super::Client,
805 pub(crate) subscription_id: String,
806 pub(crate) group_name: String,
807 pub(crate) service_name: String,
808 pub(crate) parameters: models::DataMigrationService,
809 }
810 impl RequestBuilder {
811 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
812 #[doc = ""]
813 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
814 #[doc = "However, this function can provide more flexibility when required."]
815 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
816 Box::pin({
817 let this = self.clone();
818 async move {
819 let url = this.url()?;
820 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
821 let bearer_token = this.client.bearer_token().await?;
822 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
823 req.insert_header("content-type", "application/json");
824 let req_body = azure_core::to_json(&this.parameters)?;
825 req.set_body(req_body);
826 Ok(Response(this.client.send(&mut req).await?))
827 }
828 })
829 }
830 fn url(&self) -> azure_core::Result<azure_core::Url> {
831 let mut url = self.client.endpoint().clone();
832 url.set_path(&format!(
833 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}",
834 &self.subscription_id, &self.group_name, &self.service_name
835 ));
836 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
837 if !has_api_version_already {
838 url.query_pairs_mut()
839 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
840 }
841 Ok(url)
842 }
843 }
844 impl std::future::IntoFuture for RequestBuilder {
845 type Output = azure_core::Result<models::DataMigrationService>;
846 type IntoFuture = BoxFuture<'static, azure_core::Result<models::DataMigrationService>>;
847 #[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
848 #[doc = ""]
849 #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
850 #[doc = ""]
851 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
852 #[doc = ""]
853 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
854 fn into_future(self) -> Self::IntoFuture {
855 Box::pin(async move {
856 use azure_core::{
857 error::{Error, ErrorKind},
858 lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
859 sleep::sleep,
860 };
861 use std::time::Duration;
862 loop {
863 let this = self.clone();
864 let response = this.send().await?;
865 let retry_after = get_retry_after(response.as_raw_response().headers());
866 let status = response.as_raw_response().status();
867 let body = response.into_body().await?;
868 let provisioning_state = get_provisioning_state(status, &body)?;
869 log::trace!("current provisioning_state: {provisioning_state:?}");
870 match provisioning_state {
871 LroStatus::Succeeded => return Ok(body),
872 LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
873 LroStatus::Canceled => {
874 return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
875 }
876 _ => {
877 sleep(retry_after).await;
878 }
879 }
880 }
881 })
882 }
883 }
884 }
885 pub mod delete {
886 use super::models;
887 #[cfg(not(target_arch = "wasm32"))]
888 use futures::future::BoxFuture;
889 #[cfg(target_arch = "wasm32")]
890 use futures::future::LocalBoxFuture as BoxFuture;
891 #[derive(Debug)]
892 pub struct Response(azure_core::Response);
893 impl Response {
894 pub fn into_raw_response(self) -> azure_core::Response {
895 self.0
896 }
897 pub fn as_raw_response(&self) -> &azure_core::Response {
898 &self.0
899 }
900 }
901 impl From<Response> for azure_core::Response {
902 fn from(rsp: Response) -> Self {
903 rsp.into_raw_response()
904 }
905 }
906 impl AsRef<azure_core::Response> for Response {
907 fn as_ref(&self) -> &azure_core::Response {
908 self.as_raw_response()
909 }
910 }
911 #[derive(Clone)]
912 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
913 #[doc = r""]
914 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
915 #[doc = r" parameters can be chained."]
916 #[doc = r""]
917 #[doc = r" This `RequestBuilder` implements a Long Running Operation"]
918 #[doc = r" (LRO)."]
919 #[doc = r""]
920 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
921 #[doc = r" which will convert the `RequestBuilder` into a future"]
922 #[doc = r" executes the request and polls the service until the"]
923 #[doc = r" operation completes."]
924 #[doc = r""]
925 #[doc = r" In order to execute the request without polling the service"]
926 #[doc = r" until the operation completes, use"]
927 #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
928 #[doc = r" [`Response`] value."]
929 pub struct RequestBuilder {
930 pub(crate) client: super::super::Client,
931 pub(crate) subscription_id: String,
932 pub(crate) group_name: String,
933 pub(crate) service_name: String,
934 pub(crate) delete_running_tasks: Option<bool>,
935 }
936 impl RequestBuilder {
937 #[doc = "Delete the resource even if it contains running tasks"]
938 pub fn delete_running_tasks(mut self, delete_running_tasks: bool) -> Self {
939 self.delete_running_tasks = Some(delete_running_tasks);
940 self
941 }
942 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
943 #[doc = ""]
944 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
945 #[doc = "However, this function can provide more flexibility when required."]
946 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
947 Box::pin({
948 let this = self.clone();
949 async move {
950 let url = this.url()?;
951 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
952 let bearer_token = this.client.bearer_token().await?;
953 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
954 if let Some(delete_running_tasks) = &this.delete_running_tasks {
955 req.url_mut()
956 .query_pairs_mut()
957 .append_pair("deleteRunningTasks", &delete_running_tasks.to_string());
958 }
959 let req_body = azure_core::EMPTY_BODY;
960 req.set_body(req_body);
961 Ok(Response(this.client.send(&mut req).await?))
962 }
963 })
964 }
965 fn url(&self) -> azure_core::Result<azure_core::Url> {
966 let mut url = self.client.endpoint().clone();
967 url.set_path(&format!(
968 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}",
969 &self.subscription_id, &self.group_name, &self.service_name
970 ));
971 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
972 if !has_api_version_already {
973 url.query_pairs_mut()
974 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
975 }
976 Ok(url)
977 }
978 }
979 }
980 pub mod check_status {
981 use super::models;
982 #[cfg(not(target_arch = "wasm32"))]
983 use futures::future::BoxFuture;
984 #[cfg(target_arch = "wasm32")]
985 use futures::future::LocalBoxFuture as BoxFuture;
986 #[derive(Debug)]
987 pub struct Response(azure_core::Response);
988 impl Response {
989 pub async fn into_body(self) -> azure_core::Result<models::DataMigrationServiceStatusResponse> {
990 let bytes = self.0.into_body().collect().await?;
991 let body: models::DataMigrationServiceStatusResponse = serde_json::from_slice(&bytes)?;
992 Ok(body)
993 }
994 pub fn into_raw_response(self) -> azure_core::Response {
995 self.0
996 }
997 pub fn as_raw_response(&self) -> &azure_core::Response {
998 &self.0
999 }
1000 }
1001 impl From<Response> for azure_core::Response {
1002 fn from(rsp: Response) -> Self {
1003 rsp.into_raw_response()
1004 }
1005 }
1006 impl AsRef<azure_core::Response> for Response {
1007 fn as_ref(&self) -> &azure_core::Response {
1008 self.as_raw_response()
1009 }
1010 }
1011 #[derive(Clone)]
1012 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1013 #[doc = r""]
1014 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1015 #[doc = r" parameters can be chained."]
1016 #[doc = r""]
1017 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1018 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1019 #[doc = r" executes the request and returns a `Result` with the parsed"]
1020 #[doc = r" response."]
1021 #[doc = r""]
1022 #[doc = r" In order to execute the request without polling the service"]
1023 #[doc = r" until the operation completes, use `.send().await` instead."]
1024 #[doc = r""]
1025 #[doc = r" If you need lower-level access to the raw response details"]
1026 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1027 #[doc = r" can finalize the request using the"]
1028 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1029 #[doc = r" that resolves to a lower-level [`Response`] value."]
1030 pub struct RequestBuilder {
1031 pub(crate) client: super::super::Client,
1032 pub(crate) subscription_id: String,
1033 pub(crate) group_name: String,
1034 pub(crate) service_name: String,
1035 }
1036 impl RequestBuilder {
1037 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1038 #[doc = ""]
1039 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1040 #[doc = "However, this function can provide more flexibility when required."]
1041 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1042 Box::pin({
1043 let this = self.clone();
1044 async move {
1045 let url = this.url()?;
1046 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1047 let bearer_token = this.client.bearer_token().await?;
1048 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1049 let req_body = azure_core::EMPTY_BODY;
1050 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
1051 req.set_body(req_body);
1052 Ok(Response(this.client.send(&mut req).await?))
1053 }
1054 })
1055 }
1056 fn url(&self) -> azure_core::Result<azure_core::Url> {
1057 let mut url = self.client.endpoint().clone();
1058 url.set_path(&format!(
1059 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/checkStatus",
1060 &self.subscription_id, &self.group_name, &self.service_name
1061 ));
1062 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1063 if !has_api_version_already {
1064 url.query_pairs_mut()
1065 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1066 }
1067 Ok(url)
1068 }
1069 }
1070 impl std::future::IntoFuture for RequestBuilder {
1071 type Output = azure_core::Result<models::DataMigrationServiceStatusResponse>;
1072 type IntoFuture = BoxFuture<'static, azure_core::Result<models::DataMigrationServiceStatusResponse>>;
1073 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1074 #[doc = ""]
1075 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1076 #[doc = ""]
1077 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1078 fn into_future(self) -> Self::IntoFuture {
1079 Box::pin(async move { self.send().await?.into_body().await })
1080 }
1081 }
1082 }
1083 pub mod start {
1084 use super::models;
1085 #[cfg(not(target_arch = "wasm32"))]
1086 use futures::future::BoxFuture;
1087 #[cfg(target_arch = "wasm32")]
1088 use futures::future::LocalBoxFuture as BoxFuture;
1089 #[derive(Debug)]
1090 pub struct Response(azure_core::Response);
1091 impl Response {
1092 pub fn into_raw_response(self) -> azure_core::Response {
1093 self.0
1094 }
1095 pub fn as_raw_response(&self) -> &azure_core::Response {
1096 &self.0
1097 }
1098 }
1099 impl From<Response> for azure_core::Response {
1100 fn from(rsp: Response) -> Self {
1101 rsp.into_raw_response()
1102 }
1103 }
1104 impl AsRef<azure_core::Response> for Response {
1105 fn as_ref(&self) -> &azure_core::Response {
1106 self.as_raw_response()
1107 }
1108 }
1109 #[derive(Clone)]
1110 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1111 #[doc = r""]
1112 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1113 #[doc = r" parameters can be chained."]
1114 #[doc = r""]
1115 #[doc = r" This `RequestBuilder` implements a Long Running Operation"]
1116 #[doc = r" (LRO)."]
1117 #[doc = r""]
1118 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1119 #[doc = r" which will convert the `RequestBuilder` into a future"]
1120 #[doc = r" executes the request and polls the service until the"]
1121 #[doc = r" operation completes."]
1122 #[doc = r""]
1123 #[doc = r" In order to execute the request without polling the service"]
1124 #[doc = r" until the operation completes, use"]
1125 #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
1126 #[doc = r" [`Response`] value."]
1127 pub struct RequestBuilder {
1128 pub(crate) client: super::super::Client,
1129 pub(crate) subscription_id: String,
1130 pub(crate) group_name: String,
1131 pub(crate) service_name: String,
1132 }
1133 impl RequestBuilder {
1134 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1135 #[doc = ""]
1136 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1137 #[doc = "However, this function can provide more flexibility when required."]
1138 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1139 Box::pin({
1140 let this = self.clone();
1141 async move {
1142 let url = this.url()?;
1143 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1144 let bearer_token = this.client.bearer_token().await?;
1145 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1146 let req_body = azure_core::EMPTY_BODY;
1147 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
1148 req.set_body(req_body);
1149 Ok(Response(this.client.send(&mut req).await?))
1150 }
1151 })
1152 }
1153 fn url(&self) -> azure_core::Result<azure_core::Url> {
1154 let mut url = self.client.endpoint().clone();
1155 url.set_path(&format!(
1156 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/start",
1157 &self.subscription_id, &self.group_name, &self.service_name
1158 ));
1159 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1160 if !has_api_version_already {
1161 url.query_pairs_mut()
1162 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1163 }
1164 Ok(url)
1165 }
1166 }
1167 }
1168 pub mod stop {
1169 use super::models;
1170 #[cfg(not(target_arch = "wasm32"))]
1171 use futures::future::BoxFuture;
1172 #[cfg(target_arch = "wasm32")]
1173 use futures::future::LocalBoxFuture as BoxFuture;
1174 #[derive(Debug)]
1175 pub struct Response(azure_core::Response);
1176 impl Response {
1177 pub fn into_raw_response(self) -> azure_core::Response {
1178 self.0
1179 }
1180 pub fn as_raw_response(&self) -> &azure_core::Response {
1181 &self.0
1182 }
1183 }
1184 impl From<Response> for azure_core::Response {
1185 fn from(rsp: Response) -> Self {
1186 rsp.into_raw_response()
1187 }
1188 }
1189 impl AsRef<azure_core::Response> for Response {
1190 fn as_ref(&self) -> &azure_core::Response {
1191 self.as_raw_response()
1192 }
1193 }
1194 #[derive(Clone)]
1195 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1196 #[doc = r""]
1197 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1198 #[doc = r" parameters can be chained."]
1199 #[doc = r""]
1200 #[doc = r" This `RequestBuilder` implements a Long Running Operation"]
1201 #[doc = r" (LRO)."]
1202 #[doc = r""]
1203 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1204 #[doc = r" which will convert the `RequestBuilder` into a future"]
1205 #[doc = r" executes the request and polls the service until the"]
1206 #[doc = r" operation completes."]
1207 #[doc = r""]
1208 #[doc = r" In order to execute the request without polling the service"]
1209 #[doc = r" until the operation completes, use"]
1210 #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
1211 #[doc = r" [`Response`] value."]
1212 pub struct RequestBuilder {
1213 pub(crate) client: super::super::Client,
1214 pub(crate) subscription_id: String,
1215 pub(crate) group_name: String,
1216 pub(crate) service_name: String,
1217 }
1218 impl RequestBuilder {
1219 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1220 #[doc = ""]
1221 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1222 #[doc = "However, this function can provide more flexibility when required."]
1223 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1224 Box::pin({
1225 let this = self.clone();
1226 async move {
1227 let url = this.url()?;
1228 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1229 let bearer_token = this.client.bearer_token().await?;
1230 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1231 let req_body = azure_core::EMPTY_BODY;
1232 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
1233 req.set_body(req_body);
1234 Ok(Response(this.client.send(&mut req).await?))
1235 }
1236 })
1237 }
1238 fn url(&self) -> azure_core::Result<azure_core::Url> {
1239 let mut url = self.client.endpoint().clone();
1240 url.set_path(&format!(
1241 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/stop",
1242 &self.subscription_id, &self.group_name, &self.service_name
1243 ));
1244 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1245 if !has_api_version_already {
1246 url.query_pairs_mut()
1247 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1248 }
1249 Ok(url)
1250 }
1251 }
1252 }
1253 pub mod list_skus {
1254 use super::models;
1255 #[cfg(not(target_arch = "wasm32"))]
1256 use futures::future::BoxFuture;
1257 #[cfg(target_arch = "wasm32")]
1258 use futures::future::LocalBoxFuture as BoxFuture;
1259 #[derive(Debug)]
1260 pub struct Response(azure_core::Response);
1261 impl Response {
1262 pub async fn into_body(self) -> azure_core::Result<models::ServiceSkuList> {
1263 let bytes = self.0.into_body().collect().await?;
1264 let body: models::ServiceSkuList = serde_json::from_slice(&bytes)?;
1265 Ok(body)
1266 }
1267 pub fn into_raw_response(self) -> azure_core::Response {
1268 self.0
1269 }
1270 pub fn as_raw_response(&self) -> &azure_core::Response {
1271 &self.0
1272 }
1273 }
1274 impl From<Response> for azure_core::Response {
1275 fn from(rsp: Response) -> Self {
1276 rsp.into_raw_response()
1277 }
1278 }
1279 impl AsRef<azure_core::Response> for Response {
1280 fn as_ref(&self) -> &azure_core::Response {
1281 self.as_raw_response()
1282 }
1283 }
1284 #[derive(Clone)]
1285 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1286 #[doc = r""]
1287 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1288 #[doc = r" parameters can be chained."]
1289 #[doc = r""]
1290 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1291 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1292 #[doc = r" executes the request and returns a `Result` with the parsed"]
1293 #[doc = r" response."]
1294 #[doc = r""]
1295 #[doc = r" In order to execute the request without polling the service"]
1296 #[doc = r" until the operation completes, use `.send().await` instead."]
1297 #[doc = r""]
1298 #[doc = r" If you need lower-level access to the raw response details"]
1299 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1300 #[doc = r" can finalize the request using the"]
1301 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1302 #[doc = r" that resolves to a lower-level [`Response`] value."]
1303 pub struct RequestBuilder {
1304 pub(crate) client: super::super::Client,
1305 pub(crate) subscription_id: String,
1306 pub(crate) group_name: String,
1307 pub(crate) service_name: String,
1308 }
1309 impl RequestBuilder {
1310 pub fn into_stream(self) -> azure_core::Pageable<models::ServiceSkuList, azure_core::error::Error> {
1311 let make_request = move |continuation: Option<String>| {
1312 let this = self.clone();
1313 async move {
1314 let mut url = this.url()?;
1315 let rsp = match continuation {
1316 Some(value) => {
1317 url.set_path("");
1318 url = url.join(&value)?;
1319 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1320 let bearer_token = this.client.bearer_token().await?;
1321 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1322 let has_api_version_already =
1323 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1324 if !has_api_version_already {
1325 req.url_mut()
1326 .query_pairs_mut()
1327 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1328 }
1329 let req_body = azure_core::EMPTY_BODY;
1330 req.set_body(req_body);
1331 this.client.send(&mut req).await?
1332 }
1333 None => {
1334 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1335 let bearer_token = this.client.bearer_token().await?;
1336 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1337 let req_body = azure_core::EMPTY_BODY;
1338 req.set_body(req_body);
1339 this.client.send(&mut req).await?
1340 }
1341 };
1342 let rsp = match rsp.status() {
1343 azure_core::StatusCode::Ok => Ok(Response(rsp)),
1344 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
1345 status: status_code,
1346 error_code: None,
1347 })),
1348 };
1349 rsp?.into_body().await
1350 }
1351 };
1352 azure_core::Pageable::new(make_request)
1353 }
1354 fn url(&self) -> azure_core::Result<azure_core::Url> {
1355 let mut url = self.client.endpoint().clone();
1356 url.set_path(&format!(
1357 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/skus",
1358 &self.subscription_id, &self.group_name, &self.service_name
1359 ));
1360 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1361 if !has_api_version_already {
1362 url.query_pairs_mut()
1363 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1364 }
1365 Ok(url)
1366 }
1367 }
1368 }
1369 pub mod check_children_name_availability {
1370 use super::models;
1371 #[cfg(not(target_arch = "wasm32"))]
1372 use futures::future::BoxFuture;
1373 #[cfg(target_arch = "wasm32")]
1374 use futures::future::LocalBoxFuture as BoxFuture;
1375 #[derive(Debug)]
1376 pub struct Response(azure_core::Response);
1377 impl Response {
1378 pub async fn into_body(self) -> azure_core::Result<models::NameAvailabilityResponse> {
1379 let bytes = self.0.into_body().collect().await?;
1380 let body: models::NameAvailabilityResponse = serde_json::from_slice(&bytes)?;
1381 Ok(body)
1382 }
1383 pub fn into_raw_response(self) -> azure_core::Response {
1384 self.0
1385 }
1386 pub fn as_raw_response(&self) -> &azure_core::Response {
1387 &self.0
1388 }
1389 }
1390 impl From<Response> for azure_core::Response {
1391 fn from(rsp: Response) -> Self {
1392 rsp.into_raw_response()
1393 }
1394 }
1395 impl AsRef<azure_core::Response> for Response {
1396 fn as_ref(&self) -> &azure_core::Response {
1397 self.as_raw_response()
1398 }
1399 }
1400 #[derive(Clone)]
1401 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1402 #[doc = r""]
1403 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1404 #[doc = r" parameters can be chained."]
1405 #[doc = r""]
1406 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1407 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1408 #[doc = r" executes the request and returns a `Result` with the parsed"]
1409 #[doc = r" response."]
1410 #[doc = r""]
1411 #[doc = r" In order to execute the request without polling the service"]
1412 #[doc = r" until the operation completes, use `.send().await` instead."]
1413 #[doc = r""]
1414 #[doc = r" If you need lower-level access to the raw response details"]
1415 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1416 #[doc = r" can finalize the request using the"]
1417 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1418 #[doc = r" that resolves to a lower-level [`Response`] value."]
1419 pub struct RequestBuilder {
1420 pub(crate) client: super::super::Client,
1421 pub(crate) subscription_id: String,
1422 pub(crate) group_name: String,
1423 pub(crate) service_name: String,
1424 pub(crate) parameters: models::NameAvailabilityRequest,
1425 }
1426 impl RequestBuilder {
1427 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1428 #[doc = ""]
1429 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1430 #[doc = "However, this function can provide more flexibility when required."]
1431 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1432 Box::pin({
1433 let this = self.clone();
1434 async move {
1435 let url = this.url()?;
1436 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1437 let bearer_token = this.client.bearer_token().await?;
1438 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1439 req.insert_header("content-type", "application/json");
1440 let req_body = azure_core::to_json(&this.parameters)?;
1441 req.set_body(req_body);
1442 Ok(Response(this.client.send(&mut req).await?))
1443 }
1444 })
1445 }
1446 fn url(&self) -> azure_core::Result<azure_core::Url> {
1447 let mut url = self.client.endpoint().clone();
1448 url.set_path(&format!(
1449 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/checkNameAvailability",
1450 &self.subscription_id, &self.group_name, &self.service_name
1451 ));
1452 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1453 if !has_api_version_already {
1454 url.query_pairs_mut()
1455 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1456 }
1457 Ok(url)
1458 }
1459 }
1460 impl std::future::IntoFuture for RequestBuilder {
1461 type Output = azure_core::Result<models::NameAvailabilityResponse>;
1462 type IntoFuture = BoxFuture<'static, azure_core::Result<models::NameAvailabilityResponse>>;
1463 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1464 #[doc = ""]
1465 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1466 #[doc = ""]
1467 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1468 fn into_future(self) -> Self::IntoFuture {
1469 Box::pin(async move { self.send().await?.into_body().await })
1470 }
1471 }
1472 }
1473 pub mod list_by_resource_group {
1474 use super::models;
1475 #[cfg(not(target_arch = "wasm32"))]
1476 use futures::future::BoxFuture;
1477 #[cfg(target_arch = "wasm32")]
1478 use futures::future::LocalBoxFuture as BoxFuture;
1479 #[derive(Debug)]
1480 pub struct Response(azure_core::Response);
1481 impl Response {
1482 pub async fn into_body(self) -> azure_core::Result<models::DataMigrationServiceList> {
1483 let bytes = self.0.into_body().collect().await?;
1484 let body: models::DataMigrationServiceList = serde_json::from_slice(&bytes)?;
1485 Ok(body)
1486 }
1487 pub fn into_raw_response(self) -> azure_core::Response {
1488 self.0
1489 }
1490 pub fn as_raw_response(&self) -> &azure_core::Response {
1491 &self.0
1492 }
1493 }
1494 impl From<Response> for azure_core::Response {
1495 fn from(rsp: Response) -> Self {
1496 rsp.into_raw_response()
1497 }
1498 }
1499 impl AsRef<azure_core::Response> for Response {
1500 fn as_ref(&self) -> &azure_core::Response {
1501 self.as_raw_response()
1502 }
1503 }
1504 #[derive(Clone)]
1505 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1506 #[doc = r""]
1507 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1508 #[doc = r" parameters can be chained."]
1509 #[doc = r""]
1510 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1511 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1512 #[doc = r" executes the request and returns a `Result` with the parsed"]
1513 #[doc = r" response."]
1514 #[doc = r""]
1515 #[doc = r" In order to execute the request without polling the service"]
1516 #[doc = r" until the operation completes, use `.send().await` instead."]
1517 #[doc = r""]
1518 #[doc = r" If you need lower-level access to the raw response details"]
1519 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1520 #[doc = r" can finalize the request using the"]
1521 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1522 #[doc = r" that resolves to a lower-level [`Response`] value."]
1523 pub struct RequestBuilder {
1524 pub(crate) client: super::super::Client,
1525 pub(crate) subscription_id: String,
1526 pub(crate) group_name: String,
1527 }
1528 impl RequestBuilder {
1529 pub fn into_stream(self) -> azure_core::Pageable<models::DataMigrationServiceList, azure_core::error::Error> {
1530 let make_request = move |continuation: Option<String>| {
1531 let this = self.clone();
1532 async move {
1533 let mut url = this.url()?;
1534 let rsp = match continuation {
1535 Some(value) => {
1536 url.set_path("");
1537 url = url.join(&value)?;
1538 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1539 let bearer_token = this.client.bearer_token().await?;
1540 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1541 let has_api_version_already =
1542 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1543 if !has_api_version_already {
1544 req.url_mut()
1545 .query_pairs_mut()
1546 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1547 }
1548 let req_body = azure_core::EMPTY_BODY;
1549 req.set_body(req_body);
1550 this.client.send(&mut req).await?
1551 }
1552 None => {
1553 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1554 let bearer_token = this.client.bearer_token().await?;
1555 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1556 let req_body = azure_core::EMPTY_BODY;
1557 req.set_body(req_body);
1558 this.client.send(&mut req).await?
1559 }
1560 };
1561 let rsp = match rsp.status() {
1562 azure_core::StatusCode::Ok => Ok(Response(rsp)),
1563 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
1564 status: status_code,
1565 error_code: None,
1566 })),
1567 };
1568 rsp?.into_body().await
1569 }
1570 };
1571 azure_core::Pageable::new(make_request)
1572 }
1573 fn url(&self) -> azure_core::Result<azure_core::Url> {
1574 let mut url = self.client.endpoint().clone();
1575 url.set_path(&format!(
1576 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services",
1577 &self.subscription_id, &self.group_name
1578 ));
1579 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1580 if !has_api_version_already {
1581 url.query_pairs_mut()
1582 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1583 }
1584 Ok(url)
1585 }
1586 }
1587 }
1588 pub mod list {
1589 use super::models;
1590 #[cfg(not(target_arch = "wasm32"))]
1591 use futures::future::BoxFuture;
1592 #[cfg(target_arch = "wasm32")]
1593 use futures::future::LocalBoxFuture as BoxFuture;
1594 #[derive(Debug)]
1595 pub struct Response(azure_core::Response);
1596 impl Response {
1597 pub async fn into_body(self) -> azure_core::Result<models::DataMigrationServiceList> {
1598 let bytes = self.0.into_body().collect().await?;
1599 let body: models::DataMigrationServiceList = serde_json::from_slice(&bytes)?;
1600 Ok(body)
1601 }
1602 pub fn into_raw_response(self) -> azure_core::Response {
1603 self.0
1604 }
1605 pub fn as_raw_response(&self) -> &azure_core::Response {
1606 &self.0
1607 }
1608 }
1609 impl From<Response> for azure_core::Response {
1610 fn from(rsp: Response) -> Self {
1611 rsp.into_raw_response()
1612 }
1613 }
1614 impl AsRef<azure_core::Response> for Response {
1615 fn as_ref(&self) -> &azure_core::Response {
1616 self.as_raw_response()
1617 }
1618 }
1619 #[derive(Clone)]
1620 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1621 #[doc = r""]
1622 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1623 #[doc = r" parameters can be chained."]
1624 #[doc = r""]
1625 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1626 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1627 #[doc = r" executes the request and returns a `Result` with the parsed"]
1628 #[doc = r" response."]
1629 #[doc = r""]
1630 #[doc = r" In order to execute the request without polling the service"]
1631 #[doc = r" until the operation completes, use `.send().await` instead."]
1632 #[doc = r""]
1633 #[doc = r" If you need lower-level access to the raw response details"]
1634 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1635 #[doc = r" can finalize the request using the"]
1636 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1637 #[doc = r" that resolves to a lower-level [`Response`] value."]
1638 pub struct RequestBuilder {
1639 pub(crate) client: super::super::Client,
1640 pub(crate) subscription_id: String,
1641 }
1642 impl RequestBuilder {
1643 pub fn into_stream(self) -> azure_core::Pageable<models::DataMigrationServiceList, azure_core::error::Error> {
1644 let make_request = move |continuation: Option<String>| {
1645 let this = self.clone();
1646 async move {
1647 let mut url = this.url()?;
1648 let rsp = match continuation {
1649 Some(value) => {
1650 url.set_path("");
1651 url = url.join(&value)?;
1652 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1653 let bearer_token = this.client.bearer_token().await?;
1654 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1655 let has_api_version_already =
1656 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1657 if !has_api_version_already {
1658 req.url_mut()
1659 .query_pairs_mut()
1660 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1661 }
1662 let req_body = azure_core::EMPTY_BODY;
1663 req.set_body(req_body);
1664 this.client.send(&mut req).await?
1665 }
1666 None => {
1667 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1668 let bearer_token = this.client.bearer_token().await?;
1669 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1670 let req_body = azure_core::EMPTY_BODY;
1671 req.set_body(req_body);
1672 this.client.send(&mut req).await?
1673 }
1674 };
1675 let rsp = match rsp.status() {
1676 azure_core::StatusCode::Ok => Ok(Response(rsp)),
1677 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
1678 status: status_code,
1679 error_code: None,
1680 })),
1681 };
1682 rsp?.into_body().await
1683 }
1684 };
1685 azure_core::Pageable::new(make_request)
1686 }
1687 fn url(&self) -> azure_core::Result<azure_core::Url> {
1688 let mut url = self.client.endpoint().clone();
1689 url.set_path(&format!(
1690 "/subscriptions/{}/providers/Microsoft.DataMigration/services",
1691 &self.subscription_id
1692 ));
1693 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1694 if !has_api_version_already {
1695 url.query_pairs_mut()
1696 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1697 }
1698 Ok(url)
1699 }
1700 }
1701 }
1702 pub mod check_name_availability {
1703 use super::models;
1704 #[cfg(not(target_arch = "wasm32"))]
1705 use futures::future::BoxFuture;
1706 #[cfg(target_arch = "wasm32")]
1707 use futures::future::LocalBoxFuture as BoxFuture;
1708 #[derive(Debug)]
1709 pub struct Response(azure_core::Response);
1710 impl Response {
1711 pub async fn into_body(self) -> azure_core::Result<models::NameAvailabilityResponse> {
1712 let bytes = self.0.into_body().collect().await?;
1713 let body: models::NameAvailabilityResponse = serde_json::from_slice(&bytes)?;
1714 Ok(body)
1715 }
1716 pub fn into_raw_response(self) -> azure_core::Response {
1717 self.0
1718 }
1719 pub fn as_raw_response(&self) -> &azure_core::Response {
1720 &self.0
1721 }
1722 }
1723 impl From<Response> for azure_core::Response {
1724 fn from(rsp: Response) -> Self {
1725 rsp.into_raw_response()
1726 }
1727 }
1728 impl AsRef<azure_core::Response> for Response {
1729 fn as_ref(&self) -> &azure_core::Response {
1730 self.as_raw_response()
1731 }
1732 }
1733 #[derive(Clone)]
1734 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1735 #[doc = r""]
1736 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1737 #[doc = r" parameters can be chained."]
1738 #[doc = r""]
1739 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1740 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
1741 #[doc = r" executes the request and returns a `Result` with the parsed"]
1742 #[doc = r" response."]
1743 #[doc = r""]
1744 #[doc = r" In order to execute the request without polling the service"]
1745 #[doc = r" until the operation completes, use `.send().await` instead."]
1746 #[doc = r""]
1747 #[doc = r" If you need lower-level access to the raw response details"]
1748 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1749 #[doc = r" can finalize the request using the"]
1750 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1751 #[doc = r" that resolves to a lower-level [`Response`] value."]
1752 pub struct RequestBuilder {
1753 pub(crate) client: super::super::Client,
1754 pub(crate) subscription_id: String,
1755 pub(crate) location: String,
1756 pub(crate) parameters: models::NameAvailabilityRequest,
1757 }
1758 impl RequestBuilder {
1759 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1760 #[doc = ""]
1761 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1762 #[doc = "However, this function can provide more flexibility when required."]
1763 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1764 Box::pin({
1765 let this = self.clone();
1766 async move {
1767 let url = this.url()?;
1768 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1769 let bearer_token = this.client.bearer_token().await?;
1770 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
1771 req.insert_header("content-type", "application/json");
1772 let req_body = azure_core::to_json(&this.parameters)?;
1773 req.set_body(req_body);
1774 Ok(Response(this.client.send(&mut req).await?))
1775 }
1776 })
1777 }
1778 fn url(&self) -> azure_core::Result<azure_core::Url> {
1779 let mut url = self.client.endpoint().clone();
1780 url.set_path(&format!(
1781 "/subscriptions/{}/providers/Microsoft.DataMigration/locations/{}/checkNameAvailability",
1782 &self.subscription_id, &self.location
1783 ));
1784 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
1785 if !has_api_version_already {
1786 url.query_pairs_mut()
1787 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
1788 }
1789 Ok(url)
1790 }
1791 }
1792 impl std::future::IntoFuture for RequestBuilder {
1793 type Output = azure_core::Result<models::NameAvailabilityResponse>;
1794 type IntoFuture = BoxFuture<'static, azure_core::Result<models::NameAvailabilityResponse>>;
1795 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1796 #[doc = ""]
1797 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1798 #[doc = ""]
1799 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1800 fn into_future(self) -> Self::IntoFuture {
1801 Box::pin(async move { self.send().await?.into_body().await })
1802 }
1803 }
1804 }
1805}
1806pub mod tasks {
1807 use super::models;
1808 #[cfg(not(target_arch = "wasm32"))]
1809 use futures::future::BoxFuture;
1810 #[cfg(target_arch = "wasm32")]
1811 use futures::future::LocalBoxFuture as BoxFuture;
1812 pub struct Client(pub(crate) super::Client);
1813 impl Client {
1814 #[doc = "Get tasks in a service"]
1815 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task."]
1816 #[doc = ""]
1817 #[doc = "Arguments:"]
1818 #[doc = "* `subscription_id`: Identifier of the subscription"]
1819 #[doc = "* `group_name`: Name of the resource group"]
1820 #[doc = "* `service_name`: Name of the service"]
1821 #[doc = "* `project_name`: Name of the project"]
1822 pub fn list(
1823 &self,
1824 subscription_id: impl Into<String>,
1825 group_name: impl Into<String>,
1826 service_name: impl Into<String>,
1827 project_name: impl Into<String>,
1828 ) -> list::RequestBuilder {
1829 list::RequestBuilder {
1830 client: self.0.clone(),
1831 subscription_id: subscription_id.into(),
1832 group_name: group_name.into(),
1833 service_name: service_name.into(),
1834 project_name: project_name.into(),
1835 task_type: None,
1836 }
1837 }
1838 #[doc = "Get task information"]
1839 #[doc = "The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a task."]
1840 #[doc = ""]
1841 #[doc = "Arguments:"]
1842 #[doc = "* `subscription_id`: Identifier of the subscription"]
1843 #[doc = "* `group_name`: Name of the resource group"]
1844 #[doc = "* `service_name`: Name of the service"]
1845 #[doc = "* `project_name`: Name of the project"]
1846 #[doc = "* `task_name`: Name of the Task"]
1847 pub fn get(
1848 &self,
1849 subscription_id: impl Into<String>,
1850 group_name: impl Into<String>,
1851 service_name: impl Into<String>,
1852 project_name: impl Into<String>,
1853 task_name: impl Into<String>,
1854 ) -> get::RequestBuilder {
1855 get::RequestBuilder {
1856 client: self.0.clone(),
1857 subscription_id: subscription_id.into(),
1858 group_name: group_name.into(),
1859 service_name: service_name.into(),
1860 project_name: project_name.into(),
1861 task_name: task_name.into(),
1862 expand: None,
1863 }
1864 }
1865 #[doc = "Create or update task"]
1866 #[doc = "The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one."]
1867 #[doc = ""]
1868 #[doc = "Arguments:"]
1869 #[doc = "* `subscription_id`: Identifier of the subscription"]
1870 #[doc = "* `group_name`: Name of the resource group"]
1871 #[doc = "* `service_name`: Name of the service"]
1872 #[doc = "* `project_name`: Name of the project"]
1873 #[doc = "* `task_name`: Name of the Task"]
1874 #[doc = "* `parameters`: Information about the task"]
1875 pub fn create_or_update(
1876 &self,
1877 subscription_id: impl Into<String>,
1878 group_name: impl Into<String>,
1879 service_name: impl Into<String>,
1880 project_name: impl Into<String>,
1881 task_name: impl Into<String>,
1882 parameters: impl Into<models::ProjectTask>,
1883 ) -> create_or_update::RequestBuilder {
1884 create_or_update::RequestBuilder {
1885 client: self.0.clone(),
1886 subscription_id: subscription_id.into(),
1887 group_name: group_name.into(),
1888 service_name: service_name.into(),
1889 project_name: project_name.into(),
1890 task_name: task_name.into(),
1891 parameters: parameters.into(),
1892 }
1893 }
1894 #[doc = "Create or update task"]
1895 #[doc = "The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so."]
1896 #[doc = ""]
1897 #[doc = "Arguments:"]
1898 #[doc = "* `subscription_id`: Identifier of the subscription"]
1899 #[doc = "* `group_name`: Name of the resource group"]
1900 #[doc = "* `service_name`: Name of the service"]
1901 #[doc = "* `project_name`: Name of the project"]
1902 #[doc = "* `task_name`: Name of the Task"]
1903 #[doc = "* `parameters`: Information about the task"]
1904 pub fn update(
1905 &self,
1906 subscription_id: impl Into<String>,
1907 group_name: impl Into<String>,
1908 service_name: impl Into<String>,
1909 project_name: impl Into<String>,
1910 task_name: impl Into<String>,
1911 parameters: impl Into<models::ProjectTask>,
1912 ) -> update::RequestBuilder {
1913 update::RequestBuilder {
1914 client: self.0.clone(),
1915 subscription_id: subscription_id.into(),
1916 group_name: group_name.into(),
1917 service_name: service_name.into(),
1918 project_name: project_name.into(),
1919 task_name: task_name.into(),
1920 parameters: parameters.into(),
1921 }
1922 }
1923 #[doc = "Delete task"]
1924 #[doc = "The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a task, canceling it first if it's running."]
1925 #[doc = ""]
1926 #[doc = "Arguments:"]
1927 #[doc = "* `subscription_id`: Identifier of the subscription"]
1928 #[doc = "* `group_name`: Name of the resource group"]
1929 #[doc = "* `service_name`: Name of the service"]
1930 #[doc = "* `project_name`: Name of the project"]
1931 #[doc = "* `task_name`: Name of the Task"]
1932 pub fn delete(
1933 &self,
1934 subscription_id: impl Into<String>,
1935 group_name: impl Into<String>,
1936 service_name: impl Into<String>,
1937 project_name: impl Into<String>,
1938 task_name: impl Into<String>,
1939 ) -> delete::RequestBuilder {
1940 delete::RequestBuilder {
1941 client: self.0.clone(),
1942 subscription_id: subscription_id.into(),
1943 group_name: group_name.into(),
1944 service_name: service_name.into(),
1945 project_name: project_name.into(),
1946 task_name: task_name.into(),
1947 delete_running_tasks: None,
1948 }
1949 }
1950 #[doc = "Cancel a task"]
1951 #[doc = "The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a task if it's currently queued or running."]
1952 #[doc = ""]
1953 #[doc = "Arguments:"]
1954 #[doc = "* `subscription_id`: Identifier of the subscription"]
1955 #[doc = "* `group_name`: Name of the resource group"]
1956 #[doc = "* `service_name`: Name of the service"]
1957 #[doc = "* `project_name`: Name of the project"]
1958 #[doc = "* `task_name`: Name of the Task"]
1959 pub fn cancel(
1960 &self,
1961 subscription_id: impl Into<String>,
1962 group_name: impl Into<String>,
1963 service_name: impl Into<String>,
1964 project_name: impl Into<String>,
1965 task_name: impl Into<String>,
1966 ) -> cancel::RequestBuilder {
1967 cancel::RequestBuilder {
1968 client: self.0.clone(),
1969 subscription_id: subscription_id.into(),
1970 group_name: group_name.into(),
1971 service_name: service_name.into(),
1972 project_name: project_name.into(),
1973 task_name: task_name.into(),
1974 }
1975 }
1976 #[doc = "Execute a command on a task"]
1977 #[doc = "The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method executes a command on a running task."]
1978 #[doc = ""]
1979 #[doc = "Arguments:"]
1980 #[doc = "* `subscription_id`: Identifier of the subscription"]
1981 #[doc = "* `group_name`: Name of the resource group"]
1982 #[doc = "* `service_name`: Name of the service"]
1983 #[doc = "* `project_name`: Name of the project"]
1984 #[doc = "* `task_name`: Name of the Task"]
1985 #[doc = "* `parameters`: Command to execute"]
1986 pub fn command(
1987 &self,
1988 subscription_id: impl Into<String>,
1989 group_name: impl Into<String>,
1990 service_name: impl Into<String>,
1991 project_name: impl Into<String>,
1992 task_name: impl Into<String>,
1993 parameters: impl Into<models::CommandPropertiesUnion>,
1994 ) -> command::RequestBuilder {
1995 command::RequestBuilder {
1996 client: self.0.clone(),
1997 subscription_id: subscription_id.into(),
1998 group_name: group_name.into(),
1999 service_name: service_name.into(),
2000 project_name: project_name.into(),
2001 task_name: task_name.into(),
2002 parameters: parameters.into(),
2003 }
2004 }
2005 }
2006 pub mod list {
2007 use super::models;
2008 #[cfg(not(target_arch = "wasm32"))]
2009 use futures::future::BoxFuture;
2010 #[cfg(target_arch = "wasm32")]
2011 use futures::future::LocalBoxFuture as BoxFuture;
2012 #[derive(Debug)]
2013 pub struct Response(azure_core::Response);
2014 impl Response {
2015 pub async fn into_body(self) -> azure_core::Result<models::TaskList> {
2016 let bytes = self.0.into_body().collect().await?;
2017 let body: models::TaskList = serde_json::from_slice(&bytes)?;
2018 Ok(body)
2019 }
2020 pub fn into_raw_response(self) -> azure_core::Response {
2021 self.0
2022 }
2023 pub fn as_raw_response(&self) -> &azure_core::Response {
2024 &self.0
2025 }
2026 }
2027 impl From<Response> for azure_core::Response {
2028 fn from(rsp: Response) -> Self {
2029 rsp.into_raw_response()
2030 }
2031 }
2032 impl AsRef<azure_core::Response> for Response {
2033 fn as_ref(&self) -> &azure_core::Response {
2034 self.as_raw_response()
2035 }
2036 }
2037 #[derive(Clone)]
2038 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2039 #[doc = r""]
2040 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2041 #[doc = r" parameters can be chained."]
2042 #[doc = r""]
2043 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2044 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2045 #[doc = r" executes the request and returns a `Result` with the parsed"]
2046 #[doc = r" response."]
2047 #[doc = r""]
2048 #[doc = r" In order to execute the request without polling the service"]
2049 #[doc = r" until the operation completes, use `.send().await` instead."]
2050 #[doc = r""]
2051 #[doc = r" If you need lower-level access to the raw response details"]
2052 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2053 #[doc = r" can finalize the request using the"]
2054 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2055 #[doc = r" that resolves to a lower-level [`Response`] value."]
2056 pub struct RequestBuilder {
2057 pub(crate) client: super::super::Client,
2058 pub(crate) subscription_id: String,
2059 pub(crate) group_name: String,
2060 pub(crate) service_name: String,
2061 pub(crate) project_name: String,
2062 pub(crate) task_type: Option<String>,
2063 }
2064 impl RequestBuilder {
2065 #[doc = "Filter tasks by task type"]
2066 pub fn task_type(mut self, task_type: impl Into<String>) -> Self {
2067 self.task_type = Some(task_type.into());
2068 self
2069 }
2070 pub fn into_stream(self) -> azure_core::Pageable<models::TaskList, azure_core::error::Error> {
2071 let make_request = move |continuation: Option<String>| {
2072 let this = self.clone();
2073 async move {
2074 let mut url = this.url()?;
2075 let rsp = match continuation {
2076 Some(value) => {
2077 url.set_path("");
2078 url = url.join(&value)?;
2079 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
2080 let bearer_token = this.client.bearer_token().await?;
2081 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2082 let has_api_version_already =
2083 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2084 if !has_api_version_already {
2085 req.url_mut()
2086 .query_pairs_mut()
2087 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2088 }
2089 let req_body = azure_core::EMPTY_BODY;
2090 req.set_body(req_body);
2091 this.client.send(&mut req).await?
2092 }
2093 None => {
2094 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
2095 let bearer_token = this.client.bearer_token().await?;
2096 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2097 if let Some(task_type) = &this.task_type {
2098 req.url_mut().query_pairs_mut().append_pair("taskType", task_type);
2099 }
2100 let req_body = azure_core::EMPTY_BODY;
2101 req.set_body(req_body);
2102 this.client.send(&mut req).await?
2103 }
2104 };
2105 let rsp = match rsp.status() {
2106 azure_core::StatusCode::Ok => Ok(Response(rsp)),
2107 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
2108 status: status_code,
2109 error_code: None,
2110 })),
2111 };
2112 rsp?.into_body().await
2113 }
2114 };
2115 azure_core::Pageable::new(make_request)
2116 }
2117 fn url(&self) -> azure_core::Result<azure_core::Url> {
2118 let mut url = self.client.endpoint().clone();
2119 url.set_path(&format!(
2120 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks",
2121 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name
2122 ));
2123 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2124 if !has_api_version_already {
2125 url.query_pairs_mut()
2126 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2127 }
2128 Ok(url)
2129 }
2130 }
2131 }
2132 pub mod get {
2133 use super::models;
2134 #[cfg(not(target_arch = "wasm32"))]
2135 use futures::future::BoxFuture;
2136 #[cfg(target_arch = "wasm32")]
2137 use futures::future::LocalBoxFuture as BoxFuture;
2138 #[derive(Debug)]
2139 pub struct Response(azure_core::Response);
2140 impl Response {
2141 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
2142 let bytes = self.0.into_body().collect().await?;
2143 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
2144 Ok(body)
2145 }
2146 pub fn into_raw_response(self) -> azure_core::Response {
2147 self.0
2148 }
2149 pub fn as_raw_response(&self) -> &azure_core::Response {
2150 &self.0
2151 }
2152 }
2153 impl From<Response> for azure_core::Response {
2154 fn from(rsp: Response) -> Self {
2155 rsp.into_raw_response()
2156 }
2157 }
2158 impl AsRef<azure_core::Response> for Response {
2159 fn as_ref(&self) -> &azure_core::Response {
2160 self.as_raw_response()
2161 }
2162 }
2163 #[derive(Clone)]
2164 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2165 #[doc = r""]
2166 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2167 #[doc = r" parameters can be chained."]
2168 #[doc = r""]
2169 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2170 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2171 #[doc = r" executes the request and returns a `Result` with the parsed"]
2172 #[doc = r" response."]
2173 #[doc = r""]
2174 #[doc = r" In order to execute the request without polling the service"]
2175 #[doc = r" until the operation completes, use `.send().await` instead."]
2176 #[doc = r""]
2177 #[doc = r" If you need lower-level access to the raw response details"]
2178 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2179 #[doc = r" can finalize the request using the"]
2180 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2181 #[doc = r" that resolves to a lower-level [`Response`] value."]
2182 pub struct RequestBuilder {
2183 pub(crate) client: super::super::Client,
2184 pub(crate) subscription_id: String,
2185 pub(crate) group_name: String,
2186 pub(crate) service_name: String,
2187 pub(crate) project_name: String,
2188 pub(crate) task_name: String,
2189 pub(crate) expand: Option<String>,
2190 }
2191 impl RequestBuilder {
2192 #[doc = "Expand the response"]
2193 pub fn expand(mut self, expand: impl Into<String>) -> Self {
2194 self.expand = Some(expand.into());
2195 self
2196 }
2197 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2198 #[doc = ""]
2199 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2200 #[doc = "However, this function can provide more flexibility when required."]
2201 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2202 Box::pin({
2203 let this = self.clone();
2204 async move {
2205 let url = this.url()?;
2206 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
2207 let bearer_token = this.client.bearer_token().await?;
2208 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2209 if let Some(expand) = &this.expand {
2210 req.url_mut().query_pairs_mut().append_pair("$expand", expand);
2211 }
2212 let req_body = azure_core::EMPTY_BODY;
2213 req.set_body(req_body);
2214 Ok(Response(this.client.send(&mut req).await?))
2215 }
2216 })
2217 }
2218 fn url(&self) -> azure_core::Result<azure_core::Url> {
2219 let mut url = self.client.endpoint().clone();
2220 url.set_path(&format!(
2221 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks/{}",
2222 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.task_name
2223 ));
2224 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2225 if !has_api_version_already {
2226 url.query_pairs_mut()
2227 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2228 }
2229 Ok(url)
2230 }
2231 }
2232 impl std::future::IntoFuture for RequestBuilder {
2233 type Output = azure_core::Result<models::ProjectTask>;
2234 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
2235 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2236 #[doc = ""]
2237 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2238 #[doc = ""]
2239 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2240 fn into_future(self) -> Self::IntoFuture {
2241 Box::pin(async move { self.send().await?.into_body().await })
2242 }
2243 }
2244 }
2245 pub mod create_or_update {
2246 use super::models;
2247 #[cfg(not(target_arch = "wasm32"))]
2248 use futures::future::BoxFuture;
2249 #[cfg(target_arch = "wasm32")]
2250 use futures::future::LocalBoxFuture as BoxFuture;
2251 #[derive(Debug)]
2252 pub struct Response(azure_core::Response);
2253 impl Response {
2254 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
2255 let bytes = self.0.into_body().collect().await?;
2256 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
2257 Ok(body)
2258 }
2259 pub fn into_raw_response(self) -> azure_core::Response {
2260 self.0
2261 }
2262 pub fn as_raw_response(&self) -> &azure_core::Response {
2263 &self.0
2264 }
2265 }
2266 impl From<Response> for azure_core::Response {
2267 fn from(rsp: Response) -> Self {
2268 rsp.into_raw_response()
2269 }
2270 }
2271 impl AsRef<azure_core::Response> for Response {
2272 fn as_ref(&self) -> &azure_core::Response {
2273 self.as_raw_response()
2274 }
2275 }
2276 #[derive(Clone)]
2277 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2278 #[doc = r""]
2279 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2280 #[doc = r" parameters can be chained."]
2281 #[doc = r""]
2282 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2283 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2284 #[doc = r" executes the request and returns a `Result` with the parsed"]
2285 #[doc = r" response."]
2286 #[doc = r""]
2287 #[doc = r" In order to execute the request without polling the service"]
2288 #[doc = r" until the operation completes, use `.send().await` instead."]
2289 #[doc = r""]
2290 #[doc = r" If you need lower-level access to the raw response details"]
2291 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2292 #[doc = r" can finalize the request using the"]
2293 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2294 #[doc = r" that resolves to a lower-level [`Response`] value."]
2295 pub struct RequestBuilder {
2296 pub(crate) client: super::super::Client,
2297 pub(crate) subscription_id: String,
2298 pub(crate) group_name: String,
2299 pub(crate) service_name: String,
2300 pub(crate) project_name: String,
2301 pub(crate) task_name: String,
2302 pub(crate) parameters: models::ProjectTask,
2303 }
2304 impl RequestBuilder {
2305 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2306 #[doc = ""]
2307 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2308 #[doc = "However, this function can provide more flexibility when required."]
2309 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2310 Box::pin({
2311 let this = self.clone();
2312 async move {
2313 let url = this.url()?;
2314 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
2315 let bearer_token = this.client.bearer_token().await?;
2316 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2317 req.insert_header("content-type", "application/json");
2318 let req_body = azure_core::to_json(&this.parameters)?;
2319 req.set_body(req_body);
2320 Ok(Response(this.client.send(&mut req).await?))
2321 }
2322 })
2323 }
2324 fn url(&self) -> azure_core::Result<azure_core::Url> {
2325 let mut url = self.client.endpoint().clone();
2326 url.set_path(&format!(
2327 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks/{}",
2328 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.task_name
2329 ));
2330 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2331 if !has_api_version_already {
2332 url.query_pairs_mut()
2333 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2334 }
2335 Ok(url)
2336 }
2337 }
2338 impl std::future::IntoFuture for RequestBuilder {
2339 type Output = azure_core::Result<models::ProjectTask>;
2340 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
2341 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2342 #[doc = ""]
2343 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2344 #[doc = ""]
2345 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2346 fn into_future(self) -> Self::IntoFuture {
2347 Box::pin(async move { self.send().await?.into_body().await })
2348 }
2349 }
2350 }
2351 pub mod update {
2352 use super::models;
2353 #[cfg(not(target_arch = "wasm32"))]
2354 use futures::future::BoxFuture;
2355 #[cfg(target_arch = "wasm32")]
2356 use futures::future::LocalBoxFuture as BoxFuture;
2357 #[derive(Debug)]
2358 pub struct Response(azure_core::Response);
2359 impl Response {
2360 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
2361 let bytes = self.0.into_body().collect().await?;
2362 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
2363 Ok(body)
2364 }
2365 pub fn into_raw_response(self) -> azure_core::Response {
2366 self.0
2367 }
2368 pub fn as_raw_response(&self) -> &azure_core::Response {
2369 &self.0
2370 }
2371 }
2372 impl From<Response> for azure_core::Response {
2373 fn from(rsp: Response) -> Self {
2374 rsp.into_raw_response()
2375 }
2376 }
2377 impl AsRef<azure_core::Response> for Response {
2378 fn as_ref(&self) -> &azure_core::Response {
2379 self.as_raw_response()
2380 }
2381 }
2382 #[derive(Clone)]
2383 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2384 #[doc = r""]
2385 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2386 #[doc = r" parameters can be chained."]
2387 #[doc = r""]
2388 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2389 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2390 #[doc = r" executes the request and returns a `Result` with the parsed"]
2391 #[doc = r" response."]
2392 #[doc = r""]
2393 #[doc = r" In order to execute the request without polling the service"]
2394 #[doc = r" until the operation completes, use `.send().await` instead."]
2395 #[doc = r""]
2396 #[doc = r" If you need lower-level access to the raw response details"]
2397 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2398 #[doc = r" can finalize the request using the"]
2399 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2400 #[doc = r" that resolves to a lower-level [`Response`] value."]
2401 pub struct RequestBuilder {
2402 pub(crate) client: super::super::Client,
2403 pub(crate) subscription_id: String,
2404 pub(crate) group_name: String,
2405 pub(crate) service_name: String,
2406 pub(crate) project_name: String,
2407 pub(crate) task_name: String,
2408 pub(crate) parameters: models::ProjectTask,
2409 }
2410 impl RequestBuilder {
2411 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2412 #[doc = ""]
2413 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2414 #[doc = "However, this function can provide more flexibility when required."]
2415 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2416 Box::pin({
2417 let this = self.clone();
2418 async move {
2419 let url = this.url()?;
2420 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
2421 let bearer_token = this.client.bearer_token().await?;
2422 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2423 req.insert_header("content-type", "application/json");
2424 let req_body = azure_core::to_json(&this.parameters)?;
2425 req.set_body(req_body);
2426 Ok(Response(this.client.send(&mut req).await?))
2427 }
2428 })
2429 }
2430 fn url(&self) -> azure_core::Result<azure_core::Url> {
2431 let mut url = self.client.endpoint().clone();
2432 url.set_path(&format!(
2433 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks/{}",
2434 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.task_name
2435 ));
2436 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2437 if !has_api_version_already {
2438 url.query_pairs_mut()
2439 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2440 }
2441 Ok(url)
2442 }
2443 }
2444 impl std::future::IntoFuture for RequestBuilder {
2445 type Output = azure_core::Result<models::ProjectTask>;
2446 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
2447 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2448 #[doc = ""]
2449 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2450 #[doc = ""]
2451 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2452 fn into_future(self) -> Self::IntoFuture {
2453 Box::pin(async move { self.send().await?.into_body().await })
2454 }
2455 }
2456 }
2457 pub mod delete {
2458 use super::models;
2459 #[cfg(not(target_arch = "wasm32"))]
2460 use futures::future::BoxFuture;
2461 #[cfg(target_arch = "wasm32")]
2462 use futures::future::LocalBoxFuture as BoxFuture;
2463 #[derive(Debug)]
2464 pub struct Response(azure_core::Response);
2465 impl Response {
2466 pub fn into_raw_response(self) -> azure_core::Response {
2467 self.0
2468 }
2469 pub fn as_raw_response(&self) -> &azure_core::Response {
2470 &self.0
2471 }
2472 }
2473 impl From<Response> for azure_core::Response {
2474 fn from(rsp: Response) -> Self {
2475 rsp.into_raw_response()
2476 }
2477 }
2478 impl AsRef<azure_core::Response> for Response {
2479 fn as_ref(&self) -> &azure_core::Response {
2480 self.as_raw_response()
2481 }
2482 }
2483 #[derive(Clone)]
2484 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2485 #[doc = r""]
2486 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2487 #[doc = r" parameters can be chained."]
2488 #[doc = r""]
2489 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2490 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2491 #[doc = r" executes the request and returns a `Result` with the parsed"]
2492 #[doc = r" response."]
2493 #[doc = r""]
2494 #[doc = r" In order to execute the request without polling the service"]
2495 #[doc = r" until the operation completes, use `.send().await` instead."]
2496 #[doc = r""]
2497 #[doc = r" If you need lower-level access to the raw response details"]
2498 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2499 #[doc = r" can finalize the request using the"]
2500 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2501 #[doc = r" that resolves to a lower-level [`Response`] value."]
2502 pub struct RequestBuilder {
2503 pub(crate) client: super::super::Client,
2504 pub(crate) subscription_id: String,
2505 pub(crate) group_name: String,
2506 pub(crate) service_name: String,
2507 pub(crate) project_name: String,
2508 pub(crate) task_name: String,
2509 pub(crate) delete_running_tasks: Option<bool>,
2510 }
2511 impl RequestBuilder {
2512 #[doc = "Delete the resource even if it contains running tasks"]
2513 pub fn delete_running_tasks(mut self, delete_running_tasks: bool) -> Self {
2514 self.delete_running_tasks = Some(delete_running_tasks);
2515 self
2516 }
2517 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2518 #[doc = ""]
2519 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2520 #[doc = "However, this function can provide more flexibility when required."]
2521 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2522 Box::pin({
2523 let this = self.clone();
2524 async move {
2525 let url = this.url()?;
2526 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
2527 let bearer_token = this.client.bearer_token().await?;
2528 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2529 if let Some(delete_running_tasks) = &this.delete_running_tasks {
2530 req.url_mut()
2531 .query_pairs_mut()
2532 .append_pair("deleteRunningTasks", &delete_running_tasks.to_string());
2533 }
2534 let req_body = azure_core::EMPTY_BODY;
2535 req.set_body(req_body);
2536 Ok(Response(this.client.send(&mut req).await?))
2537 }
2538 })
2539 }
2540 fn url(&self) -> azure_core::Result<azure_core::Url> {
2541 let mut url = self.client.endpoint().clone();
2542 url.set_path(&format!(
2543 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks/{}",
2544 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.task_name
2545 ));
2546 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2547 if !has_api_version_already {
2548 url.query_pairs_mut()
2549 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2550 }
2551 Ok(url)
2552 }
2553 }
2554 }
2555 pub mod cancel {
2556 use super::models;
2557 #[cfg(not(target_arch = "wasm32"))]
2558 use futures::future::BoxFuture;
2559 #[cfg(target_arch = "wasm32")]
2560 use futures::future::LocalBoxFuture as BoxFuture;
2561 #[derive(Debug)]
2562 pub struct Response(azure_core::Response);
2563 impl Response {
2564 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
2565 let bytes = self.0.into_body().collect().await?;
2566 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
2567 Ok(body)
2568 }
2569 pub fn into_raw_response(self) -> azure_core::Response {
2570 self.0
2571 }
2572 pub fn as_raw_response(&self) -> &azure_core::Response {
2573 &self.0
2574 }
2575 }
2576 impl From<Response> for azure_core::Response {
2577 fn from(rsp: Response) -> Self {
2578 rsp.into_raw_response()
2579 }
2580 }
2581 impl AsRef<azure_core::Response> for Response {
2582 fn as_ref(&self) -> &azure_core::Response {
2583 self.as_raw_response()
2584 }
2585 }
2586 #[derive(Clone)]
2587 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2588 #[doc = r""]
2589 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2590 #[doc = r" parameters can be chained."]
2591 #[doc = r""]
2592 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2593 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2594 #[doc = r" executes the request and returns a `Result` with the parsed"]
2595 #[doc = r" response."]
2596 #[doc = r""]
2597 #[doc = r" In order to execute the request without polling the service"]
2598 #[doc = r" until the operation completes, use `.send().await` instead."]
2599 #[doc = r""]
2600 #[doc = r" If you need lower-level access to the raw response details"]
2601 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2602 #[doc = r" can finalize the request using the"]
2603 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2604 #[doc = r" that resolves to a lower-level [`Response`] value."]
2605 pub struct RequestBuilder {
2606 pub(crate) client: super::super::Client,
2607 pub(crate) subscription_id: String,
2608 pub(crate) group_name: String,
2609 pub(crate) service_name: String,
2610 pub(crate) project_name: String,
2611 pub(crate) task_name: String,
2612 }
2613 impl RequestBuilder {
2614 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2615 #[doc = ""]
2616 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2617 #[doc = "However, this function can provide more flexibility when required."]
2618 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2619 Box::pin({
2620 let this = self.clone();
2621 async move {
2622 let url = this.url()?;
2623 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
2624 let bearer_token = this.client.bearer_token().await?;
2625 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2626 let req_body = azure_core::EMPTY_BODY;
2627 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
2628 req.set_body(req_body);
2629 Ok(Response(this.client.send(&mut req).await?))
2630 }
2631 })
2632 }
2633 fn url(&self) -> azure_core::Result<azure_core::Url> {
2634 let mut url = self.client.endpoint().clone();
2635 url.set_path(&format!(
2636 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks/{}/cancel",
2637 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.task_name
2638 ));
2639 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2640 if !has_api_version_already {
2641 url.query_pairs_mut()
2642 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2643 }
2644 Ok(url)
2645 }
2646 }
2647 impl std::future::IntoFuture for RequestBuilder {
2648 type Output = azure_core::Result<models::ProjectTask>;
2649 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
2650 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2651 #[doc = ""]
2652 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2653 #[doc = ""]
2654 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2655 fn into_future(self) -> Self::IntoFuture {
2656 Box::pin(async move { self.send().await?.into_body().await })
2657 }
2658 }
2659 }
2660 pub mod command {
2661 use super::models;
2662 #[cfg(not(target_arch = "wasm32"))]
2663 use futures::future::BoxFuture;
2664 #[cfg(target_arch = "wasm32")]
2665 use futures::future::LocalBoxFuture as BoxFuture;
2666 #[derive(Debug)]
2667 pub struct Response(azure_core::Response);
2668 impl Response {
2669 pub async fn into_body(self) -> azure_core::Result<models::CommandPropertiesUnion> {
2670 let bytes = self.0.into_body().collect().await?;
2671 let body: models::CommandPropertiesUnion = serde_json::from_slice(&bytes)?;
2672 Ok(body)
2673 }
2674 pub fn into_raw_response(self) -> azure_core::Response {
2675 self.0
2676 }
2677 pub fn as_raw_response(&self) -> &azure_core::Response {
2678 &self.0
2679 }
2680 }
2681 impl From<Response> for azure_core::Response {
2682 fn from(rsp: Response) -> Self {
2683 rsp.into_raw_response()
2684 }
2685 }
2686 impl AsRef<azure_core::Response> for Response {
2687 fn as_ref(&self) -> &azure_core::Response {
2688 self.as_raw_response()
2689 }
2690 }
2691 #[derive(Clone)]
2692 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2693 #[doc = r""]
2694 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2695 #[doc = r" parameters can be chained."]
2696 #[doc = r""]
2697 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2698 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2699 #[doc = r" executes the request and returns a `Result` with the parsed"]
2700 #[doc = r" response."]
2701 #[doc = r""]
2702 #[doc = r" In order to execute the request without polling the service"]
2703 #[doc = r" until the operation completes, use `.send().await` instead."]
2704 #[doc = r""]
2705 #[doc = r" If you need lower-level access to the raw response details"]
2706 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2707 #[doc = r" can finalize the request using the"]
2708 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2709 #[doc = r" that resolves to a lower-level [`Response`] value."]
2710 pub struct RequestBuilder {
2711 pub(crate) client: super::super::Client,
2712 pub(crate) subscription_id: String,
2713 pub(crate) group_name: String,
2714 pub(crate) service_name: String,
2715 pub(crate) project_name: String,
2716 pub(crate) task_name: String,
2717 pub(crate) parameters: models::CommandPropertiesUnion,
2718 }
2719 impl RequestBuilder {
2720 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2721 #[doc = ""]
2722 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2723 #[doc = "However, this function can provide more flexibility when required."]
2724 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2725 Box::pin({
2726 let this = self.clone();
2727 async move {
2728 let url = this.url()?;
2729 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
2730 let bearer_token = this.client.bearer_token().await?;
2731 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2732 req.insert_header("content-type", "application/json");
2733 let req_body = azure_core::to_json(&this.parameters)?;
2734 req.set_body(req_body);
2735 Ok(Response(this.client.send(&mut req).await?))
2736 }
2737 })
2738 }
2739 fn url(&self) -> azure_core::Result<azure_core::Url> {
2740 let mut url = self.client.endpoint().clone();
2741 url.set_path(&format!(
2742 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/tasks/{}/command",
2743 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.task_name
2744 ));
2745 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2746 if !has_api_version_already {
2747 url.query_pairs_mut()
2748 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
2749 }
2750 Ok(url)
2751 }
2752 }
2753 impl std::future::IntoFuture for RequestBuilder {
2754 type Output = azure_core::Result<models::CommandPropertiesUnion>;
2755 type IntoFuture = BoxFuture<'static, azure_core::Result<models::CommandPropertiesUnion>>;
2756 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2757 #[doc = ""]
2758 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2759 #[doc = ""]
2760 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2761 fn into_future(self) -> Self::IntoFuture {
2762 Box::pin(async move { self.send().await?.into_body().await })
2763 }
2764 }
2765 }
2766}
2767pub mod service_tasks {
2768 use super::models;
2769 #[cfg(not(target_arch = "wasm32"))]
2770 use futures::future::BoxFuture;
2771 #[cfg(target_arch = "wasm32")]
2772 use futures::future::LocalBoxFuture as BoxFuture;
2773 pub struct Client(pub(crate) super::Client);
2774 impl Client {
2775 #[doc = "Get service level tasks for a service"]
2776 #[doc = "The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service level tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task."]
2777 #[doc = ""]
2778 #[doc = "Arguments:"]
2779 #[doc = "* `subscription_id`: Identifier of the subscription"]
2780 #[doc = "* `group_name`: Name of the resource group"]
2781 #[doc = "* `service_name`: Name of the service"]
2782 pub fn list(
2783 &self,
2784 subscription_id: impl Into<String>,
2785 group_name: impl Into<String>,
2786 service_name: impl Into<String>,
2787 ) -> list::RequestBuilder {
2788 list::RequestBuilder {
2789 client: self.0.clone(),
2790 subscription_id: subscription_id.into(),
2791 group_name: group_name.into(),
2792 service_name: service_name.into(),
2793 task_type: None,
2794 }
2795 }
2796 #[doc = "Get service task information"]
2797 #[doc = "The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET method retrieves information about a service task."]
2798 #[doc = ""]
2799 #[doc = "Arguments:"]
2800 #[doc = "* `subscription_id`: Identifier of the subscription"]
2801 #[doc = "* `group_name`: Name of the resource group"]
2802 #[doc = "* `service_name`: Name of the service"]
2803 #[doc = "* `task_name`: Name of the Task"]
2804 pub fn get(
2805 &self,
2806 subscription_id: impl Into<String>,
2807 group_name: impl Into<String>,
2808 service_name: impl Into<String>,
2809 task_name: impl Into<String>,
2810 ) -> get::RequestBuilder {
2811 get::RequestBuilder {
2812 client: self.0.clone(),
2813 subscription_id: subscription_id.into(),
2814 group_name: group_name.into(),
2815 service_name: service_name.into(),
2816 task_name: task_name.into(),
2817 expand: None,
2818 }
2819 }
2820 #[doc = "Create or update service task"]
2821 #[doc = "The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new service task or updates an existing one, although since service tasks have no mutable custom properties, there is little reason to update an existing one."]
2822 #[doc = ""]
2823 #[doc = "Arguments:"]
2824 #[doc = "* `subscription_id`: Identifier of the subscription"]
2825 #[doc = "* `group_name`: Name of the resource group"]
2826 #[doc = "* `service_name`: Name of the service"]
2827 #[doc = "* `task_name`: Name of the Task"]
2828 #[doc = "* `parameters`: Information about the task"]
2829 pub fn create_or_update(
2830 &self,
2831 subscription_id: impl Into<String>,
2832 group_name: impl Into<String>,
2833 service_name: impl Into<String>,
2834 task_name: impl Into<String>,
2835 parameters: impl Into<models::ProjectTask>,
2836 ) -> create_or_update::RequestBuilder {
2837 create_or_update::RequestBuilder {
2838 client: self.0.clone(),
2839 subscription_id: subscription_id.into(),
2840 group_name: group_name.into(),
2841 service_name: service_name.into(),
2842 task_name: task_name.into(),
2843 parameters: parameters.into(),
2844 }
2845 }
2846 #[doc = "Create or update service task"]
2847 #[doc = "The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH method updates an existing service task, but since service tasks have no mutable custom properties, there is little reason to do so."]
2848 #[doc = ""]
2849 #[doc = "Arguments:"]
2850 #[doc = "* `subscription_id`: Identifier of the subscription"]
2851 #[doc = "* `group_name`: Name of the resource group"]
2852 #[doc = "* `service_name`: Name of the service"]
2853 #[doc = "* `task_name`: Name of the Task"]
2854 #[doc = "* `parameters`: Information about the task"]
2855 pub fn update(
2856 &self,
2857 subscription_id: impl Into<String>,
2858 group_name: impl Into<String>,
2859 service_name: impl Into<String>,
2860 task_name: impl Into<String>,
2861 parameters: impl Into<models::ProjectTask>,
2862 ) -> update::RequestBuilder {
2863 update::RequestBuilder {
2864 client: self.0.clone(),
2865 subscription_id: subscription_id.into(),
2866 group_name: group_name.into(),
2867 service_name: service_name.into(),
2868 task_name: task_name.into(),
2869 parameters: parameters.into(),
2870 }
2871 }
2872 #[doc = "Delete service task"]
2873 #[doc = "The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE method deletes a service task, canceling it first if it's running."]
2874 #[doc = ""]
2875 #[doc = "Arguments:"]
2876 #[doc = "* `subscription_id`: Identifier of the subscription"]
2877 #[doc = "* `group_name`: Name of the resource group"]
2878 #[doc = "* `service_name`: Name of the service"]
2879 #[doc = "* `task_name`: Name of the Task"]
2880 pub fn delete(
2881 &self,
2882 subscription_id: impl Into<String>,
2883 group_name: impl Into<String>,
2884 service_name: impl Into<String>,
2885 task_name: impl Into<String>,
2886 ) -> delete::RequestBuilder {
2887 delete::RequestBuilder {
2888 client: self.0.clone(),
2889 subscription_id: subscription_id.into(),
2890 group_name: group_name.into(),
2891 service_name: service_name.into(),
2892 task_name: task_name.into(),
2893 delete_running_tasks: None,
2894 }
2895 }
2896 #[doc = "Cancel a service task"]
2897 #[doc = "The service tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This method cancels a service task if it's currently queued or running."]
2898 #[doc = ""]
2899 #[doc = "Arguments:"]
2900 #[doc = "* `subscription_id`: Identifier of the subscription"]
2901 #[doc = "* `group_name`: Name of the resource group"]
2902 #[doc = "* `service_name`: Name of the service"]
2903 #[doc = "* `task_name`: Name of the Task"]
2904 pub fn cancel(
2905 &self,
2906 subscription_id: impl Into<String>,
2907 group_name: impl Into<String>,
2908 service_name: impl Into<String>,
2909 task_name: impl Into<String>,
2910 ) -> cancel::RequestBuilder {
2911 cancel::RequestBuilder {
2912 client: self.0.clone(),
2913 subscription_id: subscription_id.into(),
2914 group_name: group_name.into(),
2915 service_name: service_name.into(),
2916 task_name: task_name.into(),
2917 }
2918 }
2919 }
2920 pub mod list {
2921 use super::models;
2922 #[cfg(not(target_arch = "wasm32"))]
2923 use futures::future::BoxFuture;
2924 #[cfg(target_arch = "wasm32")]
2925 use futures::future::LocalBoxFuture as BoxFuture;
2926 #[derive(Debug)]
2927 pub struct Response(azure_core::Response);
2928 impl Response {
2929 pub async fn into_body(self) -> azure_core::Result<models::TaskList> {
2930 let bytes = self.0.into_body().collect().await?;
2931 let body: models::TaskList = serde_json::from_slice(&bytes)?;
2932 Ok(body)
2933 }
2934 pub fn into_raw_response(self) -> azure_core::Response {
2935 self.0
2936 }
2937 pub fn as_raw_response(&self) -> &azure_core::Response {
2938 &self.0
2939 }
2940 }
2941 impl From<Response> for azure_core::Response {
2942 fn from(rsp: Response) -> Self {
2943 rsp.into_raw_response()
2944 }
2945 }
2946 impl AsRef<azure_core::Response> for Response {
2947 fn as_ref(&self) -> &azure_core::Response {
2948 self.as_raw_response()
2949 }
2950 }
2951 #[derive(Clone)]
2952 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2953 #[doc = r""]
2954 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2955 #[doc = r" parameters can be chained."]
2956 #[doc = r""]
2957 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2958 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
2959 #[doc = r" executes the request and returns a `Result` with the parsed"]
2960 #[doc = r" response."]
2961 #[doc = r""]
2962 #[doc = r" In order to execute the request without polling the service"]
2963 #[doc = r" until the operation completes, use `.send().await` instead."]
2964 #[doc = r""]
2965 #[doc = r" If you need lower-level access to the raw response details"]
2966 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2967 #[doc = r" can finalize the request using the"]
2968 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2969 #[doc = r" that resolves to a lower-level [`Response`] value."]
2970 pub struct RequestBuilder {
2971 pub(crate) client: super::super::Client,
2972 pub(crate) subscription_id: String,
2973 pub(crate) group_name: String,
2974 pub(crate) service_name: String,
2975 pub(crate) task_type: Option<String>,
2976 }
2977 impl RequestBuilder {
2978 #[doc = "Filter tasks by task type"]
2979 pub fn task_type(mut self, task_type: impl Into<String>) -> Self {
2980 self.task_type = Some(task_type.into());
2981 self
2982 }
2983 pub fn into_stream(self) -> azure_core::Pageable<models::TaskList, azure_core::error::Error> {
2984 let make_request = move |continuation: Option<String>| {
2985 let this = self.clone();
2986 async move {
2987 let mut url = this.url()?;
2988 let rsp = match continuation {
2989 Some(value) => {
2990 url.set_path("");
2991 url = url.join(&value)?;
2992 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
2993 let bearer_token = this.client.bearer_token().await?;
2994 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
2995 let has_api_version_already =
2996 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
2997 if !has_api_version_already {
2998 req.url_mut()
2999 .query_pairs_mut()
3000 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3001 }
3002 let req_body = azure_core::EMPTY_BODY;
3003 req.set_body(req_body);
3004 this.client.send(&mut req).await?
3005 }
3006 None => {
3007 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
3008 let bearer_token = this.client.bearer_token().await?;
3009 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3010 if let Some(task_type) = &this.task_type {
3011 req.url_mut().query_pairs_mut().append_pair("taskType", task_type);
3012 }
3013 let req_body = azure_core::EMPTY_BODY;
3014 req.set_body(req_body);
3015 this.client.send(&mut req).await?
3016 }
3017 };
3018 let rsp = match rsp.status() {
3019 azure_core::StatusCode::Ok => Ok(Response(rsp)),
3020 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
3021 status: status_code,
3022 error_code: None,
3023 })),
3024 };
3025 rsp?.into_body().await
3026 }
3027 };
3028 azure_core::Pageable::new(make_request)
3029 }
3030 fn url(&self) -> azure_core::Result<azure_core::Url> {
3031 let mut url = self.client.endpoint().clone();
3032 url.set_path(&format!(
3033 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/serviceTasks",
3034 &self.subscription_id, &self.group_name, &self.service_name
3035 ));
3036 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3037 if !has_api_version_already {
3038 url.query_pairs_mut()
3039 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3040 }
3041 Ok(url)
3042 }
3043 }
3044 }
3045 pub mod get {
3046 use super::models;
3047 #[cfg(not(target_arch = "wasm32"))]
3048 use futures::future::BoxFuture;
3049 #[cfg(target_arch = "wasm32")]
3050 use futures::future::LocalBoxFuture as BoxFuture;
3051 #[derive(Debug)]
3052 pub struct Response(azure_core::Response);
3053 impl Response {
3054 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
3055 let bytes = self.0.into_body().collect().await?;
3056 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
3057 Ok(body)
3058 }
3059 pub fn into_raw_response(self) -> azure_core::Response {
3060 self.0
3061 }
3062 pub fn as_raw_response(&self) -> &azure_core::Response {
3063 &self.0
3064 }
3065 }
3066 impl From<Response> for azure_core::Response {
3067 fn from(rsp: Response) -> Self {
3068 rsp.into_raw_response()
3069 }
3070 }
3071 impl AsRef<azure_core::Response> for Response {
3072 fn as_ref(&self) -> &azure_core::Response {
3073 self.as_raw_response()
3074 }
3075 }
3076 #[derive(Clone)]
3077 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3078 #[doc = r""]
3079 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3080 #[doc = r" parameters can be chained."]
3081 #[doc = r""]
3082 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3083 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3084 #[doc = r" executes the request and returns a `Result` with the parsed"]
3085 #[doc = r" response."]
3086 #[doc = r""]
3087 #[doc = r" In order to execute the request without polling the service"]
3088 #[doc = r" until the operation completes, use `.send().await` instead."]
3089 #[doc = r""]
3090 #[doc = r" If you need lower-level access to the raw response details"]
3091 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3092 #[doc = r" can finalize the request using the"]
3093 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3094 #[doc = r" that resolves to a lower-level [`Response`] value."]
3095 pub struct RequestBuilder {
3096 pub(crate) client: super::super::Client,
3097 pub(crate) subscription_id: String,
3098 pub(crate) group_name: String,
3099 pub(crate) service_name: String,
3100 pub(crate) task_name: String,
3101 pub(crate) expand: Option<String>,
3102 }
3103 impl RequestBuilder {
3104 #[doc = "Expand the response"]
3105 pub fn expand(mut self, expand: impl Into<String>) -> Self {
3106 self.expand = Some(expand.into());
3107 self
3108 }
3109 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3110 #[doc = ""]
3111 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3112 #[doc = "However, this function can provide more flexibility when required."]
3113 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3114 Box::pin({
3115 let this = self.clone();
3116 async move {
3117 let url = this.url()?;
3118 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
3119 let bearer_token = this.client.bearer_token().await?;
3120 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3121 if let Some(expand) = &this.expand {
3122 req.url_mut().query_pairs_mut().append_pair("$expand", expand);
3123 }
3124 let req_body = azure_core::EMPTY_BODY;
3125 req.set_body(req_body);
3126 Ok(Response(this.client.send(&mut req).await?))
3127 }
3128 })
3129 }
3130 fn url(&self) -> azure_core::Result<azure_core::Url> {
3131 let mut url = self.client.endpoint().clone();
3132 url.set_path(&format!(
3133 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/serviceTasks/{}",
3134 &self.subscription_id, &self.group_name, &self.service_name, &self.task_name
3135 ));
3136 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3137 if !has_api_version_already {
3138 url.query_pairs_mut()
3139 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3140 }
3141 Ok(url)
3142 }
3143 }
3144 impl std::future::IntoFuture for RequestBuilder {
3145 type Output = azure_core::Result<models::ProjectTask>;
3146 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
3147 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3148 #[doc = ""]
3149 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3150 #[doc = ""]
3151 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3152 fn into_future(self) -> Self::IntoFuture {
3153 Box::pin(async move { self.send().await?.into_body().await })
3154 }
3155 }
3156 }
3157 pub mod create_or_update {
3158 use super::models;
3159 #[cfg(not(target_arch = "wasm32"))]
3160 use futures::future::BoxFuture;
3161 #[cfg(target_arch = "wasm32")]
3162 use futures::future::LocalBoxFuture as BoxFuture;
3163 #[derive(Debug)]
3164 pub struct Response(azure_core::Response);
3165 impl Response {
3166 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
3167 let bytes = self.0.into_body().collect().await?;
3168 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
3169 Ok(body)
3170 }
3171 pub fn into_raw_response(self) -> azure_core::Response {
3172 self.0
3173 }
3174 pub fn as_raw_response(&self) -> &azure_core::Response {
3175 &self.0
3176 }
3177 }
3178 impl From<Response> for azure_core::Response {
3179 fn from(rsp: Response) -> Self {
3180 rsp.into_raw_response()
3181 }
3182 }
3183 impl AsRef<azure_core::Response> for Response {
3184 fn as_ref(&self) -> &azure_core::Response {
3185 self.as_raw_response()
3186 }
3187 }
3188 #[derive(Clone)]
3189 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3190 #[doc = r""]
3191 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3192 #[doc = r" parameters can be chained."]
3193 #[doc = r""]
3194 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3195 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3196 #[doc = r" executes the request and returns a `Result` with the parsed"]
3197 #[doc = r" response."]
3198 #[doc = r""]
3199 #[doc = r" In order to execute the request without polling the service"]
3200 #[doc = r" until the operation completes, use `.send().await` instead."]
3201 #[doc = r""]
3202 #[doc = r" If you need lower-level access to the raw response details"]
3203 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3204 #[doc = r" can finalize the request using the"]
3205 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3206 #[doc = r" that resolves to a lower-level [`Response`] value."]
3207 pub struct RequestBuilder {
3208 pub(crate) client: super::super::Client,
3209 pub(crate) subscription_id: String,
3210 pub(crate) group_name: String,
3211 pub(crate) service_name: String,
3212 pub(crate) task_name: String,
3213 pub(crate) parameters: models::ProjectTask,
3214 }
3215 impl RequestBuilder {
3216 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3217 #[doc = ""]
3218 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3219 #[doc = "However, this function can provide more flexibility when required."]
3220 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3221 Box::pin({
3222 let this = self.clone();
3223 async move {
3224 let url = this.url()?;
3225 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3226 let bearer_token = this.client.bearer_token().await?;
3227 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3228 req.insert_header("content-type", "application/json");
3229 let req_body = azure_core::to_json(&this.parameters)?;
3230 req.set_body(req_body);
3231 Ok(Response(this.client.send(&mut req).await?))
3232 }
3233 })
3234 }
3235 fn url(&self) -> azure_core::Result<azure_core::Url> {
3236 let mut url = self.client.endpoint().clone();
3237 url.set_path(&format!(
3238 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/serviceTasks/{}",
3239 &self.subscription_id, &self.group_name, &self.service_name, &self.task_name
3240 ));
3241 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3242 if !has_api_version_already {
3243 url.query_pairs_mut()
3244 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3245 }
3246 Ok(url)
3247 }
3248 }
3249 impl std::future::IntoFuture for RequestBuilder {
3250 type Output = azure_core::Result<models::ProjectTask>;
3251 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
3252 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3253 #[doc = ""]
3254 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3255 #[doc = ""]
3256 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3257 fn into_future(self) -> Self::IntoFuture {
3258 Box::pin(async move { self.send().await?.into_body().await })
3259 }
3260 }
3261 }
3262 pub mod update {
3263 use super::models;
3264 #[cfg(not(target_arch = "wasm32"))]
3265 use futures::future::BoxFuture;
3266 #[cfg(target_arch = "wasm32")]
3267 use futures::future::LocalBoxFuture as BoxFuture;
3268 #[derive(Debug)]
3269 pub struct Response(azure_core::Response);
3270 impl Response {
3271 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
3272 let bytes = self.0.into_body().collect().await?;
3273 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
3274 Ok(body)
3275 }
3276 pub fn into_raw_response(self) -> azure_core::Response {
3277 self.0
3278 }
3279 pub fn as_raw_response(&self) -> &azure_core::Response {
3280 &self.0
3281 }
3282 }
3283 impl From<Response> for azure_core::Response {
3284 fn from(rsp: Response) -> Self {
3285 rsp.into_raw_response()
3286 }
3287 }
3288 impl AsRef<azure_core::Response> for Response {
3289 fn as_ref(&self) -> &azure_core::Response {
3290 self.as_raw_response()
3291 }
3292 }
3293 #[derive(Clone)]
3294 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3295 #[doc = r""]
3296 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3297 #[doc = r" parameters can be chained."]
3298 #[doc = r""]
3299 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3300 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3301 #[doc = r" executes the request and returns a `Result` with the parsed"]
3302 #[doc = r" response."]
3303 #[doc = r""]
3304 #[doc = r" In order to execute the request without polling the service"]
3305 #[doc = r" until the operation completes, use `.send().await` instead."]
3306 #[doc = r""]
3307 #[doc = r" If you need lower-level access to the raw response details"]
3308 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3309 #[doc = r" can finalize the request using the"]
3310 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3311 #[doc = r" that resolves to a lower-level [`Response`] value."]
3312 pub struct RequestBuilder {
3313 pub(crate) client: super::super::Client,
3314 pub(crate) subscription_id: String,
3315 pub(crate) group_name: String,
3316 pub(crate) service_name: String,
3317 pub(crate) task_name: String,
3318 pub(crate) parameters: models::ProjectTask,
3319 }
3320 impl RequestBuilder {
3321 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3322 #[doc = ""]
3323 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3324 #[doc = "However, this function can provide more flexibility when required."]
3325 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3326 Box::pin({
3327 let this = self.clone();
3328 async move {
3329 let url = this.url()?;
3330 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
3331 let bearer_token = this.client.bearer_token().await?;
3332 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3333 req.insert_header("content-type", "application/json");
3334 let req_body = azure_core::to_json(&this.parameters)?;
3335 req.set_body(req_body);
3336 Ok(Response(this.client.send(&mut req).await?))
3337 }
3338 })
3339 }
3340 fn url(&self) -> azure_core::Result<azure_core::Url> {
3341 let mut url = self.client.endpoint().clone();
3342 url.set_path(&format!(
3343 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/serviceTasks/{}",
3344 &self.subscription_id, &self.group_name, &self.service_name, &self.task_name
3345 ));
3346 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3347 if !has_api_version_already {
3348 url.query_pairs_mut()
3349 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3350 }
3351 Ok(url)
3352 }
3353 }
3354 impl std::future::IntoFuture for RequestBuilder {
3355 type Output = azure_core::Result<models::ProjectTask>;
3356 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
3357 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3358 #[doc = ""]
3359 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3360 #[doc = ""]
3361 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3362 fn into_future(self) -> Self::IntoFuture {
3363 Box::pin(async move { self.send().await?.into_body().await })
3364 }
3365 }
3366 }
3367 pub mod delete {
3368 use super::models;
3369 #[cfg(not(target_arch = "wasm32"))]
3370 use futures::future::BoxFuture;
3371 #[cfg(target_arch = "wasm32")]
3372 use futures::future::LocalBoxFuture as BoxFuture;
3373 #[derive(Debug)]
3374 pub struct Response(azure_core::Response);
3375 impl Response {
3376 pub fn into_raw_response(self) -> azure_core::Response {
3377 self.0
3378 }
3379 pub fn as_raw_response(&self) -> &azure_core::Response {
3380 &self.0
3381 }
3382 }
3383 impl From<Response> for azure_core::Response {
3384 fn from(rsp: Response) -> Self {
3385 rsp.into_raw_response()
3386 }
3387 }
3388 impl AsRef<azure_core::Response> for Response {
3389 fn as_ref(&self) -> &azure_core::Response {
3390 self.as_raw_response()
3391 }
3392 }
3393 #[derive(Clone)]
3394 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3395 #[doc = r""]
3396 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3397 #[doc = r" parameters can be chained."]
3398 #[doc = r""]
3399 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3400 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3401 #[doc = r" executes the request and returns a `Result` with the parsed"]
3402 #[doc = r" response."]
3403 #[doc = r""]
3404 #[doc = r" In order to execute the request without polling the service"]
3405 #[doc = r" until the operation completes, use `.send().await` instead."]
3406 #[doc = r""]
3407 #[doc = r" If you need lower-level access to the raw response details"]
3408 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3409 #[doc = r" can finalize the request using the"]
3410 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3411 #[doc = r" that resolves to a lower-level [`Response`] value."]
3412 pub struct RequestBuilder {
3413 pub(crate) client: super::super::Client,
3414 pub(crate) subscription_id: String,
3415 pub(crate) group_name: String,
3416 pub(crate) service_name: String,
3417 pub(crate) task_name: String,
3418 pub(crate) delete_running_tasks: Option<bool>,
3419 }
3420 impl RequestBuilder {
3421 #[doc = "Delete the resource even if it contains running tasks"]
3422 pub fn delete_running_tasks(mut self, delete_running_tasks: bool) -> Self {
3423 self.delete_running_tasks = Some(delete_running_tasks);
3424 self
3425 }
3426 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3427 #[doc = ""]
3428 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3429 #[doc = "However, this function can provide more flexibility when required."]
3430 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3431 Box::pin({
3432 let this = self.clone();
3433 async move {
3434 let url = this.url()?;
3435 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
3436 let bearer_token = this.client.bearer_token().await?;
3437 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3438 if let Some(delete_running_tasks) = &this.delete_running_tasks {
3439 req.url_mut()
3440 .query_pairs_mut()
3441 .append_pair("deleteRunningTasks", &delete_running_tasks.to_string());
3442 }
3443 let req_body = azure_core::EMPTY_BODY;
3444 req.set_body(req_body);
3445 Ok(Response(this.client.send(&mut req).await?))
3446 }
3447 })
3448 }
3449 fn url(&self) -> azure_core::Result<azure_core::Url> {
3450 let mut url = self.client.endpoint().clone();
3451 url.set_path(&format!(
3452 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/serviceTasks/{}",
3453 &self.subscription_id, &self.group_name, &self.service_name, &self.task_name
3454 ));
3455 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3456 if !has_api_version_already {
3457 url.query_pairs_mut()
3458 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3459 }
3460 Ok(url)
3461 }
3462 }
3463 }
3464 pub mod cancel {
3465 use super::models;
3466 #[cfg(not(target_arch = "wasm32"))]
3467 use futures::future::BoxFuture;
3468 #[cfg(target_arch = "wasm32")]
3469 use futures::future::LocalBoxFuture as BoxFuture;
3470 #[derive(Debug)]
3471 pub struct Response(azure_core::Response);
3472 impl Response {
3473 pub async fn into_body(self) -> azure_core::Result<models::ProjectTask> {
3474 let bytes = self.0.into_body().collect().await?;
3475 let body: models::ProjectTask = serde_json::from_slice(&bytes)?;
3476 Ok(body)
3477 }
3478 pub fn into_raw_response(self) -> azure_core::Response {
3479 self.0
3480 }
3481 pub fn as_raw_response(&self) -> &azure_core::Response {
3482 &self.0
3483 }
3484 }
3485 impl From<Response> for azure_core::Response {
3486 fn from(rsp: Response) -> Self {
3487 rsp.into_raw_response()
3488 }
3489 }
3490 impl AsRef<azure_core::Response> for Response {
3491 fn as_ref(&self) -> &azure_core::Response {
3492 self.as_raw_response()
3493 }
3494 }
3495 #[derive(Clone)]
3496 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3497 #[doc = r""]
3498 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3499 #[doc = r" parameters can be chained."]
3500 #[doc = r""]
3501 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3502 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3503 #[doc = r" executes the request and returns a `Result` with the parsed"]
3504 #[doc = r" response."]
3505 #[doc = r""]
3506 #[doc = r" In order to execute the request without polling the service"]
3507 #[doc = r" until the operation completes, use `.send().await` instead."]
3508 #[doc = r""]
3509 #[doc = r" If you need lower-level access to the raw response details"]
3510 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3511 #[doc = r" can finalize the request using the"]
3512 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3513 #[doc = r" that resolves to a lower-level [`Response`] value."]
3514 pub struct RequestBuilder {
3515 pub(crate) client: super::super::Client,
3516 pub(crate) subscription_id: String,
3517 pub(crate) group_name: String,
3518 pub(crate) service_name: String,
3519 pub(crate) task_name: String,
3520 }
3521 impl RequestBuilder {
3522 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3523 #[doc = ""]
3524 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3525 #[doc = "However, this function can provide more flexibility when required."]
3526 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3527 Box::pin({
3528 let this = self.clone();
3529 async move {
3530 let url = this.url()?;
3531 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
3532 let bearer_token = this.client.bearer_token().await?;
3533 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3534 let req_body = azure_core::EMPTY_BODY;
3535 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
3536 req.set_body(req_body);
3537 Ok(Response(this.client.send(&mut req).await?))
3538 }
3539 })
3540 }
3541 fn url(&self) -> azure_core::Result<azure_core::Url> {
3542 let mut url = self.client.endpoint().clone();
3543 url.set_path(&format!(
3544 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/serviceTasks/{}/cancel",
3545 &self.subscription_id, &self.group_name, &self.service_name, &self.task_name
3546 ));
3547 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3548 if !has_api_version_already {
3549 url.query_pairs_mut()
3550 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3551 }
3552 Ok(url)
3553 }
3554 }
3555 impl std::future::IntoFuture for RequestBuilder {
3556 type Output = azure_core::Result<models::ProjectTask>;
3557 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectTask>>;
3558 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3559 #[doc = ""]
3560 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3561 #[doc = ""]
3562 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3563 fn into_future(self) -> Self::IntoFuture {
3564 Box::pin(async move { self.send().await?.into_body().await })
3565 }
3566 }
3567 }
3568}
3569pub mod projects {
3570 use super::models;
3571 #[cfg(not(target_arch = "wasm32"))]
3572 use futures::future::BoxFuture;
3573 #[cfg(target_arch = "wasm32")]
3574 use futures::future::LocalBoxFuture as BoxFuture;
3575 pub struct Client(pub(crate) super::Client);
3576 impl Client {
3577 #[doc = "Get projects in a service"]
3578 #[doc = "The project resource is a nested resource representing a stored migration project. This method returns a list of projects owned by a service resource."]
3579 #[doc = ""]
3580 #[doc = "Arguments:"]
3581 #[doc = "* `subscription_id`: Identifier of the subscription"]
3582 #[doc = "* `group_name`: Name of the resource group"]
3583 #[doc = "* `service_name`: Name of the service"]
3584 pub fn list(
3585 &self,
3586 subscription_id: impl Into<String>,
3587 group_name: impl Into<String>,
3588 service_name: impl Into<String>,
3589 ) -> list::RequestBuilder {
3590 list::RequestBuilder {
3591 client: self.0.clone(),
3592 subscription_id: subscription_id.into(),
3593 group_name: group_name.into(),
3594 service_name: service_name.into(),
3595 }
3596 }
3597 #[doc = "Get project information"]
3598 #[doc = "The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project."]
3599 #[doc = ""]
3600 #[doc = "Arguments:"]
3601 #[doc = "* `subscription_id`: Identifier of the subscription"]
3602 #[doc = "* `group_name`: Name of the resource group"]
3603 #[doc = "* `service_name`: Name of the service"]
3604 #[doc = "* `project_name`: Name of the project"]
3605 pub fn get(
3606 &self,
3607 subscription_id: impl Into<String>,
3608 group_name: impl Into<String>,
3609 service_name: impl Into<String>,
3610 project_name: impl Into<String>,
3611 ) -> get::RequestBuilder {
3612 get::RequestBuilder {
3613 client: self.0.clone(),
3614 subscription_id: subscription_id.into(),
3615 group_name: group_name.into(),
3616 service_name: service_name.into(),
3617 project_name: project_name.into(),
3618 }
3619 }
3620 #[doc = "Create or update project"]
3621 #[doc = "The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one."]
3622 #[doc = ""]
3623 #[doc = "Arguments:"]
3624 #[doc = "* `subscription_id`: Identifier of the subscription"]
3625 #[doc = "* `group_name`: Name of the resource group"]
3626 #[doc = "* `service_name`: Name of the service"]
3627 #[doc = "* `project_name`: Name of the project"]
3628 #[doc = "* `parameters`: Information about the project"]
3629 pub fn create_or_update(
3630 &self,
3631 subscription_id: impl Into<String>,
3632 group_name: impl Into<String>,
3633 service_name: impl Into<String>,
3634 project_name: impl Into<String>,
3635 parameters: impl Into<models::Project>,
3636 ) -> create_or_update::RequestBuilder {
3637 create_or_update::RequestBuilder {
3638 client: self.0.clone(),
3639 subscription_id: subscription_id.into(),
3640 group_name: group_name.into(),
3641 service_name: service_name.into(),
3642 project_name: project_name.into(),
3643 parameters: parameters.into(),
3644 }
3645 }
3646 #[doc = "Update project"]
3647 #[doc = "The project resource is a nested resource representing a stored migration project. The PATCH method updates an existing project."]
3648 #[doc = ""]
3649 #[doc = "Arguments:"]
3650 #[doc = "* `subscription_id`: Identifier of the subscription"]
3651 #[doc = "* `group_name`: Name of the resource group"]
3652 #[doc = "* `service_name`: Name of the service"]
3653 #[doc = "* `project_name`: Name of the project"]
3654 #[doc = "* `parameters`: Information about the project"]
3655 pub fn update(
3656 &self,
3657 subscription_id: impl Into<String>,
3658 group_name: impl Into<String>,
3659 service_name: impl Into<String>,
3660 project_name: impl Into<String>,
3661 parameters: impl Into<models::Project>,
3662 ) -> update::RequestBuilder {
3663 update::RequestBuilder {
3664 client: self.0.clone(),
3665 subscription_id: subscription_id.into(),
3666 group_name: group_name.into(),
3667 service_name: service_name.into(),
3668 project_name: project_name.into(),
3669 parameters: parameters.into(),
3670 }
3671 }
3672 #[doc = "Delete project"]
3673 #[doc = "The project resource is a nested resource representing a stored migration project. The DELETE method deletes a project."]
3674 #[doc = ""]
3675 #[doc = "Arguments:"]
3676 #[doc = "* `subscription_id`: Identifier of the subscription"]
3677 #[doc = "* `group_name`: Name of the resource group"]
3678 #[doc = "* `service_name`: Name of the service"]
3679 #[doc = "* `project_name`: Name of the project"]
3680 pub fn delete(
3681 &self,
3682 subscription_id: impl Into<String>,
3683 group_name: impl Into<String>,
3684 service_name: impl Into<String>,
3685 project_name: impl Into<String>,
3686 ) -> delete::RequestBuilder {
3687 delete::RequestBuilder {
3688 client: self.0.clone(),
3689 subscription_id: subscription_id.into(),
3690 group_name: group_name.into(),
3691 service_name: service_name.into(),
3692 project_name: project_name.into(),
3693 delete_running_tasks: None,
3694 }
3695 }
3696 }
3697 pub mod list {
3698 use super::models;
3699 #[cfg(not(target_arch = "wasm32"))]
3700 use futures::future::BoxFuture;
3701 #[cfg(target_arch = "wasm32")]
3702 use futures::future::LocalBoxFuture as BoxFuture;
3703 #[derive(Debug)]
3704 pub struct Response(azure_core::Response);
3705 impl Response {
3706 pub async fn into_body(self) -> azure_core::Result<models::ProjectList> {
3707 let bytes = self.0.into_body().collect().await?;
3708 let body: models::ProjectList = serde_json::from_slice(&bytes)?;
3709 Ok(body)
3710 }
3711 pub fn into_raw_response(self) -> azure_core::Response {
3712 self.0
3713 }
3714 pub fn as_raw_response(&self) -> &azure_core::Response {
3715 &self.0
3716 }
3717 }
3718 impl From<Response> for azure_core::Response {
3719 fn from(rsp: Response) -> Self {
3720 rsp.into_raw_response()
3721 }
3722 }
3723 impl AsRef<azure_core::Response> for Response {
3724 fn as_ref(&self) -> &azure_core::Response {
3725 self.as_raw_response()
3726 }
3727 }
3728 #[derive(Clone)]
3729 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3730 #[doc = r""]
3731 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3732 #[doc = r" parameters can be chained."]
3733 #[doc = r""]
3734 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3735 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3736 #[doc = r" executes the request and returns a `Result` with the parsed"]
3737 #[doc = r" response."]
3738 #[doc = r""]
3739 #[doc = r" In order to execute the request without polling the service"]
3740 #[doc = r" until the operation completes, use `.send().await` instead."]
3741 #[doc = r""]
3742 #[doc = r" If you need lower-level access to the raw response details"]
3743 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3744 #[doc = r" can finalize the request using the"]
3745 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3746 #[doc = r" that resolves to a lower-level [`Response`] value."]
3747 pub struct RequestBuilder {
3748 pub(crate) client: super::super::Client,
3749 pub(crate) subscription_id: String,
3750 pub(crate) group_name: String,
3751 pub(crate) service_name: String,
3752 }
3753 impl RequestBuilder {
3754 pub fn into_stream(self) -> azure_core::Pageable<models::ProjectList, azure_core::error::Error> {
3755 let make_request = move |continuation: Option<String>| {
3756 let this = self.clone();
3757 async move {
3758 let mut url = this.url()?;
3759 let rsp = match continuation {
3760 Some(value) => {
3761 url.set_path("");
3762 url = url.join(&value)?;
3763 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
3764 let bearer_token = this.client.bearer_token().await?;
3765 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3766 let has_api_version_already =
3767 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3768 if !has_api_version_already {
3769 req.url_mut()
3770 .query_pairs_mut()
3771 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3772 }
3773 let req_body = azure_core::EMPTY_BODY;
3774 req.set_body(req_body);
3775 this.client.send(&mut req).await?
3776 }
3777 None => {
3778 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
3779 let bearer_token = this.client.bearer_token().await?;
3780 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3781 let req_body = azure_core::EMPTY_BODY;
3782 req.set_body(req_body);
3783 this.client.send(&mut req).await?
3784 }
3785 };
3786 let rsp = match rsp.status() {
3787 azure_core::StatusCode::Ok => Ok(Response(rsp)),
3788 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
3789 status: status_code,
3790 error_code: None,
3791 })),
3792 };
3793 rsp?.into_body().await
3794 }
3795 };
3796 azure_core::Pageable::new(make_request)
3797 }
3798 fn url(&self) -> azure_core::Result<azure_core::Url> {
3799 let mut url = self.client.endpoint().clone();
3800 url.set_path(&format!(
3801 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects",
3802 &self.subscription_id, &self.group_name, &self.service_name
3803 ));
3804 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3805 if !has_api_version_already {
3806 url.query_pairs_mut()
3807 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3808 }
3809 Ok(url)
3810 }
3811 }
3812 }
3813 pub mod get {
3814 use super::models;
3815 #[cfg(not(target_arch = "wasm32"))]
3816 use futures::future::BoxFuture;
3817 #[cfg(target_arch = "wasm32")]
3818 use futures::future::LocalBoxFuture as BoxFuture;
3819 #[derive(Debug)]
3820 pub struct Response(azure_core::Response);
3821 impl Response {
3822 pub async fn into_body(self) -> azure_core::Result<models::Project> {
3823 let bytes = self.0.into_body().collect().await?;
3824 let body: models::Project = serde_json::from_slice(&bytes)?;
3825 Ok(body)
3826 }
3827 pub fn into_raw_response(self) -> azure_core::Response {
3828 self.0
3829 }
3830 pub fn as_raw_response(&self) -> &azure_core::Response {
3831 &self.0
3832 }
3833 }
3834 impl From<Response> for azure_core::Response {
3835 fn from(rsp: Response) -> Self {
3836 rsp.into_raw_response()
3837 }
3838 }
3839 impl AsRef<azure_core::Response> for Response {
3840 fn as_ref(&self) -> &azure_core::Response {
3841 self.as_raw_response()
3842 }
3843 }
3844 #[derive(Clone)]
3845 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3846 #[doc = r""]
3847 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3848 #[doc = r" parameters can be chained."]
3849 #[doc = r""]
3850 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3851 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3852 #[doc = r" executes the request and returns a `Result` with the parsed"]
3853 #[doc = r" response."]
3854 #[doc = r""]
3855 #[doc = r" In order to execute the request without polling the service"]
3856 #[doc = r" until the operation completes, use `.send().await` instead."]
3857 #[doc = r""]
3858 #[doc = r" If you need lower-level access to the raw response details"]
3859 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3860 #[doc = r" can finalize the request using the"]
3861 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3862 #[doc = r" that resolves to a lower-level [`Response`] value."]
3863 pub struct RequestBuilder {
3864 pub(crate) client: super::super::Client,
3865 pub(crate) subscription_id: String,
3866 pub(crate) group_name: String,
3867 pub(crate) service_name: String,
3868 pub(crate) project_name: String,
3869 }
3870 impl RequestBuilder {
3871 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3872 #[doc = ""]
3873 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3874 #[doc = "However, this function can provide more flexibility when required."]
3875 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3876 Box::pin({
3877 let this = self.clone();
3878 async move {
3879 let url = this.url()?;
3880 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
3881 let bearer_token = this.client.bearer_token().await?;
3882 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3883 let req_body = azure_core::EMPTY_BODY;
3884 req.set_body(req_body);
3885 Ok(Response(this.client.send(&mut req).await?))
3886 }
3887 })
3888 }
3889 fn url(&self) -> azure_core::Result<azure_core::Url> {
3890 let mut url = self.client.endpoint().clone();
3891 url.set_path(&format!(
3892 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}",
3893 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name
3894 ));
3895 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
3896 if !has_api_version_already {
3897 url.query_pairs_mut()
3898 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
3899 }
3900 Ok(url)
3901 }
3902 }
3903 impl std::future::IntoFuture for RequestBuilder {
3904 type Output = azure_core::Result<models::Project>;
3905 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Project>>;
3906 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3907 #[doc = ""]
3908 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3909 #[doc = ""]
3910 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3911 fn into_future(self) -> Self::IntoFuture {
3912 Box::pin(async move { self.send().await?.into_body().await })
3913 }
3914 }
3915 }
3916 pub mod create_or_update {
3917 use super::models;
3918 #[cfg(not(target_arch = "wasm32"))]
3919 use futures::future::BoxFuture;
3920 #[cfg(target_arch = "wasm32")]
3921 use futures::future::LocalBoxFuture as BoxFuture;
3922 #[derive(Debug)]
3923 pub struct Response(azure_core::Response);
3924 impl Response {
3925 pub async fn into_body(self) -> azure_core::Result<models::Project> {
3926 let bytes = self.0.into_body().collect().await?;
3927 let body: models::Project = serde_json::from_slice(&bytes)?;
3928 Ok(body)
3929 }
3930 pub fn into_raw_response(self) -> azure_core::Response {
3931 self.0
3932 }
3933 pub fn as_raw_response(&self) -> &azure_core::Response {
3934 &self.0
3935 }
3936 }
3937 impl From<Response> for azure_core::Response {
3938 fn from(rsp: Response) -> Self {
3939 rsp.into_raw_response()
3940 }
3941 }
3942 impl AsRef<azure_core::Response> for Response {
3943 fn as_ref(&self) -> &azure_core::Response {
3944 self.as_raw_response()
3945 }
3946 }
3947 #[derive(Clone)]
3948 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3949 #[doc = r""]
3950 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3951 #[doc = r" parameters can be chained."]
3952 #[doc = r""]
3953 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3954 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
3955 #[doc = r" executes the request and returns a `Result` with the parsed"]
3956 #[doc = r" response."]
3957 #[doc = r""]
3958 #[doc = r" In order to execute the request without polling the service"]
3959 #[doc = r" until the operation completes, use `.send().await` instead."]
3960 #[doc = r""]
3961 #[doc = r" If you need lower-level access to the raw response details"]
3962 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3963 #[doc = r" can finalize the request using the"]
3964 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3965 #[doc = r" that resolves to a lower-level [`Response`] value."]
3966 pub struct RequestBuilder {
3967 pub(crate) client: super::super::Client,
3968 pub(crate) subscription_id: String,
3969 pub(crate) group_name: String,
3970 pub(crate) service_name: String,
3971 pub(crate) project_name: String,
3972 pub(crate) parameters: models::Project,
3973 }
3974 impl RequestBuilder {
3975 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3976 #[doc = ""]
3977 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3978 #[doc = "However, this function can provide more flexibility when required."]
3979 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3980 Box::pin({
3981 let this = self.clone();
3982 async move {
3983 let url = this.url()?;
3984 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
3985 let bearer_token = this.client.bearer_token().await?;
3986 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
3987 req.insert_header("content-type", "application/json");
3988 let req_body = azure_core::to_json(&this.parameters)?;
3989 req.set_body(req_body);
3990 Ok(Response(this.client.send(&mut req).await?))
3991 }
3992 })
3993 }
3994 fn url(&self) -> azure_core::Result<azure_core::Url> {
3995 let mut url = self.client.endpoint().clone();
3996 url.set_path(&format!(
3997 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}",
3998 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name
3999 ));
4000 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4001 if !has_api_version_already {
4002 url.query_pairs_mut()
4003 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4004 }
4005 Ok(url)
4006 }
4007 }
4008 impl std::future::IntoFuture for RequestBuilder {
4009 type Output = azure_core::Result<models::Project>;
4010 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Project>>;
4011 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4012 #[doc = ""]
4013 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4014 #[doc = ""]
4015 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4016 fn into_future(self) -> Self::IntoFuture {
4017 Box::pin(async move { self.send().await?.into_body().await })
4018 }
4019 }
4020 }
4021 pub mod update {
4022 use super::models;
4023 #[cfg(not(target_arch = "wasm32"))]
4024 use futures::future::BoxFuture;
4025 #[cfg(target_arch = "wasm32")]
4026 use futures::future::LocalBoxFuture as BoxFuture;
4027 #[derive(Debug)]
4028 pub struct Response(azure_core::Response);
4029 impl Response {
4030 pub async fn into_body(self) -> azure_core::Result<models::Project> {
4031 let bytes = self.0.into_body().collect().await?;
4032 let body: models::Project = serde_json::from_slice(&bytes)?;
4033 Ok(body)
4034 }
4035 pub fn into_raw_response(self) -> azure_core::Response {
4036 self.0
4037 }
4038 pub fn as_raw_response(&self) -> &azure_core::Response {
4039 &self.0
4040 }
4041 }
4042 impl From<Response> for azure_core::Response {
4043 fn from(rsp: Response) -> Self {
4044 rsp.into_raw_response()
4045 }
4046 }
4047 impl AsRef<azure_core::Response> for Response {
4048 fn as_ref(&self) -> &azure_core::Response {
4049 self.as_raw_response()
4050 }
4051 }
4052 #[derive(Clone)]
4053 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4054 #[doc = r""]
4055 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4056 #[doc = r" parameters can be chained."]
4057 #[doc = r""]
4058 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4059 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4060 #[doc = r" executes the request and returns a `Result` with the parsed"]
4061 #[doc = r" response."]
4062 #[doc = r""]
4063 #[doc = r" In order to execute the request without polling the service"]
4064 #[doc = r" until the operation completes, use `.send().await` instead."]
4065 #[doc = r""]
4066 #[doc = r" If you need lower-level access to the raw response details"]
4067 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4068 #[doc = r" can finalize the request using the"]
4069 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4070 #[doc = r" that resolves to a lower-level [`Response`] value."]
4071 pub struct RequestBuilder {
4072 pub(crate) client: super::super::Client,
4073 pub(crate) subscription_id: String,
4074 pub(crate) group_name: String,
4075 pub(crate) service_name: String,
4076 pub(crate) project_name: String,
4077 pub(crate) parameters: models::Project,
4078 }
4079 impl RequestBuilder {
4080 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4081 #[doc = ""]
4082 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4083 #[doc = "However, this function can provide more flexibility when required."]
4084 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4085 Box::pin({
4086 let this = self.clone();
4087 async move {
4088 let url = this.url()?;
4089 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
4090 let bearer_token = this.client.bearer_token().await?;
4091 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4092 req.insert_header("content-type", "application/json");
4093 let req_body = azure_core::to_json(&this.parameters)?;
4094 req.set_body(req_body);
4095 Ok(Response(this.client.send(&mut req).await?))
4096 }
4097 })
4098 }
4099 fn url(&self) -> azure_core::Result<azure_core::Url> {
4100 let mut url = self.client.endpoint().clone();
4101 url.set_path(&format!(
4102 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}",
4103 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name
4104 ));
4105 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4106 if !has_api_version_already {
4107 url.query_pairs_mut()
4108 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4109 }
4110 Ok(url)
4111 }
4112 }
4113 impl std::future::IntoFuture for RequestBuilder {
4114 type Output = azure_core::Result<models::Project>;
4115 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Project>>;
4116 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4117 #[doc = ""]
4118 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4119 #[doc = ""]
4120 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4121 fn into_future(self) -> Self::IntoFuture {
4122 Box::pin(async move { self.send().await?.into_body().await })
4123 }
4124 }
4125 }
4126 pub mod delete {
4127 use super::models;
4128 #[cfg(not(target_arch = "wasm32"))]
4129 use futures::future::BoxFuture;
4130 #[cfg(target_arch = "wasm32")]
4131 use futures::future::LocalBoxFuture as BoxFuture;
4132 #[derive(Debug)]
4133 pub struct Response(azure_core::Response);
4134 impl Response {
4135 pub fn into_raw_response(self) -> azure_core::Response {
4136 self.0
4137 }
4138 pub fn as_raw_response(&self) -> &azure_core::Response {
4139 &self.0
4140 }
4141 }
4142 impl From<Response> for azure_core::Response {
4143 fn from(rsp: Response) -> Self {
4144 rsp.into_raw_response()
4145 }
4146 }
4147 impl AsRef<azure_core::Response> for Response {
4148 fn as_ref(&self) -> &azure_core::Response {
4149 self.as_raw_response()
4150 }
4151 }
4152 #[derive(Clone)]
4153 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4154 #[doc = r""]
4155 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4156 #[doc = r" parameters can be chained."]
4157 #[doc = r""]
4158 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4159 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4160 #[doc = r" executes the request and returns a `Result` with the parsed"]
4161 #[doc = r" response."]
4162 #[doc = r""]
4163 #[doc = r" In order to execute the request without polling the service"]
4164 #[doc = r" until the operation completes, use `.send().await` instead."]
4165 #[doc = r""]
4166 #[doc = r" If you need lower-level access to the raw response details"]
4167 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4168 #[doc = r" can finalize the request using the"]
4169 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4170 #[doc = r" that resolves to a lower-level [`Response`] value."]
4171 pub struct RequestBuilder {
4172 pub(crate) client: super::super::Client,
4173 pub(crate) subscription_id: String,
4174 pub(crate) group_name: String,
4175 pub(crate) service_name: String,
4176 pub(crate) project_name: String,
4177 pub(crate) delete_running_tasks: Option<bool>,
4178 }
4179 impl RequestBuilder {
4180 #[doc = "Delete the resource even if it contains running tasks"]
4181 pub fn delete_running_tasks(mut self, delete_running_tasks: bool) -> Self {
4182 self.delete_running_tasks = Some(delete_running_tasks);
4183 self
4184 }
4185 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4186 #[doc = ""]
4187 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4188 #[doc = "However, this function can provide more flexibility when required."]
4189 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4190 Box::pin({
4191 let this = self.clone();
4192 async move {
4193 let url = this.url()?;
4194 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
4195 let bearer_token = this.client.bearer_token().await?;
4196 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4197 if let Some(delete_running_tasks) = &this.delete_running_tasks {
4198 req.url_mut()
4199 .query_pairs_mut()
4200 .append_pair("deleteRunningTasks", &delete_running_tasks.to_string());
4201 }
4202 let req_body = azure_core::EMPTY_BODY;
4203 req.set_body(req_body);
4204 Ok(Response(this.client.send(&mut req).await?))
4205 }
4206 })
4207 }
4208 fn url(&self) -> azure_core::Result<azure_core::Url> {
4209 let mut url = self.client.endpoint().clone();
4210 url.set_path(&format!(
4211 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}",
4212 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name
4213 ));
4214 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4215 if !has_api_version_already {
4216 url.query_pairs_mut()
4217 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4218 }
4219 Ok(url)
4220 }
4221 }
4222 }
4223}
4224pub mod usages {
4225 use super::models;
4226 #[cfg(not(target_arch = "wasm32"))]
4227 use futures::future::BoxFuture;
4228 #[cfg(target_arch = "wasm32")]
4229 use futures::future::LocalBoxFuture as BoxFuture;
4230 pub struct Client(pub(crate) super::Client);
4231 impl Client {
4232 #[doc = "Get resource quotas and usage information"]
4233 #[doc = "This method returns region-specific quotas and resource usage information for the Database Migration Service."]
4234 #[doc = ""]
4235 #[doc = "Arguments:"]
4236 #[doc = "* `subscription_id`: Identifier of the subscription"]
4237 #[doc = "* `location`: The Azure region of the operation"]
4238 pub fn list(&self, subscription_id: impl Into<String>, location: impl Into<String>) -> list::RequestBuilder {
4239 list::RequestBuilder {
4240 client: self.0.clone(),
4241 subscription_id: subscription_id.into(),
4242 location: location.into(),
4243 }
4244 }
4245 }
4246 pub mod list {
4247 use super::models;
4248 #[cfg(not(target_arch = "wasm32"))]
4249 use futures::future::BoxFuture;
4250 #[cfg(target_arch = "wasm32")]
4251 use futures::future::LocalBoxFuture as BoxFuture;
4252 #[derive(Debug)]
4253 pub struct Response(azure_core::Response);
4254 impl Response {
4255 pub async fn into_body(self) -> azure_core::Result<models::QuotaList> {
4256 let bytes = self.0.into_body().collect().await?;
4257 let body: models::QuotaList = serde_json::from_slice(&bytes)?;
4258 Ok(body)
4259 }
4260 pub fn into_raw_response(self) -> azure_core::Response {
4261 self.0
4262 }
4263 pub fn as_raw_response(&self) -> &azure_core::Response {
4264 &self.0
4265 }
4266 }
4267 impl From<Response> for azure_core::Response {
4268 fn from(rsp: Response) -> Self {
4269 rsp.into_raw_response()
4270 }
4271 }
4272 impl AsRef<azure_core::Response> for Response {
4273 fn as_ref(&self) -> &azure_core::Response {
4274 self.as_raw_response()
4275 }
4276 }
4277 #[derive(Clone)]
4278 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4279 #[doc = r""]
4280 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4281 #[doc = r" parameters can be chained."]
4282 #[doc = r""]
4283 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4284 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4285 #[doc = r" executes the request and returns a `Result` with the parsed"]
4286 #[doc = r" response."]
4287 #[doc = r""]
4288 #[doc = r" In order to execute the request without polling the service"]
4289 #[doc = r" until the operation completes, use `.send().await` instead."]
4290 #[doc = r""]
4291 #[doc = r" If you need lower-level access to the raw response details"]
4292 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4293 #[doc = r" can finalize the request using the"]
4294 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4295 #[doc = r" that resolves to a lower-level [`Response`] value."]
4296 pub struct RequestBuilder {
4297 pub(crate) client: super::super::Client,
4298 pub(crate) subscription_id: String,
4299 pub(crate) location: String,
4300 }
4301 impl RequestBuilder {
4302 pub fn into_stream(self) -> azure_core::Pageable<models::QuotaList, azure_core::error::Error> {
4303 let make_request = move |continuation: Option<String>| {
4304 let this = self.clone();
4305 async move {
4306 let mut url = this.url()?;
4307 let rsp = match continuation {
4308 Some(value) => {
4309 url.set_path("");
4310 url = url.join(&value)?;
4311 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4312 let bearer_token = this.client.bearer_token().await?;
4313 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4314 let has_api_version_already =
4315 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4316 if !has_api_version_already {
4317 req.url_mut()
4318 .query_pairs_mut()
4319 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4320 }
4321 let req_body = azure_core::EMPTY_BODY;
4322 req.set_body(req_body);
4323 this.client.send(&mut req).await?
4324 }
4325 None => {
4326 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4327 let bearer_token = this.client.bearer_token().await?;
4328 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4329 let req_body = azure_core::EMPTY_BODY;
4330 req.set_body(req_body);
4331 this.client.send(&mut req).await?
4332 }
4333 };
4334 let rsp = match rsp.status() {
4335 azure_core::StatusCode::Ok => Ok(Response(rsp)),
4336 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
4337 status: status_code,
4338 error_code: None,
4339 })),
4340 };
4341 rsp?.into_body().await
4342 }
4343 };
4344 azure_core::Pageable::new(make_request)
4345 }
4346 fn url(&self) -> azure_core::Result<azure_core::Url> {
4347 let mut url = self.client.endpoint().clone();
4348 url.set_path(&format!(
4349 "/subscriptions/{}/providers/Microsoft.DataMigration/locations/{}/usages",
4350 &self.subscription_id, &self.location
4351 ));
4352 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4353 if !has_api_version_already {
4354 url.query_pairs_mut()
4355 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4356 }
4357 Ok(url)
4358 }
4359 }
4360 }
4361}
4362pub mod operations {
4363 use super::models;
4364 #[cfg(not(target_arch = "wasm32"))]
4365 use futures::future::BoxFuture;
4366 #[cfg(target_arch = "wasm32")]
4367 use futures::future::LocalBoxFuture as BoxFuture;
4368 pub struct Client(pub(crate) super::Client);
4369 impl Client {
4370 #[doc = "Get available resource provider actions (operations)"]
4371 #[doc = "Lists all available actions exposed by the Database Migration Service resource provider."]
4372 pub fn list(&self) -> list::RequestBuilder {
4373 list::RequestBuilder { client: self.0.clone() }
4374 }
4375 }
4376 pub mod list {
4377 use super::models;
4378 #[cfg(not(target_arch = "wasm32"))]
4379 use futures::future::BoxFuture;
4380 #[cfg(target_arch = "wasm32")]
4381 use futures::future::LocalBoxFuture as BoxFuture;
4382 #[derive(Debug)]
4383 pub struct Response(azure_core::Response);
4384 impl Response {
4385 pub async fn into_body(self) -> azure_core::Result<models::ServiceOperationList> {
4386 let bytes = self.0.into_body().collect().await?;
4387 let body: models::ServiceOperationList = serde_json::from_slice(&bytes)?;
4388 Ok(body)
4389 }
4390 pub fn into_raw_response(self) -> azure_core::Response {
4391 self.0
4392 }
4393 pub fn as_raw_response(&self) -> &azure_core::Response {
4394 &self.0
4395 }
4396 }
4397 impl From<Response> for azure_core::Response {
4398 fn from(rsp: Response) -> Self {
4399 rsp.into_raw_response()
4400 }
4401 }
4402 impl AsRef<azure_core::Response> for Response {
4403 fn as_ref(&self) -> &azure_core::Response {
4404 self.as_raw_response()
4405 }
4406 }
4407 #[derive(Clone)]
4408 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4409 #[doc = r""]
4410 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4411 #[doc = r" parameters can be chained."]
4412 #[doc = r""]
4413 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4414 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4415 #[doc = r" executes the request and returns a `Result` with the parsed"]
4416 #[doc = r" response."]
4417 #[doc = r""]
4418 #[doc = r" In order to execute the request without polling the service"]
4419 #[doc = r" until the operation completes, use `.send().await` instead."]
4420 #[doc = r""]
4421 #[doc = r" If you need lower-level access to the raw response details"]
4422 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4423 #[doc = r" can finalize the request using the"]
4424 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4425 #[doc = r" that resolves to a lower-level [`Response`] value."]
4426 pub struct RequestBuilder {
4427 pub(crate) client: super::super::Client,
4428 }
4429 impl RequestBuilder {
4430 pub fn into_stream(self) -> azure_core::Pageable<models::ServiceOperationList, azure_core::error::Error> {
4431 let make_request = move |continuation: Option<String>| {
4432 let this = self.clone();
4433 async move {
4434 let mut url = this.url()?;
4435 let rsp = match continuation {
4436 Some(value) => {
4437 url.set_path("");
4438 url = url.join(&value)?;
4439 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4440 let bearer_token = this.client.bearer_token().await?;
4441 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4442 let has_api_version_already =
4443 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4444 if !has_api_version_already {
4445 req.url_mut()
4446 .query_pairs_mut()
4447 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4448 }
4449 let req_body = azure_core::EMPTY_BODY;
4450 req.set_body(req_body);
4451 this.client.send(&mut req).await?
4452 }
4453 None => {
4454 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4455 let bearer_token = this.client.bearer_token().await?;
4456 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4457 let req_body = azure_core::EMPTY_BODY;
4458 req.set_body(req_body);
4459 this.client.send(&mut req).await?
4460 }
4461 };
4462 let rsp = match rsp.status() {
4463 azure_core::StatusCode::Ok => Ok(Response(rsp)),
4464 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
4465 status: status_code,
4466 error_code: None,
4467 })),
4468 };
4469 rsp?.into_body().await
4470 }
4471 };
4472 azure_core::Pageable::new(make_request)
4473 }
4474 fn url(&self) -> azure_core::Result<azure_core::Url> {
4475 let mut url = self.client.endpoint().clone();
4476 url.set_path("/providers/Microsoft.DataMigration/operations");
4477 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4478 if !has_api_version_already {
4479 url.query_pairs_mut()
4480 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4481 }
4482 Ok(url)
4483 }
4484 }
4485 }
4486}
4487pub mod files {
4488 use super::models;
4489 #[cfg(not(target_arch = "wasm32"))]
4490 use futures::future::BoxFuture;
4491 #[cfg(target_arch = "wasm32")]
4492 use futures::future::LocalBoxFuture as BoxFuture;
4493 pub struct Client(pub(crate) super::Client);
4494 impl Client {
4495 #[doc = "Get files in a project"]
4496 #[doc = "The project resource is a nested resource representing a stored migration project. This method returns a list of files owned by a project resource."]
4497 #[doc = ""]
4498 #[doc = "Arguments:"]
4499 #[doc = "* `subscription_id`: Identifier of the subscription"]
4500 #[doc = "* `group_name`: Name of the resource group"]
4501 #[doc = "* `service_name`: Name of the service"]
4502 #[doc = "* `project_name`: Name of the project"]
4503 pub fn list(
4504 &self,
4505 subscription_id: impl Into<String>,
4506 group_name: impl Into<String>,
4507 service_name: impl Into<String>,
4508 project_name: impl Into<String>,
4509 ) -> list::RequestBuilder {
4510 list::RequestBuilder {
4511 client: self.0.clone(),
4512 subscription_id: subscription_id.into(),
4513 group_name: group_name.into(),
4514 service_name: service_name.into(),
4515 project_name: project_name.into(),
4516 }
4517 }
4518 #[doc = "Get file information"]
4519 #[doc = "The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file."]
4520 #[doc = ""]
4521 #[doc = "Arguments:"]
4522 #[doc = "* `subscription_id`: Identifier of the subscription"]
4523 #[doc = "* `group_name`: Name of the resource group"]
4524 #[doc = "* `service_name`: Name of the service"]
4525 #[doc = "* `project_name`: Name of the project"]
4526 #[doc = "* `file_name`: Name of the File"]
4527 pub fn get(
4528 &self,
4529 subscription_id: impl Into<String>,
4530 group_name: impl Into<String>,
4531 service_name: impl Into<String>,
4532 project_name: impl Into<String>,
4533 file_name: impl Into<String>,
4534 ) -> get::RequestBuilder {
4535 get::RequestBuilder {
4536 client: self.0.clone(),
4537 subscription_id: subscription_id.into(),
4538 group_name: group_name.into(),
4539 service_name: service_name.into(),
4540 project_name: project_name.into(),
4541 file_name: file_name.into(),
4542 }
4543 }
4544 #[doc = "Create a file resource"]
4545 #[doc = "The PUT method creates a new file or updates an existing one."]
4546 #[doc = ""]
4547 #[doc = "Arguments:"]
4548 #[doc = "* `subscription_id`: Identifier of the subscription"]
4549 #[doc = "* `group_name`: Name of the resource group"]
4550 #[doc = "* `service_name`: Name of the service"]
4551 #[doc = "* `project_name`: Name of the project"]
4552 #[doc = "* `file_name`: Name of the File"]
4553 #[doc = "* `parameters`: Information about the file"]
4554 pub fn create_or_update(
4555 &self,
4556 subscription_id: impl Into<String>,
4557 group_name: impl Into<String>,
4558 service_name: impl Into<String>,
4559 project_name: impl Into<String>,
4560 file_name: impl Into<String>,
4561 parameters: impl Into<models::ProjectFile>,
4562 ) -> create_or_update::RequestBuilder {
4563 create_or_update::RequestBuilder {
4564 client: self.0.clone(),
4565 subscription_id: subscription_id.into(),
4566 group_name: group_name.into(),
4567 service_name: service_name.into(),
4568 project_name: project_name.into(),
4569 file_name: file_name.into(),
4570 parameters: parameters.into(),
4571 }
4572 }
4573 #[doc = "Update a file"]
4574 #[doc = "This method updates an existing file."]
4575 #[doc = ""]
4576 #[doc = "Arguments:"]
4577 #[doc = "* `subscription_id`: Identifier of the subscription"]
4578 #[doc = "* `group_name`: Name of the resource group"]
4579 #[doc = "* `service_name`: Name of the service"]
4580 #[doc = "* `project_name`: Name of the project"]
4581 #[doc = "* `file_name`: Name of the File"]
4582 #[doc = "* `parameters`: Information about the file"]
4583 pub fn update(
4584 &self,
4585 subscription_id: impl Into<String>,
4586 group_name: impl Into<String>,
4587 service_name: impl Into<String>,
4588 project_name: impl Into<String>,
4589 file_name: impl Into<String>,
4590 parameters: impl Into<models::ProjectFile>,
4591 ) -> update::RequestBuilder {
4592 update::RequestBuilder {
4593 client: self.0.clone(),
4594 subscription_id: subscription_id.into(),
4595 group_name: group_name.into(),
4596 service_name: service_name.into(),
4597 project_name: project_name.into(),
4598 file_name: file_name.into(),
4599 parameters: parameters.into(),
4600 }
4601 }
4602 #[doc = "Delete file"]
4603 #[doc = "This method deletes a file."]
4604 #[doc = ""]
4605 #[doc = "Arguments:"]
4606 #[doc = "* `subscription_id`: Identifier of the subscription"]
4607 #[doc = "* `group_name`: Name of the resource group"]
4608 #[doc = "* `service_name`: Name of the service"]
4609 #[doc = "* `project_name`: Name of the project"]
4610 #[doc = "* `file_name`: Name of the File"]
4611 pub fn delete(
4612 &self,
4613 subscription_id: impl Into<String>,
4614 group_name: impl Into<String>,
4615 service_name: impl Into<String>,
4616 project_name: impl Into<String>,
4617 file_name: impl Into<String>,
4618 ) -> delete::RequestBuilder {
4619 delete::RequestBuilder {
4620 client: self.0.clone(),
4621 subscription_id: subscription_id.into(),
4622 group_name: group_name.into(),
4623 service_name: service_name.into(),
4624 project_name: project_name.into(),
4625 file_name: file_name.into(),
4626 }
4627 }
4628 #[doc = "Request storage information for downloading the file content"]
4629 #[doc = "This method is used for requesting storage information using which contents of the file can be downloaded."]
4630 #[doc = ""]
4631 #[doc = "Arguments:"]
4632 #[doc = "* `subscription_id`: Identifier of the subscription"]
4633 #[doc = "* `group_name`: Name of the resource group"]
4634 #[doc = "* `service_name`: Name of the service"]
4635 #[doc = "* `project_name`: Name of the project"]
4636 #[doc = "* `file_name`: Name of the File"]
4637 pub fn read(
4638 &self,
4639 subscription_id: impl Into<String>,
4640 group_name: impl Into<String>,
4641 service_name: impl Into<String>,
4642 project_name: impl Into<String>,
4643 file_name: impl Into<String>,
4644 ) -> read::RequestBuilder {
4645 read::RequestBuilder {
4646 client: self.0.clone(),
4647 subscription_id: subscription_id.into(),
4648 group_name: group_name.into(),
4649 service_name: service_name.into(),
4650 project_name: project_name.into(),
4651 file_name: file_name.into(),
4652 }
4653 }
4654 #[doc = "Request information for reading and writing file content."]
4655 #[doc = "This method is used for requesting information for reading and writing the file content."]
4656 #[doc = ""]
4657 #[doc = "Arguments:"]
4658 #[doc = "* `subscription_id`: Identifier of the subscription"]
4659 #[doc = "* `group_name`: Name of the resource group"]
4660 #[doc = "* `service_name`: Name of the service"]
4661 #[doc = "* `project_name`: Name of the project"]
4662 #[doc = "* `file_name`: Name of the File"]
4663 pub fn read_write(
4664 &self,
4665 subscription_id: impl Into<String>,
4666 group_name: impl Into<String>,
4667 service_name: impl Into<String>,
4668 project_name: impl Into<String>,
4669 file_name: impl Into<String>,
4670 ) -> read_write::RequestBuilder {
4671 read_write::RequestBuilder {
4672 client: self.0.clone(),
4673 subscription_id: subscription_id.into(),
4674 group_name: group_name.into(),
4675 service_name: service_name.into(),
4676 project_name: project_name.into(),
4677 file_name: file_name.into(),
4678 }
4679 }
4680 }
4681 pub mod list {
4682 use super::models;
4683 #[cfg(not(target_arch = "wasm32"))]
4684 use futures::future::BoxFuture;
4685 #[cfg(target_arch = "wasm32")]
4686 use futures::future::LocalBoxFuture as BoxFuture;
4687 #[derive(Debug)]
4688 pub struct Response(azure_core::Response);
4689 impl Response {
4690 pub async fn into_body(self) -> azure_core::Result<models::FileList> {
4691 let bytes = self.0.into_body().collect().await?;
4692 let body: models::FileList = serde_json::from_slice(&bytes)?;
4693 Ok(body)
4694 }
4695 pub fn into_raw_response(self) -> azure_core::Response {
4696 self.0
4697 }
4698 pub fn as_raw_response(&self) -> &azure_core::Response {
4699 &self.0
4700 }
4701 }
4702 impl From<Response> for azure_core::Response {
4703 fn from(rsp: Response) -> Self {
4704 rsp.into_raw_response()
4705 }
4706 }
4707 impl AsRef<azure_core::Response> for Response {
4708 fn as_ref(&self) -> &azure_core::Response {
4709 self.as_raw_response()
4710 }
4711 }
4712 #[derive(Clone)]
4713 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4714 #[doc = r""]
4715 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4716 #[doc = r" parameters can be chained."]
4717 #[doc = r""]
4718 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4719 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4720 #[doc = r" executes the request and returns a `Result` with the parsed"]
4721 #[doc = r" response."]
4722 #[doc = r""]
4723 #[doc = r" In order to execute the request without polling the service"]
4724 #[doc = r" until the operation completes, use `.send().await` instead."]
4725 #[doc = r""]
4726 #[doc = r" If you need lower-level access to the raw response details"]
4727 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4728 #[doc = r" can finalize the request using the"]
4729 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4730 #[doc = r" that resolves to a lower-level [`Response`] value."]
4731 pub struct RequestBuilder {
4732 pub(crate) client: super::super::Client,
4733 pub(crate) subscription_id: String,
4734 pub(crate) group_name: String,
4735 pub(crate) service_name: String,
4736 pub(crate) project_name: String,
4737 }
4738 impl RequestBuilder {
4739 pub fn into_stream(self) -> azure_core::Pageable<models::FileList, azure_core::error::Error> {
4740 let make_request = move |continuation: Option<String>| {
4741 let this = self.clone();
4742 async move {
4743 let mut url = this.url()?;
4744 let rsp = match continuation {
4745 Some(value) => {
4746 url.set_path("");
4747 url = url.join(&value)?;
4748 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4749 let bearer_token = this.client.bearer_token().await?;
4750 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4751 let has_api_version_already =
4752 req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4753 if !has_api_version_already {
4754 req.url_mut()
4755 .query_pairs_mut()
4756 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4757 }
4758 let req_body = azure_core::EMPTY_BODY;
4759 req.set_body(req_body);
4760 this.client.send(&mut req).await?
4761 }
4762 None => {
4763 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4764 let bearer_token = this.client.bearer_token().await?;
4765 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4766 let req_body = azure_core::EMPTY_BODY;
4767 req.set_body(req_body);
4768 this.client.send(&mut req).await?
4769 }
4770 };
4771 let rsp = match rsp.status() {
4772 azure_core::StatusCode::Ok => Ok(Response(rsp)),
4773 status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
4774 status: status_code,
4775 error_code: None,
4776 })),
4777 };
4778 rsp?.into_body().await
4779 }
4780 };
4781 azure_core::Pageable::new(make_request)
4782 }
4783 fn url(&self) -> azure_core::Result<azure_core::Url> {
4784 let mut url = self.client.endpoint().clone();
4785 url.set_path(&format!(
4786 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files",
4787 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name
4788 ));
4789 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4790 if !has_api_version_already {
4791 url.query_pairs_mut()
4792 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4793 }
4794 Ok(url)
4795 }
4796 }
4797 }
4798 pub mod get {
4799 use super::models;
4800 #[cfg(not(target_arch = "wasm32"))]
4801 use futures::future::BoxFuture;
4802 #[cfg(target_arch = "wasm32")]
4803 use futures::future::LocalBoxFuture as BoxFuture;
4804 #[derive(Debug)]
4805 pub struct Response(azure_core::Response);
4806 impl Response {
4807 pub async fn into_body(self) -> azure_core::Result<models::ProjectFile> {
4808 let bytes = self.0.into_body().collect().await?;
4809 let body: models::ProjectFile = serde_json::from_slice(&bytes)?;
4810 Ok(body)
4811 }
4812 pub fn into_raw_response(self) -> azure_core::Response {
4813 self.0
4814 }
4815 pub fn as_raw_response(&self) -> &azure_core::Response {
4816 &self.0
4817 }
4818 }
4819 impl From<Response> for azure_core::Response {
4820 fn from(rsp: Response) -> Self {
4821 rsp.into_raw_response()
4822 }
4823 }
4824 impl AsRef<azure_core::Response> for Response {
4825 fn as_ref(&self) -> &azure_core::Response {
4826 self.as_raw_response()
4827 }
4828 }
4829 #[derive(Clone)]
4830 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4831 #[doc = r""]
4832 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4833 #[doc = r" parameters can be chained."]
4834 #[doc = r""]
4835 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4836 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4837 #[doc = r" executes the request and returns a `Result` with the parsed"]
4838 #[doc = r" response."]
4839 #[doc = r""]
4840 #[doc = r" In order to execute the request without polling the service"]
4841 #[doc = r" until the operation completes, use `.send().await` instead."]
4842 #[doc = r""]
4843 #[doc = r" If you need lower-level access to the raw response details"]
4844 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4845 #[doc = r" can finalize the request using the"]
4846 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4847 #[doc = r" that resolves to a lower-level [`Response`] value."]
4848 pub struct RequestBuilder {
4849 pub(crate) client: super::super::Client,
4850 pub(crate) subscription_id: String,
4851 pub(crate) group_name: String,
4852 pub(crate) service_name: String,
4853 pub(crate) project_name: String,
4854 pub(crate) file_name: String,
4855 }
4856 impl RequestBuilder {
4857 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4858 #[doc = ""]
4859 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4860 #[doc = "However, this function can provide more flexibility when required."]
4861 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4862 Box::pin({
4863 let this = self.clone();
4864 async move {
4865 let url = this.url()?;
4866 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
4867 let bearer_token = this.client.bearer_token().await?;
4868 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4869 let req_body = azure_core::EMPTY_BODY;
4870 req.set_body(req_body);
4871 Ok(Response(this.client.send(&mut req).await?))
4872 }
4873 })
4874 }
4875 fn url(&self) -> azure_core::Result<azure_core::Url> {
4876 let mut url = self.client.endpoint().clone();
4877 url.set_path(&format!(
4878 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files/{}",
4879 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.file_name
4880 ));
4881 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4882 if !has_api_version_already {
4883 url.query_pairs_mut()
4884 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4885 }
4886 Ok(url)
4887 }
4888 }
4889 impl std::future::IntoFuture for RequestBuilder {
4890 type Output = azure_core::Result<models::ProjectFile>;
4891 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectFile>>;
4892 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4893 #[doc = ""]
4894 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4895 #[doc = ""]
4896 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4897 fn into_future(self) -> Self::IntoFuture {
4898 Box::pin(async move { self.send().await?.into_body().await })
4899 }
4900 }
4901 }
4902 pub mod create_or_update {
4903 use super::models;
4904 #[cfg(not(target_arch = "wasm32"))]
4905 use futures::future::BoxFuture;
4906 #[cfg(target_arch = "wasm32")]
4907 use futures::future::LocalBoxFuture as BoxFuture;
4908 #[derive(Debug)]
4909 pub struct Response(azure_core::Response);
4910 impl Response {
4911 pub async fn into_body(self) -> azure_core::Result<models::ProjectFile> {
4912 let bytes = self.0.into_body().collect().await?;
4913 let body: models::ProjectFile = serde_json::from_slice(&bytes)?;
4914 Ok(body)
4915 }
4916 pub fn into_raw_response(self) -> azure_core::Response {
4917 self.0
4918 }
4919 pub fn as_raw_response(&self) -> &azure_core::Response {
4920 &self.0
4921 }
4922 }
4923 impl From<Response> for azure_core::Response {
4924 fn from(rsp: Response) -> Self {
4925 rsp.into_raw_response()
4926 }
4927 }
4928 impl AsRef<azure_core::Response> for Response {
4929 fn as_ref(&self) -> &azure_core::Response {
4930 self.as_raw_response()
4931 }
4932 }
4933 #[derive(Clone)]
4934 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4935 #[doc = r""]
4936 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4937 #[doc = r" parameters can be chained."]
4938 #[doc = r""]
4939 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4940 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
4941 #[doc = r" executes the request and returns a `Result` with the parsed"]
4942 #[doc = r" response."]
4943 #[doc = r""]
4944 #[doc = r" In order to execute the request without polling the service"]
4945 #[doc = r" until the operation completes, use `.send().await` instead."]
4946 #[doc = r""]
4947 #[doc = r" If you need lower-level access to the raw response details"]
4948 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4949 #[doc = r" can finalize the request using the"]
4950 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4951 #[doc = r" that resolves to a lower-level [`Response`] value."]
4952 pub struct RequestBuilder {
4953 pub(crate) client: super::super::Client,
4954 pub(crate) subscription_id: String,
4955 pub(crate) group_name: String,
4956 pub(crate) service_name: String,
4957 pub(crate) project_name: String,
4958 pub(crate) file_name: String,
4959 pub(crate) parameters: models::ProjectFile,
4960 }
4961 impl RequestBuilder {
4962 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4963 #[doc = ""]
4964 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4965 #[doc = "However, this function can provide more flexibility when required."]
4966 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4967 Box::pin({
4968 let this = self.clone();
4969 async move {
4970 let url = this.url()?;
4971 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
4972 let bearer_token = this.client.bearer_token().await?;
4973 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
4974 req.insert_header("content-type", "application/json");
4975 let req_body = azure_core::to_json(&this.parameters)?;
4976 req.set_body(req_body);
4977 Ok(Response(this.client.send(&mut req).await?))
4978 }
4979 })
4980 }
4981 fn url(&self) -> azure_core::Result<azure_core::Url> {
4982 let mut url = self.client.endpoint().clone();
4983 url.set_path(&format!(
4984 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files/{}",
4985 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.file_name
4986 ));
4987 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
4988 if !has_api_version_already {
4989 url.query_pairs_mut()
4990 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
4991 }
4992 Ok(url)
4993 }
4994 }
4995 impl std::future::IntoFuture for RequestBuilder {
4996 type Output = azure_core::Result<models::ProjectFile>;
4997 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectFile>>;
4998 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4999 #[doc = ""]
5000 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5001 #[doc = ""]
5002 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5003 fn into_future(self) -> Self::IntoFuture {
5004 Box::pin(async move { self.send().await?.into_body().await })
5005 }
5006 }
5007 }
5008 pub mod update {
5009 use super::models;
5010 #[cfg(not(target_arch = "wasm32"))]
5011 use futures::future::BoxFuture;
5012 #[cfg(target_arch = "wasm32")]
5013 use futures::future::LocalBoxFuture as BoxFuture;
5014 #[derive(Debug)]
5015 pub struct Response(azure_core::Response);
5016 impl Response {
5017 pub async fn into_body(self) -> azure_core::Result<models::ProjectFile> {
5018 let bytes = self.0.into_body().collect().await?;
5019 let body: models::ProjectFile = serde_json::from_slice(&bytes)?;
5020 Ok(body)
5021 }
5022 pub fn into_raw_response(self) -> azure_core::Response {
5023 self.0
5024 }
5025 pub fn as_raw_response(&self) -> &azure_core::Response {
5026 &self.0
5027 }
5028 }
5029 impl From<Response> for azure_core::Response {
5030 fn from(rsp: Response) -> Self {
5031 rsp.into_raw_response()
5032 }
5033 }
5034 impl AsRef<azure_core::Response> for Response {
5035 fn as_ref(&self) -> &azure_core::Response {
5036 self.as_raw_response()
5037 }
5038 }
5039 #[derive(Clone)]
5040 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5041 #[doc = r""]
5042 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5043 #[doc = r" parameters can be chained."]
5044 #[doc = r""]
5045 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5046 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5047 #[doc = r" executes the request and returns a `Result` with the parsed"]
5048 #[doc = r" response."]
5049 #[doc = r""]
5050 #[doc = r" In order to execute the request without polling the service"]
5051 #[doc = r" until the operation completes, use `.send().await` instead."]
5052 #[doc = r""]
5053 #[doc = r" If you need lower-level access to the raw response details"]
5054 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5055 #[doc = r" can finalize the request using the"]
5056 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5057 #[doc = r" that resolves to a lower-level [`Response`] value."]
5058 pub struct RequestBuilder {
5059 pub(crate) client: super::super::Client,
5060 pub(crate) subscription_id: String,
5061 pub(crate) group_name: String,
5062 pub(crate) service_name: String,
5063 pub(crate) project_name: String,
5064 pub(crate) file_name: String,
5065 pub(crate) parameters: models::ProjectFile,
5066 }
5067 impl RequestBuilder {
5068 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5069 #[doc = ""]
5070 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5071 #[doc = "However, this function can provide more flexibility when required."]
5072 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5073 Box::pin({
5074 let this = self.clone();
5075 async move {
5076 let url = this.url()?;
5077 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
5078 let bearer_token = this.client.bearer_token().await?;
5079 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
5080 req.insert_header("content-type", "application/json");
5081 let req_body = azure_core::to_json(&this.parameters)?;
5082 req.set_body(req_body);
5083 Ok(Response(this.client.send(&mut req).await?))
5084 }
5085 })
5086 }
5087 fn url(&self) -> azure_core::Result<azure_core::Url> {
5088 let mut url = self.client.endpoint().clone();
5089 url.set_path(&format!(
5090 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files/{}",
5091 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.file_name
5092 ));
5093 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
5094 if !has_api_version_already {
5095 url.query_pairs_mut()
5096 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
5097 }
5098 Ok(url)
5099 }
5100 }
5101 impl std::future::IntoFuture for RequestBuilder {
5102 type Output = azure_core::Result<models::ProjectFile>;
5103 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProjectFile>>;
5104 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5105 #[doc = ""]
5106 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5107 #[doc = ""]
5108 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5109 fn into_future(self) -> Self::IntoFuture {
5110 Box::pin(async move { self.send().await?.into_body().await })
5111 }
5112 }
5113 }
5114 pub mod delete {
5115 use super::models;
5116 #[cfg(not(target_arch = "wasm32"))]
5117 use futures::future::BoxFuture;
5118 #[cfg(target_arch = "wasm32")]
5119 use futures::future::LocalBoxFuture as BoxFuture;
5120 #[derive(Debug)]
5121 pub struct Response(azure_core::Response);
5122 impl Response {
5123 pub fn into_raw_response(self) -> azure_core::Response {
5124 self.0
5125 }
5126 pub fn as_raw_response(&self) -> &azure_core::Response {
5127 &self.0
5128 }
5129 }
5130 impl From<Response> for azure_core::Response {
5131 fn from(rsp: Response) -> Self {
5132 rsp.into_raw_response()
5133 }
5134 }
5135 impl AsRef<azure_core::Response> for Response {
5136 fn as_ref(&self) -> &azure_core::Response {
5137 self.as_raw_response()
5138 }
5139 }
5140 #[derive(Clone)]
5141 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5142 #[doc = r""]
5143 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5144 #[doc = r" parameters can be chained."]
5145 #[doc = r""]
5146 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5147 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5148 #[doc = r" executes the request and returns a `Result` with the parsed"]
5149 #[doc = r" response."]
5150 #[doc = r""]
5151 #[doc = r" In order to execute the request without polling the service"]
5152 #[doc = r" until the operation completes, use `.send().await` instead."]
5153 #[doc = r""]
5154 #[doc = r" If you need lower-level access to the raw response details"]
5155 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5156 #[doc = r" can finalize the request using the"]
5157 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5158 #[doc = r" that resolves to a lower-level [`Response`] value."]
5159 pub struct RequestBuilder {
5160 pub(crate) client: super::super::Client,
5161 pub(crate) subscription_id: String,
5162 pub(crate) group_name: String,
5163 pub(crate) service_name: String,
5164 pub(crate) project_name: String,
5165 pub(crate) file_name: String,
5166 }
5167 impl RequestBuilder {
5168 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5169 #[doc = ""]
5170 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5171 #[doc = "However, this function can provide more flexibility when required."]
5172 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5173 Box::pin({
5174 let this = self.clone();
5175 async move {
5176 let url = this.url()?;
5177 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
5178 let bearer_token = this.client.bearer_token().await?;
5179 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
5180 let req_body = azure_core::EMPTY_BODY;
5181 req.set_body(req_body);
5182 Ok(Response(this.client.send(&mut req).await?))
5183 }
5184 })
5185 }
5186 fn url(&self) -> azure_core::Result<azure_core::Url> {
5187 let mut url = self.client.endpoint().clone();
5188 url.set_path(&format!(
5189 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files/{}",
5190 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.file_name
5191 ));
5192 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
5193 if !has_api_version_already {
5194 url.query_pairs_mut()
5195 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
5196 }
5197 Ok(url)
5198 }
5199 }
5200 }
5201 pub mod read {
5202 use super::models;
5203 #[cfg(not(target_arch = "wasm32"))]
5204 use futures::future::BoxFuture;
5205 #[cfg(target_arch = "wasm32")]
5206 use futures::future::LocalBoxFuture as BoxFuture;
5207 #[derive(Debug)]
5208 pub struct Response(azure_core::Response);
5209 impl Response {
5210 pub async fn into_body(self) -> azure_core::Result<models::FileStorageInfo> {
5211 let bytes = self.0.into_body().collect().await?;
5212 let body: models::FileStorageInfo = serde_json::from_slice(&bytes)?;
5213 Ok(body)
5214 }
5215 pub fn into_raw_response(self) -> azure_core::Response {
5216 self.0
5217 }
5218 pub fn as_raw_response(&self) -> &azure_core::Response {
5219 &self.0
5220 }
5221 }
5222 impl From<Response> for azure_core::Response {
5223 fn from(rsp: Response) -> Self {
5224 rsp.into_raw_response()
5225 }
5226 }
5227 impl AsRef<azure_core::Response> for Response {
5228 fn as_ref(&self) -> &azure_core::Response {
5229 self.as_raw_response()
5230 }
5231 }
5232 #[derive(Clone)]
5233 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5234 #[doc = r""]
5235 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5236 #[doc = r" parameters can be chained."]
5237 #[doc = r""]
5238 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5239 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5240 #[doc = r" executes the request and returns a `Result` with the parsed"]
5241 #[doc = r" response."]
5242 #[doc = r""]
5243 #[doc = r" In order to execute the request without polling the service"]
5244 #[doc = r" until the operation completes, use `.send().await` instead."]
5245 #[doc = r""]
5246 #[doc = r" If you need lower-level access to the raw response details"]
5247 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5248 #[doc = r" can finalize the request using the"]
5249 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5250 #[doc = r" that resolves to a lower-level [`Response`] value."]
5251 pub struct RequestBuilder {
5252 pub(crate) client: super::super::Client,
5253 pub(crate) subscription_id: String,
5254 pub(crate) group_name: String,
5255 pub(crate) service_name: String,
5256 pub(crate) project_name: String,
5257 pub(crate) file_name: String,
5258 }
5259 impl RequestBuilder {
5260 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5261 #[doc = ""]
5262 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5263 #[doc = "However, this function can provide more flexibility when required."]
5264 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5265 Box::pin({
5266 let this = self.clone();
5267 async move {
5268 let url = this.url()?;
5269 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
5270 let bearer_token = this.client.bearer_token().await?;
5271 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
5272 let req_body = azure_core::EMPTY_BODY;
5273 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
5274 req.set_body(req_body);
5275 Ok(Response(this.client.send(&mut req).await?))
5276 }
5277 })
5278 }
5279 fn url(&self) -> azure_core::Result<azure_core::Url> {
5280 let mut url = self.client.endpoint().clone();
5281 url.set_path(&format!(
5282 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files/{}/read",
5283 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.file_name
5284 ));
5285 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
5286 if !has_api_version_already {
5287 url.query_pairs_mut()
5288 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
5289 }
5290 Ok(url)
5291 }
5292 }
5293 impl std::future::IntoFuture for RequestBuilder {
5294 type Output = azure_core::Result<models::FileStorageInfo>;
5295 type IntoFuture = BoxFuture<'static, azure_core::Result<models::FileStorageInfo>>;
5296 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5297 #[doc = ""]
5298 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5299 #[doc = ""]
5300 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5301 fn into_future(self) -> Self::IntoFuture {
5302 Box::pin(async move { self.send().await?.into_body().await })
5303 }
5304 }
5305 }
5306 pub mod read_write {
5307 use super::models;
5308 #[cfg(not(target_arch = "wasm32"))]
5309 use futures::future::BoxFuture;
5310 #[cfg(target_arch = "wasm32")]
5311 use futures::future::LocalBoxFuture as BoxFuture;
5312 #[derive(Debug)]
5313 pub struct Response(azure_core::Response);
5314 impl Response {
5315 pub async fn into_body(self) -> azure_core::Result<models::FileStorageInfo> {
5316 let bytes = self.0.into_body().collect().await?;
5317 let body: models::FileStorageInfo = serde_json::from_slice(&bytes)?;
5318 Ok(body)
5319 }
5320 pub fn into_raw_response(self) -> azure_core::Response {
5321 self.0
5322 }
5323 pub fn as_raw_response(&self) -> &azure_core::Response {
5324 &self.0
5325 }
5326 }
5327 impl From<Response> for azure_core::Response {
5328 fn from(rsp: Response) -> Self {
5329 rsp.into_raw_response()
5330 }
5331 }
5332 impl AsRef<azure_core::Response> for Response {
5333 fn as_ref(&self) -> &azure_core::Response {
5334 self.as_raw_response()
5335 }
5336 }
5337 #[derive(Clone)]
5338 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5339 #[doc = r""]
5340 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5341 #[doc = r" parameters can be chained."]
5342 #[doc = r""]
5343 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5344 #[doc = r" which will convert the [`RequestBuilder`] into a future"]
5345 #[doc = r" executes the request and returns a `Result` with the parsed"]
5346 #[doc = r" response."]
5347 #[doc = r""]
5348 #[doc = r" In order to execute the request without polling the service"]
5349 #[doc = r" until the operation completes, use `.send().await` instead."]
5350 #[doc = r""]
5351 #[doc = r" If you need lower-level access to the raw response details"]
5352 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5353 #[doc = r" can finalize the request using the"]
5354 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5355 #[doc = r" that resolves to a lower-level [`Response`] value."]
5356 pub struct RequestBuilder {
5357 pub(crate) client: super::super::Client,
5358 pub(crate) subscription_id: String,
5359 pub(crate) group_name: String,
5360 pub(crate) service_name: String,
5361 pub(crate) project_name: String,
5362 pub(crate) file_name: String,
5363 }
5364 impl RequestBuilder {
5365 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5366 #[doc = ""]
5367 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5368 #[doc = "However, this function can provide more flexibility when required."]
5369 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5370 Box::pin({
5371 let this = self.clone();
5372 async move {
5373 let url = this.url()?;
5374 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
5375 let bearer_token = this.client.bearer_token().await?;
5376 req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
5377 let req_body = azure_core::EMPTY_BODY;
5378 req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
5379 req.set_body(req_body);
5380 Ok(Response(this.client.send(&mut req).await?))
5381 }
5382 })
5383 }
5384 fn url(&self) -> azure_core::Result<azure_core::Url> {
5385 let mut url = self.client.endpoint().clone();
5386 url.set_path(&format!(
5387 "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataMigration/services/{}/projects/{}/files/{}/readwrite",
5388 &self.subscription_id, &self.group_name, &self.service_name, &self.project_name, &self.file_name
5389 ));
5390 let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
5391 if !has_api_version_already {
5392 url.query_pairs_mut()
5393 .append_pair(azure_core::query_param::API_VERSION, "2021-06-30");
5394 }
5395 Ok(url)
5396 }
5397 }
5398 impl std::future::IntoFuture for RequestBuilder {
5399 type Output = azure_core::Result<models::FileStorageInfo>;
5400 type IntoFuture = BoxFuture<'static, azure_core::Result<models::FileStorageInfo>>;
5401 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5402 #[doc = ""]
5403 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5404 #[doc = ""]
5405 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5406 fn into_future(self) -> Self::IntoFuture {
5407 Box::pin(async move { self.send().await?.into_body().await })
5408 }
5409 }
5410 }
5411}