gcloud_storage/http/buckets/
set_iam_policy.rs

1use reqwest_middleware::{ClientWithMiddleware as Client, RequestBuilder};
2
3use crate::http::buckets::Policy;
4use crate::http::Escape;
5
6/// Request message for `SetIamPolicy` method.
7#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Default, Debug)]
8#[serde(rename_all = "camelCase")]
9pub struct SetIamPolicyRequest {
10    /// REQUIRED: The resource for which the policy is being specified.
11    /// See the operation documentation for the appropriate value for this field.
12    pub resource: String,
13    /// REQUIRED: The complete policy to be applied to the `resource`. The size of
14    /// the policy is limited to a few 10s of KB. An empty policy is a
15    /// valid policy but certain Cloud Platform services (such as Projects)
16    /// might reject them.
17    pub policy: Policy,
18}
19
20pub(crate) fn build(base_url: &str, client: &Client, req: &SetIamPolicyRequest) -> RequestBuilder {
21    let url = format!("{}/b/{}/iam", base_url, req.resource.escape());
22    client.put(url).json(&req.policy)
23}