google_cloud_storage/http/bucket_access_controls/mod.rs
1use crate::http::object_access_controls::ProjectTeam;
2
3pub mod delete;
4pub mod get;
5pub mod insert;
6pub mod list;
7pub mod patch;
8
9/// Predefined or "canned" aliases for sets of specific bucket ACL entries.
10#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Deserialize, serde::Serialize, Debug)]
11#[serde(rename_all = "camelCase")]
12pub enum PredefinedBucketAcl {
13 /// Project team owners get `OWNER` access, and
14 /// `allAuthenticatedUsers` get `READER` access.
15 AuthenticatedRead,
16 /// Project team owners get `OWNER` access.
17 Private,
18 /// Project team members get access according to their roles.
19 ProjectPrivate,
20 /// Project team owners get `OWNER` access, and
21 /// `allUsers` get `READER` access.
22 PublicRead,
23 /// Project team owners get `OWNER` access, and
24 /// `allUsers` get `WRITER` access.
25 PublicReadWrite,
26}
27
28/// An access-control entry.
29#[derive(Clone, PartialEq, Eq, Default, serde::Deserialize, serde::Serialize, Debug)]
30#[serde(rename_all = "camelCase")]
31pub struct BucketAccessControl {
32 /// The access permission for the entity.
33 pub role: BucketACLRole,
34 /// The ID of the access-control entry.
35 pub id: String,
36 /// The entity holding the permission, in one of the following forms:
37 /// * `user-{userid}`
38 /// * `user-{email}`
39 /// * `group-{groupid}`
40 /// * `group-{email}`
41 /// * `domain-{domain}`
42 /// * `project-{team-projectid}`
43 /// * `allUsers`
44 /// * `allAuthenticatedUsers`
45 /// Examples:
46 /// * The user `liz@example.com` would be `user-liz@example.com`.
47 /// * The group `example@googlegroups.com` would be
48 /// `group-example@googlegroups.com`
49 /// * All members of the Google Apps for Business domain `example.com` would be
50 /// `domain-example.com`
51 pub entity: String,
52 /// The ID for the entity, if any.
53 pub entity_id: Option<String>,
54 /// The email address associated with the entity, if any.
55 pub email: Option<String>,
56 /// The domain associated with the entity, if any.
57 pub domain: Option<String>,
58 /// The project team associated with the entity, if any.
59 pub project_team: Option<ProjectTeam>,
60 /// The link to this access-control entry.
61 pub self_link: String,
62 /// HTTP 1.1 Entity tag for the access-control entry.
63 pub etag: String,
64}
65
66/// A set of properties to return in a response.
67#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Deserialize, serde::Serialize, Debug)]
68pub enum BucketACLRole {
69 OWNER,
70 READER,
71 WRITER,
72}
73
74impl Default for BucketACLRole {
75 fn default() -> Self {
76 Self::READER
77 }
78}