Skip to main content

azure_devops_rust_api/security_roles/
mod.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3#![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 = 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::Transport>) -> 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::RawResponse> {
101        let context = azure_core::http::Context::default();
102        self.pipeline.send(&context, request, None).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            None,
125        );
126        Self {
127            endpoint,
128            credential,
129            scopes,
130            pipeline,
131        }
132    }
133    pub fn roleassignments_client(&self) -> roleassignments::Client {
134        roleassignments::Client(self.clone())
135    }
136    pub fn roledefinitions_client(&self) -> roledefinitions::Client {
137        roledefinitions::Client(self.clone())
138    }
139}
140pub mod roleassignments {
141    use super::models;
142    #[cfg(not(target_arch = "wasm32"))]
143    use futures::future::BoxFuture;
144    #[cfg(target_arch = "wasm32")]
145    use futures::future::LocalBoxFuture as BoxFuture;
146    pub struct Client(pub(crate) super::Client);
147    impl Client {
148        #[doc = "Arguments:"]
149        #[doc = "* `organization`: The name of the Azure DevOps organization."]
150        pub fn change_inheritance(
151            &self,
152            scope_id: impl Into<String>,
153            resource_id: impl Into<String>,
154            inherit_permissions: bool,
155            organization: impl Into<String>,
156        ) -> change_inheritance::RequestBuilder {
157            change_inheritance::RequestBuilder {
158                client: self.0.clone(),
159                scope_id: scope_id.into(),
160                resource_id: resource_id.into(),
161                inherit_permissions,
162                organization: organization.into(),
163            }
164        }
165        #[doc = "Get role assignments for the resource"]
166        #[doc = ""]
167        #[doc = "Arguments:"]
168        #[doc = "* `scope_id`: Id of the assigned scope"]
169        #[doc = "* `resource_id`: Id of the resource that is assigned the scope"]
170        #[doc = "* `organization`: The name of the Azure DevOps organization."]
171        pub fn list(
172            &self,
173            scope_id: impl Into<String>,
174            resource_id: impl Into<String>,
175            organization: impl Into<String>,
176        ) -> list::RequestBuilder {
177            list::RequestBuilder {
178                client: self.0.clone(),
179                scope_id: scope_id.into(),
180                resource_id: resource_id.into(),
181                organization: organization.into(),
182            }
183        }
184        #[doc = "Set role assignments on a resource"]
185        #[doc = ""]
186        #[doc = "Arguments:"]
187        #[doc = "* `body`: Roles to be assigned"]
188        #[doc = "* `scope_id`: Id of the assigned scope"]
189        #[doc = "* `resource_id`: Id of the resource on which the role is to be assigned"]
190        #[doc = "* `organization`: The name of the Azure DevOps organization."]
191        pub fn set_role_assignments(
192            &self,
193            body: Vec<models::UserRoleAssignmentRef>,
194            scope_id: impl Into<String>,
195            resource_id: impl Into<String>,
196            organization: impl Into<String>,
197        ) -> set_role_assignments::RequestBuilder {
198            set_role_assignments::RequestBuilder {
199                client: self.0.clone(),
200                body,
201                scope_id: scope_id.into(),
202                resource_id: resource_id.into(),
203                organization: organization.into(),
204                limit_to_caller_identity_domain: None,
205            }
206        }
207        #[doc = "Arguments:"]
208        #[doc = "* `organization`: The name of the Azure DevOps organization."]
209        pub fn remove_role_assignments(
210            &self,
211            body: Vec<String>,
212            scope_id: impl Into<String>,
213            resource_id: impl Into<String>,
214            organization: impl Into<String>,
215        ) -> remove_role_assignments::RequestBuilder {
216            remove_role_assignments::RequestBuilder {
217                client: self.0.clone(),
218                body,
219                scope_id: scope_id.into(),
220                resource_id: resource_id.into(),
221                organization: organization.into(),
222            }
223        }
224        #[doc = "Set role assignment on a resource"]
225        #[doc = ""]
226        #[doc = "Arguments:"]
227        #[doc = "* `body`: Roles to be assigned"]
228        #[doc = "* `scope_id`: Id of the assigned scope"]
229        #[doc = "* `resource_id`: Id of the resource on which the role is to be assigned"]
230        #[doc = "* `organization`: The name of the Azure DevOps organization."]
231        pub fn set_role_assignment(
232            &self,
233            body: impl Into<models::UserRoleAssignmentRef>,
234            scope_id: impl Into<String>,
235            resource_id: impl Into<String>,
236            identity_id: impl Into<String>,
237            organization: impl Into<String>,
238        ) -> set_role_assignment::RequestBuilder {
239            set_role_assignment::RequestBuilder {
240                client: self.0.clone(),
241                body: body.into(),
242                scope_id: scope_id.into(),
243                resource_id: resource_id.into(),
244                identity_id: identity_id.into(),
245                organization: organization.into(),
246            }
247        }
248        #[doc = "Remove the role assignment on a resource"]
249        #[doc = ""]
250        #[doc = "Arguments:"]
251        #[doc = "* `scope_id`: Id of the assigned scope"]
252        #[doc = "* `resource_id`: Id of the resource on which the role is to be removed"]
253        #[doc = "* `identity_id`: Identity on which the assignment is to be removed"]
254        #[doc = "* `organization`: The name of the Azure DevOps organization."]
255        pub fn remove_role_assignment(
256            &self,
257            scope_id: impl Into<String>,
258            resource_id: impl Into<String>,
259            identity_id: impl Into<String>,
260            organization: impl Into<String>,
261        ) -> remove_role_assignment::RequestBuilder {
262            remove_role_assignment::RequestBuilder {
263                client: self.0.clone(),
264                scope_id: scope_id.into(),
265                resource_id: resource_id.into(),
266                identity_id: identity_id.into(),
267                organization: organization.into(),
268            }
269        }
270    }
271    pub mod change_inheritance {
272        use super::models;
273        #[cfg(not(target_arch = "wasm32"))]
274        use futures::future::BoxFuture;
275        #[cfg(target_arch = "wasm32")]
276        use futures::future::LocalBoxFuture as BoxFuture;
277        #[derive(Debug)]
278        pub struct Response(azure_core::http::Response<(), azure_core::http::NoFormat>);
279        impl Response {
280            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
281                self.0.into()
282            }
283        }
284        #[derive(Clone)]
285        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
286        #[doc = r""]
287        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
288        #[doc = r" parameters can be chained."]
289        #[doc = r""]
290        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
291        #[doc = r" converts the [`RequestBuilder`] into a future,"]
292        #[doc = r" executes the request and returns a `Result` with the parsed"]
293        #[doc = r" response."]
294        #[doc = r""]
295        #[doc = r" If you need lower-level access to the raw response details"]
296        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
297        #[doc = r" can finalize the request using the"]
298        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
299        #[doc = r" that resolves to a lower-level [`Response`] value."]
300        pub struct RequestBuilder {
301            pub(crate) client: super::super::Client,
302            pub(crate) scope_id: String,
303            pub(crate) resource_id: String,
304            pub(crate) inherit_permissions: bool,
305            pub(crate) organization: String,
306        }
307        impl RequestBuilder {
308            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
309            #[doc = ""]
310            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
311            #[doc = "However, this function can provide more flexibility when required."]
312            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
313                Box::pin({
314                    let this = self.clone();
315                    async move {
316                        let url = this.url()?;
317                        let mut req =
318                            azure_core::http::Request::new(url, azure_core::http::Method::Patch);
319                        if let Some(auth_header) = this
320                            .client
321                            .token_credential()
322                            .http_authorization_header(&this.client.scopes())
323                            .await?
324                        {
325                            req.insert_header(
326                                azure_core::http::headers::AUTHORIZATION,
327                                auth_header,
328                            );
329                        }
330                        let inherit_permissions = &this.inherit_permissions;
331                        req.url_mut()
332                            .query_pairs_mut()
333                            .append_pair("inheritPermissions", &inherit_permissions.to_string());
334                        let req_body = azure_core::Bytes::new();
335                        req.set_body(req_body);
336                        Ok(Response(this.client.send(&mut req).await?.into()))
337                    }
338                })
339            }
340            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
341                let mut url = azure_core :: http :: Url :: parse (& format ! ("{}/{}/_apis/securityroles/scopes/{}/roleassignments/resources/{}?inheritPermissions={}" , self . client . endpoint () , & self . organization , & self . scope_id , & self . resource_id , & self . inherit_permissions)) ? ;
342                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
343                if !has_api_version_already {
344                    url.query_pairs_mut()
345                        .append_pair("api-version", "7.1-preview");
346                }
347                Ok(url)
348            }
349        }
350        impl std::future::IntoFuture for RequestBuilder {
351            type Output = azure_core::Result<()>;
352            type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
353            #[doc = "Returns a future that sends the request and waits for the response."]
354            #[doc = ""]
355            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
356            #[doc = ""]
357            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
358            fn into_future(self) -> Self::IntoFuture {
359                Box::pin(async move {
360                    let _rsp = self.send().await?;
361                    Ok(())
362                })
363            }
364        }
365    }
366    pub mod list {
367        use super::models;
368        #[cfg(not(target_arch = "wasm32"))]
369        use futures::future::BoxFuture;
370        #[cfg(target_arch = "wasm32")]
371        use futures::future::LocalBoxFuture as BoxFuture;
372        #[derive(Debug)]
373        pub struct Response(
374            azure_core::http::Response<models::RoleAssignmentList, azure_core::http::JsonFormat>,
375        );
376        impl Response {
377            pub fn into_body(self) -> azure_core::Result<models::RoleAssignmentList> {
378                self.0.into_model()
379            }
380            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
381                self.0.into()
382            }
383        }
384        #[derive(Clone)]
385        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
386        #[doc = r""]
387        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
388        #[doc = r" parameters can be chained."]
389        #[doc = r""]
390        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
391        #[doc = r" converts the [`RequestBuilder`] into a future,"]
392        #[doc = r" executes the request and returns a `Result` with the parsed"]
393        #[doc = r" response."]
394        #[doc = r""]
395        #[doc = r" If you need lower-level access to the raw response details"]
396        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
397        #[doc = r" can finalize the request using the"]
398        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
399        #[doc = r" that resolves to a lower-level [`Response`] value."]
400        pub struct RequestBuilder {
401            pub(crate) client: super::super::Client,
402            pub(crate) scope_id: String,
403            pub(crate) resource_id: String,
404            pub(crate) organization: String,
405        }
406        impl RequestBuilder {
407            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
408            #[doc = ""]
409            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
410            #[doc = "However, this function can provide more flexibility when required."]
411            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
412                Box::pin({
413                    let this = self.clone();
414                    async move {
415                        let url = this.url()?;
416                        let mut req =
417                            azure_core::http::Request::new(url, azure_core::http::Method::Get);
418                        if let Some(auth_header) = this
419                            .client
420                            .token_credential()
421                            .http_authorization_header(&this.client.scopes())
422                            .await?
423                        {
424                            req.insert_header(
425                                azure_core::http::headers::AUTHORIZATION,
426                                auth_header,
427                            );
428                        }
429                        let req_body = azure_core::Bytes::new();
430                        req.set_body(req_body);
431                        Ok(Response(this.client.send(&mut req).await?.into()))
432                    }
433                })
434            }
435            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
436                let mut url = azure_core::http::Url::parse(&format!(
437                    "{}/{}/_apis/securityroles/scopes/{}/roleassignments/resources/{}",
438                    self.client.endpoint(),
439                    &self.organization,
440                    &self.scope_id,
441                    &self.resource_id
442                ))?;
443                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
444                if !has_api_version_already {
445                    url.query_pairs_mut()
446                        .append_pair("api-version", "7.1-preview");
447                }
448                Ok(url)
449            }
450        }
451        impl std::future::IntoFuture for RequestBuilder {
452            type Output = azure_core::Result<models::RoleAssignmentList>;
453            type IntoFuture = BoxFuture<'static, azure_core::Result<models::RoleAssignmentList>>;
454            #[doc = "Returns a future that sends the request and returns the parsed response body."]
455            #[doc = ""]
456            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
457            #[doc = ""]
458            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
459            fn into_future(self) -> Self::IntoFuture {
460                Box::pin(async move { self.send().await?.into_body() })
461            }
462        }
463    }
464    pub mod set_role_assignments {
465        use super::models;
466        #[cfg(not(target_arch = "wasm32"))]
467        use futures::future::BoxFuture;
468        #[cfg(target_arch = "wasm32")]
469        use futures::future::LocalBoxFuture as BoxFuture;
470        #[derive(Debug)]
471        pub struct Response(
472            azure_core::http::Response<models::RoleAssignmentList, azure_core::http::JsonFormat>,
473        );
474        impl Response {
475            pub fn into_body(self) -> azure_core::Result<models::RoleAssignmentList> {
476                self.0.into_model()
477            }
478            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
479                self.0.into()
480            }
481        }
482        #[derive(Clone)]
483        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
484        #[doc = r""]
485        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
486        #[doc = r" parameters can be chained."]
487        #[doc = r""]
488        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
489        #[doc = r" converts the [`RequestBuilder`] into a future,"]
490        #[doc = r" executes the request and returns a `Result` with the parsed"]
491        #[doc = r" response."]
492        #[doc = r""]
493        #[doc = r" If you need lower-level access to the raw response details"]
494        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
495        #[doc = r" can finalize the request using the"]
496        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
497        #[doc = r" that resolves to a lower-level [`Response`] value."]
498        pub struct RequestBuilder {
499            pub(crate) client: super::super::Client,
500            pub(crate) body: Vec<models::UserRoleAssignmentRef>,
501            pub(crate) scope_id: String,
502            pub(crate) resource_id: String,
503            pub(crate) organization: String,
504            pub(crate) limit_to_caller_identity_domain: Option<bool>,
505        }
506        impl RequestBuilder {
507            pub fn limit_to_caller_identity_domain(
508                mut self,
509                limit_to_caller_identity_domain: bool,
510            ) -> Self {
511                self.limit_to_caller_identity_domain = Some(limit_to_caller_identity_domain);
512                self
513            }
514            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
515            #[doc = ""]
516            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
517            #[doc = "However, this function can provide more flexibility when required."]
518            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
519                Box::pin({
520                    let this = self.clone();
521                    async move {
522                        let url = this.url()?;
523                        let mut req =
524                            azure_core::http::Request::new(url, azure_core::http::Method::Put);
525                        if let Some(auth_header) = this
526                            .client
527                            .token_credential()
528                            .http_authorization_header(&this.client.scopes())
529                            .await?
530                        {
531                            req.insert_header(
532                                azure_core::http::headers::AUTHORIZATION,
533                                auth_header,
534                            );
535                        }
536                        req.insert_header("content-type", "application/json");
537                        let req_body = azure_core::json::to_json(&this.body)?;
538                        if let Some(limit_to_caller_identity_domain) =
539                            &this.limit_to_caller_identity_domain
540                        {
541                            req.url_mut().query_pairs_mut().append_pair(
542                                "limitToCallerIdentityDomain",
543                                &limit_to_caller_identity_domain.to_string(),
544                            );
545                        }
546                        req.set_body(req_body);
547                        Ok(Response(this.client.send(&mut req).await?.into()))
548                    }
549                })
550            }
551            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
552                let mut url = azure_core::http::Url::parse(&format!(
553                    "{}/{}/_apis/securityroles/scopes/{}/roleassignments/resources/{}",
554                    self.client.endpoint(),
555                    &self.organization,
556                    &self.scope_id,
557                    &self.resource_id
558                ))?;
559                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
560                if !has_api_version_already {
561                    url.query_pairs_mut()
562                        .append_pair("api-version", "7.1-preview");
563                }
564                Ok(url)
565            }
566        }
567        impl std::future::IntoFuture for RequestBuilder {
568            type Output = azure_core::Result<models::RoleAssignmentList>;
569            type IntoFuture = BoxFuture<'static, azure_core::Result<models::RoleAssignmentList>>;
570            #[doc = "Returns a future that sends the request and returns the parsed response body."]
571            #[doc = ""]
572            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
573            #[doc = ""]
574            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
575            fn into_future(self) -> Self::IntoFuture {
576                Box::pin(async move { self.send().await?.into_body() })
577            }
578        }
579    }
580    pub mod remove_role_assignments {
581        use super::models;
582        #[cfg(not(target_arch = "wasm32"))]
583        use futures::future::BoxFuture;
584        #[cfg(target_arch = "wasm32")]
585        use futures::future::LocalBoxFuture as BoxFuture;
586        #[derive(Debug)]
587        pub struct Response(azure_core::http::Response<(), azure_core::http::NoFormat>);
588        impl Response {
589            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
590                self.0.into()
591            }
592        }
593        #[derive(Clone)]
594        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
595        #[doc = r""]
596        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
597        #[doc = r" parameters can be chained."]
598        #[doc = r""]
599        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
600        #[doc = r" converts the [`RequestBuilder`] into a future,"]
601        #[doc = r" executes the request and returns a `Result` with the parsed"]
602        #[doc = r" response."]
603        #[doc = r""]
604        #[doc = r" If you need lower-level access to the raw response details"]
605        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
606        #[doc = r" can finalize the request using the"]
607        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
608        #[doc = r" that resolves to a lower-level [`Response`] value."]
609        pub struct RequestBuilder {
610            pub(crate) client: super::super::Client,
611            pub(crate) body: Vec<String>,
612            pub(crate) scope_id: String,
613            pub(crate) resource_id: String,
614            pub(crate) organization: String,
615        }
616        impl RequestBuilder {
617            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
618            #[doc = ""]
619            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
620            #[doc = "However, this function can provide more flexibility when required."]
621            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
622                Box::pin({
623                    let this = self.clone();
624                    async move {
625                        let url = this.url()?;
626                        let mut req =
627                            azure_core::http::Request::new(url, azure_core::http::Method::Patch);
628                        if let Some(auth_header) = this
629                            .client
630                            .token_credential()
631                            .http_authorization_header(&this.client.scopes())
632                            .await?
633                        {
634                            req.insert_header(
635                                azure_core::http::headers::AUTHORIZATION,
636                                auth_header,
637                            );
638                        }
639                        req.insert_header("content-type", "application/json");
640                        let req_body = azure_core::json::to_json(&this.body)?;
641                        req.set_body(req_body);
642                        Ok(Response(this.client.send(&mut req).await?.into()))
643                    }
644                })
645            }
646            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
647                let mut url = azure_core::http::Url::parse(&format!(
648                    "{}/{}/_apis/securityroles/scopes/{}/roleassignments/resources/{}",
649                    self.client.endpoint(),
650                    &self.organization,
651                    &self.scope_id,
652                    &self.resource_id
653                ))?;
654                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
655                if !has_api_version_already {
656                    url.query_pairs_mut()
657                        .append_pair("api-version", "7.1-preview");
658                }
659                Ok(url)
660            }
661        }
662        impl std::future::IntoFuture for RequestBuilder {
663            type Output = azure_core::Result<()>;
664            type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
665            #[doc = "Returns a future that sends the request and waits for the response."]
666            #[doc = ""]
667            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
668            #[doc = ""]
669            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
670            fn into_future(self) -> Self::IntoFuture {
671                Box::pin(async move {
672                    let _rsp = self.send().await?;
673                    Ok(())
674                })
675            }
676        }
677    }
678    pub mod set_role_assignment {
679        use super::models;
680        #[cfg(not(target_arch = "wasm32"))]
681        use futures::future::BoxFuture;
682        #[cfg(target_arch = "wasm32")]
683        use futures::future::LocalBoxFuture as BoxFuture;
684        #[derive(Debug)]
685        pub struct Response(
686            azure_core::http::Response<models::RoleAssignment, azure_core::http::JsonFormat>,
687        );
688        impl Response {
689            pub fn into_body(self) -> azure_core::Result<models::RoleAssignment> {
690                self.0.into_model()
691            }
692            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
693                self.0.into()
694            }
695        }
696        #[derive(Clone)]
697        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
698        #[doc = r""]
699        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
700        #[doc = r" parameters can be chained."]
701        #[doc = r""]
702        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
703        #[doc = r" converts the [`RequestBuilder`] into a future,"]
704        #[doc = r" executes the request and returns a `Result` with the parsed"]
705        #[doc = r" response."]
706        #[doc = r""]
707        #[doc = r" If you need lower-level access to the raw response details"]
708        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
709        #[doc = r" can finalize the request using the"]
710        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
711        #[doc = r" that resolves to a lower-level [`Response`] value."]
712        pub struct RequestBuilder {
713            pub(crate) client: super::super::Client,
714            pub(crate) body: models::UserRoleAssignmentRef,
715            pub(crate) scope_id: String,
716            pub(crate) resource_id: String,
717            pub(crate) identity_id: String,
718            pub(crate) organization: String,
719        }
720        impl RequestBuilder {
721            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
722            #[doc = ""]
723            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
724            #[doc = "However, this function can provide more flexibility when required."]
725            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
726                Box::pin({
727                    let this = self.clone();
728                    async move {
729                        let url = this.url()?;
730                        let mut req =
731                            azure_core::http::Request::new(url, azure_core::http::Method::Put);
732                        if let Some(auth_header) = this
733                            .client
734                            .token_credential()
735                            .http_authorization_header(&this.client.scopes())
736                            .await?
737                        {
738                            req.insert_header(
739                                azure_core::http::headers::AUTHORIZATION,
740                                auth_header,
741                            );
742                        }
743                        req.insert_header("content-type", "application/json");
744                        let req_body = azure_core::json::to_json(&this.body)?;
745                        req.set_body(req_body);
746                        Ok(Response(this.client.send(&mut req).await?.into()))
747                    }
748                })
749            }
750            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
751                let mut url = azure_core::http::Url::parse(&format!(
752                    "{}/{}/_apis/securityroles/scopes/{}/roleassignments/resources/{}/{}",
753                    self.client.endpoint(),
754                    &self.organization,
755                    &self.scope_id,
756                    &self.resource_id,
757                    &self.identity_id
758                ))?;
759                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
760                if !has_api_version_already {
761                    url.query_pairs_mut()
762                        .append_pair("api-version", "7.1-preview");
763                }
764                Ok(url)
765            }
766        }
767        impl std::future::IntoFuture for RequestBuilder {
768            type Output = azure_core::Result<models::RoleAssignment>;
769            type IntoFuture = BoxFuture<'static, azure_core::Result<models::RoleAssignment>>;
770            #[doc = "Returns a future that sends the request and returns the parsed response body."]
771            #[doc = ""]
772            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
773            #[doc = ""]
774            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
775            fn into_future(self) -> Self::IntoFuture {
776                Box::pin(async move { self.send().await?.into_body() })
777            }
778        }
779    }
780    pub mod remove_role_assignment {
781        use super::models;
782        #[cfg(not(target_arch = "wasm32"))]
783        use futures::future::BoxFuture;
784        #[cfg(target_arch = "wasm32")]
785        use futures::future::LocalBoxFuture as BoxFuture;
786        #[derive(Debug)]
787        pub struct Response(azure_core::http::Response<(), azure_core::http::NoFormat>);
788        impl Response {
789            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
790                self.0.into()
791            }
792        }
793        #[derive(Clone)]
794        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
795        #[doc = r""]
796        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
797        #[doc = r" parameters can be chained."]
798        #[doc = r""]
799        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
800        #[doc = r" converts the [`RequestBuilder`] into a future,"]
801        #[doc = r" executes the request and returns a `Result` with the parsed"]
802        #[doc = r" response."]
803        #[doc = r""]
804        #[doc = r" If you need lower-level access to the raw response details"]
805        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
806        #[doc = r" can finalize the request using the"]
807        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
808        #[doc = r" that resolves to a lower-level [`Response`] value."]
809        pub struct RequestBuilder {
810            pub(crate) client: super::super::Client,
811            pub(crate) scope_id: String,
812            pub(crate) resource_id: String,
813            pub(crate) identity_id: String,
814            pub(crate) organization: String,
815        }
816        impl RequestBuilder {
817            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
818            #[doc = ""]
819            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
820            #[doc = "However, this function can provide more flexibility when required."]
821            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
822                Box::pin({
823                    let this = self.clone();
824                    async move {
825                        let url = this.url()?;
826                        let mut req =
827                            azure_core::http::Request::new(url, azure_core::http::Method::Delete);
828                        if let Some(auth_header) = this
829                            .client
830                            .token_credential()
831                            .http_authorization_header(&this.client.scopes())
832                            .await?
833                        {
834                            req.insert_header(
835                                azure_core::http::headers::AUTHORIZATION,
836                                auth_header,
837                            );
838                        }
839                        let req_body = azure_core::Bytes::new();
840                        req.set_body(req_body);
841                        Ok(Response(this.client.send(&mut req).await?.into()))
842                    }
843                })
844            }
845            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
846                let mut url = azure_core::http::Url::parse(&format!(
847                    "{}/{}/_apis/securityroles/scopes/{}/roleassignments/resources/{}/{}",
848                    self.client.endpoint(),
849                    &self.organization,
850                    &self.scope_id,
851                    &self.resource_id,
852                    &self.identity_id
853                ))?;
854                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
855                if !has_api_version_already {
856                    url.query_pairs_mut()
857                        .append_pair("api-version", "7.1-preview");
858                }
859                Ok(url)
860            }
861        }
862        impl std::future::IntoFuture for RequestBuilder {
863            type Output = azure_core::Result<()>;
864            type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
865            #[doc = "Returns a future that sends the request and waits for the response."]
866            #[doc = ""]
867            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
868            #[doc = ""]
869            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
870            fn into_future(self) -> Self::IntoFuture {
871                Box::pin(async move {
872                    let _rsp = self.send().await?;
873                    Ok(())
874                })
875            }
876        }
877    }
878}
879pub mod roledefinitions {
880    use super::models;
881    #[cfg(not(target_arch = "wasm32"))]
882    use futures::future::BoxFuture;
883    #[cfg(target_arch = "wasm32")]
884    use futures::future::LocalBoxFuture as BoxFuture;
885    pub struct Client(pub(crate) super::Client);
886    impl Client {
887        #[doc = "Arguments:"]
888        #[doc = "* `organization`: The name of the Azure DevOps organization."]
889        pub fn list(
890            &self,
891            scope_id: impl Into<String>,
892            organization: impl Into<String>,
893        ) -> list::RequestBuilder {
894            list::RequestBuilder {
895                client: self.0.clone(),
896                scope_id: scope_id.into(),
897                organization: organization.into(),
898            }
899        }
900    }
901    pub mod list {
902        use super::models;
903        #[cfg(not(target_arch = "wasm32"))]
904        use futures::future::BoxFuture;
905        #[cfg(target_arch = "wasm32")]
906        use futures::future::LocalBoxFuture as BoxFuture;
907        #[derive(Debug)]
908        pub struct Response(
909            azure_core::http::Response<models::SecurityRoleList, azure_core::http::JsonFormat>,
910        );
911        impl Response {
912            pub fn into_body(self) -> azure_core::Result<models::SecurityRoleList> {
913                self.0.into_model()
914            }
915            pub fn into_raw_response(self) -> azure_core::http::RawResponse {
916                self.0.into()
917            }
918        }
919        #[derive(Clone)]
920        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
921        #[doc = r""]
922        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
923        #[doc = r" parameters can be chained."]
924        #[doc = r""]
925        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
926        #[doc = r" converts the [`RequestBuilder`] into a future,"]
927        #[doc = r" executes the request and returns a `Result` with the parsed"]
928        #[doc = r" response."]
929        #[doc = r""]
930        #[doc = r" If you need lower-level access to the raw response details"]
931        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
932        #[doc = r" can finalize the request using the"]
933        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
934        #[doc = r" that resolves to a lower-level [`Response`] value."]
935        pub struct RequestBuilder {
936            pub(crate) client: super::super::Client,
937            pub(crate) scope_id: String,
938            pub(crate) organization: String,
939        }
940        impl RequestBuilder {
941            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
942            #[doc = ""]
943            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
944            #[doc = "However, this function can provide more flexibility when required."]
945            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
946                Box::pin({
947                    let this = self.clone();
948                    async move {
949                        let url = this.url()?;
950                        let mut req =
951                            azure_core::http::Request::new(url, azure_core::http::Method::Get);
952                        if let Some(auth_header) = this
953                            .client
954                            .token_credential()
955                            .http_authorization_header(&this.client.scopes())
956                            .await?
957                        {
958                            req.insert_header(
959                                azure_core::http::headers::AUTHORIZATION,
960                                auth_header,
961                            );
962                        }
963                        let req_body = azure_core::Bytes::new();
964                        req.set_body(req_body);
965                        Ok(Response(this.client.send(&mut req).await?.into()))
966                    }
967                })
968            }
969            fn url(&self) -> azure_core::Result<azure_core::http::Url> {
970                let mut url = azure_core::http::Url::parse(&format!(
971                    "{}/{}/_apis/securityroles/scopes/{}/roledefinitions",
972                    self.client.endpoint(),
973                    &self.organization,
974                    &self.scope_id
975                ))?;
976                let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
977                if !has_api_version_already {
978                    url.query_pairs_mut()
979                        .append_pair("api-version", "7.1-preview");
980                }
981                Ok(url)
982            }
983        }
984        impl std::future::IntoFuture for RequestBuilder {
985            type Output = azure_core::Result<models::SecurityRoleList>;
986            type IntoFuture = BoxFuture<'static, azure_core::Result<models::SecurityRoleList>>;
987            #[doc = "Returns a future that sends the request and returns the parsed response body."]
988            #[doc = ""]
989            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
990            #[doc = ""]
991            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
992            fn into_future(self) -> Self::IntoFuture {
993                Box::pin(async move { self.send().await?.into_body() })
994            }
995        }
996    }
997}