1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use anyhow::Result;

use crate::Client;

pub struct Policy {
    pub client: Client,
}

impl Policy {
    #[doc(hidden)]
    pub fn new(client: Client) -> Self {
        Policy { client }
    }

    /**
     * Fetch the top-level IAM policy.
     *
     * This function performs a `GET` to the `/policy` endpoint.
     */
    pub async fn get(&self) -> Result<crate::types::FleetRolesPolicy> {
        let url = "/policy".to_string();
        self.client.get(&url, None).await
    }

    /**
     * Update the top-level IAM policy.
     *
     * This function performs a `PUT` to the `/policy` endpoint.
     */
    pub async fn put(
        &self,
        body: &crate::types::FleetRolesPolicy,
    ) -> Result<crate::types::FleetRolesPolicy> {
        let url = "/policy".to_string();
        self.client
            .put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
            .await
    }
}