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