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
use crate::http::hmac_keys::HmacKeyMetadata;
use crate::http::{Escape, BASE_URL};
use reqwest::{Client, RequestBuilder};

#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
#[serde(rename_all = "camelCase")]
pub struct ListHmacKeysRequest {
    /// Required. The project id to list HMAC keys for.
    pub project_id: String,
    /// An optional filter to only return HMAC keys for one service account.
    pub service_account_email: Option<String>,
    /// An optional bool to return deleted keys that have not been wiped out yet.
    pub show_deleted_keys: Option<bool>,
    /// The maximum number of keys to return.
    pub max_results: Option<i32>,
    /// A previously returned token from ListHmacKeysResponse to get the next page.
    pub page_token: Option<String>,
}

/// Hmac key list response with next page information.
#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ListHmacKeysResponse {
    /// The continuation token, used to page through large result sets. Provide
    /// this value in a subsequent request to return the next page of results.
    pub next_page_token: Option<String>,
    /// The list of items.
    pub items: Option<Vec<HmacKeyMetadata>>,
}

pub(crate) fn build(client: &Client, req: &ListHmacKeysRequest) -> RequestBuilder {
    let url = format!("{}/projects/{}/hmacKeys", BASE_URL, req.project_id.escape());
    client.get(url)
}