1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum EndpointsAgentsConnectorsAgentConfigRetrieveError {
20 Status400(models::ValidationError),
21 Status403(models::GenericError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum EndpointsAgentsConnectorsAuthFedCreateError {
29 Status404(),
30 Status400(models::ValidationError),
31 Status403(models::GenericError),
32 UnknownValue(serde_json::Value),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum EndpointsAgentsConnectorsAuthIaCreateError {
39 Status400(models::ValidationError),
40 Status403(models::GenericError),
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum EndpointsAgentsConnectorsCheckInCreateError {
48 Status400(models::ValidationError),
49 Status403(models::GenericError),
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum EndpointsAgentsConnectorsCreateError {
57 Status400(models::ValidationError),
58 Status403(models::GenericError),
59 UnknownValue(serde_json::Value),
60}
61
62#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(untagged)]
65pub enum EndpointsAgentsConnectorsDestroyError {
66 Status400(models::ValidationError),
67 Status403(models::GenericError),
68 UnknownValue(serde_json::Value),
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum EndpointsAgentsConnectorsEnrollCreateError {
75 Status400(models::ValidationError),
76 Status403(models::GenericError),
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum EndpointsAgentsConnectorsListError {
84 Status400(models::ValidationError),
85 Status403(models::GenericError),
86 UnknownValue(serde_json::Value),
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum EndpointsAgentsConnectorsMdmConfigCreateError {
93 Status400(models::ValidationError),
94 Status403(models::GenericError),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum EndpointsAgentsConnectorsPartialUpdateError {
102 Status400(models::ValidationError),
103 Status403(models::GenericError),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum EndpointsAgentsConnectorsRetrieveError {
111 Status400(models::ValidationError),
112 Status403(models::GenericError),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum EndpointsAgentsConnectorsUpdateError {
120 Status400(models::ValidationError),
121 Status403(models::GenericError),
122 UnknownValue(serde_json::Value),
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum EndpointsAgentsConnectorsUsedByListError {
129 Status400(models::ValidationError),
130 Status403(models::GenericError),
131 UnknownValue(serde_json::Value),
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum EndpointsAgentsEnrollmentTokensCreateError {
138 Status400(models::ValidationError),
139 Status403(models::GenericError),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum EndpointsAgentsEnrollmentTokensDestroyError {
147 Status400(models::ValidationError),
148 Status403(models::GenericError),
149 UnknownValue(serde_json::Value),
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum EndpointsAgentsEnrollmentTokensListError {
156 Status400(models::ValidationError),
157 Status403(models::GenericError),
158 UnknownValue(serde_json::Value),
159}
160
161#[derive(Debug, Clone, Serialize, Deserialize)]
163#[serde(untagged)]
164pub enum EndpointsAgentsEnrollmentTokensPartialUpdateError {
165 Status400(models::ValidationError),
166 Status403(models::GenericError),
167 UnknownValue(serde_json::Value),
168}
169
170#[derive(Debug, Clone, Serialize, Deserialize)]
172#[serde(untagged)]
173pub enum EndpointsAgentsEnrollmentTokensRetrieveError {
174 Status400(models::ValidationError),
175 Status403(models::GenericError),
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum EndpointsAgentsEnrollmentTokensUpdateError {
183 Status400(models::ValidationError),
184 Status403(models::GenericError),
185 UnknownValue(serde_json::Value),
186}
187
188#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum EndpointsAgentsEnrollmentTokensUsedByListError {
192 Status400(models::ValidationError),
193 Status403(models::GenericError),
194 UnknownValue(serde_json::Value),
195}
196
197#[derive(Debug, Clone, Serialize, Deserialize)]
199#[serde(untagged)]
200pub enum EndpointsAgentsEnrollmentTokensViewKeyRetrieveError {
201 Status404(),
202 Status400(models::ValidationError),
203 Status403(models::GenericError),
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum EndpointsAgentsPssoRegisterDeviceCreateError {
211 Status400(models::ValidationError),
212 Status403(models::GenericError),
213 UnknownValue(serde_json::Value),
214}
215
216#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum EndpointsAgentsPssoRegisterUserCreateError {
220 Status400(models::ValidationError),
221 Status403(models::GenericError),
222 UnknownValue(serde_json::Value),
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum EndpointsConnectorsDestroyError {
229 Status400(models::ValidationError),
230 Status403(models::GenericError),
231 UnknownValue(serde_json::Value),
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum EndpointsConnectorsListError {
238 Status400(models::ValidationError),
239 Status403(models::GenericError),
240 UnknownValue(serde_json::Value),
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum EndpointsConnectorsRetrieveError {
247 Status400(models::ValidationError),
248 Status403(models::GenericError),
249 UnknownValue(serde_json::Value),
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum EndpointsConnectorsTypesListError {
256 Status400(models::ValidationError),
257 Status403(models::GenericError),
258 UnknownValue(serde_json::Value),
259}
260
261#[derive(Debug, Clone, Serialize, Deserialize)]
263#[serde(untagged)]
264pub enum EndpointsConnectorsUsedByListError {
265 Status400(models::ValidationError),
266 Status403(models::GenericError),
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum EndpointsDeviceAccessGroupsCreateError {
274 Status400(models::ValidationError),
275 Status403(models::GenericError),
276 UnknownValue(serde_json::Value),
277}
278
279#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum EndpointsDeviceAccessGroupsDestroyError {
283 Status400(models::ValidationError),
284 Status403(models::GenericError),
285 UnknownValue(serde_json::Value),
286}
287
288#[derive(Debug, Clone, Serialize, Deserialize)]
290#[serde(untagged)]
291pub enum EndpointsDeviceAccessGroupsListError {
292 Status400(models::ValidationError),
293 Status403(models::GenericError),
294 UnknownValue(serde_json::Value),
295}
296
297#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum EndpointsDeviceAccessGroupsPartialUpdateError {
301 Status400(models::ValidationError),
302 Status403(models::GenericError),
303 UnknownValue(serde_json::Value),
304}
305
306#[derive(Debug, Clone, Serialize, Deserialize)]
308#[serde(untagged)]
309pub enum EndpointsDeviceAccessGroupsRetrieveError {
310 Status400(models::ValidationError),
311 Status403(models::GenericError),
312 UnknownValue(serde_json::Value),
313}
314
315#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum EndpointsDeviceAccessGroupsUpdateError {
319 Status400(models::ValidationError),
320 Status403(models::GenericError),
321 UnknownValue(serde_json::Value),
322}
323
324#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum EndpointsDeviceAccessGroupsUsedByListError {
328 Status400(models::ValidationError),
329 Status403(models::GenericError),
330 UnknownValue(serde_json::Value),
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize)]
335#[serde(untagged)]
336pub enum EndpointsDeviceBindingsCreateError {
337 Status400(models::ValidationError),
338 Status403(models::GenericError),
339 UnknownValue(serde_json::Value),
340}
341
342#[derive(Debug, Clone, Serialize, Deserialize)]
344#[serde(untagged)]
345pub enum EndpointsDeviceBindingsDestroyError {
346 Status400(models::ValidationError),
347 Status403(models::GenericError),
348 UnknownValue(serde_json::Value),
349}
350
351#[derive(Debug, Clone, Serialize, Deserialize)]
353#[serde(untagged)]
354pub enum EndpointsDeviceBindingsListError {
355 Status400(models::ValidationError),
356 Status403(models::GenericError),
357 UnknownValue(serde_json::Value),
358}
359
360#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum EndpointsDeviceBindingsPartialUpdateError {
364 Status400(models::ValidationError),
365 Status403(models::GenericError),
366 UnknownValue(serde_json::Value),
367}
368
369#[derive(Debug, Clone, Serialize, Deserialize)]
371#[serde(untagged)]
372pub enum EndpointsDeviceBindingsRetrieveError {
373 Status400(models::ValidationError),
374 Status403(models::GenericError),
375 UnknownValue(serde_json::Value),
376}
377
378#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum EndpointsDeviceBindingsUpdateError {
382 Status400(models::ValidationError),
383 Status403(models::GenericError),
384 UnknownValue(serde_json::Value),
385}
386
387#[derive(Debug, Clone, Serialize, Deserialize)]
389#[serde(untagged)]
390pub enum EndpointsDeviceBindingsUsedByListError {
391 Status400(models::ValidationError),
392 Status403(models::GenericError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum EndpointsDevicesDestroyError {
400 Status400(models::ValidationError),
401 Status403(models::GenericError),
402 UnknownValue(serde_json::Value),
403}
404
405#[derive(Debug, Clone, Serialize, Deserialize)]
407#[serde(untagged)]
408pub enum EndpointsDevicesListError {
409 Status400(models::ValidationError),
410 Status403(models::GenericError),
411 UnknownValue(serde_json::Value),
412}
413
414#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum EndpointsDevicesPartialUpdateError {
418 Status400(models::ValidationError),
419 Status403(models::GenericError),
420 UnknownValue(serde_json::Value),
421}
422
423#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum EndpointsDevicesRetrieveError {
427 Status400(models::ValidationError),
428 Status403(models::GenericError),
429 UnknownValue(serde_json::Value),
430}
431
432#[derive(Debug, Clone, Serialize, Deserialize)]
434#[serde(untagged)]
435pub enum EndpointsDevicesSummaryRetrieveError {
436 Status400(models::ValidationError),
437 Status403(models::GenericError),
438 UnknownValue(serde_json::Value),
439}
440
441#[derive(Debug, Clone, Serialize, Deserialize)]
443#[serde(untagged)]
444pub enum EndpointsDevicesUpdateError {
445 Status400(models::ValidationError),
446 Status403(models::GenericError),
447 UnknownValue(serde_json::Value),
448}
449
450#[derive(Debug, Clone, Serialize, Deserialize)]
452#[serde(untagged)]
453pub enum EndpointsDevicesUsedByListError {
454 Status400(models::ValidationError),
455 Status403(models::GenericError),
456 UnknownValue(serde_json::Value),
457}
458
459#[derive(Debug, Clone, Serialize, Deserialize)]
461#[serde(untagged)]
462pub enum EndpointsFleetConnectorsCreateError {
463 Status400(models::ValidationError),
464 Status403(models::GenericError),
465 UnknownValue(serde_json::Value),
466}
467
468#[derive(Debug, Clone, Serialize, Deserialize)]
470#[serde(untagged)]
471pub enum EndpointsFleetConnectorsDestroyError {
472 Status400(models::ValidationError),
473 Status403(models::GenericError),
474 UnknownValue(serde_json::Value),
475}
476
477#[derive(Debug, Clone, Serialize, Deserialize)]
479#[serde(untagged)]
480pub enum EndpointsFleetConnectorsListError {
481 Status400(models::ValidationError),
482 Status403(models::GenericError),
483 UnknownValue(serde_json::Value),
484}
485
486#[derive(Debug, Clone, Serialize, Deserialize)]
488#[serde(untagged)]
489pub enum EndpointsFleetConnectorsPartialUpdateError {
490 Status400(models::ValidationError),
491 Status403(models::GenericError),
492 UnknownValue(serde_json::Value),
493}
494
495#[derive(Debug, Clone, Serialize, Deserialize)]
497#[serde(untagged)]
498pub enum EndpointsFleetConnectorsRetrieveError {
499 Status400(models::ValidationError),
500 Status403(models::GenericError),
501 UnknownValue(serde_json::Value),
502}
503
504#[derive(Debug, Clone, Serialize, Deserialize)]
506#[serde(untagged)]
507pub enum EndpointsFleetConnectorsUpdateError {
508 Status400(models::ValidationError),
509 Status403(models::GenericError),
510 UnknownValue(serde_json::Value),
511}
512
513#[derive(Debug, Clone, Serialize, Deserialize)]
515#[serde(untagged)]
516pub enum EndpointsFleetConnectorsUsedByListError {
517 Status400(models::ValidationError),
518 Status403(models::GenericError),
519 UnknownValue(serde_json::Value),
520}
521
522pub async fn endpoints_agents_connectors_agent_config_retrieve(
524 configuration: &configuration::Configuration,
525) -> Result<models::AgentConfig, Error<EndpointsAgentsConnectorsAgentConfigRetrieveError>> {
526 let uri_str = format!("{}/endpoints/agents/connectors/agent_config/", configuration.base_path);
527 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
528
529 if let Some(ref user_agent) = configuration.user_agent {
530 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
531 }
532
533 let req = req_builder.build()?;
534 let resp = configuration.client.execute(req).await?;
535
536 let status = resp.status();
537 let content_type = resp
538 .headers()
539 .get("content-type")
540 .and_then(|v| v.to_str().ok())
541 .unwrap_or("application/octet-stream");
542 let content_type = super::ContentType::from(content_type);
543
544 if !status.is_client_error() && !status.is_server_error() {
545 let content = resp.text().await?;
546 match content_type {
547 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
548 ContentType::Text => {
549 return Err(Error::from(serde_json::Error::custom(
550 "Received `text/plain` content type response that cannot be converted to `models::AgentConfig`",
551 )))
552 }
553 ContentType::Unsupported(unknown_type) => {
554 return Err(Error::from(serde_json::Error::custom(format!(
555 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConfig`"
556 ))))
557 }
558 }
559 } else {
560 let content = resp.text().await?;
561 let entity: Option<EndpointsAgentsConnectorsAgentConfigRetrieveError> = serde_json::from_str(&content).ok();
562 Err(Error::ResponseError(ResponseContent {
563 status,
564 content,
565 entity,
566 }))
567 }
568}
569
570pub async fn endpoints_agents_connectors_auth_fed_create(
572 configuration: &configuration::Configuration,
573 device: &str,
574) -> Result<models::AgentTokenResponse, Error<EndpointsAgentsConnectorsAuthFedCreateError>> {
575 let p_query_device = device;
577
578 let uri_str = format!("{}/endpoints/agents/connectors/auth_fed/", configuration.base_path);
579 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
580
581 req_builder = req_builder.query(&[("device", &p_query_device.to_string())]);
582 if let Some(ref user_agent) = configuration.user_agent {
583 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
584 }
585
586 let req = req_builder.build()?;
587 let resp = configuration.client.execute(req).await?;
588
589 let status = resp.status();
590 let content_type = resp
591 .headers()
592 .get("content-type")
593 .and_then(|v| v.to_str().ok())
594 .unwrap_or("application/octet-stream");
595 let content_type = super::ContentType::from(content_type);
596
597 if !status.is_client_error() && !status.is_server_error() {
598 let content = resp.text().await?;
599 match content_type {
600 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
601 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentTokenResponse`"))),
602 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AgentTokenResponse`")))),
603 }
604 } else {
605 let content = resp.text().await?;
606 let entity: Option<EndpointsAgentsConnectorsAuthFedCreateError> = serde_json::from_str(&content).ok();
607 Err(Error::ResponseError(ResponseContent {
608 status,
609 content,
610 entity,
611 }))
612 }
613}
614
615pub async fn endpoints_agents_connectors_auth_ia_create(
617 configuration: &configuration::Configuration,
618) -> Result<models::AgentAuthenticationResponse, Error<EndpointsAgentsConnectorsAuthIaCreateError>> {
619 let uri_str = format!("{}/endpoints/agents/connectors/auth_ia/", configuration.base_path);
620 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
621
622 if let Some(ref user_agent) = configuration.user_agent {
623 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
624 }
625
626 let req = req_builder.build()?;
627 let resp = configuration.client.execute(req).await?;
628
629 let status = resp.status();
630 let content_type = resp
631 .headers()
632 .get("content-type")
633 .and_then(|v| v.to_str().ok())
634 .unwrap_or("application/octet-stream");
635 let content_type = super::ContentType::from(content_type);
636
637 if !status.is_client_error() && !status.is_server_error() {
638 let content = resp.text().await?;
639 match content_type {
640 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
641 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentAuthenticationResponse`"))),
642 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AgentAuthenticationResponse`")))),
643 }
644 } else {
645 let content = resp.text().await?;
646 let entity: Option<EndpointsAgentsConnectorsAuthIaCreateError> = serde_json::from_str(&content).ok();
647 Err(Error::ResponseError(ResponseContent {
648 status,
649 content,
650 entity,
651 }))
652 }
653}
654
655pub async fn endpoints_agents_connectors_check_in_create(
657 configuration: &configuration::Configuration,
658 device_facts_request: Option<models::DeviceFactsRequest>,
659) -> Result<(), Error<EndpointsAgentsConnectorsCheckInCreateError>> {
660 let p_body_device_facts_request = device_facts_request;
662
663 let uri_str = format!("{}/endpoints/agents/connectors/check_in/", configuration.base_path);
664 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
665
666 if let Some(ref user_agent) = configuration.user_agent {
667 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
668 }
669 req_builder = req_builder.json(&p_body_device_facts_request);
670
671 let req = req_builder.build()?;
672 let resp = configuration.client.execute(req).await?;
673
674 let status = resp.status();
675
676 if !status.is_client_error() && !status.is_server_error() {
677 Ok(())
678 } else {
679 let content = resp.text().await?;
680 let entity: Option<EndpointsAgentsConnectorsCheckInCreateError> = serde_json::from_str(&content).ok();
681 Err(Error::ResponseError(ResponseContent {
682 status,
683 content,
684 entity,
685 }))
686 }
687}
688
689pub async fn endpoints_agents_connectors_create(
691 configuration: &configuration::Configuration,
692 agent_connector_request: models::AgentConnectorRequest,
693) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsCreateError>> {
694 let p_body_agent_connector_request = agent_connector_request;
696
697 let uri_str = format!("{}/endpoints/agents/connectors/", configuration.base_path);
698 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
699
700 if let Some(ref user_agent) = configuration.user_agent {
701 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
702 }
703 if let Some(ref token) = configuration.bearer_access_token {
704 req_builder = req_builder.bearer_auth(token.to_owned());
705 };
706 req_builder = req_builder.json(&p_body_agent_connector_request);
707
708 let req = req_builder.build()?;
709 let resp = configuration.client.execute(req).await?;
710
711 let status = resp.status();
712 let content_type = resp
713 .headers()
714 .get("content-type")
715 .and_then(|v| v.to_str().ok())
716 .unwrap_or("application/octet-stream");
717 let content_type = super::ContentType::from(content_type);
718
719 if !status.is_client_error() && !status.is_server_error() {
720 let content = resp.text().await?;
721 match content_type {
722 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
723 ContentType::Text => {
724 return Err(Error::from(serde_json::Error::custom(
725 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
726 )))
727 }
728 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
729 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
730 )))),
731 }
732 } else {
733 let content = resp.text().await?;
734 let entity: Option<EndpointsAgentsConnectorsCreateError> = serde_json::from_str(&content).ok();
735 Err(Error::ResponseError(ResponseContent {
736 status,
737 content,
738 entity,
739 }))
740 }
741}
742
743pub async fn endpoints_agents_connectors_destroy(
745 configuration: &configuration::Configuration,
746 connector_uuid: &str,
747) -> Result<(), Error<EndpointsAgentsConnectorsDestroyError>> {
748 let p_path_connector_uuid = connector_uuid;
750
751 let uri_str = format!(
752 "{}/endpoints/agents/connectors/{connector_uuid}/",
753 configuration.base_path,
754 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
755 );
756 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
757
758 if let Some(ref user_agent) = configuration.user_agent {
759 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
760 }
761 if let Some(ref token) = configuration.bearer_access_token {
762 req_builder = req_builder.bearer_auth(token.to_owned());
763 };
764
765 let req = req_builder.build()?;
766 let resp = configuration.client.execute(req).await?;
767
768 let status = resp.status();
769
770 if !status.is_client_error() && !status.is_server_error() {
771 Ok(())
772 } else {
773 let content = resp.text().await?;
774 let entity: Option<EndpointsAgentsConnectorsDestroyError> = serde_json::from_str(&content).ok();
775 Err(Error::ResponseError(ResponseContent {
776 status,
777 content,
778 entity,
779 }))
780 }
781}
782
783pub async fn endpoints_agents_connectors_enroll_create(
785 configuration: &configuration::Configuration,
786 enroll_request: models::EnrollRequest,
787) -> Result<models::AgentTokenResponse, Error<EndpointsAgentsConnectorsEnrollCreateError>> {
788 let p_body_enroll_request = enroll_request;
790
791 let uri_str = format!("{}/endpoints/agents/connectors/enroll/", configuration.base_path);
792 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
793
794 if let Some(ref user_agent) = configuration.user_agent {
795 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
796 }
797 req_builder = req_builder.json(&p_body_enroll_request);
798
799 let req = req_builder.build()?;
800 let resp = configuration.client.execute(req).await?;
801
802 let status = resp.status();
803 let content_type = resp
804 .headers()
805 .get("content-type")
806 .and_then(|v| v.to_str().ok())
807 .unwrap_or("application/octet-stream");
808 let content_type = super::ContentType::from(content_type);
809
810 if !status.is_client_error() && !status.is_server_error() {
811 let content = resp.text().await?;
812 match content_type {
813 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
814 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentTokenResponse`"))),
815 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AgentTokenResponse`")))),
816 }
817 } else {
818 let content = resp.text().await?;
819 let entity: Option<EndpointsAgentsConnectorsEnrollCreateError> = serde_json::from_str(&content).ok();
820 Err(Error::ResponseError(ResponseContent {
821 status,
822 content,
823 entity,
824 }))
825 }
826}
827
828pub async fn endpoints_agents_connectors_list(
830 configuration: &configuration::Configuration,
831 enabled: Option<bool>,
832 name: Option<&str>,
833 ordering: Option<&str>,
834 page: Option<i32>,
835 page_size: Option<i32>,
836 search: Option<&str>,
837) -> Result<models::PaginatedAgentConnectorList, Error<EndpointsAgentsConnectorsListError>> {
838 let p_query_enabled = enabled;
840 let p_query_name = name;
841 let p_query_ordering = ordering;
842 let p_query_page = page;
843 let p_query_page_size = page_size;
844 let p_query_search = search;
845
846 let uri_str = format!("{}/endpoints/agents/connectors/", configuration.base_path);
847 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
848
849 if let Some(ref param_value) = p_query_enabled {
850 req_builder = req_builder.query(&[("enabled", ¶m_value.to_string())]);
851 }
852 if let Some(ref param_value) = p_query_name {
853 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
854 }
855 if let Some(ref param_value) = p_query_ordering {
856 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
857 }
858 if let Some(ref param_value) = p_query_page {
859 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
860 }
861 if let Some(ref param_value) = p_query_page_size {
862 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
863 }
864 if let Some(ref param_value) = p_query_search {
865 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
866 }
867 if let Some(ref user_agent) = configuration.user_agent {
868 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
869 }
870 if let Some(ref token) = configuration.bearer_access_token {
871 req_builder = req_builder.bearer_auth(token.to_owned());
872 };
873
874 let req = req_builder.build()?;
875 let resp = configuration.client.execute(req).await?;
876
877 let status = resp.status();
878 let content_type = resp
879 .headers()
880 .get("content-type")
881 .and_then(|v| v.to_str().ok())
882 .unwrap_or("application/octet-stream");
883 let content_type = super::ContentType::from(content_type);
884
885 if !status.is_client_error() && !status.is_server_error() {
886 let content = resp.text().await?;
887 match content_type {
888 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
889 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedAgentConnectorList`"))),
890 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedAgentConnectorList`")))),
891 }
892 } else {
893 let content = resp.text().await?;
894 let entity: Option<EndpointsAgentsConnectorsListError> = serde_json::from_str(&content).ok();
895 Err(Error::ResponseError(ResponseContent {
896 status,
897 content,
898 entity,
899 }))
900 }
901}
902
903pub async fn endpoints_agents_connectors_mdm_config_create(
905 configuration: &configuration::Configuration,
906 connector_uuid: &str,
907 mdm_config_request: models::MdmConfigRequest,
908) -> Result<models::MdmConfigResponse, Error<EndpointsAgentsConnectorsMdmConfigCreateError>> {
909 let p_path_connector_uuid = connector_uuid;
911 let p_body_mdm_config_request = mdm_config_request;
912
913 let uri_str = format!(
914 "{}/endpoints/agents/connectors/{connector_uuid}/mdm_config/",
915 configuration.base_path,
916 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
917 );
918 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
919
920 if let Some(ref user_agent) = configuration.user_agent {
921 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
922 }
923 if let Some(ref token) = configuration.bearer_access_token {
924 req_builder = req_builder.bearer_auth(token.to_owned());
925 };
926 req_builder = req_builder.json(&p_body_mdm_config_request);
927
928 let req = req_builder.build()?;
929 let resp = configuration.client.execute(req).await?;
930
931 let status = resp.status();
932 let content_type = resp
933 .headers()
934 .get("content-type")
935 .and_then(|v| v.to_str().ok())
936 .unwrap_or("application/octet-stream");
937 let content_type = super::ContentType::from(content_type);
938
939 if !status.is_client_error() && !status.is_server_error() {
940 let content = resp.text().await?;
941 match content_type {
942 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
943 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MdmConfigResponse`"))),
944 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::MdmConfigResponse`")))),
945 }
946 } else {
947 let content = resp.text().await?;
948 let entity: Option<EndpointsAgentsConnectorsMdmConfigCreateError> = serde_json::from_str(&content).ok();
949 Err(Error::ResponseError(ResponseContent {
950 status,
951 content,
952 entity,
953 }))
954 }
955}
956
957pub async fn endpoints_agents_connectors_partial_update(
959 configuration: &configuration::Configuration,
960 connector_uuid: &str,
961 patched_agent_connector_request: Option<models::PatchedAgentConnectorRequest>,
962) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsPartialUpdateError>> {
963 let p_path_connector_uuid = connector_uuid;
965 let p_body_patched_agent_connector_request = patched_agent_connector_request;
966
967 let uri_str = format!(
968 "{}/endpoints/agents/connectors/{connector_uuid}/",
969 configuration.base_path,
970 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
971 );
972 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
973
974 if let Some(ref user_agent) = configuration.user_agent {
975 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
976 }
977 if let Some(ref token) = configuration.bearer_access_token {
978 req_builder = req_builder.bearer_auth(token.to_owned());
979 };
980 req_builder = req_builder.json(&p_body_patched_agent_connector_request);
981
982 let req = req_builder.build()?;
983 let resp = configuration.client.execute(req).await?;
984
985 let status = resp.status();
986 let content_type = resp
987 .headers()
988 .get("content-type")
989 .and_then(|v| v.to_str().ok())
990 .unwrap_or("application/octet-stream");
991 let content_type = super::ContentType::from(content_type);
992
993 if !status.is_client_error() && !status.is_server_error() {
994 let content = resp.text().await?;
995 match content_type {
996 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
997 ContentType::Text => {
998 return Err(Error::from(serde_json::Error::custom(
999 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
1000 )))
1001 }
1002 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1003 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
1004 )))),
1005 }
1006 } else {
1007 let content = resp.text().await?;
1008 let entity: Option<EndpointsAgentsConnectorsPartialUpdateError> = serde_json::from_str(&content).ok();
1009 Err(Error::ResponseError(ResponseContent {
1010 status,
1011 content,
1012 entity,
1013 }))
1014 }
1015}
1016
1017pub async fn endpoints_agents_connectors_retrieve(
1019 configuration: &configuration::Configuration,
1020 connector_uuid: &str,
1021) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsRetrieveError>> {
1022 let p_path_connector_uuid = connector_uuid;
1024
1025 let uri_str = format!(
1026 "{}/endpoints/agents/connectors/{connector_uuid}/",
1027 configuration.base_path,
1028 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1029 );
1030 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1031
1032 if let Some(ref user_agent) = configuration.user_agent {
1033 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1034 }
1035 if let Some(ref token) = configuration.bearer_access_token {
1036 req_builder = req_builder.bearer_auth(token.to_owned());
1037 };
1038
1039 let req = req_builder.build()?;
1040 let resp = configuration.client.execute(req).await?;
1041
1042 let status = resp.status();
1043 let content_type = resp
1044 .headers()
1045 .get("content-type")
1046 .and_then(|v| v.to_str().ok())
1047 .unwrap_or("application/octet-stream");
1048 let content_type = super::ContentType::from(content_type);
1049
1050 if !status.is_client_error() && !status.is_server_error() {
1051 let content = resp.text().await?;
1052 match content_type {
1053 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1054 ContentType::Text => {
1055 return Err(Error::from(serde_json::Error::custom(
1056 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
1057 )))
1058 }
1059 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1060 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
1061 )))),
1062 }
1063 } else {
1064 let content = resp.text().await?;
1065 let entity: Option<EndpointsAgentsConnectorsRetrieveError> = serde_json::from_str(&content).ok();
1066 Err(Error::ResponseError(ResponseContent {
1067 status,
1068 content,
1069 entity,
1070 }))
1071 }
1072}
1073
1074pub async fn endpoints_agents_connectors_update(
1076 configuration: &configuration::Configuration,
1077 connector_uuid: &str,
1078 agent_connector_request: models::AgentConnectorRequest,
1079) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsUpdateError>> {
1080 let p_path_connector_uuid = connector_uuid;
1082 let p_body_agent_connector_request = agent_connector_request;
1083
1084 let uri_str = format!(
1085 "{}/endpoints/agents/connectors/{connector_uuid}/",
1086 configuration.base_path,
1087 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1088 );
1089 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1090
1091 if let Some(ref user_agent) = configuration.user_agent {
1092 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1093 }
1094 if let Some(ref token) = configuration.bearer_access_token {
1095 req_builder = req_builder.bearer_auth(token.to_owned());
1096 };
1097 req_builder = req_builder.json(&p_body_agent_connector_request);
1098
1099 let req = req_builder.build()?;
1100 let resp = configuration.client.execute(req).await?;
1101
1102 let status = resp.status();
1103 let content_type = resp
1104 .headers()
1105 .get("content-type")
1106 .and_then(|v| v.to_str().ok())
1107 .unwrap_or("application/octet-stream");
1108 let content_type = super::ContentType::from(content_type);
1109
1110 if !status.is_client_error() && !status.is_server_error() {
1111 let content = resp.text().await?;
1112 match content_type {
1113 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1114 ContentType::Text => {
1115 return Err(Error::from(serde_json::Error::custom(
1116 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
1117 )))
1118 }
1119 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1120 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
1121 )))),
1122 }
1123 } else {
1124 let content = resp.text().await?;
1125 let entity: Option<EndpointsAgentsConnectorsUpdateError> = serde_json::from_str(&content).ok();
1126 Err(Error::ResponseError(ResponseContent {
1127 status,
1128 content,
1129 entity,
1130 }))
1131 }
1132}
1133
1134pub async fn endpoints_agents_connectors_used_by_list(
1136 configuration: &configuration::Configuration,
1137 connector_uuid: &str,
1138) -> Result<Vec<models::UsedBy>, Error<EndpointsAgentsConnectorsUsedByListError>> {
1139 let p_path_connector_uuid = connector_uuid;
1141
1142 let uri_str = format!(
1143 "{}/endpoints/agents/connectors/{connector_uuid}/used_by/",
1144 configuration.base_path,
1145 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1146 );
1147 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1148
1149 if let Some(ref user_agent) = configuration.user_agent {
1150 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1151 }
1152 if let Some(ref token) = configuration.bearer_access_token {
1153 req_builder = req_builder.bearer_auth(token.to_owned());
1154 };
1155
1156 let req = req_builder.build()?;
1157 let resp = configuration.client.execute(req).await?;
1158
1159 let status = resp.status();
1160 let content_type = resp
1161 .headers()
1162 .get("content-type")
1163 .and_then(|v| v.to_str().ok())
1164 .unwrap_or("application/octet-stream");
1165 let content_type = super::ContentType::from(content_type);
1166
1167 if !status.is_client_error() && !status.is_server_error() {
1168 let content = resp.text().await?;
1169 match content_type {
1170 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1171 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1172 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1173 }
1174 } else {
1175 let content = resp.text().await?;
1176 let entity: Option<EndpointsAgentsConnectorsUsedByListError> = serde_json::from_str(&content).ok();
1177 Err(Error::ResponseError(ResponseContent {
1178 status,
1179 content,
1180 entity,
1181 }))
1182 }
1183}
1184
1185pub async fn endpoints_agents_enrollment_tokens_create(
1187 configuration: &configuration::Configuration,
1188 enrollment_token_request: models::EnrollmentTokenRequest,
1189) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensCreateError>> {
1190 let p_body_enrollment_token_request = enrollment_token_request;
1192
1193 let uri_str = format!("{}/endpoints/agents/enrollment_tokens/", configuration.base_path);
1194 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1195
1196 if let Some(ref user_agent) = configuration.user_agent {
1197 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1198 }
1199 if let Some(ref token) = configuration.bearer_access_token {
1200 req_builder = req_builder.bearer_auth(token.to_owned());
1201 };
1202 req_builder = req_builder.json(&p_body_enrollment_token_request);
1203
1204 let req = req_builder.build()?;
1205 let resp = configuration.client.execute(req).await?;
1206
1207 let status = resp.status();
1208 let content_type = resp
1209 .headers()
1210 .get("content-type")
1211 .and_then(|v| v.to_str().ok())
1212 .unwrap_or("application/octet-stream");
1213 let content_type = super::ContentType::from(content_type);
1214
1215 if !status.is_client_error() && !status.is_server_error() {
1216 let content = resp.text().await?;
1217 match content_type {
1218 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1219 ContentType::Text => {
1220 return Err(Error::from(serde_json::Error::custom(
1221 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1222 )))
1223 }
1224 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1225 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1226 )))),
1227 }
1228 } else {
1229 let content = resp.text().await?;
1230 let entity: Option<EndpointsAgentsEnrollmentTokensCreateError> = serde_json::from_str(&content).ok();
1231 Err(Error::ResponseError(ResponseContent {
1232 status,
1233 content,
1234 entity,
1235 }))
1236 }
1237}
1238
1239pub async fn endpoints_agents_enrollment_tokens_destroy(
1241 configuration: &configuration::Configuration,
1242 token_uuid: &str,
1243) -> Result<(), Error<EndpointsAgentsEnrollmentTokensDestroyError>> {
1244 let p_path_token_uuid = token_uuid;
1246
1247 let uri_str = format!(
1248 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1249 configuration.base_path,
1250 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1251 );
1252 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1253
1254 if let Some(ref user_agent) = configuration.user_agent {
1255 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1256 }
1257 if let Some(ref token) = configuration.bearer_access_token {
1258 req_builder = req_builder.bearer_auth(token.to_owned());
1259 };
1260
1261 let req = req_builder.build()?;
1262 let resp = configuration.client.execute(req).await?;
1263
1264 let status = resp.status();
1265
1266 if !status.is_client_error() && !status.is_server_error() {
1267 Ok(())
1268 } else {
1269 let content = resp.text().await?;
1270 let entity: Option<EndpointsAgentsEnrollmentTokensDestroyError> = serde_json::from_str(&content).ok();
1271 Err(Error::ResponseError(ResponseContent {
1272 status,
1273 content,
1274 entity,
1275 }))
1276 }
1277}
1278
1279pub async fn endpoints_agents_enrollment_tokens_list(
1281 configuration: &configuration::Configuration,
1282 connector: Option<&str>,
1283 ordering: Option<&str>,
1284 page: Option<i32>,
1285 page_size: Option<i32>,
1286 search: Option<&str>,
1287 token_uuid: Option<&str>,
1288) -> Result<models::PaginatedEnrollmentTokenList, Error<EndpointsAgentsEnrollmentTokensListError>> {
1289 let p_query_connector = connector;
1291 let p_query_ordering = ordering;
1292 let p_query_page = page;
1293 let p_query_page_size = page_size;
1294 let p_query_search = search;
1295 let p_query_token_uuid = token_uuid;
1296
1297 let uri_str = format!("{}/endpoints/agents/enrollment_tokens/", configuration.base_path);
1298 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1299
1300 if let Some(ref param_value) = p_query_connector {
1301 req_builder = req_builder.query(&[("connector", ¶m_value.to_string())]);
1302 }
1303 if let Some(ref param_value) = p_query_ordering {
1304 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1305 }
1306 if let Some(ref param_value) = p_query_page {
1307 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1308 }
1309 if let Some(ref param_value) = p_query_page_size {
1310 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1311 }
1312 if let Some(ref param_value) = p_query_search {
1313 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1314 }
1315 if let Some(ref param_value) = p_query_token_uuid {
1316 req_builder = req_builder.query(&[("token_uuid", ¶m_value.to_string())]);
1317 }
1318 if let Some(ref user_agent) = configuration.user_agent {
1319 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1320 }
1321 if let Some(ref token) = configuration.bearer_access_token {
1322 req_builder = req_builder.bearer_auth(token.to_owned());
1323 };
1324
1325 let req = req_builder.build()?;
1326 let resp = configuration.client.execute(req).await?;
1327
1328 let status = resp.status();
1329 let content_type = resp
1330 .headers()
1331 .get("content-type")
1332 .and_then(|v| v.to_str().ok())
1333 .unwrap_or("application/octet-stream");
1334 let content_type = super::ContentType::from(content_type);
1335
1336 if !status.is_client_error() && !status.is_server_error() {
1337 let content = resp.text().await?;
1338 match content_type {
1339 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1340 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEnrollmentTokenList`"))),
1341 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedEnrollmentTokenList`")))),
1342 }
1343 } else {
1344 let content = resp.text().await?;
1345 let entity: Option<EndpointsAgentsEnrollmentTokensListError> = serde_json::from_str(&content).ok();
1346 Err(Error::ResponseError(ResponseContent {
1347 status,
1348 content,
1349 entity,
1350 }))
1351 }
1352}
1353
1354pub async fn endpoints_agents_enrollment_tokens_partial_update(
1356 configuration: &configuration::Configuration,
1357 token_uuid: &str,
1358 patched_enrollment_token_request: Option<models::PatchedEnrollmentTokenRequest>,
1359) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensPartialUpdateError>> {
1360 let p_path_token_uuid = token_uuid;
1362 let p_body_patched_enrollment_token_request = patched_enrollment_token_request;
1363
1364 let uri_str = format!(
1365 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1366 configuration.base_path,
1367 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1368 );
1369 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1370
1371 if let Some(ref user_agent) = configuration.user_agent {
1372 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1373 }
1374 if let Some(ref token) = configuration.bearer_access_token {
1375 req_builder = req_builder.bearer_auth(token.to_owned());
1376 };
1377 req_builder = req_builder.json(&p_body_patched_enrollment_token_request);
1378
1379 let req = req_builder.build()?;
1380 let resp = configuration.client.execute(req).await?;
1381
1382 let status = resp.status();
1383 let content_type = resp
1384 .headers()
1385 .get("content-type")
1386 .and_then(|v| v.to_str().ok())
1387 .unwrap_or("application/octet-stream");
1388 let content_type = super::ContentType::from(content_type);
1389
1390 if !status.is_client_error() && !status.is_server_error() {
1391 let content = resp.text().await?;
1392 match content_type {
1393 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1394 ContentType::Text => {
1395 return Err(Error::from(serde_json::Error::custom(
1396 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1397 )))
1398 }
1399 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1400 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1401 )))),
1402 }
1403 } else {
1404 let content = resp.text().await?;
1405 let entity: Option<EndpointsAgentsEnrollmentTokensPartialUpdateError> = serde_json::from_str(&content).ok();
1406 Err(Error::ResponseError(ResponseContent {
1407 status,
1408 content,
1409 entity,
1410 }))
1411 }
1412}
1413
1414pub async fn endpoints_agents_enrollment_tokens_retrieve(
1416 configuration: &configuration::Configuration,
1417 token_uuid: &str,
1418) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensRetrieveError>> {
1419 let p_path_token_uuid = token_uuid;
1421
1422 let uri_str = format!(
1423 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1424 configuration.base_path,
1425 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1426 );
1427 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1428
1429 if let Some(ref user_agent) = configuration.user_agent {
1430 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1431 }
1432 if let Some(ref token) = configuration.bearer_access_token {
1433 req_builder = req_builder.bearer_auth(token.to_owned());
1434 };
1435
1436 let req = req_builder.build()?;
1437 let resp = configuration.client.execute(req).await?;
1438
1439 let status = resp.status();
1440 let content_type = resp
1441 .headers()
1442 .get("content-type")
1443 .and_then(|v| v.to_str().ok())
1444 .unwrap_or("application/octet-stream");
1445 let content_type = super::ContentType::from(content_type);
1446
1447 if !status.is_client_error() && !status.is_server_error() {
1448 let content = resp.text().await?;
1449 match content_type {
1450 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1451 ContentType::Text => {
1452 return Err(Error::from(serde_json::Error::custom(
1453 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1454 )))
1455 }
1456 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1457 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1458 )))),
1459 }
1460 } else {
1461 let content = resp.text().await?;
1462 let entity: Option<EndpointsAgentsEnrollmentTokensRetrieveError> = serde_json::from_str(&content).ok();
1463 Err(Error::ResponseError(ResponseContent {
1464 status,
1465 content,
1466 entity,
1467 }))
1468 }
1469}
1470
1471pub async fn endpoints_agents_enrollment_tokens_update(
1473 configuration: &configuration::Configuration,
1474 token_uuid: &str,
1475 enrollment_token_request: models::EnrollmentTokenRequest,
1476) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensUpdateError>> {
1477 let p_path_token_uuid = token_uuid;
1479 let p_body_enrollment_token_request = enrollment_token_request;
1480
1481 let uri_str = format!(
1482 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1483 configuration.base_path,
1484 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1485 );
1486 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1487
1488 if let Some(ref user_agent) = configuration.user_agent {
1489 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1490 }
1491 if let Some(ref token) = configuration.bearer_access_token {
1492 req_builder = req_builder.bearer_auth(token.to_owned());
1493 };
1494 req_builder = req_builder.json(&p_body_enrollment_token_request);
1495
1496 let req = req_builder.build()?;
1497 let resp = configuration.client.execute(req).await?;
1498
1499 let status = resp.status();
1500 let content_type = resp
1501 .headers()
1502 .get("content-type")
1503 .and_then(|v| v.to_str().ok())
1504 .unwrap_or("application/octet-stream");
1505 let content_type = super::ContentType::from(content_type);
1506
1507 if !status.is_client_error() && !status.is_server_error() {
1508 let content = resp.text().await?;
1509 match content_type {
1510 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1511 ContentType::Text => {
1512 return Err(Error::from(serde_json::Error::custom(
1513 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1514 )))
1515 }
1516 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1517 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1518 )))),
1519 }
1520 } else {
1521 let content = resp.text().await?;
1522 let entity: Option<EndpointsAgentsEnrollmentTokensUpdateError> = serde_json::from_str(&content).ok();
1523 Err(Error::ResponseError(ResponseContent {
1524 status,
1525 content,
1526 entity,
1527 }))
1528 }
1529}
1530
1531pub async fn endpoints_agents_enrollment_tokens_used_by_list(
1533 configuration: &configuration::Configuration,
1534 token_uuid: &str,
1535) -> Result<Vec<models::UsedBy>, Error<EndpointsAgentsEnrollmentTokensUsedByListError>> {
1536 let p_path_token_uuid = token_uuid;
1538
1539 let uri_str = format!(
1540 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/used_by/",
1541 configuration.base_path,
1542 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1543 );
1544 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1545
1546 if let Some(ref user_agent) = configuration.user_agent {
1547 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1548 }
1549 if let Some(ref token) = configuration.bearer_access_token {
1550 req_builder = req_builder.bearer_auth(token.to_owned());
1551 };
1552
1553 let req = req_builder.build()?;
1554 let resp = configuration.client.execute(req).await?;
1555
1556 let status = resp.status();
1557 let content_type = resp
1558 .headers()
1559 .get("content-type")
1560 .and_then(|v| v.to_str().ok())
1561 .unwrap_or("application/octet-stream");
1562 let content_type = super::ContentType::from(content_type);
1563
1564 if !status.is_client_error() && !status.is_server_error() {
1565 let content = resp.text().await?;
1566 match content_type {
1567 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1568 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1569 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1570 }
1571 } else {
1572 let content = resp.text().await?;
1573 let entity: Option<EndpointsAgentsEnrollmentTokensUsedByListError> = serde_json::from_str(&content).ok();
1574 Err(Error::ResponseError(ResponseContent {
1575 status,
1576 content,
1577 entity,
1578 }))
1579 }
1580}
1581
1582pub async fn endpoints_agents_enrollment_tokens_view_key_retrieve(
1584 configuration: &configuration::Configuration,
1585 token_uuid: &str,
1586) -> Result<models::TokenView, Error<EndpointsAgentsEnrollmentTokensViewKeyRetrieveError>> {
1587 let p_path_token_uuid = token_uuid;
1589
1590 let uri_str = format!(
1591 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/view_key/",
1592 configuration.base_path,
1593 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1594 );
1595 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1596
1597 if let Some(ref user_agent) = configuration.user_agent {
1598 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1599 }
1600 if let Some(ref token) = configuration.bearer_access_token {
1601 req_builder = req_builder.bearer_auth(token.to_owned());
1602 };
1603
1604 let req = req_builder.build()?;
1605 let resp = configuration.client.execute(req).await?;
1606
1607 let status = resp.status();
1608 let content_type = resp
1609 .headers()
1610 .get("content-type")
1611 .and_then(|v| v.to_str().ok())
1612 .unwrap_or("application/octet-stream");
1613 let content_type = super::ContentType::from(content_type);
1614
1615 if !status.is_client_error() && !status.is_server_error() {
1616 let content = resp.text().await?;
1617 match content_type {
1618 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1619 ContentType::Text => {
1620 return Err(Error::from(serde_json::Error::custom(
1621 "Received `text/plain` content type response that cannot be converted to `models::TokenView`",
1622 )))
1623 }
1624 ContentType::Unsupported(unknown_type) => {
1625 return Err(Error::from(serde_json::Error::custom(format!(
1626 "Received `{unknown_type}` content type response that cannot be converted to `models::TokenView`"
1627 ))))
1628 }
1629 }
1630 } else {
1631 let content = resp.text().await?;
1632 let entity: Option<EndpointsAgentsEnrollmentTokensViewKeyRetrieveError> = serde_json::from_str(&content).ok();
1633 Err(Error::ResponseError(ResponseContent {
1634 status,
1635 content,
1636 entity,
1637 }))
1638 }
1639}
1640
1641pub async fn endpoints_agents_psso_register_device_create(
1642 configuration: &configuration::Configuration,
1643 agent_psso_device_registration_request: models::AgentPssoDeviceRegistrationRequest,
1644) -> Result<models::AgentPssoDeviceRegistrationResponse, Error<EndpointsAgentsPssoRegisterDeviceCreateError>> {
1645 let p_body_agent_psso_device_registration_request = agent_psso_device_registration_request;
1647
1648 let uri_str = format!("{}/endpoints/agents/psso/register/device/", configuration.base_path);
1649 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1650
1651 if let Some(ref user_agent) = configuration.user_agent {
1652 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1653 }
1654 req_builder = req_builder.json(&p_body_agent_psso_device_registration_request);
1655
1656 let req = req_builder.build()?;
1657 let resp = configuration.client.execute(req).await?;
1658
1659 let status = resp.status();
1660 let content_type = resp
1661 .headers()
1662 .get("content-type")
1663 .and_then(|v| v.to_str().ok())
1664 .unwrap_or("application/octet-stream");
1665 let content_type = super::ContentType::from(content_type);
1666
1667 if !status.is_client_error() && !status.is_server_error() {
1668 let content = resp.text().await?;
1669 match content_type {
1670 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1671 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentPssoDeviceRegistrationResponse`"))),
1672 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AgentPssoDeviceRegistrationResponse`")))),
1673 }
1674 } else {
1675 let content = resp.text().await?;
1676 let entity: Option<EndpointsAgentsPssoRegisterDeviceCreateError> = serde_json::from_str(&content).ok();
1677 Err(Error::ResponseError(ResponseContent {
1678 status,
1679 content,
1680 entity,
1681 }))
1682 }
1683}
1684
1685pub async fn endpoints_agents_psso_register_user_create(
1686 configuration: &configuration::Configuration,
1687 agent_psso_user_registration_request: models::AgentPssoUserRegistrationRequest,
1688) -> Result<models::UserSelf, Error<EndpointsAgentsPssoRegisterUserCreateError>> {
1689 let p_body_agent_psso_user_registration_request = agent_psso_user_registration_request;
1691
1692 let uri_str = format!("{}/endpoints/agents/psso/register/user/", configuration.base_path);
1693 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1694
1695 if let Some(ref user_agent) = configuration.user_agent {
1696 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1697 }
1698 req_builder = req_builder.json(&p_body_agent_psso_user_registration_request);
1699
1700 let req = req_builder.build()?;
1701 let resp = configuration.client.execute(req).await?;
1702
1703 let status = resp.status();
1704 let content_type = resp
1705 .headers()
1706 .get("content-type")
1707 .and_then(|v| v.to_str().ok())
1708 .unwrap_or("application/octet-stream");
1709 let content_type = super::ContentType::from(content_type);
1710
1711 if !status.is_client_error() && !status.is_server_error() {
1712 let content = resp.text().await?;
1713 match content_type {
1714 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1715 ContentType::Text => {
1716 return Err(Error::from(serde_json::Error::custom(
1717 "Received `text/plain` content type response that cannot be converted to `models::UserSelf`",
1718 )))
1719 }
1720 ContentType::Unsupported(unknown_type) => {
1721 return Err(Error::from(serde_json::Error::custom(format!(
1722 "Received `{unknown_type}` content type response that cannot be converted to `models::UserSelf`"
1723 ))))
1724 }
1725 }
1726 } else {
1727 let content = resp.text().await?;
1728 let entity: Option<EndpointsAgentsPssoRegisterUserCreateError> = serde_json::from_str(&content).ok();
1729 Err(Error::ResponseError(ResponseContent {
1730 status,
1731 content,
1732 entity,
1733 }))
1734 }
1735}
1736
1737pub async fn endpoints_connectors_destroy(
1739 configuration: &configuration::Configuration,
1740 connector_uuid: &str,
1741) -> Result<(), Error<EndpointsConnectorsDestroyError>> {
1742 let p_path_connector_uuid = connector_uuid;
1744
1745 let uri_str = format!(
1746 "{}/endpoints/connectors/{connector_uuid}/",
1747 configuration.base_path,
1748 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1749 );
1750 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1751
1752 if let Some(ref user_agent) = configuration.user_agent {
1753 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1754 }
1755 if let Some(ref token) = configuration.bearer_access_token {
1756 req_builder = req_builder.bearer_auth(token.to_owned());
1757 };
1758
1759 let req = req_builder.build()?;
1760 let resp = configuration.client.execute(req).await?;
1761
1762 let status = resp.status();
1763
1764 if !status.is_client_error() && !status.is_server_error() {
1765 Ok(())
1766 } else {
1767 let content = resp.text().await?;
1768 let entity: Option<EndpointsConnectorsDestroyError> = serde_json::from_str(&content).ok();
1769 Err(Error::ResponseError(ResponseContent {
1770 status,
1771 content,
1772 entity,
1773 }))
1774 }
1775}
1776
1777pub async fn endpoints_connectors_list(
1779 configuration: &configuration::Configuration,
1780 ordering: Option<&str>,
1781 page: Option<i32>,
1782 page_size: Option<i32>,
1783 search: Option<&str>,
1784) -> Result<models::PaginatedConnectorList, Error<EndpointsConnectorsListError>> {
1785 let p_query_ordering = ordering;
1787 let p_query_page = page;
1788 let p_query_page_size = page_size;
1789 let p_query_search = search;
1790
1791 let uri_str = format!("{}/endpoints/connectors/", configuration.base_path);
1792 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1793
1794 if let Some(ref param_value) = p_query_ordering {
1795 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1796 }
1797 if let Some(ref param_value) = p_query_page {
1798 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1799 }
1800 if let Some(ref param_value) = p_query_page_size {
1801 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1802 }
1803 if let Some(ref param_value) = p_query_search {
1804 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1805 }
1806 if let Some(ref user_agent) = configuration.user_agent {
1807 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1808 }
1809 if let Some(ref token) = configuration.bearer_access_token {
1810 req_builder = req_builder.bearer_auth(token.to_owned());
1811 };
1812
1813 let req = req_builder.build()?;
1814 let resp = configuration.client.execute(req).await?;
1815
1816 let status = resp.status();
1817 let content_type = resp
1818 .headers()
1819 .get("content-type")
1820 .and_then(|v| v.to_str().ok())
1821 .unwrap_or("application/octet-stream");
1822 let content_type = super::ContentType::from(content_type);
1823
1824 if !status.is_client_error() && !status.is_server_error() {
1825 let content = resp.text().await?;
1826 match content_type {
1827 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1828 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedConnectorList`"))),
1829 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedConnectorList`")))),
1830 }
1831 } else {
1832 let content = resp.text().await?;
1833 let entity: Option<EndpointsConnectorsListError> = serde_json::from_str(&content).ok();
1834 Err(Error::ResponseError(ResponseContent {
1835 status,
1836 content,
1837 entity,
1838 }))
1839 }
1840}
1841
1842pub async fn endpoints_connectors_retrieve(
1844 configuration: &configuration::Configuration,
1845 connector_uuid: &str,
1846) -> Result<models::Connector, Error<EndpointsConnectorsRetrieveError>> {
1847 let p_path_connector_uuid = connector_uuid;
1849
1850 let uri_str = format!(
1851 "{}/endpoints/connectors/{connector_uuid}/",
1852 configuration.base_path,
1853 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1854 );
1855 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1856
1857 if let Some(ref user_agent) = configuration.user_agent {
1858 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1859 }
1860 if let Some(ref token) = configuration.bearer_access_token {
1861 req_builder = req_builder.bearer_auth(token.to_owned());
1862 };
1863
1864 let req = req_builder.build()?;
1865 let resp = configuration.client.execute(req).await?;
1866
1867 let status = resp.status();
1868 let content_type = resp
1869 .headers()
1870 .get("content-type")
1871 .and_then(|v| v.to_str().ok())
1872 .unwrap_or("application/octet-stream");
1873 let content_type = super::ContentType::from(content_type);
1874
1875 if !status.is_client_error() && !status.is_server_error() {
1876 let content = resp.text().await?;
1877 match content_type {
1878 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1879 ContentType::Text => {
1880 return Err(Error::from(serde_json::Error::custom(
1881 "Received `text/plain` content type response that cannot be converted to `models::Connector`",
1882 )))
1883 }
1884 ContentType::Unsupported(unknown_type) => {
1885 return Err(Error::from(serde_json::Error::custom(format!(
1886 "Received `{unknown_type}` content type response that cannot be converted to `models::Connector`"
1887 ))))
1888 }
1889 }
1890 } else {
1891 let content = resp.text().await?;
1892 let entity: Option<EndpointsConnectorsRetrieveError> = serde_json::from_str(&content).ok();
1893 Err(Error::ResponseError(ResponseContent {
1894 status,
1895 content,
1896 entity,
1897 }))
1898 }
1899}
1900
1901pub async fn endpoints_connectors_types_list(
1903 configuration: &configuration::Configuration,
1904) -> Result<Vec<models::TypeCreate>, Error<EndpointsConnectorsTypesListError>> {
1905 let uri_str = format!("{}/endpoints/connectors/types/", configuration.base_path);
1906 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1907
1908 if let Some(ref user_agent) = configuration.user_agent {
1909 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1910 }
1911 if let Some(ref token) = configuration.bearer_access_token {
1912 req_builder = req_builder.bearer_auth(token.to_owned());
1913 };
1914
1915 let req = req_builder.build()?;
1916 let resp = configuration.client.execute(req).await?;
1917
1918 let status = resp.status();
1919 let content_type = resp
1920 .headers()
1921 .get("content-type")
1922 .and_then(|v| v.to_str().ok())
1923 .unwrap_or("application/octet-stream");
1924 let content_type = super::ContentType::from(content_type);
1925
1926 if !status.is_client_error() && !status.is_server_error() {
1927 let content = resp.text().await?;
1928 match content_type {
1929 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1930 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TypeCreate>`"))),
1931 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TypeCreate>`")))),
1932 }
1933 } else {
1934 let content = resp.text().await?;
1935 let entity: Option<EndpointsConnectorsTypesListError> = serde_json::from_str(&content).ok();
1936 Err(Error::ResponseError(ResponseContent {
1937 status,
1938 content,
1939 entity,
1940 }))
1941 }
1942}
1943
1944pub async fn endpoints_connectors_used_by_list(
1946 configuration: &configuration::Configuration,
1947 connector_uuid: &str,
1948) -> Result<Vec<models::UsedBy>, Error<EndpointsConnectorsUsedByListError>> {
1949 let p_path_connector_uuid = connector_uuid;
1951
1952 let uri_str = format!(
1953 "{}/endpoints/connectors/{connector_uuid}/used_by/",
1954 configuration.base_path,
1955 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1956 );
1957 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1958
1959 if let Some(ref user_agent) = configuration.user_agent {
1960 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1961 }
1962 if let Some(ref token) = configuration.bearer_access_token {
1963 req_builder = req_builder.bearer_auth(token.to_owned());
1964 };
1965
1966 let req = req_builder.build()?;
1967 let resp = configuration.client.execute(req).await?;
1968
1969 let status = resp.status();
1970 let content_type = resp
1971 .headers()
1972 .get("content-type")
1973 .and_then(|v| v.to_str().ok())
1974 .unwrap_or("application/octet-stream");
1975 let content_type = super::ContentType::from(content_type);
1976
1977 if !status.is_client_error() && !status.is_server_error() {
1978 let content = resp.text().await?;
1979 match content_type {
1980 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1981 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1982 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1983 }
1984 } else {
1985 let content = resp.text().await?;
1986 let entity: Option<EndpointsConnectorsUsedByListError> = serde_json::from_str(&content).ok();
1987 Err(Error::ResponseError(ResponseContent {
1988 status,
1989 content,
1990 entity,
1991 }))
1992 }
1993}
1994
1995pub async fn endpoints_device_access_groups_create(
1997 configuration: &configuration::Configuration,
1998 device_access_group_request: models::DeviceAccessGroupRequest,
1999) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsCreateError>> {
2000 let p_body_device_access_group_request = device_access_group_request;
2002
2003 let uri_str = format!("{}/endpoints/device_access_groups/", configuration.base_path);
2004 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2005
2006 if let Some(ref user_agent) = configuration.user_agent {
2007 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2008 }
2009 if let Some(ref token) = configuration.bearer_access_token {
2010 req_builder = req_builder.bearer_auth(token.to_owned());
2011 };
2012 req_builder = req_builder.json(&p_body_device_access_group_request);
2013
2014 let req = req_builder.build()?;
2015 let resp = configuration.client.execute(req).await?;
2016
2017 let status = resp.status();
2018 let content_type = resp
2019 .headers()
2020 .get("content-type")
2021 .and_then(|v| v.to_str().ok())
2022 .unwrap_or("application/octet-stream");
2023 let content_type = super::ContentType::from(content_type);
2024
2025 if !status.is_client_error() && !status.is_server_error() {
2026 let content = resp.text().await?;
2027 match content_type {
2028 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2029 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2030 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceAccessGroup`")))),
2031 }
2032 } else {
2033 let content = resp.text().await?;
2034 let entity: Option<EndpointsDeviceAccessGroupsCreateError> = serde_json::from_str(&content).ok();
2035 Err(Error::ResponseError(ResponseContent {
2036 status,
2037 content,
2038 entity,
2039 }))
2040 }
2041}
2042
2043pub async fn endpoints_device_access_groups_destroy(
2045 configuration: &configuration::Configuration,
2046 pbm_uuid: &str,
2047) -> Result<(), Error<EndpointsDeviceAccessGroupsDestroyError>> {
2048 let p_path_pbm_uuid = pbm_uuid;
2050
2051 let uri_str = format!(
2052 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2053 configuration.base_path,
2054 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2055 );
2056 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2057
2058 if let Some(ref user_agent) = configuration.user_agent {
2059 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2060 }
2061 if let Some(ref token) = configuration.bearer_access_token {
2062 req_builder = req_builder.bearer_auth(token.to_owned());
2063 };
2064
2065 let req = req_builder.build()?;
2066 let resp = configuration.client.execute(req).await?;
2067
2068 let status = resp.status();
2069
2070 if !status.is_client_error() && !status.is_server_error() {
2071 Ok(())
2072 } else {
2073 let content = resp.text().await?;
2074 let entity: Option<EndpointsDeviceAccessGroupsDestroyError> = serde_json::from_str(&content).ok();
2075 Err(Error::ResponseError(ResponseContent {
2076 status,
2077 content,
2078 entity,
2079 }))
2080 }
2081}
2082
2083pub async fn endpoints_device_access_groups_list(
2085 configuration: &configuration::Configuration,
2086 name: Option<&str>,
2087 ordering: Option<&str>,
2088 page: Option<i32>,
2089 page_size: Option<i32>,
2090 pbm_uuid: Option<&str>,
2091 search: Option<&str>,
2092) -> Result<models::PaginatedDeviceAccessGroupList, Error<EndpointsDeviceAccessGroupsListError>> {
2093 let p_query_name = name;
2095 let p_query_ordering = ordering;
2096 let p_query_page = page;
2097 let p_query_page_size = page_size;
2098 let p_query_pbm_uuid = pbm_uuid;
2099 let p_query_search = search;
2100
2101 let uri_str = format!("{}/endpoints/device_access_groups/", configuration.base_path);
2102 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2103
2104 if let Some(ref param_value) = p_query_name {
2105 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2106 }
2107 if let Some(ref param_value) = p_query_ordering {
2108 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2109 }
2110 if let Some(ref param_value) = p_query_page {
2111 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2112 }
2113 if let Some(ref param_value) = p_query_page_size {
2114 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2115 }
2116 if let Some(ref param_value) = p_query_pbm_uuid {
2117 req_builder = req_builder.query(&[("pbm_uuid", ¶m_value.to_string())]);
2118 }
2119 if let Some(ref param_value) = p_query_search {
2120 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2121 }
2122 if let Some(ref user_agent) = configuration.user_agent {
2123 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2124 }
2125 if let Some(ref token) = configuration.bearer_access_token {
2126 req_builder = req_builder.bearer_auth(token.to_owned());
2127 };
2128
2129 let req = req_builder.build()?;
2130 let resp = configuration.client.execute(req).await?;
2131
2132 let status = resp.status();
2133 let content_type = resp
2134 .headers()
2135 .get("content-type")
2136 .and_then(|v| v.to_str().ok())
2137 .unwrap_or("application/octet-stream");
2138 let content_type = super::ContentType::from(content_type);
2139
2140 if !status.is_client_error() && !status.is_server_error() {
2141 let content = resp.text().await?;
2142 match content_type {
2143 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2144 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDeviceAccessGroupList`"))),
2145 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedDeviceAccessGroupList`")))),
2146 }
2147 } else {
2148 let content = resp.text().await?;
2149 let entity: Option<EndpointsDeviceAccessGroupsListError> = serde_json::from_str(&content).ok();
2150 Err(Error::ResponseError(ResponseContent {
2151 status,
2152 content,
2153 entity,
2154 }))
2155 }
2156}
2157
2158pub async fn endpoints_device_access_groups_partial_update(
2160 configuration: &configuration::Configuration,
2161 pbm_uuid: &str,
2162 patched_device_access_group_request: Option<models::PatchedDeviceAccessGroupRequest>,
2163) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsPartialUpdateError>> {
2164 let p_path_pbm_uuid = pbm_uuid;
2166 let p_body_patched_device_access_group_request = patched_device_access_group_request;
2167
2168 let uri_str = format!(
2169 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2170 configuration.base_path,
2171 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2172 );
2173 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2174
2175 if let Some(ref user_agent) = configuration.user_agent {
2176 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2177 }
2178 if let Some(ref token) = configuration.bearer_access_token {
2179 req_builder = req_builder.bearer_auth(token.to_owned());
2180 };
2181 req_builder = req_builder.json(&p_body_patched_device_access_group_request);
2182
2183 let req = req_builder.build()?;
2184 let resp = configuration.client.execute(req).await?;
2185
2186 let status = resp.status();
2187 let content_type = resp
2188 .headers()
2189 .get("content-type")
2190 .and_then(|v| v.to_str().ok())
2191 .unwrap_or("application/octet-stream");
2192 let content_type = super::ContentType::from(content_type);
2193
2194 if !status.is_client_error() && !status.is_server_error() {
2195 let content = resp.text().await?;
2196 match content_type {
2197 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2198 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2199 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceAccessGroup`")))),
2200 }
2201 } else {
2202 let content = resp.text().await?;
2203 let entity: Option<EndpointsDeviceAccessGroupsPartialUpdateError> = serde_json::from_str(&content).ok();
2204 Err(Error::ResponseError(ResponseContent {
2205 status,
2206 content,
2207 entity,
2208 }))
2209 }
2210}
2211
2212pub async fn endpoints_device_access_groups_retrieve(
2214 configuration: &configuration::Configuration,
2215 pbm_uuid: &str,
2216) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsRetrieveError>> {
2217 let p_path_pbm_uuid = pbm_uuid;
2219
2220 let uri_str = format!(
2221 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2222 configuration.base_path,
2223 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2224 );
2225 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2226
2227 if let Some(ref user_agent) = configuration.user_agent {
2228 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2229 }
2230 if let Some(ref token) = configuration.bearer_access_token {
2231 req_builder = req_builder.bearer_auth(token.to_owned());
2232 };
2233
2234 let req = req_builder.build()?;
2235 let resp = configuration.client.execute(req).await?;
2236
2237 let status = resp.status();
2238 let content_type = resp
2239 .headers()
2240 .get("content-type")
2241 .and_then(|v| v.to_str().ok())
2242 .unwrap_or("application/octet-stream");
2243 let content_type = super::ContentType::from(content_type);
2244
2245 if !status.is_client_error() && !status.is_server_error() {
2246 let content = resp.text().await?;
2247 match content_type {
2248 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2249 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2250 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceAccessGroup`")))),
2251 }
2252 } else {
2253 let content = resp.text().await?;
2254 let entity: Option<EndpointsDeviceAccessGroupsRetrieveError> = serde_json::from_str(&content).ok();
2255 Err(Error::ResponseError(ResponseContent {
2256 status,
2257 content,
2258 entity,
2259 }))
2260 }
2261}
2262
2263pub async fn endpoints_device_access_groups_update(
2265 configuration: &configuration::Configuration,
2266 pbm_uuid: &str,
2267 device_access_group_request: models::DeviceAccessGroupRequest,
2268) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsUpdateError>> {
2269 let p_path_pbm_uuid = pbm_uuid;
2271 let p_body_device_access_group_request = device_access_group_request;
2272
2273 let uri_str = format!(
2274 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2275 configuration.base_path,
2276 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2277 );
2278 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2279
2280 if let Some(ref user_agent) = configuration.user_agent {
2281 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2282 }
2283 if let Some(ref token) = configuration.bearer_access_token {
2284 req_builder = req_builder.bearer_auth(token.to_owned());
2285 };
2286 req_builder = req_builder.json(&p_body_device_access_group_request);
2287
2288 let req = req_builder.build()?;
2289 let resp = configuration.client.execute(req).await?;
2290
2291 let status = resp.status();
2292 let content_type = resp
2293 .headers()
2294 .get("content-type")
2295 .and_then(|v| v.to_str().ok())
2296 .unwrap_or("application/octet-stream");
2297 let content_type = super::ContentType::from(content_type);
2298
2299 if !status.is_client_error() && !status.is_server_error() {
2300 let content = resp.text().await?;
2301 match content_type {
2302 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2303 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2304 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceAccessGroup`")))),
2305 }
2306 } else {
2307 let content = resp.text().await?;
2308 let entity: Option<EndpointsDeviceAccessGroupsUpdateError> = serde_json::from_str(&content).ok();
2309 Err(Error::ResponseError(ResponseContent {
2310 status,
2311 content,
2312 entity,
2313 }))
2314 }
2315}
2316
2317pub async fn endpoints_device_access_groups_used_by_list(
2319 configuration: &configuration::Configuration,
2320 pbm_uuid: &str,
2321) -> Result<Vec<models::UsedBy>, Error<EndpointsDeviceAccessGroupsUsedByListError>> {
2322 let p_path_pbm_uuid = pbm_uuid;
2324
2325 let uri_str = format!(
2326 "{}/endpoints/device_access_groups/{pbm_uuid}/used_by/",
2327 configuration.base_path,
2328 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2329 );
2330 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2331
2332 if let Some(ref user_agent) = configuration.user_agent {
2333 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2334 }
2335 if let Some(ref token) = configuration.bearer_access_token {
2336 req_builder = req_builder.bearer_auth(token.to_owned());
2337 };
2338
2339 let req = req_builder.build()?;
2340 let resp = configuration.client.execute(req).await?;
2341
2342 let status = resp.status();
2343 let content_type = resp
2344 .headers()
2345 .get("content-type")
2346 .and_then(|v| v.to_str().ok())
2347 .unwrap_or("application/octet-stream");
2348 let content_type = super::ContentType::from(content_type);
2349
2350 if !status.is_client_error() && !status.is_server_error() {
2351 let content = resp.text().await?;
2352 match content_type {
2353 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2354 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2355 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
2356 }
2357 } else {
2358 let content = resp.text().await?;
2359 let entity: Option<EndpointsDeviceAccessGroupsUsedByListError> = serde_json::from_str(&content).ok();
2360 Err(Error::ResponseError(ResponseContent {
2361 status,
2362 content,
2363 entity,
2364 }))
2365 }
2366}
2367
2368pub async fn endpoints_device_bindings_create(
2370 configuration: &configuration::Configuration,
2371 device_user_binding_request: models::DeviceUserBindingRequest,
2372) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsCreateError>> {
2373 let p_body_device_user_binding_request = device_user_binding_request;
2375
2376 let uri_str = format!("{}/endpoints/device_bindings/", configuration.base_path);
2377 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2378
2379 if let Some(ref user_agent) = configuration.user_agent {
2380 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2381 }
2382 if let Some(ref token) = configuration.bearer_access_token {
2383 req_builder = req_builder.bearer_auth(token.to_owned());
2384 };
2385 req_builder = req_builder.json(&p_body_device_user_binding_request);
2386
2387 let req = req_builder.build()?;
2388 let resp = configuration.client.execute(req).await?;
2389
2390 let status = resp.status();
2391 let content_type = resp
2392 .headers()
2393 .get("content-type")
2394 .and_then(|v| v.to_str().ok())
2395 .unwrap_or("application/octet-stream");
2396 let content_type = super::ContentType::from(content_type);
2397
2398 if !status.is_client_error() && !status.is_server_error() {
2399 let content = resp.text().await?;
2400 match content_type {
2401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2403 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceUserBinding`")))),
2404 }
2405 } else {
2406 let content = resp.text().await?;
2407 let entity: Option<EndpointsDeviceBindingsCreateError> = serde_json::from_str(&content).ok();
2408 Err(Error::ResponseError(ResponseContent {
2409 status,
2410 content,
2411 entity,
2412 }))
2413 }
2414}
2415
2416pub async fn endpoints_device_bindings_destroy(
2418 configuration: &configuration::Configuration,
2419 policy_binding_uuid: &str,
2420) -> Result<(), Error<EndpointsDeviceBindingsDestroyError>> {
2421 let p_path_policy_binding_uuid = policy_binding_uuid;
2423
2424 let uri_str = format!(
2425 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2426 configuration.base_path,
2427 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2428 );
2429 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2430
2431 if let Some(ref user_agent) = configuration.user_agent {
2432 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2433 }
2434 if let Some(ref token) = configuration.bearer_access_token {
2435 req_builder = req_builder.bearer_auth(token.to_owned());
2436 };
2437
2438 let req = req_builder.build()?;
2439 let resp = configuration.client.execute(req).await?;
2440
2441 let status = resp.status();
2442
2443 if !status.is_client_error() && !status.is_server_error() {
2444 Ok(())
2445 } else {
2446 let content = resp.text().await?;
2447 let entity: Option<EndpointsDeviceBindingsDestroyError> = serde_json::from_str(&content).ok();
2448 Err(Error::ResponseError(ResponseContent {
2449 status,
2450 content,
2451 entity,
2452 }))
2453 }
2454}
2455
2456pub async fn endpoints_device_bindings_list(
2458 configuration: &configuration::Configuration,
2459 enabled: Option<bool>,
2460 order: Option<i32>,
2461 ordering: Option<&str>,
2462 page: Option<i32>,
2463 page_size: Option<i32>,
2464 policy: Option<&str>,
2465 policy__isnull: Option<bool>,
2466 search: Option<&str>,
2467 target: Option<&str>,
2468 target_in: Option<Vec<uuid::Uuid>>,
2469 timeout: Option<i32>,
2470) -> Result<models::PaginatedDeviceUserBindingList, Error<EndpointsDeviceBindingsListError>> {
2471 let p_query_enabled = enabled;
2473 let p_query_order = order;
2474 let p_query_ordering = ordering;
2475 let p_query_page = page;
2476 let p_query_page_size = page_size;
2477 let p_query_policy = policy;
2478 let p_query_policy__isnull = policy__isnull;
2479 let p_query_search = search;
2480 let p_query_target = target;
2481 let p_query_target_in = target_in;
2482 let p_query_timeout = timeout;
2483
2484 let uri_str = format!("{}/endpoints/device_bindings/", configuration.base_path);
2485 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2486
2487 if let Some(ref param_value) = p_query_enabled {
2488 req_builder = req_builder.query(&[("enabled", ¶m_value.to_string())]);
2489 }
2490 if let Some(ref param_value) = p_query_order {
2491 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
2492 }
2493 if let Some(ref param_value) = p_query_ordering {
2494 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2495 }
2496 if let Some(ref param_value) = p_query_page {
2497 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2498 }
2499 if let Some(ref param_value) = p_query_page_size {
2500 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2501 }
2502 if let Some(ref param_value) = p_query_policy {
2503 req_builder = req_builder.query(&[("policy", ¶m_value.to_string())]);
2504 }
2505 if let Some(ref param_value) = p_query_policy__isnull {
2506 req_builder = req_builder.query(&[("policy__isnull", ¶m_value.to_string())]);
2507 }
2508 if let Some(ref param_value) = p_query_search {
2509 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2510 }
2511 if let Some(ref param_value) = p_query_target {
2512 req_builder = req_builder.query(&[("target", ¶m_value.to_string())]);
2513 }
2514 if let Some(ref param_value) = p_query_target_in {
2515 req_builder = match "multi" {
2516 "multi" => req_builder.query(
2517 ¶m_value
2518 .into_iter()
2519 .map(|p| ("target_in".to_owned(), p.to_string()))
2520 .collect::<Vec<(std::string::String, std::string::String)>>(),
2521 ),
2522 _ => req_builder.query(&[(
2523 "target_in",
2524 ¶m_value
2525 .into_iter()
2526 .map(|p| p.to_string())
2527 .collect::<Vec<String>>()
2528 .join(",")
2529 .to_string(),
2530 )]),
2531 };
2532 }
2533 if let Some(ref param_value) = p_query_timeout {
2534 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
2535 }
2536 if let Some(ref user_agent) = configuration.user_agent {
2537 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2538 }
2539 if let Some(ref token) = configuration.bearer_access_token {
2540 req_builder = req_builder.bearer_auth(token.to_owned());
2541 };
2542
2543 let req = req_builder.build()?;
2544 let resp = configuration.client.execute(req).await?;
2545
2546 let status = resp.status();
2547 let content_type = resp
2548 .headers()
2549 .get("content-type")
2550 .and_then(|v| v.to_str().ok())
2551 .unwrap_or("application/octet-stream");
2552 let content_type = super::ContentType::from(content_type);
2553
2554 if !status.is_client_error() && !status.is_server_error() {
2555 let content = resp.text().await?;
2556 match content_type {
2557 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2558 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDeviceUserBindingList`"))),
2559 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedDeviceUserBindingList`")))),
2560 }
2561 } else {
2562 let content = resp.text().await?;
2563 let entity: Option<EndpointsDeviceBindingsListError> = serde_json::from_str(&content).ok();
2564 Err(Error::ResponseError(ResponseContent {
2565 status,
2566 content,
2567 entity,
2568 }))
2569 }
2570}
2571
2572pub async fn endpoints_device_bindings_partial_update(
2574 configuration: &configuration::Configuration,
2575 policy_binding_uuid: &str,
2576 patched_device_user_binding_request: Option<models::PatchedDeviceUserBindingRequest>,
2577) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsPartialUpdateError>> {
2578 let p_path_policy_binding_uuid = policy_binding_uuid;
2580 let p_body_patched_device_user_binding_request = patched_device_user_binding_request;
2581
2582 let uri_str = format!(
2583 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2584 configuration.base_path,
2585 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2586 );
2587 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2588
2589 if let Some(ref user_agent) = configuration.user_agent {
2590 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2591 }
2592 if let Some(ref token) = configuration.bearer_access_token {
2593 req_builder = req_builder.bearer_auth(token.to_owned());
2594 };
2595 req_builder = req_builder.json(&p_body_patched_device_user_binding_request);
2596
2597 let req = req_builder.build()?;
2598 let resp = configuration.client.execute(req).await?;
2599
2600 let status = resp.status();
2601 let content_type = resp
2602 .headers()
2603 .get("content-type")
2604 .and_then(|v| v.to_str().ok())
2605 .unwrap_or("application/octet-stream");
2606 let content_type = super::ContentType::from(content_type);
2607
2608 if !status.is_client_error() && !status.is_server_error() {
2609 let content = resp.text().await?;
2610 match content_type {
2611 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2612 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2613 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceUserBinding`")))),
2614 }
2615 } else {
2616 let content = resp.text().await?;
2617 let entity: Option<EndpointsDeviceBindingsPartialUpdateError> = serde_json::from_str(&content).ok();
2618 Err(Error::ResponseError(ResponseContent {
2619 status,
2620 content,
2621 entity,
2622 }))
2623 }
2624}
2625
2626pub async fn endpoints_device_bindings_retrieve(
2628 configuration: &configuration::Configuration,
2629 policy_binding_uuid: &str,
2630) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsRetrieveError>> {
2631 let p_path_policy_binding_uuid = policy_binding_uuid;
2633
2634 let uri_str = format!(
2635 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2636 configuration.base_path,
2637 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2638 );
2639 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2640
2641 if let Some(ref user_agent) = configuration.user_agent {
2642 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2643 }
2644 if let Some(ref token) = configuration.bearer_access_token {
2645 req_builder = req_builder.bearer_auth(token.to_owned());
2646 };
2647
2648 let req = req_builder.build()?;
2649 let resp = configuration.client.execute(req).await?;
2650
2651 let status = resp.status();
2652 let content_type = resp
2653 .headers()
2654 .get("content-type")
2655 .and_then(|v| v.to_str().ok())
2656 .unwrap_or("application/octet-stream");
2657 let content_type = super::ContentType::from(content_type);
2658
2659 if !status.is_client_error() && !status.is_server_error() {
2660 let content = resp.text().await?;
2661 match content_type {
2662 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2663 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2664 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceUserBinding`")))),
2665 }
2666 } else {
2667 let content = resp.text().await?;
2668 let entity: Option<EndpointsDeviceBindingsRetrieveError> = serde_json::from_str(&content).ok();
2669 Err(Error::ResponseError(ResponseContent {
2670 status,
2671 content,
2672 entity,
2673 }))
2674 }
2675}
2676
2677pub async fn endpoints_device_bindings_update(
2679 configuration: &configuration::Configuration,
2680 policy_binding_uuid: &str,
2681 device_user_binding_request: models::DeviceUserBindingRequest,
2682) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsUpdateError>> {
2683 let p_path_policy_binding_uuid = policy_binding_uuid;
2685 let p_body_device_user_binding_request = device_user_binding_request;
2686
2687 let uri_str = format!(
2688 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2689 configuration.base_path,
2690 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2691 );
2692 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2693
2694 if let Some(ref user_agent) = configuration.user_agent {
2695 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2696 }
2697 if let Some(ref token) = configuration.bearer_access_token {
2698 req_builder = req_builder.bearer_auth(token.to_owned());
2699 };
2700 req_builder = req_builder.json(&p_body_device_user_binding_request);
2701
2702 let req = req_builder.build()?;
2703 let resp = configuration.client.execute(req).await?;
2704
2705 let status = resp.status();
2706 let content_type = resp
2707 .headers()
2708 .get("content-type")
2709 .and_then(|v| v.to_str().ok())
2710 .unwrap_or("application/octet-stream");
2711 let content_type = super::ContentType::from(content_type);
2712
2713 if !status.is_client_error() && !status.is_server_error() {
2714 let content = resp.text().await?;
2715 match content_type {
2716 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2717 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2718 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceUserBinding`")))),
2719 }
2720 } else {
2721 let content = resp.text().await?;
2722 let entity: Option<EndpointsDeviceBindingsUpdateError> = serde_json::from_str(&content).ok();
2723 Err(Error::ResponseError(ResponseContent {
2724 status,
2725 content,
2726 entity,
2727 }))
2728 }
2729}
2730
2731pub async fn endpoints_device_bindings_used_by_list(
2733 configuration: &configuration::Configuration,
2734 policy_binding_uuid: &str,
2735) -> Result<Vec<models::UsedBy>, Error<EndpointsDeviceBindingsUsedByListError>> {
2736 let p_path_policy_binding_uuid = policy_binding_uuid;
2738
2739 let uri_str = format!(
2740 "{}/endpoints/device_bindings/{policy_binding_uuid}/used_by/",
2741 configuration.base_path,
2742 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2743 );
2744 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2745
2746 if let Some(ref user_agent) = configuration.user_agent {
2747 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2748 }
2749 if let Some(ref token) = configuration.bearer_access_token {
2750 req_builder = req_builder.bearer_auth(token.to_owned());
2751 };
2752
2753 let req = req_builder.build()?;
2754 let resp = configuration.client.execute(req).await?;
2755
2756 let status = resp.status();
2757 let content_type = resp
2758 .headers()
2759 .get("content-type")
2760 .and_then(|v| v.to_str().ok())
2761 .unwrap_or("application/octet-stream");
2762 let content_type = super::ContentType::from(content_type);
2763
2764 if !status.is_client_error() && !status.is_server_error() {
2765 let content = resp.text().await?;
2766 match content_type {
2767 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2768 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2769 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
2770 }
2771 } else {
2772 let content = resp.text().await?;
2773 let entity: Option<EndpointsDeviceBindingsUsedByListError> = serde_json::from_str(&content).ok();
2774 Err(Error::ResponseError(ResponseContent {
2775 status,
2776 content,
2777 entity,
2778 }))
2779 }
2780}
2781
2782pub async fn endpoints_devices_destroy(
2784 configuration: &configuration::Configuration,
2785 device_uuid: &str,
2786) -> Result<(), Error<EndpointsDevicesDestroyError>> {
2787 let p_path_device_uuid = device_uuid;
2789
2790 let uri_str = format!(
2791 "{}/endpoints/devices/{device_uuid}/",
2792 configuration.base_path,
2793 device_uuid = crate::apis::urlencode(p_path_device_uuid)
2794 );
2795 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2796
2797 if let Some(ref user_agent) = configuration.user_agent {
2798 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2799 }
2800 if let Some(ref token) = configuration.bearer_access_token {
2801 req_builder = req_builder.bearer_auth(token.to_owned());
2802 };
2803
2804 let req = req_builder.build()?;
2805 let resp = configuration.client.execute(req).await?;
2806
2807 let status = resp.status();
2808
2809 if !status.is_client_error() && !status.is_server_error() {
2810 Ok(())
2811 } else {
2812 let content = resp.text().await?;
2813 let entity: Option<EndpointsDevicesDestroyError> = serde_json::from_str(&content).ok();
2814 Err(Error::ResponseError(ResponseContent {
2815 status,
2816 content,
2817 entity,
2818 }))
2819 }
2820}
2821
2822pub async fn endpoints_devices_list(
2824 configuration: &configuration::Configuration,
2825 identifier: Option<&str>,
2826 name: Option<&str>,
2827 ordering: Option<&str>,
2828 page: Option<i32>,
2829 page_size: Option<i32>,
2830 search: Option<&str>,
2831) -> Result<models::PaginatedEndpointDeviceList, Error<EndpointsDevicesListError>> {
2832 let p_query_identifier = identifier;
2834 let p_query_name = name;
2835 let p_query_ordering = ordering;
2836 let p_query_page = page;
2837 let p_query_page_size = page_size;
2838 let p_query_search = search;
2839
2840 let uri_str = format!("{}/endpoints/devices/", configuration.base_path);
2841 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2842
2843 if let Some(ref param_value) = p_query_identifier {
2844 req_builder = req_builder.query(&[("identifier", ¶m_value.to_string())]);
2845 }
2846 if let Some(ref param_value) = p_query_name {
2847 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2848 }
2849 if let Some(ref param_value) = p_query_ordering {
2850 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2851 }
2852 if let Some(ref param_value) = p_query_page {
2853 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2854 }
2855 if let Some(ref param_value) = p_query_page_size {
2856 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2857 }
2858 if let Some(ref param_value) = p_query_search {
2859 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2860 }
2861 if let Some(ref user_agent) = configuration.user_agent {
2862 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2863 }
2864 if let Some(ref token) = configuration.bearer_access_token {
2865 req_builder = req_builder.bearer_auth(token.to_owned());
2866 };
2867
2868 let req = req_builder.build()?;
2869 let resp = configuration.client.execute(req).await?;
2870
2871 let status = resp.status();
2872 let content_type = resp
2873 .headers()
2874 .get("content-type")
2875 .and_then(|v| v.to_str().ok())
2876 .unwrap_or("application/octet-stream");
2877 let content_type = super::ContentType::from(content_type);
2878
2879 if !status.is_client_error() && !status.is_server_error() {
2880 let content = resp.text().await?;
2881 match content_type {
2882 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2883 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEndpointDeviceList`"))),
2884 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedEndpointDeviceList`")))),
2885 }
2886 } else {
2887 let content = resp.text().await?;
2888 let entity: Option<EndpointsDevicesListError> = serde_json::from_str(&content).ok();
2889 Err(Error::ResponseError(ResponseContent {
2890 status,
2891 content,
2892 entity,
2893 }))
2894 }
2895}
2896
2897pub async fn endpoints_devices_partial_update(
2899 configuration: &configuration::Configuration,
2900 device_uuid: &str,
2901 patched_endpoint_device_request: Option<models::PatchedEndpointDeviceRequest>,
2902) -> Result<models::EndpointDevice, Error<EndpointsDevicesPartialUpdateError>> {
2903 let p_path_device_uuid = device_uuid;
2905 let p_body_patched_endpoint_device_request = patched_endpoint_device_request;
2906
2907 let uri_str = format!(
2908 "{}/endpoints/devices/{device_uuid}/",
2909 configuration.base_path,
2910 device_uuid = crate::apis::urlencode(p_path_device_uuid)
2911 );
2912 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2913
2914 if let Some(ref user_agent) = configuration.user_agent {
2915 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2916 }
2917 if let Some(ref token) = configuration.bearer_access_token {
2918 req_builder = req_builder.bearer_auth(token.to_owned());
2919 };
2920 req_builder = req_builder.json(&p_body_patched_endpoint_device_request);
2921
2922 let req = req_builder.build()?;
2923 let resp = configuration.client.execute(req).await?;
2924
2925 let status = resp.status();
2926 let content_type = resp
2927 .headers()
2928 .get("content-type")
2929 .and_then(|v| v.to_str().ok())
2930 .unwrap_or("application/octet-stream");
2931 let content_type = super::ContentType::from(content_type);
2932
2933 if !status.is_client_error() && !status.is_server_error() {
2934 let content = resp.text().await?;
2935 match content_type {
2936 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2937 ContentType::Text => {
2938 return Err(Error::from(serde_json::Error::custom(
2939 "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
2940 )))
2941 }
2942 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2943 "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
2944 )))),
2945 }
2946 } else {
2947 let content = resp.text().await?;
2948 let entity: Option<EndpointsDevicesPartialUpdateError> = serde_json::from_str(&content).ok();
2949 Err(Error::ResponseError(ResponseContent {
2950 status,
2951 content,
2952 entity,
2953 }))
2954 }
2955}
2956
2957pub async fn endpoints_devices_retrieve(
2959 configuration: &configuration::Configuration,
2960 device_uuid: &str,
2961) -> Result<models::EndpointDeviceDetails, Error<EndpointsDevicesRetrieveError>> {
2962 let p_path_device_uuid = device_uuid;
2964
2965 let uri_str = format!(
2966 "{}/endpoints/devices/{device_uuid}/",
2967 configuration.base_path,
2968 device_uuid = crate::apis::urlencode(p_path_device_uuid)
2969 );
2970 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2971
2972 if let Some(ref user_agent) = configuration.user_agent {
2973 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2974 }
2975 if let Some(ref token) = configuration.bearer_access_token {
2976 req_builder = req_builder.bearer_auth(token.to_owned());
2977 };
2978
2979 let req = req_builder.build()?;
2980 let resp = configuration.client.execute(req).await?;
2981
2982 let status = resp.status();
2983 let content_type = resp
2984 .headers()
2985 .get("content-type")
2986 .and_then(|v| v.to_str().ok())
2987 .unwrap_or("application/octet-stream");
2988 let content_type = super::ContentType::from(content_type);
2989
2990 if !status.is_client_error() && !status.is_server_error() {
2991 let content = resp.text().await?;
2992 match content_type {
2993 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2994 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EndpointDeviceDetails`"))),
2995 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDeviceDetails`")))),
2996 }
2997 } else {
2998 let content = resp.text().await?;
2999 let entity: Option<EndpointsDevicesRetrieveError> = serde_json::from_str(&content).ok();
3000 Err(Error::ResponseError(ResponseContent {
3001 status,
3002 content,
3003 entity,
3004 }))
3005 }
3006}
3007
3008pub async fn endpoints_devices_summary_retrieve(
3010 configuration: &configuration::Configuration,
3011) -> Result<models::DeviceSummary, Error<EndpointsDevicesSummaryRetrieveError>> {
3012 let uri_str = format!("{}/endpoints/devices/summary/", configuration.base_path);
3013 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3014
3015 if let Some(ref user_agent) = configuration.user_agent {
3016 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3017 }
3018 if let Some(ref token) = configuration.bearer_access_token {
3019 req_builder = req_builder.bearer_auth(token.to_owned());
3020 };
3021
3022 let req = req_builder.build()?;
3023 let resp = configuration.client.execute(req).await?;
3024
3025 let status = resp.status();
3026 let content_type = resp
3027 .headers()
3028 .get("content-type")
3029 .and_then(|v| v.to_str().ok())
3030 .unwrap_or("application/octet-stream");
3031 let content_type = super::ContentType::from(content_type);
3032
3033 if !status.is_client_error() && !status.is_server_error() {
3034 let content = resp.text().await?;
3035 match content_type {
3036 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3037 ContentType::Text => {
3038 return Err(Error::from(serde_json::Error::custom(
3039 "Received `text/plain` content type response that cannot be converted to `models::DeviceSummary`",
3040 )))
3041 }
3042 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3043 "Received `{unknown_type}` content type response that cannot be converted to `models::DeviceSummary`"
3044 )))),
3045 }
3046 } else {
3047 let content = resp.text().await?;
3048 let entity: Option<EndpointsDevicesSummaryRetrieveError> = serde_json::from_str(&content).ok();
3049 Err(Error::ResponseError(ResponseContent {
3050 status,
3051 content,
3052 entity,
3053 }))
3054 }
3055}
3056
3057pub async fn endpoints_devices_update(
3059 configuration: &configuration::Configuration,
3060 device_uuid: &str,
3061 endpoint_device_request: models::EndpointDeviceRequest,
3062) -> Result<models::EndpointDevice, Error<EndpointsDevicesUpdateError>> {
3063 let p_path_device_uuid = device_uuid;
3065 let p_body_endpoint_device_request = endpoint_device_request;
3066
3067 let uri_str = format!(
3068 "{}/endpoints/devices/{device_uuid}/",
3069 configuration.base_path,
3070 device_uuid = crate::apis::urlencode(p_path_device_uuid)
3071 );
3072 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3073
3074 if let Some(ref user_agent) = configuration.user_agent {
3075 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3076 }
3077 if let Some(ref token) = configuration.bearer_access_token {
3078 req_builder = req_builder.bearer_auth(token.to_owned());
3079 };
3080 req_builder = req_builder.json(&p_body_endpoint_device_request);
3081
3082 let req = req_builder.build()?;
3083 let resp = configuration.client.execute(req).await?;
3084
3085 let status = resp.status();
3086 let content_type = resp
3087 .headers()
3088 .get("content-type")
3089 .and_then(|v| v.to_str().ok())
3090 .unwrap_or("application/octet-stream");
3091 let content_type = super::ContentType::from(content_type);
3092
3093 if !status.is_client_error() && !status.is_server_error() {
3094 let content = resp.text().await?;
3095 match content_type {
3096 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3097 ContentType::Text => {
3098 return Err(Error::from(serde_json::Error::custom(
3099 "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
3100 )))
3101 }
3102 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3103 "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
3104 )))),
3105 }
3106 } else {
3107 let content = resp.text().await?;
3108 let entity: Option<EndpointsDevicesUpdateError> = serde_json::from_str(&content).ok();
3109 Err(Error::ResponseError(ResponseContent {
3110 status,
3111 content,
3112 entity,
3113 }))
3114 }
3115}
3116
3117pub async fn endpoints_devices_used_by_list(
3119 configuration: &configuration::Configuration,
3120 device_uuid: &str,
3121) -> Result<Vec<models::UsedBy>, Error<EndpointsDevicesUsedByListError>> {
3122 let p_path_device_uuid = device_uuid;
3124
3125 let uri_str = format!(
3126 "{}/endpoints/devices/{device_uuid}/used_by/",
3127 configuration.base_path,
3128 device_uuid = crate::apis::urlencode(p_path_device_uuid)
3129 );
3130 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3131
3132 if let Some(ref user_agent) = configuration.user_agent {
3133 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3134 }
3135 if let Some(ref token) = configuration.bearer_access_token {
3136 req_builder = req_builder.bearer_auth(token.to_owned());
3137 };
3138
3139 let req = req_builder.build()?;
3140 let resp = configuration.client.execute(req).await?;
3141
3142 let status = resp.status();
3143 let content_type = resp
3144 .headers()
3145 .get("content-type")
3146 .and_then(|v| v.to_str().ok())
3147 .unwrap_or("application/octet-stream");
3148 let content_type = super::ContentType::from(content_type);
3149
3150 if !status.is_client_error() && !status.is_server_error() {
3151 let content = resp.text().await?;
3152 match content_type {
3153 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3154 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3155 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
3156 }
3157 } else {
3158 let content = resp.text().await?;
3159 let entity: Option<EndpointsDevicesUsedByListError> = serde_json::from_str(&content).ok();
3160 Err(Error::ResponseError(ResponseContent {
3161 status,
3162 content,
3163 entity,
3164 }))
3165 }
3166}
3167
3168pub async fn endpoints_fleet_connectors_create(
3170 configuration: &configuration::Configuration,
3171 fleet_connector_request: models::FleetConnectorRequest,
3172) -> Result<models::FleetConnector, Error<EndpointsFleetConnectorsCreateError>> {
3173 let p_body_fleet_connector_request = fleet_connector_request;
3175
3176 let uri_str = format!("{}/endpoints/fleet/connectors/", configuration.base_path);
3177 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3178
3179 if let Some(ref user_agent) = configuration.user_agent {
3180 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3181 }
3182 if let Some(ref token) = configuration.bearer_access_token {
3183 req_builder = req_builder.bearer_auth(token.to_owned());
3184 };
3185 req_builder = req_builder.json(&p_body_fleet_connector_request);
3186
3187 let req = req_builder.build()?;
3188 let resp = configuration.client.execute(req).await?;
3189
3190 let status = resp.status();
3191 let content_type = resp
3192 .headers()
3193 .get("content-type")
3194 .and_then(|v| v.to_str().ok())
3195 .unwrap_or("application/octet-stream");
3196 let content_type = super::ContentType::from(content_type);
3197
3198 if !status.is_client_error() && !status.is_server_error() {
3199 let content = resp.text().await?;
3200 match content_type {
3201 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3202 ContentType::Text => {
3203 return Err(Error::from(serde_json::Error::custom(
3204 "Received `text/plain` content type response that cannot be converted to `models::FleetConnector`",
3205 )))
3206 }
3207 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3208 "Received `{unknown_type}` content type response that cannot be converted to `models::FleetConnector`"
3209 )))),
3210 }
3211 } else {
3212 let content = resp.text().await?;
3213 let entity: Option<EndpointsFleetConnectorsCreateError> = serde_json::from_str(&content).ok();
3214 Err(Error::ResponseError(ResponseContent {
3215 status,
3216 content,
3217 entity,
3218 }))
3219 }
3220}
3221
3222pub async fn endpoints_fleet_connectors_destroy(
3224 configuration: &configuration::Configuration,
3225 connector_uuid: &str,
3226) -> Result<(), Error<EndpointsFleetConnectorsDestroyError>> {
3227 let p_path_connector_uuid = connector_uuid;
3229
3230 let uri_str = format!(
3231 "{}/endpoints/fleet/connectors/{connector_uuid}/",
3232 configuration.base_path,
3233 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
3234 );
3235 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3236
3237 if let Some(ref user_agent) = configuration.user_agent {
3238 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3239 }
3240 if let Some(ref token) = configuration.bearer_access_token {
3241 req_builder = req_builder.bearer_auth(token.to_owned());
3242 };
3243
3244 let req = req_builder.build()?;
3245 let resp = configuration.client.execute(req).await?;
3246
3247 let status = resp.status();
3248
3249 if !status.is_client_error() && !status.is_server_error() {
3250 Ok(())
3251 } else {
3252 let content = resp.text().await?;
3253 let entity: Option<EndpointsFleetConnectorsDestroyError> = serde_json::from_str(&content).ok();
3254 Err(Error::ResponseError(ResponseContent {
3255 status,
3256 content,
3257 entity,
3258 }))
3259 }
3260}
3261
3262pub async fn endpoints_fleet_connectors_list(
3264 configuration: &configuration::Configuration,
3265 name: Option<&str>,
3266 ordering: Option<&str>,
3267 page: Option<i32>,
3268 page_size: Option<i32>,
3269 search: Option<&str>,
3270) -> Result<models::PaginatedFleetConnectorList, Error<EndpointsFleetConnectorsListError>> {
3271 let p_query_name = name;
3273 let p_query_ordering = ordering;
3274 let p_query_page = page;
3275 let p_query_page_size = page_size;
3276 let p_query_search = search;
3277
3278 let uri_str = format!("{}/endpoints/fleet/connectors/", configuration.base_path);
3279 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3280
3281 if let Some(ref param_value) = p_query_name {
3282 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
3283 }
3284 if let Some(ref param_value) = p_query_ordering {
3285 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
3286 }
3287 if let Some(ref param_value) = p_query_page {
3288 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3289 }
3290 if let Some(ref param_value) = p_query_page_size {
3291 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
3292 }
3293 if let Some(ref param_value) = p_query_search {
3294 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
3295 }
3296 if let Some(ref user_agent) = configuration.user_agent {
3297 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3298 }
3299 if let Some(ref token) = configuration.bearer_access_token {
3300 req_builder = req_builder.bearer_auth(token.to_owned());
3301 };
3302
3303 let req = req_builder.build()?;
3304 let resp = configuration.client.execute(req).await?;
3305
3306 let status = resp.status();
3307 let content_type = resp
3308 .headers()
3309 .get("content-type")
3310 .and_then(|v| v.to_str().ok())
3311 .unwrap_or("application/octet-stream");
3312 let content_type = super::ContentType::from(content_type);
3313
3314 if !status.is_client_error() && !status.is_server_error() {
3315 let content = resp.text().await?;
3316 match content_type {
3317 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3318 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedFleetConnectorList`"))),
3319 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PaginatedFleetConnectorList`")))),
3320 }
3321 } else {
3322 let content = resp.text().await?;
3323 let entity: Option<EndpointsFleetConnectorsListError> = serde_json::from_str(&content).ok();
3324 Err(Error::ResponseError(ResponseContent {
3325 status,
3326 content,
3327 entity,
3328 }))
3329 }
3330}
3331
3332pub async fn endpoints_fleet_connectors_partial_update(
3334 configuration: &configuration::Configuration,
3335 connector_uuid: &str,
3336 patched_fleet_connector_request: Option<models::PatchedFleetConnectorRequest>,
3337) -> Result<models::FleetConnector, Error<EndpointsFleetConnectorsPartialUpdateError>> {
3338 let p_path_connector_uuid = connector_uuid;
3340 let p_body_patched_fleet_connector_request = patched_fleet_connector_request;
3341
3342 let uri_str = format!(
3343 "{}/endpoints/fleet/connectors/{connector_uuid}/",
3344 configuration.base_path,
3345 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
3346 );
3347 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3348
3349 if let Some(ref user_agent) = configuration.user_agent {
3350 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3351 }
3352 if let Some(ref token) = configuration.bearer_access_token {
3353 req_builder = req_builder.bearer_auth(token.to_owned());
3354 };
3355 req_builder = req_builder.json(&p_body_patched_fleet_connector_request);
3356
3357 let req = req_builder.build()?;
3358 let resp = configuration.client.execute(req).await?;
3359
3360 let status = resp.status();
3361 let content_type = resp
3362 .headers()
3363 .get("content-type")
3364 .and_then(|v| v.to_str().ok())
3365 .unwrap_or("application/octet-stream");
3366 let content_type = super::ContentType::from(content_type);
3367
3368 if !status.is_client_error() && !status.is_server_error() {
3369 let content = resp.text().await?;
3370 match content_type {
3371 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3372 ContentType::Text => {
3373 return Err(Error::from(serde_json::Error::custom(
3374 "Received `text/plain` content type response that cannot be converted to `models::FleetConnector`",
3375 )))
3376 }
3377 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3378 "Received `{unknown_type}` content type response that cannot be converted to `models::FleetConnector`"
3379 )))),
3380 }
3381 } else {
3382 let content = resp.text().await?;
3383 let entity: Option<EndpointsFleetConnectorsPartialUpdateError> = serde_json::from_str(&content).ok();
3384 Err(Error::ResponseError(ResponseContent {
3385 status,
3386 content,
3387 entity,
3388 }))
3389 }
3390}
3391
3392pub async fn endpoints_fleet_connectors_retrieve(
3394 configuration: &configuration::Configuration,
3395 connector_uuid: &str,
3396) -> Result<models::FleetConnector, Error<EndpointsFleetConnectorsRetrieveError>> {
3397 let p_path_connector_uuid = connector_uuid;
3399
3400 let uri_str = format!(
3401 "{}/endpoints/fleet/connectors/{connector_uuid}/",
3402 configuration.base_path,
3403 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
3404 );
3405 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3406
3407 if let Some(ref user_agent) = configuration.user_agent {
3408 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3409 }
3410 if let Some(ref token) = configuration.bearer_access_token {
3411 req_builder = req_builder.bearer_auth(token.to_owned());
3412 };
3413
3414 let req = req_builder.build()?;
3415 let resp = configuration.client.execute(req).await?;
3416
3417 let status = resp.status();
3418 let content_type = resp
3419 .headers()
3420 .get("content-type")
3421 .and_then(|v| v.to_str().ok())
3422 .unwrap_or("application/octet-stream");
3423 let content_type = super::ContentType::from(content_type);
3424
3425 if !status.is_client_error() && !status.is_server_error() {
3426 let content = resp.text().await?;
3427 match content_type {
3428 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3429 ContentType::Text => {
3430 return Err(Error::from(serde_json::Error::custom(
3431 "Received `text/plain` content type response that cannot be converted to `models::FleetConnector`",
3432 )))
3433 }
3434 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3435 "Received `{unknown_type}` content type response that cannot be converted to `models::FleetConnector`"
3436 )))),
3437 }
3438 } else {
3439 let content = resp.text().await?;
3440 let entity: Option<EndpointsFleetConnectorsRetrieveError> = serde_json::from_str(&content).ok();
3441 Err(Error::ResponseError(ResponseContent {
3442 status,
3443 content,
3444 entity,
3445 }))
3446 }
3447}
3448
3449pub async fn endpoints_fleet_connectors_update(
3451 configuration: &configuration::Configuration,
3452 connector_uuid: &str,
3453 fleet_connector_request: models::FleetConnectorRequest,
3454) -> Result<models::FleetConnector, Error<EndpointsFleetConnectorsUpdateError>> {
3455 let p_path_connector_uuid = connector_uuid;
3457 let p_body_fleet_connector_request = fleet_connector_request;
3458
3459 let uri_str = format!(
3460 "{}/endpoints/fleet/connectors/{connector_uuid}/",
3461 configuration.base_path,
3462 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
3463 );
3464 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3465
3466 if let Some(ref user_agent) = configuration.user_agent {
3467 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3468 }
3469 if let Some(ref token) = configuration.bearer_access_token {
3470 req_builder = req_builder.bearer_auth(token.to_owned());
3471 };
3472 req_builder = req_builder.json(&p_body_fleet_connector_request);
3473
3474 let req = req_builder.build()?;
3475 let resp = configuration.client.execute(req).await?;
3476
3477 let status = resp.status();
3478 let content_type = resp
3479 .headers()
3480 .get("content-type")
3481 .and_then(|v| v.to_str().ok())
3482 .unwrap_or("application/octet-stream");
3483 let content_type = super::ContentType::from(content_type);
3484
3485 if !status.is_client_error() && !status.is_server_error() {
3486 let content = resp.text().await?;
3487 match content_type {
3488 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3489 ContentType::Text => {
3490 return Err(Error::from(serde_json::Error::custom(
3491 "Received `text/plain` content type response that cannot be converted to `models::FleetConnector`",
3492 )))
3493 }
3494 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3495 "Received `{unknown_type}` content type response that cannot be converted to `models::FleetConnector`"
3496 )))),
3497 }
3498 } else {
3499 let content = resp.text().await?;
3500 let entity: Option<EndpointsFleetConnectorsUpdateError> = serde_json::from_str(&content).ok();
3501 Err(Error::ResponseError(ResponseContent {
3502 status,
3503 content,
3504 entity,
3505 }))
3506 }
3507}
3508
3509pub async fn endpoints_fleet_connectors_used_by_list(
3511 configuration: &configuration::Configuration,
3512 connector_uuid: &str,
3513) -> Result<Vec<models::UsedBy>, Error<EndpointsFleetConnectorsUsedByListError>> {
3514 let p_path_connector_uuid = connector_uuid;
3516
3517 let uri_str = format!(
3518 "{}/endpoints/fleet/connectors/{connector_uuid}/used_by/",
3519 configuration.base_path,
3520 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
3521 );
3522 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3523
3524 if let Some(ref user_agent) = configuration.user_agent {
3525 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3526 }
3527 if let Some(ref token) = configuration.bearer_access_token {
3528 req_builder = req_builder.bearer_auth(token.to_owned());
3529 };
3530
3531 let req = req_builder.build()?;
3532 let resp = configuration.client.execute(req).await?;
3533
3534 let status = resp.status();
3535 let content_type = resp
3536 .headers()
3537 .get("content-type")
3538 .and_then(|v| v.to_str().ok())
3539 .unwrap_or("application/octet-stream");
3540 let content_type = super::ContentType::from(content_type);
3541
3542 if !status.is_client_error() && !status.is_server_error() {
3543 let content = resp.text().await?;
3544 match content_type {
3545 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3546 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3547 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
3548 }
3549 } else {
3550 let content = resp.text().await?;
3551 let entity: Option<EndpointsFleetConnectorsUsedByListError> = serde_json::from_str(&content).ok();
3552 Err(Error::ResponseError(ResponseContent {
3553 status,
3554 content,
3555 entity,
3556 }))
3557 }
3558}