google_cloud_bigquery/http/table/
set_iam_policy.rs

1use reqwest_middleware::{ClientWithMiddleware as Client, RequestBuilder};
2
3use crate::http::types::Policy;
4
5#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Default, Debug)]
6#[serde(rename_all = "camelCase")]
7pub struct SetIamPolicyRequest {
8    /// REQUIRED: The complete policy to be applied to the resource.
9    /// The size of the policy is limited to a few 10s of KB.
10    /// An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
11    pub policy: Policy,
12    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:
13    ///
14    /// paths: "bindings, etag"
15    ///
16    /// This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".
17    pub update_mask: Option<String>,
18}
19
20pub(crate) fn build(
21    base_url: &str,
22    client: &Client,
23    project_id: &str,
24    dataset_id: &str,
25    table_id: &str,
26    req: &SetIamPolicyRequest,
27) -> RequestBuilder {
28    let url = format!(
29        "{}/projects/{}/datasets/{}/tables/{}:setIamPolicy?alt=json",
30        base_url, project_id, dataset_id, table_id
31    );
32    client.post(url).json(&req)
33}