1#![allow(unused_mut)]
4#![allow(unused_variables)]
5#![allow(unused_imports)]
6#![allow(clippy::redundant_clone)]
7#![allow(clippy::too_many_arguments)]
8#![allow(clippy::module_inception)]
9pub mod models;
10#[derive(Clone)]
11pub struct Client {
12 endpoint: azure_core::http::Url,
13 credential: crate::Credential,
14 scopes: Vec<String>,
15 pipeline: azure_core::http::Pipeline,
16}
17#[derive(Clone)]
18pub struct ClientBuilder {
19 credential: crate::Credential,
20 endpoint: Option<azure_core::http::Url>,
21 scopes: Option<Vec<String>>,
22 options: azure_core::http::ClientOptions,
23}
24azure_core::static_url!(DEFAULT_ENDPOINT, "https://dev.azure.com");
25impl ClientBuilder {
26 #[doc = "Create a new instance of `ClientBuilder`."]
27 #[must_use]
28 pub fn new(credential: crate::Credential) -> Self {
29 Self {
30 credential,
31 endpoint: None,
32 scopes: None,
33 options: azure_core::http::ClientOptions::default(),
34 }
35 }
36 #[doc = "Set the endpoint."]
37 #[must_use]
38 pub fn endpoint(mut self, endpoint: impl Into<azure_core::http::Url>) -> Self {
39 self.endpoint = Some(endpoint.into());
40 self
41 }
42 #[doc = "Set the scopes."]
43 #[must_use]
44 pub fn scopes(mut self, scopes: &[&str]) -> Self {
45 self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
46 self
47 }
48 #[doc = "Set the retry options."]
49 #[must_use]
50 pub fn retry(mut self, retry: impl Into<azure_core::http::RetryOptions>) -> Self {
51 self.options.retry = Some(retry.into());
52 self
53 }
54 #[doc = "Set the transport options."]
55 #[must_use]
56 pub fn transport(mut self, transport: impl Into<azure_core::http::TransportOptions>) -> Self {
57 self.options.transport = Some(transport.into());
58 self
59 }
60 #[doc = "Set per-call policies."]
61 #[must_use]
62 pub fn per_call_policies(
63 mut self,
64 policies: impl Into<Vec<std::sync::Arc<dyn azure_core::http::policies::Policy>>>,
65 ) -> Self {
66 self.options.per_call_policies = policies.into();
67 self
68 }
69 #[doc = "Set per-try policies."]
70 #[must_use]
71 pub fn per_try_policies(
72 mut self,
73 policies: impl Into<Vec<std::sync::Arc<dyn azure_core::http::policies::Policy>>>,
74 ) -> Self {
75 self.options.per_try_policies = policies.into();
76 self
77 }
78 #[doc = "Convert the builder into a `Client` instance."]
79 pub fn build(self) -> Client {
80 let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
81 let scopes = self
82 .scopes
83 .unwrap_or_else(|| vec![crate::ADO_SCOPE.to_string()]);
84 Client::new(endpoint, self.credential, scopes, self.options)
85 }
86}
87impl Client {
88 pub(crate) fn endpoint(&self) -> &azure_core::http::Url {
89 &self.endpoint
90 }
91 pub(crate) fn token_credential(&self) -> &crate::Credential {
92 &self.credential
93 }
94 pub(crate) fn scopes(&self) -> Vec<&str> {
95 self.scopes.iter().map(String::as_str).collect()
96 }
97 pub(crate) async fn send(
98 &self,
99 request: &mut azure_core::http::Request,
100 ) -> azure_core::Result<azure_core::http::Response> {
101 let context = azure_core::http::Context::default();
102 self.pipeline.send(&context, request).await
103 }
104 #[doc = "Create a new `ClientBuilder`."]
105 #[must_use]
106 pub fn builder(credential: crate::Credential) -> ClientBuilder {
107 ClientBuilder::new(credential)
108 }
109 #[doc = "Create a new `Client`."]
110 #[must_use]
111 pub fn new(
112 endpoint: impl Into<azure_core::http::Url>,
113 credential: crate::Credential,
114 scopes: Vec<String>,
115 options: azure_core::http::ClientOptions,
116 ) -> Self {
117 let endpoint = endpoint.into();
118 let pipeline = azure_core::http::Pipeline::new(
119 option_env!("CARGO_PKG_NAME"),
120 option_env!("CARGO_PKG_VERSION"),
121 options,
122 Vec::new(),
123 Vec::new(),
124 );
125 Self {
126 endpoint,
127 credential,
128 scopes,
129 pipeline,
130 }
131 }
132 pub fn endpointproxy_client(&self) -> endpointproxy::Client {
133 endpointproxy::Client(self.clone())
134 }
135 pub fn endpoints_client(&self) -> endpoints::Client {
136 endpoints::Client(self.clone())
137 }
138 pub fn executionhistory_client(&self) -> executionhistory::Client {
139 executionhistory::Client(self.clone())
140 }
141 pub fn types_client(&self) -> types::Client {
142 types::Client(self.clone())
143 }
144}
145pub mod endpointproxy {
146 use super::models;
147 #[cfg(not(target_arch = "wasm32"))]
148 use futures::future::BoxFuture;
149 #[cfg(target_arch = "wasm32")]
150 use futures::future::LocalBoxFuture as BoxFuture;
151 pub struct Client(pub(crate) super::Client);
152 impl Client {
153 #[doc = "Proxy for a GET request defined by a service endpoint."]
154 #[doc = ""]
155 #[doc = "Arguments:"]
156 #[doc = "* `organization`: The name of the Azure DevOps organization."]
157 #[doc = "* `body`: Service endpoint request."]
158 #[doc = "* `project`: Project ID or project name"]
159 #[doc = "* `endpoint_id`: Id of the service endpoint."]
160 pub fn execute_service_endpoint_request(
161 &self,
162 organization: impl Into<String>,
163 body: impl Into<models::ServiceEndpointRequest>,
164 project: impl Into<String>,
165 endpoint_id: impl Into<String>,
166 ) -> execute_service_endpoint_request::RequestBuilder {
167 execute_service_endpoint_request::RequestBuilder {
168 client: self.0.clone(),
169 organization: organization.into(),
170 body: body.into(),
171 project: project.into(),
172 endpoint_id: endpoint_id.into(),
173 }
174 }
175 #[doc = "Use ExecuteServiceEndpointRequest API Instead"]
176 #[doc = ""]
177 #[doc = "Arguments:"]
178 #[doc = "* `organization`: The name of the Azure DevOps organization."]
179 #[doc = "* `body`: Describes the data source to fetch."]
180 #[doc = "* `project`: Project ID or project name"]
181 pub fn query(
182 &self,
183 organization: impl Into<String>,
184 body: impl Into<models::DataSourceBinding>,
185 project: impl Into<String>,
186 ) -> query::RequestBuilder {
187 query::RequestBuilder {
188 client: self.0.clone(),
189 organization: organization.into(),
190 body: body.into(),
191 project: project.into(),
192 }
193 }
194 }
195 pub mod execute_service_endpoint_request {
196 use super::models;
197 #[cfg(not(target_arch = "wasm32"))]
198 use futures::future::BoxFuture;
199 #[cfg(target_arch = "wasm32")]
200 use futures::future::LocalBoxFuture as BoxFuture;
201 #[derive(Debug)]
202 pub struct Response(azure_core::http::Response);
203 impl Response {
204 pub async fn into_raw_body(
205 self,
206 ) -> azure_core::Result<models::ServiceEndpointRequestResult> {
207 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
208 let body: models::ServiceEndpointRequestResult = serde_json::from_slice(&bytes)
209 .map_err(|e| {
210 azure_core::error::Error::full(
211 azure_core::error::ErrorKind::DataConversion,
212 e,
213 format!(
214 "Failed to deserialize response:\n{}",
215 String::from_utf8_lossy(&bytes)
216 ),
217 )
218 })?;
219 Ok(body)
220 }
221 pub fn into_raw_response(self) -> azure_core::http::Response {
222 self.0
223 }
224 pub fn as_raw_response(&self) -> &azure_core::http::Response {
225 &self.0
226 }
227 }
228 impl From<Response> for azure_core::http::Response {
229 fn from(rsp: Response) -> Self {
230 rsp.into_raw_response()
231 }
232 }
233 impl AsRef<azure_core::http::Response> for Response {
234 fn as_ref(&self) -> &azure_core::http::Response {
235 self.as_raw_response()
236 }
237 }
238 #[derive(Clone)]
239 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
240 #[doc = r""]
241 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
242 #[doc = r" parameters can be chained."]
243 #[doc = r""]
244 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
245 #[doc = r" converts the [`RequestBuilder`] into a future,"]
246 #[doc = r" executes the request and returns a `Result` with the parsed"]
247 #[doc = r" response."]
248 #[doc = r""]
249 #[doc = r" If you need lower-level access to the raw response details"]
250 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
251 #[doc = r" can finalize the request using the"]
252 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
253 #[doc = r" that resolves to a lower-level [`Response`] value."]
254 pub struct RequestBuilder {
255 pub(crate) client: super::super::Client,
256 pub(crate) organization: String,
257 pub(crate) body: models::ServiceEndpointRequest,
258 pub(crate) project: String,
259 pub(crate) endpoint_id: String,
260 }
261 impl RequestBuilder {
262 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
263 #[doc = ""]
264 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
265 #[doc = "However, this function can provide more flexibility when required."]
266 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
267 Box::pin({
268 let this = self.clone();
269 async move {
270 let url = this.url()?;
271 let mut req =
272 azure_core::http::Request::new(url, azure_core::http::Method::Post);
273 if let Some(auth_header) = this
274 .client
275 .token_credential()
276 .http_authorization_header(&this.client.scopes())
277 .await?
278 {
279 req.insert_header(
280 azure_core::http::headers::AUTHORIZATION,
281 auth_header,
282 );
283 }
284 req.insert_header("content-type", "application/json");
285 let req_body = azure_core::json::to_json(&this.body)?;
286 let endpoint_id = &this.endpoint_id;
287 req.url_mut()
288 .query_pairs_mut()
289 .append_pair("endpointId", endpoint_id);
290 req.set_body(req_body);
291 Ok(Response(this.client.send(&mut req).await?))
292 }
293 })
294 }
295 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
296 let mut url = azure_core::http::Url::parse(&format!(
297 "{}/{}/{}/_apis/serviceendpoint/endpointproxy?endpointId={}",
298 self.client.endpoint(),
299 &self.organization,
300 &self.project,
301 &self.endpoint_id
302 ))?;
303 let has_api_version_already = url
304 .query_pairs()
305 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
306 if !has_api_version_already {
307 url.query_pairs_mut().append_pair(
308 azure_core::http::headers::query_param::API_VERSION,
309 "7.1-preview",
310 );
311 }
312 Ok(url)
313 }
314 }
315 impl std::future::IntoFuture for RequestBuilder {
316 type Output = azure_core::Result<models::ServiceEndpointRequestResult>;
317 type IntoFuture =
318 BoxFuture<'static, azure_core::Result<models::ServiceEndpointRequestResult>>;
319 #[doc = "Returns a future that sends the request and returns the parsed response body."]
320 #[doc = ""]
321 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
322 #[doc = ""]
323 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
324 fn into_future(self) -> Self::IntoFuture {
325 Box::pin(async move { self.send().await?.into_raw_body().await })
326 }
327 }
328 }
329 pub mod query {
330 use super::models;
331 #[cfg(not(target_arch = "wasm32"))]
332 use futures::future::BoxFuture;
333 #[cfg(target_arch = "wasm32")]
334 use futures::future::LocalBoxFuture as BoxFuture;
335 #[derive(Debug)]
336 pub struct Response(azure_core::http::Response);
337 impl Response {
338 pub async fn into_raw_body(self) -> azure_core::Result<Vec<String>> {
339 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
340 let body: Vec<String> = serde_json::from_slice(&bytes).map_err(|e| {
341 azure_core::error::Error::full(
342 azure_core::error::ErrorKind::DataConversion,
343 e,
344 format!(
345 "Failed to deserialize response:\n{}",
346 String::from_utf8_lossy(&bytes)
347 ),
348 )
349 })?;
350 Ok(body)
351 }
352 pub fn into_raw_response(self) -> azure_core::http::Response {
353 self.0
354 }
355 pub fn as_raw_response(&self) -> &azure_core::http::Response {
356 &self.0
357 }
358 }
359 impl From<Response> for azure_core::http::Response {
360 fn from(rsp: Response) -> Self {
361 rsp.into_raw_response()
362 }
363 }
364 impl AsRef<azure_core::http::Response> for Response {
365 fn as_ref(&self) -> &azure_core::http::Response {
366 self.as_raw_response()
367 }
368 }
369 #[derive(Clone)]
370 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
371 #[doc = r""]
372 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
373 #[doc = r" parameters can be chained."]
374 #[doc = r""]
375 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
376 #[doc = r" converts the [`RequestBuilder`] into a future,"]
377 #[doc = r" executes the request and returns a `Result` with the parsed"]
378 #[doc = r" response."]
379 #[doc = r""]
380 #[doc = r" If you need lower-level access to the raw response details"]
381 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
382 #[doc = r" can finalize the request using the"]
383 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
384 #[doc = r" that resolves to a lower-level [`Response`] value."]
385 pub struct RequestBuilder {
386 pub(crate) client: super::super::Client,
387 pub(crate) organization: String,
388 pub(crate) body: models::DataSourceBinding,
389 pub(crate) project: String,
390 }
391 impl RequestBuilder {
392 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
393 #[doc = ""]
394 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
395 #[doc = "However, this function can provide more flexibility when required."]
396 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
397 Box::pin({
398 let this = self.clone();
399 async move {
400 let url = this.url()?;
401 let mut req =
402 azure_core::http::Request::new(url, azure_core::http::Method::Post);
403 if let Some(auth_header) = this
404 .client
405 .token_credential()
406 .http_authorization_header(&this.client.scopes())
407 .await?
408 {
409 req.insert_header(
410 azure_core::http::headers::AUTHORIZATION,
411 auth_header,
412 );
413 }
414 req.insert_header("content-type", "application/json");
415 let req_body = azure_core::json::to_json(&this.body)?;
416 req.set_body(req_body);
417 Ok(Response(this.client.send(&mut req).await?))
418 }
419 })
420 }
421 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
422 let mut url = azure_core::http::Url::parse(&format!(
423 "{}/{}/{}/_apis/serviceendpoint/endpointproxy",
424 self.client.endpoint(),
425 &self.organization,
426 &self.project
427 ))?;
428 let has_api_version_already = url
429 .query_pairs()
430 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
431 if !has_api_version_already {
432 url.query_pairs_mut().append_pair(
433 azure_core::http::headers::query_param::API_VERSION,
434 "7.1-preview",
435 );
436 }
437 Ok(url)
438 }
439 }
440 impl std::future::IntoFuture for RequestBuilder {
441 type Output = azure_core::Result<Vec<String>>;
442 type IntoFuture = BoxFuture<'static, azure_core::Result<Vec<String>>>;
443 #[doc = "Returns a future that sends the request and returns the parsed response body."]
444 #[doc = ""]
445 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
446 #[doc = ""]
447 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
448 fn into_future(self) -> Self::IntoFuture {
449 Box::pin(async move { self.send().await?.into_raw_body().await })
450 }
451 }
452 }
453}
454pub mod endpoints {
455 use super::models;
456 #[cfg(not(target_arch = "wasm32"))]
457 use futures::future::BoxFuture;
458 #[cfg(target_arch = "wasm32")]
459 use futures::future::LocalBoxFuture as BoxFuture;
460 pub struct Client(pub(crate) super::Client);
461 impl Client {
462 #[doc = "Get the service endpoints."]
463 #[doc = ""]
464 #[doc = "Arguments:"]
465 #[doc = "* `organization`: The name of the Azure DevOps organization."]
466 #[doc = "* `project`: Project ID or project name"]
467 pub fn get_service_endpoints(
468 &self,
469 organization: impl Into<String>,
470 project: impl Into<String>,
471 ) -> get_service_endpoints::RequestBuilder {
472 get_service_endpoints::RequestBuilder {
473 client: self.0.clone(),
474 organization: organization.into(),
475 project: project.into(),
476 type_: None,
477 auth_schemes: None,
478 endpoint_ids: None,
479 owner: None,
480 include_failed: None,
481 include_details: None,
482 action_filter: None,
483 }
484 }
485 #[doc = "Creates a new service endpoint"]
486 #[doc = ""]
487 #[doc = "Arguments:"]
488 #[doc = "* `organization`: The name of the Azure DevOps organization."]
489 #[doc = "* `body`: Service endpoint to create"]
490 pub fn create(
491 &self,
492 organization: impl Into<String>,
493 body: impl Into<models::ServiceEndpoint>,
494 ) -> create::RequestBuilder {
495 create::RequestBuilder {
496 client: self.0.clone(),
497 organization: organization.into(),
498 body: body.into(),
499 }
500 }
501 #[doc = "Update the service endpoints."]
502 #[doc = ""]
503 #[doc = "Arguments:"]
504 #[doc = "* `organization`: The name of the Azure DevOps organization."]
505 #[doc = "* `body`: Names of the service endpoints to update."]
506 pub fn update_service_endpoints(
507 &self,
508 organization: impl Into<String>,
509 body: Vec<models::ServiceEndpoint>,
510 ) -> update_service_endpoints::RequestBuilder {
511 update_service_endpoints::RequestBuilder {
512 client: self.0.clone(),
513 organization: organization.into(),
514 body,
515 }
516 }
517 #[doc = "Update the service endpoint"]
518 #[doc = ""]
519 #[doc = "Arguments:"]
520 #[doc = "* `organization`: The name of the Azure DevOps organization."]
521 #[doc = "* `body`: Updated data for the endpoint"]
522 #[doc = "* `endpoint_id`: Endpoint Id of the endpoint to update"]
523 pub fn update_service_endpoint(
524 &self,
525 organization: impl Into<String>,
526 body: impl Into<models::ServiceEndpoint>,
527 endpoint_id: impl Into<String>,
528 ) -> update_service_endpoint::RequestBuilder {
529 update_service_endpoint::RequestBuilder {
530 client: self.0.clone(),
531 organization: organization.into(),
532 body: body.into(),
533 endpoint_id: endpoint_id.into(),
534 operation: None,
535 }
536 }
537 #[doc = "Share service endpoint across projects"]
538 #[doc = ""]
539 #[doc = "Arguments:"]
540 #[doc = "* `organization`: The name of the Azure DevOps organization."]
541 #[doc = "* `body`: Project reference details of the target project"]
542 #[doc = "* `endpoint_id`: Endpoint Id of the endpoint to share"]
543 pub fn share_service_endpoint(
544 &self,
545 organization: impl Into<String>,
546 body: Vec<models::ServiceEndpointProjectReference>,
547 endpoint_id: impl Into<String>,
548 ) -> share_service_endpoint::RequestBuilder {
549 share_service_endpoint::RequestBuilder {
550 client: self.0.clone(),
551 organization: organization.into(),
552 body,
553 endpoint_id: endpoint_id.into(),
554 }
555 }
556 #[doc = "Delete a service endpoint"]
557 #[doc = ""]
558 #[doc = "Arguments:"]
559 #[doc = "* `organization`: The name of the Azure DevOps organization."]
560 #[doc = "* `endpoint_id`: Endpoint Id of endpoint to delete"]
561 #[doc = "* `project_ids`: project Ids from which endpoint needs to be deleted"]
562 pub fn delete(
563 &self,
564 organization: impl Into<String>,
565 endpoint_id: impl Into<String>,
566 project_ids: impl Into<String>,
567 ) -> delete::RequestBuilder {
568 delete::RequestBuilder {
569 client: self.0.clone(),
570 organization: organization.into(),
571 endpoint_id: endpoint_id.into(),
572 project_ids: project_ids.into(),
573 deep: None,
574 }
575 }
576 #[doc = "Get the service endpoints by name."]
577 #[doc = ""]
578 #[doc = "Arguments:"]
579 #[doc = "* `organization`: The name of the Azure DevOps organization."]
580 #[doc = "* `project`: Project ID or project name"]
581 #[doc = "* `endpoint_names`: Names of the service endpoints."]
582 pub fn get_service_endpoints_by_names(
583 &self,
584 organization: impl Into<String>,
585 project: impl Into<String>,
586 endpoint_names: impl Into<String>,
587 ) -> get_service_endpoints_by_names::RequestBuilder {
588 get_service_endpoints_by_names::RequestBuilder {
589 client: self.0.clone(),
590 organization: organization.into(),
591 project: project.into(),
592 endpoint_names: endpoint_names.into(),
593 type_: None,
594 auth_schemes: None,
595 owner: None,
596 include_failed: None,
597 include_details: None,
598 }
599 }
600 #[doc = "Gets the service endpoints and patch new authorization parameters"]
601 #[doc = ""]
602 #[doc = "Arguments:"]
603 #[doc = "* `organization`: The name of the Azure DevOps organization."]
604 #[doc = "* `body`: Scope, Validity of Token requested."]
605 #[doc = "* `project`: Project ID or project name"]
606 #[doc = "* `endpoint_ids`: Ids of the service endpoints."]
607 pub fn get_service_endpoints_with_refreshed_authentication(
608 &self,
609 organization: impl Into<String>,
610 body: Vec<models::RefreshAuthenticationParameters>,
611 project: impl Into<String>,
612 endpoint_ids: impl Into<String>,
613 ) -> get_service_endpoints_with_refreshed_authentication::RequestBuilder {
614 get_service_endpoints_with_refreshed_authentication::RequestBuilder {
615 client: self.0.clone(),
616 organization: organization.into(),
617 body,
618 project: project.into(),
619 endpoint_ids: endpoint_ids.into(),
620 }
621 }
622 #[doc = "Get the service endpoint details."]
623 #[doc = ""]
624 #[doc = "Arguments:"]
625 #[doc = "* `organization`: The name of the Azure DevOps organization."]
626 #[doc = "* `project`: Project ID or project name"]
627 #[doc = "* `endpoint_id`: Id of the service endpoint."]
628 pub fn get(
629 &self,
630 organization: impl Into<String>,
631 project: impl Into<String>,
632 endpoint_id: impl Into<String>,
633 ) -> get::RequestBuilder {
634 get::RequestBuilder {
635 client: self.0.clone(),
636 organization: organization.into(),
637 project: project.into(),
638 endpoint_id: endpoint_id.into(),
639 action_filter: None,
640 }
641 }
642 }
643 pub mod get_service_endpoints {
644 use super::models;
645 #[cfg(not(target_arch = "wasm32"))]
646 use futures::future::BoxFuture;
647 #[cfg(target_arch = "wasm32")]
648 use futures::future::LocalBoxFuture as BoxFuture;
649 #[derive(Debug)]
650 pub struct Response(azure_core::http::Response);
651 impl Response {
652 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpointList> {
653 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
654 let body: models::ServiceEndpointList =
655 serde_json::from_slice(&bytes).map_err(|e| {
656 azure_core::error::Error::full(
657 azure_core::error::ErrorKind::DataConversion,
658 e,
659 format!(
660 "Failed to deserialize response:\n{}",
661 String::from_utf8_lossy(&bytes)
662 ),
663 )
664 })?;
665 Ok(body)
666 }
667 pub fn into_raw_response(self) -> azure_core::http::Response {
668 self.0
669 }
670 pub fn as_raw_response(&self) -> &azure_core::http::Response {
671 &self.0
672 }
673 }
674 impl From<Response> for azure_core::http::Response {
675 fn from(rsp: Response) -> Self {
676 rsp.into_raw_response()
677 }
678 }
679 impl AsRef<azure_core::http::Response> for Response {
680 fn as_ref(&self) -> &azure_core::http::Response {
681 self.as_raw_response()
682 }
683 }
684 #[derive(Clone)]
685 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
686 #[doc = r""]
687 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
688 #[doc = r" parameters can be chained."]
689 #[doc = r""]
690 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
691 #[doc = r" converts the [`RequestBuilder`] into a future,"]
692 #[doc = r" executes the request and returns a `Result` with the parsed"]
693 #[doc = r" response."]
694 #[doc = r""]
695 #[doc = r" If you need lower-level access to the raw response details"]
696 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
697 #[doc = r" can finalize the request using the"]
698 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
699 #[doc = r" that resolves to a lower-level [`Response`] value."]
700 pub struct RequestBuilder {
701 pub(crate) client: super::super::Client,
702 pub(crate) organization: String,
703 pub(crate) project: String,
704 pub(crate) type_: Option<String>,
705 pub(crate) auth_schemes: Option<String>,
706 pub(crate) endpoint_ids: Option<String>,
707 pub(crate) owner: Option<String>,
708 pub(crate) include_failed: Option<bool>,
709 pub(crate) include_details: Option<bool>,
710 pub(crate) action_filter: Option<String>,
711 }
712 impl RequestBuilder {
713 #[doc = "Type of the service endpoints."]
714 pub fn type_(mut self, type_: impl Into<String>) -> Self {
715 self.type_ = Some(type_.into());
716 self
717 }
718 #[doc = "Authorization schemes used for service endpoints."]
719 pub fn auth_schemes(mut self, auth_schemes: impl Into<String>) -> Self {
720 self.auth_schemes = Some(auth_schemes.into());
721 self
722 }
723 #[doc = "Ids of the service endpoints."]
724 pub fn endpoint_ids(mut self, endpoint_ids: impl Into<String>) -> Self {
725 self.endpoint_ids = Some(endpoint_ids.into());
726 self
727 }
728 #[doc = "Owner for service endpoints."]
729 pub fn owner(mut self, owner: impl Into<String>) -> Self {
730 self.owner = Some(owner.into());
731 self
732 }
733 #[doc = "Failed flag for service endpoints."]
734 pub fn include_failed(mut self, include_failed: bool) -> Self {
735 self.include_failed = Some(include_failed);
736 self
737 }
738 #[doc = "Flag to include more details for service endpoints. This is for internal use only and the flag will be treated as false for all other requests"]
739 pub fn include_details(mut self, include_details: bool) -> Self {
740 self.include_details = Some(include_details);
741 self
742 }
743 #[doc = "The \"actionFilter\" parameter allows users to evaluate requestor permissions and retrieve a list of endpoints that match the specified conditions, ensuring that only relevant endpoints are returned based on their permissions"]
744 pub fn action_filter(mut self, action_filter: impl Into<String>) -> Self {
745 self.action_filter = Some(action_filter.into());
746 self
747 }
748 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
749 #[doc = ""]
750 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
751 #[doc = "However, this function can provide more flexibility when required."]
752 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
753 Box::pin({
754 let this = self.clone();
755 async move {
756 let url = this.url()?;
757 let mut req =
758 azure_core::http::Request::new(url, azure_core::http::Method::Get);
759 if let Some(auth_header) = this
760 .client
761 .token_credential()
762 .http_authorization_header(&this.client.scopes())
763 .await?
764 {
765 req.insert_header(
766 azure_core::http::headers::AUTHORIZATION,
767 auth_header,
768 );
769 }
770 if let Some(type_) = &this.type_ {
771 req.url_mut().query_pairs_mut().append_pair("type", type_);
772 }
773 if let Some(auth_schemes) = &this.auth_schemes {
774 req.url_mut()
775 .query_pairs_mut()
776 .append_pair("authSchemes", auth_schemes);
777 }
778 if let Some(endpoint_ids) = &this.endpoint_ids {
779 req.url_mut()
780 .query_pairs_mut()
781 .append_pair("endpointIds", endpoint_ids);
782 }
783 if let Some(owner) = &this.owner {
784 req.url_mut().query_pairs_mut().append_pair("owner", owner);
785 }
786 if let Some(include_failed) = &this.include_failed {
787 req.url_mut()
788 .query_pairs_mut()
789 .append_pair("includeFailed", &include_failed.to_string());
790 }
791 if let Some(include_details) = &this.include_details {
792 req.url_mut()
793 .query_pairs_mut()
794 .append_pair("includeDetails", &include_details.to_string());
795 }
796 if let Some(action_filter) = &this.action_filter {
797 req.url_mut()
798 .query_pairs_mut()
799 .append_pair("actionFilter", action_filter);
800 }
801 let req_body = azure_core::Bytes::new();
802 req.set_body(req_body);
803 Ok(Response(this.client.send(&mut req).await?))
804 }
805 })
806 }
807 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
808 let mut url = azure_core::http::Url::parse(&format!(
809 "{}/{}/{}/_apis/serviceendpoint/endpoints?",
810 self.client.endpoint(),
811 &self.organization,
812 &self.project
813 ))?;
814 let has_api_version_already = url
815 .query_pairs()
816 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
817 if !has_api_version_already {
818 url.query_pairs_mut().append_pair(
819 azure_core::http::headers::query_param::API_VERSION,
820 "7.1-preview",
821 );
822 }
823 Ok(url)
824 }
825 }
826 impl std::future::IntoFuture for RequestBuilder {
827 type Output = azure_core::Result<models::ServiceEndpointList>;
828 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpointList>>;
829 #[doc = "Returns a future that sends the request and returns the parsed response body."]
830 #[doc = ""]
831 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
832 #[doc = ""]
833 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
834 fn into_future(self) -> Self::IntoFuture {
835 Box::pin(async move { self.send().await?.into_raw_body().await })
836 }
837 }
838 }
839 pub mod create {
840 use super::models;
841 #[cfg(not(target_arch = "wasm32"))]
842 use futures::future::BoxFuture;
843 #[cfg(target_arch = "wasm32")]
844 use futures::future::LocalBoxFuture as BoxFuture;
845 #[derive(Debug)]
846 pub struct Response(azure_core::http::Response);
847 impl Response {
848 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpoint> {
849 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
850 let body: models::ServiceEndpoint =
851 serde_json::from_slice(&bytes).map_err(|e| {
852 azure_core::error::Error::full(
853 azure_core::error::ErrorKind::DataConversion,
854 e,
855 format!(
856 "Failed to deserialize response:\n{}",
857 String::from_utf8_lossy(&bytes)
858 ),
859 )
860 })?;
861 Ok(body)
862 }
863 pub fn into_raw_response(self) -> azure_core::http::Response {
864 self.0
865 }
866 pub fn as_raw_response(&self) -> &azure_core::http::Response {
867 &self.0
868 }
869 }
870 impl From<Response> for azure_core::http::Response {
871 fn from(rsp: Response) -> Self {
872 rsp.into_raw_response()
873 }
874 }
875 impl AsRef<azure_core::http::Response> for Response {
876 fn as_ref(&self) -> &azure_core::http::Response {
877 self.as_raw_response()
878 }
879 }
880 #[derive(Clone)]
881 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
882 #[doc = r""]
883 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
884 #[doc = r" parameters can be chained."]
885 #[doc = r""]
886 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
887 #[doc = r" converts the [`RequestBuilder`] into a future,"]
888 #[doc = r" executes the request and returns a `Result` with the parsed"]
889 #[doc = r" response."]
890 #[doc = r""]
891 #[doc = r" If you need lower-level access to the raw response details"]
892 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
893 #[doc = r" can finalize the request using the"]
894 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
895 #[doc = r" that resolves to a lower-level [`Response`] value."]
896 pub struct RequestBuilder {
897 pub(crate) client: super::super::Client,
898 pub(crate) organization: String,
899 pub(crate) body: models::ServiceEndpoint,
900 }
901 impl RequestBuilder {
902 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
903 #[doc = ""]
904 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
905 #[doc = "However, this function can provide more flexibility when required."]
906 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
907 Box::pin({
908 let this = self.clone();
909 async move {
910 let url = this.url()?;
911 let mut req =
912 azure_core::http::Request::new(url, azure_core::http::Method::Post);
913 if let Some(auth_header) = this
914 .client
915 .token_credential()
916 .http_authorization_header(&this.client.scopes())
917 .await?
918 {
919 req.insert_header(
920 azure_core::http::headers::AUTHORIZATION,
921 auth_header,
922 );
923 }
924 req.insert_header("content-type", "application/json");
925 let req_body = azure_core::json::to_json(&this.body)?;
926 req.set_body(req_body);
927 Ok(Response(this.client.send(&mut req).await?))
928 }
929 })
930 }
931 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
932 let mut url = azure_core::http::Url::parse(&format!(
933 "{}/{}/_apis/serviceendpoint/endpoints",
934 self.client.endpoint(),
935 &self.organization
936 ))?;
937 let has_api_version_already = url
938 .query_pairs()
939 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
940 if !has_api_version_already {
941 url.query_pairs_mut().append_pair(
942 azure_core::http::headers::query_param::API_VERSION,
943 "7.1-preview",
944 );
945 }
946 Ok(url)
947 }
948 }
949 impl std::future::IntoFuture for RequestBuilder {
950 type Output = azure_core::Result<models::ServiceEndpoint>;
951 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpoint>>;
952 #[doc = "Returns a future that sends the request and returns the parsed response body."]
953 #[doc = ""]
954 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
955 #[doc = ""]
956 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
957 fn into_future(self) -> Self::IntoFuture {
958 Box::pin(async move { self.send().await?.into_raw_body().await })
959 }
960 }
961 }
962 pub mod update_service_endpoints {
963 use super::models;
964 #[cfg(not(target_arch = "wasm32"))]
965 use futures::future::BoxFuture;
966 #[cfg(target_arch = "wasm32")]
967 use futures::future::LocalBoxFuture as BoxFuture;
968 #[derive(Debug)]
969 pub struct Response(azure_core::http::Response);
970 impl Response {
971 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpointList> {
972 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
973 let body: models::ServiceEndpointList =
974 serde_json::from_slice(&bytes).map_err(|e| {
975 azure_core::error::Error::full(
976 azure_core::error::ErrorKind::DataConversion,
977 e,
978 format!(
979 "Failed to deserialize response:\n{}",
980 String::from_utf8_lossy(&bytes)
981 ),
982 )
983 })?;
984 Ok(body)
985 }
986 pub fn into_raw_response(self) -> azure_core::http::Response {
987 self.0
988 }
989 pub fn as_raw_response(&self) -> &azure_core::http::Response {
990 &self.0
991 }
992 }
993 impl From<Response> for azure_core::http::Response {
994 fn from(rsp: Response) -> Self {
995 rsp.into_raw_response()
996 }
997 }
998 impl AsRef<azure_core::http::Response> for Response {
999 fn as_ref(&self) -> &azure_core::http::Response {
1000 self.as_raw_response()
1001 }
1002 }
1003 #[derive(Clone)]
1004 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1005 #[doc = r""]
1006 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1007 #[doc = r" parameters can be chained."]
1008 #[doc = r""]
1009 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1010 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1011 #[doc = r" executes the request and returns a `Result` with the parsed"]
1012 #[doc = r" response."]
1013 #[doc = r""]
1014 #[doc = r" If you need lower-level access to the raw response details"]
1015 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1016 #[doc = r" can finalize the request using the"]
1017 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1018 #[doc = r" that resolves to a lower-level [`Response`] value."]
1019 pub struct RequestBuilder {
1020 pub(crate) client: super::super::Client,
1021 pub(crate) organization: String,
1022 pub(crate) body: Vec<models::ServiceEndpoint>,
1023 }
1024 impl RequestBuilder {
1025 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1026 #[doc = ""]
1027 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1028 #[doc = "However, this function can provide more flexibility when required."]
1029 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1030 Box::pin({
1031 let this = self.clone();
1032 async move {
1033 let url = this.url()?;
1034 let mut req =
1035 azure_core::http::Request::new(url, azure_core::http::Method::Put);
1036 if let Some(auth_header) = this
1037 .client
1038 .token_credential()
1039 .http_authorization_header(&this.client.scopes())
1040 .await?
1041 {
1042 req.insert_header(
1043 azure_core::http::headers::AUTHORIZATION,
1044 auth_header,
1045 );
1046 }
1047 req.insert_header("content-type", "application/json");
1048 let req_body = azure_core::json::to_json(&this.body)?;
1049 req.set_body(req_body);
1050 Ok(Response(this.client.send(&mut req).await?))
1051 }
1052 })
1053 }
1054 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1055 let mut url = azure_core::http::Url::parse(&format!(
1056 "{}/{}/_apis/serviceendpoint/endpoints",
1057 self.client.endpoint(),
1058 &self.organization
1059 ))?;
1060 let has_api_version_already = url
1061 .query_pairs()
1062 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1063 if !has_api_version_already {
1064 url.query_pairs_mut().append_pair(
1065 azure_core::http::headers::query_param::API_VERSION,
1066 "7.1-preview",
1067 );
1068 }
1069 Ok(url)
1070 }
1071 }
1072 impl std::future::IntoFuture for RequestBuilder {
1073 type Output = azure_core::Result<models::ServiceEndpointList>;
1074 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpointList>>;
1075 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1076 #[doc = ""]
1077 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1078 #[doc = ""]
1079 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1080 fn into_future(self) -> Self::IntoFuture {
1081 Box::pin(async move { self.send().await?.into_raw_body().await })
1082 }
1083 }
1084 }
1085 pub mod update_service_endpoint {
1086 use super::models;
1087 #[cfg(not(target_arch = "wasm32"))]
1088 use futures::future::BoxFuture;
1089 #[cfg(target_arch = "wasm32")]
1090 use futures::future::LocalBoxFuture as BoxFuture;
1091 #[derive(Debug)]
1092 pub struct Response(azure_core::http::Response);
1093 impl Response {
1094 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpoint> {
1095 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1096 let body: models::ServiceEndpoint =
1097 serde_json::from_slice(&bytes).map_err(|e| {
1098 azure_core::error::Error::full(
1099 azure_core::error::ErrorKind::DataConversion,
1100 e,
1101 format!(
1102 "Failed to deserialize response:\n{}",
1103 String::from_utf8_lossy(&bytes)
1104 ),
1105 )
1106 })?;
1107 Ok(body)
1108 }
1109 pub fn into_raw_response(self) -> azure_core::http::Response {
1110 self.0
1111 }
1112 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1113 &self.0
1114 }
1115 }
1116 impl From<Response> for azure_core::http::Response {
1117 fn from(rsp: Response) -> Self {
1118 rsp.into_raw_response()
1119 }
1120 }
1121 impl AsRef<azure_core::http::Response> for Response {
1122 fn as_ref(&self) -> &azure_core::http::Response {
1123 self.as_raw_response()
1124 }
1125 }
1126 #[derive(Clone)]
1127 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1128 #[doc = r""]
1129 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1130 #[doc = r" parameters can be chained."]
1131 #[doc = r""]
1132 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1133 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1134 #[doc = r" executes the request and returns a `Result` with the parsed"]
1135 #[doc = r" response."]
1136 #[doc = r""]
1137 #[doc = r" If you need lower-level access to the raw response details"]
1138 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1139 #[doc = r" can finalize the request using the"]
1140 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1141 #[doc = r" that resolves to a lower-level [`Response`] value."]
1142 pub struct RequestBuilder {
1143 pub(crate) client: super::super::Client,
1144 pub(crate) organization: String,
1145 pub(crate) body: models::ServiceEndpoint,
1146 pub(crate) endpoint_id: String,
1147 pub(crate) operation: Option<String>,
1148 }
1149 impl RequestBuilder {
1150 #[doc = "operation type"]
1151 pub fn operation(mut self, operation: impl Into<String>) -> Self {
1152 self.operation = Some(operation.into());
1153 self
1154 }
1155 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1156 #[doc = ""]
1157 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1158 #[doc = "However, this function can provide more flexibility when required."]
1159 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1160 Box::pin({
1161 let this = self.clone();
1162 async move {
1163 let url = this.url()?;
1164 let mut req =
1165 azure_core::http::Request::new(url, azure_core::http::Method::Put);
1166 if let Some(auth_header) = this
1167 .client
1168 .token_credential()
1169 .http_authorization_header(&this.client.scopes())
1170 .await?
1171 {
1172 req.insert_header(
1173 azure_core::http::headers::AUTHORIZATION,
1174 auth_header,
1175 );
1176 }
1177 req.insert_header("content-type", "application/json");
1178 let req_body = azure_core::json::to_json(&this.body)?;
1179 if let Some(operation) = &this.operation {
1180 req.url_mut()
1181 .query_pairs_mut()
1182 .append_pair("operation", operation);
1183 }
1184 req.set_body(req_body);
1185 Ok(Response(this.client.send(&mut req).await?))
1186 }
1187 })
1188 }
1189 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1190 let mut url = azure_core::http::Url::parse(&format!(
1191 "{}/{}/_apis/serviceendpoint/endpoints/{}",
1192 self.client.endpoint(),
1193 &self.organization,
1194 &self.endpoint_id
1195 ))?;
1196 let has_api_version_already = url
1197 .query_pairs()
1198 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1199 if !has_api_version_already {
1200 url.query_pairs_mut().append_pair(
1201 azure_core::http::headers::query_param::API_VERSION,
1202 "7.1-preview",
1203 );
1204 }
1205 Ok(url)
1206 }
1207 }
1208 impl std::future::IntoFuture for RequestBuilder {
1209 type Output = azure_core::Result<models::ServiceEndpoint>;
1210 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpoint>>;
1211 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1212 #[doc = ""]
1213 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1214 #[doc = ""]
1215 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1216 fn into_future(self) -> Self::IntoFuture {
1217 Box::pin(async move { self.send().await?.into_raw_body().await })
1218 }
1219 }
1220 }
1221 pub mod share_service_endpoint {
1222 use super::models;
1223 #[cfg(not(target_arch = "wasm32"))]
1224 use futures::future::BoxFuture;
1225 #[cfg(target_arch = "wasm32")]
1226 use futures::future::LocalBoxFuture as BoxFuture;
1227 #[derive(Debug)]
1228 pub struct Response(azure_core::http::Response);
1229 impl Response {
1230 pub fn into_raw_response(self) -> azure_core::http::Response {
1231 self.0
1232 }
1233 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1234 &self.0
1235 }
1236 }
1237 impl From<Response> for azure_core::http::Response {
1238 fn from(rsp: Response) -> Self {
1239 rsp.into_raw_response()
1240 }
1241 }
1242 impl AsRef<azure_core::http::Response> for Response {
1243 fn as_ref(&self) -> &azure_core::http::Response {
1244 self.as_raw_response()
1245 }
1246 }
1247 #[derive(Clone)]
1248 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1249 #[doc = r""]
1250 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1251 #[doc = r" parameters can be chained."]
1252 #[doc = r""]
1253 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1254 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1255 #[doc = r" executes the request and returns a `Result` with the parsed"]
1256 #[doc = r" response."]
1257 #[doc = r""]
1258 #[doc = r" If you need lower-level access to the raw response details"]
1259 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1260 #[doc = r" can finalize the request using the"]
1261 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1262 #[doc = r" that resolves to a lower-level [`Response`] value."]
1263 pub struct RequestBuilder {
1264 pub(crate) client: super::super::Client,
1265 pub(crate) organization: String,
1266 pub(crate) body: Vec<models::ServiceEndpointProjectReference>,
1267 pub(crate) endpoint_id: String,
1268 }
1269 impl RequestBuilder {
1270 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1271 #[doc = ""]
1272 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1273 #[doc = "However, this function can provide more flexibility when required."]
1274 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1275 Box::pin({
1276 let this = self.clone();
1277 async move {
1278 let url = this.url()?;
1279 let mut req =
1280 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
1281 if let Some(auth_header) = this
1282 .client
1283 .token_credential()
1284 .http_authorization_header(&this.client.scopes())
1285 .await?
1286 {
1287 req.insert_header(
1288 azure_core::http::headers::AUTHORIZATION,
1289 auth_header,
1290 );
1291 }
1292 req.insert_header("content-type", "application/json");
1293 let req_body = azure_core::json::to_json(&this.body)?;
1294 req.set_body(req_body);
1295 Ok(Response(this.client.send(&mut req).await?))
1296 }
1297 })
1298 }
1299 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1300 let mut url = azure_core::http::Url::parse(&format!(
1301 "{}/{}/_apis/serviceendpoint/endpoints/{}",
1302 self.client.endpoint(),
1303 &self.organization,
1304 &self.endpoint_id
1305 ))?;
1306 let has_api_version_already = url
1307 .query_pairs()
1308 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1309 if !has_api_version_already {
1310 url.query_pairs_mut().append_pair(
1311 azure_core::http::headers::query_param::API_VERSION,
1312 "7.1-preview",
1313 );
1314 }
1315 Ok(url)
1316 }
1317 }
1318 impl std::future::IntoFuture for RequestBuilder {
1319 type Output = azure_core::Result<()>;
1320 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
1321 #[doc = "Returns a future that sends the request and waits for the response."]
1322 #[doc = ""]
1323 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1324 #[doc = ""]
1325 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1326 fn into_future(self) -> Self::IntoFuture {
1327 Box::pin(async move {
1328 let _rsp = self.send().await?;
1329 Ok(())
1330 })
1331 }
1332 }
1333 }
1334 pub mod delete {
1335 use super::models;
1336 #[cfg(not(target_arch = "wasm32"))]
1337 use futures::future::BoxFuture;
1338 #[cfg(target_arch = "wasm32")]
1339 use futures::future::LocalBoxFuture as BoxFuture;
1340 #[derive(Debug)]
1341 pub struct Response(azure_core::http::Response);
1342 impl Response {
1343 pub fn into_raw_response(self) -> azure_core::http::Response {
1344 self.0
1345 }
1346 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1347 &self.0
1348 }
1349 }
1350 impl From<Response> for azure_core::http::Response {
1351 fn from(rsp: Response) -> Self {
1352 rsp.into_raw_response()
1353 }
1354 }
1355 impl AsRef<azure_core::http::Response> for Response {
1356 fn as_ref(&self) -> &azure_core::http::Response {
1357 self.as_raw_response()
1358 }
1359 }
1360 #[derive(Clone)]
1361 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1362 #[doc = r""]
1363 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1364 #[doc = r" parameters can be chained."]
1365 #[doc = r""]
1366 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1367 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1368 #[doc = r" executes the request and returns a `Result` with the parsed"]
1369 #[doc = r" response."]
1370 #[doc = r""]
1371 #[doc = r" If you need lower-level access to the raw response details"]
1372 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1373 #[doc = r" can finalize the request using the"]
1374 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1375 #[doc = r" that resolves to a lower-level [`Response`] value."]
1376 pub struct RequestBuilder {
1377 pub(crate) client: super::super::Client,
1378 pub(crate) organization: String,
1379 pub(crate) endpoint_id: String,
1380 pub(crate) project_ids: String,
1381 pub(crate) deep: Option<bool>,
1382 }
1383 impl RequestBuilder {
1384 #[doc = "delete the spn created by endpoint"]
1385 pub fn deep(mut self, deep: bool) -> Self {
1386 self.deep = Some(deep);
1387 self
1388 }
1389 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1390 #[doc = ""]
1391 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1392 #[doc = "However, this function can provide more flexibility when required."]
1393 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1394 Box::pin({
1395 let this = self.clone();
1396 async move {
1397 let url = this.url()?;
1398 let mut req =
1399 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
1400 if let Some(auth_header) = this
1401 .client
1402 .token_credential()
1403 .http_authorization_header(&this.client.scopes())
1404 .await?
1405 {
1406 req.insert_header(
1407 azure_core::http::headers::AUTHORIZATION,
1408 auth_header,
1409 );
1410 }
1411 let project_ids = &this.project_ids;
1412 req.url_mut()
1413 .query_pairs_mut()
1414 .append_pair("projectIds", project_ids);
1415 if let Some(deep) = &this.deep {
1416 req.url_mut()
1417 .query_pairs_mut()
1418 .append_pair("deep", &deep.to_string());
1419 }
1420 let req_body = azure_core::Bytes::new();
1421 req.set_body(req_body);
1422 Ok(Response(this.client.send(&mut req).await?))
1423 }
1424 })
1425 }
1426 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1427 let mut url = azure_core::http::Url::parse(&format!(
1428 "{}/{}/_apis/serviceendpoint/endpoints/{}",
1429 self.client.endpoint(),
1430 &self.organization,
1431 &self.endpoint_id
1432 ))?;
1433 let has_api_version_already = url
1434 .query_pairs()
1435 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1436 if !has_api_version_already {
1437 url.query_pairs_mut().append_pair(
1438 azure_core::http::headers::query_param::API_VERSION,
1439 "7.1-preview",
1440 );
1441 }
1442 Ok(url)
1443 }
1444 }
1445 impl std::future::IntoFuture for RequestBuilder {
1446 type Output = azure_core::Result<()>;
1447 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
1448 #[doc = "Returns a future that sends the request and waits for the response."]
1449 #[doc = ""]
1450 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1451 #[doc = ""]
1452 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1453 fn into_future(self) -> Self::IntoFuture {
1454 Box::pin(async move {
1455 let _rsp = self.send().await?;
1456 Ok(())
1457 })
1458 }
1459 }
1460 }
1461 pub mod get_service_endpoints_by_names {
1462 use super::models;
1463 #[cfg(not(target_arch = "wasm32"))]
1464 use futures::future::BoxFuture;
1465 #[cfg(target_arch = "wasm32")]
1466 use futures::future::LocalBoxFuture as BoxFuture;
1467 #[derive(Debug)]
1468 pub struct Response(azure_core::http::Response);
1469 impl Response {
1470 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpointList> {
1471 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1472 let body: models::ServiceEndpointList =
1473 serde_json::from_slice(&bytes).map_err(|e| {
1474 azure_core::error::Error::full(
1475 azure_core::error::ErrorKind::DataConversion,
1476 e,
1477 format!(
1478 "Failed to deserialize response:\n{}",
1479 String::from_utf8_lossy(&bytes)
1480 ),
1481 )
1482 })?;
1483 Ok(body)
1484 }
1485 pub fn into_raw_response(self) -> azure_core::http::Response {
1486 self.0
1487 }
1488 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1489 &self.0
1490 }
1491 }
1492 impl From<Response> for azure_core::http::Response {
1493 fn from(rsp: Response) -> Self {
1494 rsp.into_raw_response()
1495 }
1496 }
1497 impl AsRef<azure_core::http::Response> for Response {
1498 fn as_ref(&self) -> &azure_core::http::Response {
1499 self.as_raw_response()
1500 }
1501 }
1502 #[derive(Clone)]
1503 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1504 #[doc = r""]
1505 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1506 #[doc = r" parameters can be chained."]
1507 #[doc = r""]
1508 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1509 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1510 #[doc = r" executes the request and returns a `Result` with the parsed"]
1511 #[doc = r" response."]
1512 #[doc = r""]
1513 #[doc = r" If you need lower-level access to the raw response details"]
1514 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1515 #[doc = r" can finalize the request using the"]
1516 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1517 #[doc = r" that resolves to a lower-level [`Response`] value."]
1518 pub struct RequestBuilder {
1519 pub(crate) client: super::super::Client,
1520 pub(crate) organization: String,
1521 pub(crate) project: String,
1522 pub(crate) endpoint_names: String,
1523 pub(crate) type_: Option<String>,
1524 pub(crate) auth_schemes: Option<String>,
1525 pub(crate) owner: Option<String>,
1526 pub(crate) include_failed: Option<bool>,
1527 pub(crate) include_details: Option<bool>,
1528 }
1529 impl RequestBuilder {
1530 #[doc = "Type of the service endpoints."]
1531 pub fn type_(mut self, type_: impl Into<String>) -> Self {
1532 self.type_ = Some(type_.into());
1533 self
1534 }
1535 #[doc = "Authorization schemes used for service endpoints."]
1536 pub fn auth_schemes(mut self, auth_schemes: impl Into<String>) -> Self {
1537 self.auth_schemes = Some(auth_schemes.into());
1538 self
1539 }
1540 #[doc = "Owner for service endpoints."]
1541 pub fn owner(mut self, owner: impl Into<String>) -> Self {
1542 self.owner = Some(owner.into());
1543 self
1544 }
1545 #[doc = "Failed flag for service endpoints."]
1546 pub fn include_failed(mut self, include_failed: bool) -> Self {
1547 self.include_failed = Some(include_failed);
1548 self
1549 }
1550 #[doc = "Flag to include more details for service endpoints. This is for internal use only and the flag will be treated as false for all other requests"]
1551 pub fn include_details(mut self, include_details: bool) -> Self {
1552 self.include_details = Some(include_details);
1553 self
1554 }
1555 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1556 #[doc = ""]
1557 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1558 #[doc = "However, this function can provide more flexibility when required."]
1559 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1560 Box::pin({
1561 let this = self.clone();
1562 async move {
1563 let url = this.url()?;
1564 let mut req =
1565 azure_core::http::Request::new(url, azure_core::http::Method::Get);
1566 if let Some(auth_header) = this
1567 .client
1568 .token_credential()
1569 .http_authorization_header(&this.client.scopes())
1570 .await?
1571 {
1572 req.insert_header(
1573 azure_core::http::headers::AUTHORIZATION,
1574 auth_header,
1575 );
1576 }
1577 let endpoint_names = &this.endpoint_names;
1578 req.url_mut()
1579 .query_pairs_mut()
1580 .append_pair("endpointNames", endpoint_names);
1581 if let Some(type_) = &this.type_ {
1582 req.url_mut().query_pairs_mut().append_pair("type", type_);
1583 }
1584 if let Some(auth_schemes) = &this.auth_schemes {
1585 req.url_mut()
1586 .query_pairs_mut()
1587 .append_pair("authSchemes", auth_schemes);
1588 }
1589 if let Some(owner) = &this.owner {
1590 req.url_mut().query_pairs_mut().append_pair("owner", owner);
1591 }
1592 if let Some(include_failed) = &this.include_failed {
1593 req.url_mut()
1594 .query_pairs_mut()
1595 .append_pair("includeFailed", &include_failed.to_string());
1596 }
1597 if let Some(include_details) = &this.include_details {
1598 req.url_mut()
1599 .query_pairs_mut()
1600 .append_pair("includeDetails", &include_details.to_string());
1601 }
1602 let req_body = azure_core::Bytes::new();
1603 req.set_body(req_body);
1604 Ok(Response(this.client.send(&mut req).await?))
1605 }
1606 })
1607 }
1608 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1609 let mut url = azure_core::http::Url::parse(&format!(
1610 "{}/{}/{}/_apis/serviceendpoint/endpoints",
1611 self.client.endpoint(),
1612 &self.organization,
1613 &self.project
1614 ))?;
1615 let has_api_version_already = url
1616 .query_pairs()
1617 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1618 if !has_api_version_already {
1619 url.query_pairs_mut().append_pair(
1620 azure_core::http::headers::query_param::API_VERSION,
1621 "7.1-preview",
1622 );
1623 }
1624 Ok(url)
1625 }
1626 }
1627 impl std::future::IntoFuture for RequestBuilder {
1628 type Output = azure_core::Result<models::ServiceEndpointList>;
1629 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpointList>>;
1630 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1631 #[doc = ""]
1632 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1633 #[doc = ""]
1634 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1635 fn into_future(self) -> Self::IntoFuture {
1636 Box::pin(async move { self.send().await?.into_raw_body().await })
1637 }
1638 }
1639 }
1640 pub mod get_service_endpoints_with_refreshed_authentication {
1641 use super::models;
1642 #[cfg(not(target_arch = "wasm32"))]
1643 use futures::future::BoxFuture;
1644 #[cfg(target_arch = "wasm32")]
1645 use futures::future::LocalBoxFuture as BoxFuture;
1646 #[derive(Debug)]
1647 pub struct Response(azure_core::http::Response);
1648 impl Response {
1649 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpointList> {
1650 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1651 let body: models::ServiceEndpointList =
1652 serde_json::from_slice(&bytes).map_err(|e| {
1653 azure_core::error::Error::full(
1654 azure_core::error::ErrorKind::DataConversion,
1655 e,
1656 format!(
1657 "Failed to deserialize response:\n{}",
1658 String::from_utf8_lossy(&bytes)
1659 ),
1660 )
1661 })?;
1662 Ok(body)
1663 }
1664 pub fn into_raw_response(self) -> azure_core::http::Response {
1665 self.0
1666 }
1667 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1668 &self.0
1669 }
1670 }
1671 impl From<Response> for azure_core::http::Response {
1672 fn from(rsp: Response) -> Self {
1673 rsp.into_raw_response()
1674 }
1675 }
1676 impl AsRef<azure_core::http::Response> for Response {
1677 fn as_ref(&self) -> &azure_core::http::Response {
1678 self.as_raw_response()
1679 }
1680 }
1681 #[derive(Clone)]
1682 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1683 #[doc = r""]
1684 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1685 #[doc = r" parameters can be chained."]
1686 #[doc = r""]
1687 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1688 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1689 #[doc = r" executes the request and returns a `Result` with the parsed"]
1690 #[doc = r" response."]
1691 #[doc = r""]
1692 #[doc = r" If you need lower-level access to the raw response details"]
1693 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1694 #[doc = r" can finalize the request using the"]
1695 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1696 #[doc = r" that resolves to a lower-level [`Response`] value."]
1697 pub struct RequestBuilder {
1698 pub(crate) client: super::super::Client,
1699 pub(crate) organization: String,
1700 pub(crate) body: Vec<models::RefreshAuthenticationParameters>,
1701 pub(crate) project: String,
1702 pub(crate) endpoint_ids: String,
1703 }
1704 impl RequestBuilder {
1705 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1706 #[doc = ""]
1707 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1708 #[doc = "However, this function can provide more flexibility when required."]
1709 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1710 Box::pin({
1711 let this = self.clone();
1712 async move {
1713 let url = this.url()?;
1714 let mut req =
1715 azure_core::http::Request::new(url, azure_core::http::Method::Post);
1716 if let Some(auth_header) = this
1717 .client
1718 .token_credential()
1719 .http_authorization_header(&this.client.scopes())
1720 .await?
1721 {
1722 req.insert_header(
1723 azure_core::http::headers::AUTHORIZATION,
1724 auth_header,
1725 );
1726 }
1727 req.insert_header("content-type", "application/json");
1728 let req_body = azure_core::json::to_json(&this.body)?;
1729 let endpoint_ids = &this.endpoint_ids;
1730 req.url_mut()
1731 .query_pairs_mut()
1732 .append_pair("endpointIds", endpoint_ids);
1733 req.set_body(req_body);
1734 Ok(Response(this.client.send(&mut req).await?))
1735 }
1736 })
1737 }
1738 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1739 let mut url = azure_core::http::Url::parse(&format!(
1740 "{}/{}/{}/_apis/serviceendpoint/endpoints",
1741 self.client.endpoint(),
1742 &self.organization,
1743 &self.project
1744 ))?;
1745 let has_api_version_already = url
1746 .query_pairs()
1747 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1748 if !has_api_version_already {
1749 url.query_pairs_mut().append_pair(
1750 azure_core::http::headers::query_param::API_VERSION,
1751 "7.1-preview",
1752 );
1753 }
1754 Ok(url)
1755 }
1756 }
1757 impl std::future::IntoFuture for RequestBuilder {
1758 type Output = azure_core::Result<models::ServiceEndpointList>;
1759 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpointList>>;
1760 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1761 #[doc = ""]
1762 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1763 #[doc = ""]
1764 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1765 fn into_future(self) -> Self::IntoFuture {
1766 Box::pin(async move { self.send().await?.into_raw_body().await })
1767 }
1768 }
1769 }
1770 pub mod get {
1771 use super::models;
1772 #[cfg(not(target_arch = "wasm32"))]
1773 use futures::future::BoxFuture;
1774 #[cfg(target_arch = "wasm32")]
1775 use futures::future::LocalBoxFuture as BoxFuture;
1776 #[derive(Debug)]
1777 pub struct Response(azure_core::http::Response);
1778 impl Response {
1779 pub async fn into_raw_body(self) -> azure_core::Result<models::ServiceEndpoint> {
1780 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1781 let body: models::ServiceEndpoint =
1782 serde_json::from_slice(&bytes).map_err(|e| {
1783 azure_core::error::Error::full(
1784 azure_core::error::ErrorKind::DataConversion,
1785 e,
1786 format!(
1787 "Failed to deserialize response:\n{}",
1788 String::from_utf8_lossy(&bytes)
1789 ),
1790 )
1791 })?;
1792 Ok(body)
1793 }
1794 pub fn into_raw_response(self) -> azure_core::http::Response {
1795 self.0
1796 }
1797 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1798 &self.0
1799 }
1800 }
1801 impl From<Response> for azure_core::http::Response {
1802 fn from(rsp: Response) -> Self {
1803 rsp.into_raw_response()
1804 }
1805 }
1806 impl AsRef<azure_core::http::Response> for Response {
1807 fn as_ref(&self) -> &azure_core::http::Response {
1808 self.as_raw_response()
1809 }
1810 }
1811 #[derive(Clone)]
1812 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1813 #[doc = r""]
1814 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1815 #[doc = r" parameters can be chained."]
1816 #[doc = r""]
1817 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1818 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1819 #[doc = r" executes the request and returns a `Result` with the parsed"]
1820 #[doc = r" response."]
1821 #[doc = r""]
1822 #[doc = r" If you need lower-level access to the raw response details"]
1823 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1824 #[doc = r" can finalize the request using the"]
1825 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1826 #[doc = r" that resolves to a lower-level [`Response`] value."]
1827 pub struct RequestBuilder {
1828 pub(crate) client: super::super::Client,
1829 pub(crate) organization: String,
1830 pub(crate) project: String,
1831 pub(crate) endpoint_id: String,
1832 pub(crate) action_filter: Option<String>,
1833 }
1834 impl RequestBuilder {
1835 #[doc = "Action filter for the service connection. It specifies the action which can be performed on the service connection."]
1836 pub fn action_filter(mut self, action_filter: impl Into<String>) -> Self {
1837 self.action_filter = Some(action_filter.into());
1838 self
1839 }
1840 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1841 #[doc = ""]
1842 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1843 #[doc = "However, this function can provide more flexibility when required."]
1844 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1845 Box::pin({
1846 let this = self.clone();
1847 async move {
1848 let url = this.url()?;
1849 let mut req =
1850 azure_core::http::Request::new(url, azure_core::http::Method::Get);
1851 if let Some(auth_header) = this
1852 .client
1853 .token_credential()
1854 .http_authorization_header(&this.client.scopes())
1855 .await?
1856 {
1857 req.insert_header(
1858 azure_core::http::headers::AUTHORIZATION,
1859 auth_header,
1860 );
1861 }
1862 if let Some(action_filter) = &this.action_filter {
1863 req.url_mut()
1864 .query_pairs_mut()
1865 .append_pair("actionFilter", action_filter);
1866 }
1867 let req_body = azure_core::Bytes::new();
1868 req.set_body(req_body);
1869 Ok(Response(this.client.send(&mut req).await?))
1870 }
1871 })
1872 }
1873 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1874 let mut url = azure_core::http::Url::parse(&format!(
1875 "{}/{}/{}/_apis/serviceendpoint/endpoints/{}",
1876 self.client.endpoint(),
1877 &self.organization,
1878 &self.project,
1879 &self.endpoint_id
1880 ))?;
1881 let has_api_version_already = url
1882 .query_pairs()
1883 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1884 if !has_api_version_already {
1885 url.query_pairs_mut().append_pair(
1886 azure_core::http::headers::query_param::API_VERSION,
1887 "7.1-preview",
1888 );
1889 }
1890 Ok(url)
1891 }
1892 }
1893 impl std::future::IntoFuture for RequestBuilder {
1894 type Output = azure_core::Result<models::ServiceEndpoint>;
1895 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ServiceEndpoint>>;
1896 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1897 #[doc = ""]
1898 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1899 #[doc = ""]
1900 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1901 fn into_future(self) -> Self::IntoFuture {
1902 Box::pin(async move { self.send().await?.into_raw_body().await })
1903 }
1904 }
1905 }
1906}
1907pub mod types {
1908 use super::models;
1909 #[cfg(not(target_arch = "wasm32"))]
1910 use futures::future::BoxFuture;
1911 #[cfg(target_arch = "wasm32")]
1912 use futures::future::LocalBoxFuture as BoxFuture;
1913 pub struct Client(pub(crate) super::Client);
1914 impl Client {
1915 #[doc = "Get service endpoint types."]
1916 #[doc = ""]
1917 #[doc = "Arguments:"]
1918 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1919 pub fn list(&self, organization: impl Into<String>) -> list::RequestBuilder {
1920 list::RequestBuilder {
1921 client: self.0.clone(),
1922 organization: organization.into(),
1923 type_: None,
1924 scheme: None,
1925 }
1926 }
1927 }
1928 pub mod list {
1929 use super::models;
1930 #[cfg(not(target_arch = "wasm32"))]
1931 use futures::future::BoxFuture;
1932 #[cfg(target_arch = "wasm32")]
1933 use futures::future::LocalBoxFuture as BoxFuture;
1934 #[derive(Debug)]
1935 pub struct Response(azure_core::http::Response);
1936 impl Response {
1937 pub async fn into_raw_body(
1938 self,
1939 ) -> azure_core::Result<models::ServiceEndpointTypeList> {
1940 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1941 let body: models::ServiceEndpointTypeList = serde_json::from_slice(&bytes)
1942 .map_err(|e| {
1943 azure_core::error::Error::full(
1944 azure_core::error::ErrorKind::DataConversion,
1945 e,
1946 format!(
1947 "Failed to deserialize response:\n{}",
1948 String::from_utf8_lossy(&bytes)
1949 ),
1950 )
1951 })?;
1952 Ok(body)
1953 }
1954 pub fn into_raw_response(self) -> azure_core::http::Response {
1955 self.0
1956 }
1957 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1958 &self.0
1959 }
1960 }
1961 impl From<Response> for azure_core::http::Response {
1962 fn from(rsp: Response) -> Self {
1963 rsp.into_raw_response()
1964 }
1965 }
1966 impl AsRef<azure_core::http::Response> for Response {
1967 fn as_ref(&self) -> &azure_core::http::Response {
1968 self.as_raw_response()
1969 }
1970 }
1971 #[derive(Clone)]
1972 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1973 #[doc = r""]
1974 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1975 #[doc = r" parameters can be chained."]
1976 #[doc = r""]
1977 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1978 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1979 #[doc = r" executes the request and returns a `Result` with the parsed"]
1980 #[doc = r" response."]
1981 #[doc = r""]
1982 #[doc = r" If you need lower-level access to the raw response details"]
1983 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1984 #[doc = r" can finalize the request using the"]
1985 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1986 #[doc = r" that resolves to a lower-level [`Response`] value."]
1987 pub struct RequestBuilder {
1988 pub(crate) client: super::super::Client,
1989 pub(crate) organization: String,
1990 pub(crate) type_: Option<String>,
1991 pub(crate) scheme: Option<String>,
1992 }
1993 impl RequestBuilder {
1994 #[doc = "Type of service endpoint."]
1995 pub fn type_(mut self, type_: impl Into<String>) -> Self {
1996 self.type_ = Some(type_.into());
1997 self
1998 }
1999 #[doc = "Scheme of service endpoint."]
2000 pub fn scheme(mut self, scheme: impl Into<String>) -> Self {
2001 self.scheme = Some(scheme.into());
2002 self
2003 }
2004 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2005 #[doc = ""]
2006 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2007 #[doc = "However, this function can provide more flexibility when required."]
2008 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2009 Box::pin({
2010 let this = self.clone();
2011 async move {
2012 let url = this.url()?;
2013 let mut req =
2014 azure_core::http::Request::new(url, azure_core::http::Method::Get);
2015 if let Some(auth_header) = this
2016 .client
2017 .token_credential()
2018 .http_authorization_header(&this.client.scopes())
2019 .await?
2020 {
2021 req.insert_header(
2022 azure_core::http::headers::AUTHORIZATION,
2023 auth_header,
2024 );
2025 }
2026 if let Some(type_) = &this.type_ {
2027 req.url_mut().query_pairs_mut().append_pair("type", type_);
2028 }
2029 if let Some(scheme) = &this.scheme {
2030 req.url_mut()
2031 .query_pairs_mut()
2032 .append_pair("scheme", scheme);
2033 }
2034 let req_body = azure_core::Bytes::new();
2035 req.set_body(req_body);
2036 Ok(Response(this.client.send(&mut req).await?))
2037 }
2038 })
2039 }
2040 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2041 let mut url = azure_core::http::Url::parse(&format!(
2042 "{}/{}/_apis/serviceendpoint/types",
2043 self.client.endpoint(),
2044 &self.organization
2045 ))?;
2046 let has_api_version_already = url
2047 .query_pairs()
2048 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2049 if !has_api_version_already {
2050 url.query_pairs_mut().append_pair(
2051 azure_core::http::headers::query_param::API_VERSION,
2052 "7.1-preview",
2053 );
2054 }
2055 Ok(url)
2056 }
2057 }
2058 impl std::future::IntoFuture for RequestBuilder {
2059 type Output = azure_core::Result<models::ServiceEndpointTypeList>;
2060 type IntoFuture =
2061 BoxFuture<'static, azure_core::Result<models::ServiceEndpointTypeList>>;
2062 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2063 #[doc = ""]
2064 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2065 #[doc = ""]
2066 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2067 fn into_future(self) -> Self::IntoFuture {
2068 Box::pin(async move { self.send().await?.into_raw_body().await })
2069 }
2070 }
2071 }
2072}
2073pub mod executionhistory {
2074 use super::models;
2075 #[cfg(not(target_arch = "wasm32"))]
2076 use futures::future::BoxFuture;
2077 #[cfg(target_arch = "wasm32")]
2078 use futures::future::LocalBoxFuture as BoxFuture;
2079 pub struct Client(pub(crate) super::Client);
2080 impl Client {
2081 #[doc = "Get service endpoint execution records."]
2082 #[doc = ""]
2083 #[doc = "Arguments:"]
2084 #[doc = "* `organization`: The name of the Azure DevOps organization."]
2085 #[doc = "* `project`: Project ID or project name"]
2086 #[doc = "* `endpoint_id`: Id of the service endpoint."]
2087 pub fn list(
2088 &self,
2089 organization: impl Into<String>,
2090 project: impl Into<String>,
2091 endpoint_id: impl Into<String>,
2092 ) -> list::RequestBuilder {
2093 list::RequestBuilder {
2094 client: self.0.clone(),
2095 organization: organization.into(),
2096 project: project.into(),
2097 endpoint_id: endpoint_id.into(),
2098 top: None,
2099 continuation_token: None,
2100 }
2101 }
2102 }
2103 pub mod list {
2104 use super::models;
2105 #[cfg(not(target_arch = "wasm32"))]
2106 use futures::future::BoxFuture;
2107 #[cfg(target_arch = "wasm32")]
2108 use futures::future::LocalBoxFuture as BoxFuture;
2109 #[derive(Debug)]
2110 pub struct Response(azure_core::http::Response);
2111 impl Response {
2112 pub async fn into_raw_body(
2113 self,
2114 ) -> azure_core::Result<models::ServiceEndpointExecutionRecordList> {
2115 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
2116 let body: models::ServiceEndpointExecutionRecordList =
2117 serde_json::from_slice(&bytes).map_err(|e| {
2118 azure_core::error::Error::full(
2119 azure_core::error::ErrorKind::DataConversion,
2120 e,
2121 format!(
2122 "Failed to deserialize response:\n{}",
2123 String::from_utf8_lossy(&bytes)
2124 ),
2125 )
2126 })?;
2127 Ok(body)
2128 }
2129 pub fn into_raw_response(self) -> azure_core::http::Response {
2130 self.0
2131 }
2132 pub fn as_raw_response(&self) -> &azure_core::http::Response {
2133 &self.0
2134 }
2135 }
2136 impl From<Response> for azure_core::http::Response {
2137 fn from(rsp: Response) -> Self {
2138 rsp.into_raw_response()
2139 }
2140 }
2141 impl AsRef<azure_core::http::Response> for Response {
2142 fn as_ref(&self) -> &azure_core::http::Response {
2143 self.as_raw_response()
2144 }
2145 }
2146 #[derive(Clone)]
2147 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2148 #[doc = r""]
2149 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2150 #[doc = r" parameters can be chained."]
2151 #[doc = r""]
2152 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2153 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2154 #[doc = r" executes the request and returns a `Result` with the parsed"]
2155 #[doc = r" response."]
2156 #[doc = r""]
2157 #[doc = r" If you need lower-level access to the raw response details"]
2158 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2159 #[doc = r" can finalize the request using the"]
2160 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2161 #[doc = r" that resolves to a lower-level [`Response`] value."]
2162 pub struct RequestBuilder {
2163 pub(crate) client: super::super::Client,
2164 pub(crate) organization: String,
2165 pub(crate) project: String,
2166 pub(crate) endpoint_id: String,
2167 pub(crate) top: Option<i32>,
2168 pub(crate) continuation_token: Option<i64>,
2169 }
2170 impl RequestBuilder {
2171 #[doc = "Number of service endpoint execution records to get."]
2172 pub fn top(mut self, top: i32) -> Self {
2173 self.top = Some(top);
2174 self
2175 }
2176 #[doc = "A continuation token, returned by a previous call to this method, that can be used to return the next set of records"]
2177 pub fn continuation_token(mut self, continuation_token: i64) -> Self {
2178 self.continuation_token = Some(continuation_token);
2179 self
2180 }
2181 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2182 #[doc = ""]
2183 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2184 #[doc = "However, this function can provide more flexibility when required."]
2185 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2186 Box::pin({
2187 let this = self.clone();
2188 async move {
2189 let url = this.url()?;
2190 let mut req =
2191 azure_core::http::Request::new(url, azure_core::http::Method::Get);
2192 if let Some(auth_header) = this
2193 .client
2194 .token_credential()
2195 .http_authorization_header(&this.client.scopes())
2196 .await?
2197 {
2198 req.insert_header(
2199 azure_core::http::headers::AUTHORIZATION,
2200 auth_header,
2201 );
2202 }
2203 if let Some(top) = &this.top {
2204 req.url_mut()
2205 .query_pairs_mut()
2206 .append_pair("top", &top.to_string());
2207 }
2208 if let Some(continuation_token) = &this.continuation_token {
2209 req.url_mut()
2210 .query_pairs_mut()
2211 .append_pair("continuationToken", &continuation_token.to_string());
2212 }
2213 let req_body = azure_core::Bytes::new();
2214 req.set_body(req_body);
2215 Ok(Response(this.client.send(&mut req).await?))
2216 }
2217 })
2218 }
2219 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2220 let mut url = azure_core::http::Url::parse(&format!(
2221 "{}/{}/{}/_apis/serviceendpoint/{}/executionhistory",
2222 self.client.endpoint(),
2223 &self.organization,
2224 &self.project,
2225 &self.endpoint_id
2226 ))?;
2227 let has_api_version_already = url
2228 .query_pairs()
2229 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2230 if !has_api_version_already {
2231 url.query_pairs_mut().append_pair(
2232 azure_core::http::headers::query_param::API_VERSION,
2233 "7.1-preview",
2234 );
2235 }
2236 Ok(url)
2237 }
2238 }
2239 impl std::future::IntoFuture for RequestBuilder {
2240 type Output = azure_core::Result<models::ServiceEndpointExecutionRecordList>;
2241 type IntoFuture =
2242 BoxFuture<'static, azure_core::Result<models::ServiceEndpointExecutionRecordList>>;
2243 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2244 #[doc = ""]
2245 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2246 #[doc = ""]
2247 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2248 fn into_future(self) -> Self::IntoFuture {
2249 Box::pin(async move { self.send().await?.into_raw_body().await })
2250 }
2251 }
2252 }
2253}