Skip to main content

fakecloud_cloudfront/
tenants.rs

1// CloudFront DistributionTenant data types — multi-tenant distribution
2// service that lets callers carve a base distribution into per-tenant
3// configurations (custom domains, certs, parameter overrides). Wire
4// protocol mirrors the parent Distribution: REST-XML with ETag-based
5// concurrency control.
6
7use chrono::{DateTime, Utc};
8use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct StoredDistributionTenant {
12    pub id: String,
13    pub arn: String,
14    pub name: String,
15    pub distribution_id: String,
16    pub domains: Vec<String>,
17    pub connection_group_id: Option<String>,
18    pub web_acl_arn: Option<String>,
19    pub enabled: bool,
20    pub status: String,
21    pub etag: String,
22    pub created_time: DateTime<Utc>,
23    pub last_modified_time: DateTime<Utc>,
24    /// Per-tenant parameter overrides (Name/Value pairs).
25    #[serde(default)]
26    pub parameters: Vec<TenantParameter>,
27    /// WebAcl / Certificate / GeoRestrictions overrides.
28    #[serde(default)]
29    pub customizations: Option<TenantCustomizations>,
30    // Note: ManagedCertificateRequest is intentionally NOT stored. It is an
31    // input-only member on Create/UpdateDistributionTenant (it drives managed
32    // cert provisioning); the DistributionTenant / DistributionTenantSummary
33    // output shapes never echo it, so keeping it would be dead write-only
34    // state. We accept and ignore it, matching AWS's output.
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
38pub struct TenantParameter {
39    pub name: String,
40    pub value: String,
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
44pub struct TenantCustomizations {
45    pub web_acl: Option<TenantWebAclCustomization>,
46    pub certificate: Option<String>,
47    pub geo_restrictions: Option<TenantGeoRestrictionCustomization>,
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
51pub struct TenantWebAclCustomization {
52    pub action: String,
53    pub arn: Option<String>,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
57pub struct TenantGeoRestrictionCustomization {
58    pub restriction_type: String,
59    pub locations: Vec<String>,
60}
61
62#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct StoredTenantInvalidation {
64    pub id: String,
65    pub tenant_id: String,
66    pub status: String,
67    pub create_time: DateTime<Utc>,
68    pub paths: Vec<String>,
69    pub caller_reference: String,
70}