aws_lite_rs/types/cloudfront.rs
1//! Types for the Amazon CloudFront API (v1).
2//!
3//! Auto-generated from the AWS Botocore Model.
4//! **Do not edit manually** — modify the manifest and re-run codegen.
5
6use serde::{Deserialize, Serialize};
7
8/// A distribution list.
9///
10/// **AWS API**: `cloudfront.v1.DistributionList`
11/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/DistributionList>
12#[derive(Debug, Clone, Default, Serialize, Deserialize)]
13#[serde(rename_all = "PascalCase")]
14pub struct DistributionList {
15 /// The value you provided for the Marker request parameter.
16 pub marker: String,
17
18 /// If IsTruncated is true, this element is present and contains the value you can use for
19 /// the Marker request parameter to continue listing your distributions where they left off.
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub next_marker: Option<String>,
22
23 /// The value you provided for the MaxItems request parameter.
24 pub max_items: i32,
25
26 /// A flag that indicates whether more distributions remain to be listed. If your results
27 /// were truncated, you can make a follow-up pagination request using the Marker request
28 /// parameter to retrieve more distributions in the list.
29 #[serde(default)]
30 pub is_truncated: bool,
31
32 /// The number of distributions that were created by the current Amazon Web Services
33 /// account.
34 pub quantity: i32,
35
36 /// A complex type that contains one DistributionSummary element for each distribution that
37 /// was created by the current Amazon Web Services account.
38 #[serde(default)]
39 #[serde(skip_serializing_if = "Vec::is_empty")]
40 pub items: Vec<DistributionSummary>,
41}
42
43impl DistributionList {
44 #[cfg(any(test, feature = "test-support"))]
45 /// Create a fixture instance for testing.
46 pub fn fixture() -> Self {
47 Self {
48 marker: "test-marker".into(),
49 next_marker: Some("test-next_marker".into()),
50 max_items: 100,
51 is_truncated: false,
52 quantity: 100,
53 items: vec![],
54 }
55 }
56}
57
58/// A summary of the information about a CloudFront distribution.
59///
60/// **AWS API**: `cloudfront.v1.DistributionSummary`
61/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/DistributionSummary>
62///
63/// ## Coverage
64/// 9 of 26 fields included.
65/// Omitted fields:
66/// - `ETag` — not selected in manifest
67/// - `LastModifiedTime` — not selected in manifest
68/// - `Aliases` — not selected in manifest
69/// - `OriginGroups` — not selected in manifest
70/// - `CacheBehaviors` — not selected in manifest
71/// - `CustomErrorResponses` — not selected in manifest
72/// - `ViewerCertificate` — not selected in manifest
73/// - `Restrictions` — not selected in manifest
74/// - `WebACLId` — not selected in manifest
75/// - `HttpVersion` — not selected in manifest
76/// - `IsIPV6Enabled` — not selected in manifest
77/// - `AliasICPRecordals` — not selected in manifest
78/// - `Staging` — not selected in manifest
79/// - `ConnectionMode` — not selected in manifest
80/// - `AnycastIpListId` — not selected in manifest
81/// - `ViewerMtlsConfig` — not selected in manifest
82/// - `ConnectionFunctionAssociation` — not selected in manifest
83#[derive(Debug, Clone, Default, Serialize, Deserialize)]
84#[serde(rename_all = "PascalCase")]
85pub struct DistributionSummary {
86 /// The identifier for the distribution. For example: EDFDVBD632BHDS5.
87 pub id: String,
88
89 /// The ARN (Amazon Resource Name) for the distribution. For example:
90 /// arn:aws:cloudfront::123456789012:distribution/EDFDVBD632BHDS5, where 123456789012 is
91 /// your Amazon Web Services account ID.
92 #[serde(rename = "ARN")]
93 pub arn: String,
94
95 /// The current status of the distribution. When the status is Deployed, the distribution's
96 /// information is propagated to all CloudFront edge locations.
97 pub status: String,
98
99 /// The domain name that corresponds to the distribution, for example,
100 /// d111111abcdef8.cloudfront.net.
101 pub domain_name: String,
102
103 /// A complex type that contains information about origins for this distribution.
104 pub origins: Origins,
105
106 /// A complex type that describes the default cache behavior if you don't specify a
107 /// CacheBehavior element or if files don't match any of the values of PathPattern in
108 /// CacheBehavior elements. You must create exactly one default cache behavior.
109 pub default_cache_behavior: DefaultCacheBehavior,
110
111 /// This field only supports standard distributions. You can't specify this field for multi-
112 /// tenant distributions. For more information, see Unsupported features for SaaS Manager
113 /// for Amazon CloudFront in the Amazon CloudFront Developer Guide. A complex type that
114 /// contains information about price class for this streaming distribution.
115 pub price_class: String,
116
117 /// Whether the distribution is enabled to accept user requests for content.
118 #[serde(default)]
119 pub enabled: bool,
120
121 /// The comment originally specified when this distribution was created.
122 pub comment: String,
123}
124
125impl DistributionSummary {
126 #[cfg(any(test, feature = "test-support"))]
127 /// Create a fixture instance for testing.
128 pub fn fixture() -> Self {
129 Self {
130 id: "test-id".into(),
131 arn: "test-arn".into(),
132 status: "test-status".into(),
133 domain_name: "test-domain_name".into(),
134 origins: Origins::fixture(),
135 default_cache_behavior: DefaultCacheBehavior::fixture(),
136 price_class: "test-price_class".into(),
137 enabled: false,
138 comment: "test-comment".into(),
139 }
140 }
141}
142
143/// A distribution tells CloudFront where you want content to be delivered from, and the details
144/// about how to track and manage content delivery.
145///
146/// **AWS API**: `cloudfront.v1.Distribution`
147/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/Distribution>
148///
149/// ## Coverage
150/// 5 of 10 fields included.
151/// Omitted fields:
152/// - `LastModifiedTime` — not selected in manifest
153/// - `InProgressInvalidationBatches` — not selected in manifest
154/// - `ActiveTrustedSigners` — not selected in manifest
155/// - `ActiveTrustedKeyGroups` — not selected in manifest
156/// - `AliasICPRecordals` — not selected in manifest
157#[derive(Debug, Clone, Default, Serialize, Deserialize)]
158#[serde(rename_all = "PascalCase")]
159pub struct Distribution {
160 /// The distribution's identifier. For example: E1U5RQF7T870K0.
161 pub id: String,
162
163 /// The distribution's Amazon Resource Name (ARN).
164 #[serde(rename = "ARN")]
165 pub arn: String,
166
167 /// The distribution's status. When the status is Deployed, the distribution's information
168 /// is fully propagated to all CloudFront edge locations.
169 pub status: String,
170
171 /// The distribution's CloudFront domain name. For example: d111111abcdef8.cloudfront.net.
172 pub domain_name: String,
173
174 /// The distribution's configuration.
175 pub distribution_config: DistributionConfig,
176}
177
178impl Distribution {
179 #[cfg(any(test, feature = "test-support"))]
180 /// Create a fixture instance for testing.
181 pub fn fixture() -> Self {
182 Self {
183 id: "test-id".into(),
184 arn: "test-arn".into(),
185 status: "test-status".into(),
186 domain_name: "test-domain_name".into(),
187 distribution_config: DistributionConfig::fixture(),
188 }
189 }
190}
191
192/// A distribution configuration.
193///
194/// **AWS API**: `cloudfront.v1.DistributionConfig`
195/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/DistributionConfig>
196///
197/// ## Coverage
198/// 9 of 24 fields included.
199/// Omitted fields:
200/// - `OriginGroups` — not selected in manifest
201/// - `CacheBehaviors` — not selected in manifest
202/// - `CustomErrorResponses` — not selected in manifest
203/// - `Logging` — not selected in manifest
204/// - `Restrictions` — not selected in manifest
205/// - `WebACLId` — not selected in manifest
206/// - `HttpVersion` — not selected in manifest
207/// - `IsIPV6Enabled` — not selected in manifest
208/// - `ContinuousDeploymentPolicyId` — not selected in manifest
209/// - `Staging` — not selected in manifest
210/// - `AnycastIpListId` — not selected in manifest
211/// - `TenantConfig` — not selected in manifest
212/// - `ConnectionMode` — not selected in manifest
213/// - `ViewerMtlsConfig` — not selected in manifest
214/// - `ConnectionFunctionAssociation` — not selected in manifest
215#[derive(Debug, Clone, Default, Serialize, Deserialize)]
216#[serde(rename_all = "PascalCase")]
217pub struct DistributionConfig {
218 /// A unique value (for example, a date-time stamp) that ensures that the request can't be
219 /// replayed. If the value of CallerReference is new (regardless of the content of the
220 /// DistributionConfig object), CloudFront creates a new distribution. If CallerReference is
221 /// a value that you already sent in a previous request to create a distribution, CloudFront
222 /// returns a DistributionAlreadyExists error.
223 pub caller_reference: String,
224
225 /// This field only supports standard distributions. You can't specify this field for multi-
226 /// tenant distributions. For more information, see Unsupported features for SaaS Manager
227 /// for Amazon CloudFront in the Amazon CloudFront Developer Guide. A complex type that
228 /// contains information about CNAMEs (alternate domain names), if any, for this
229 /// distribution.
230 #[serde(skip_serializing_if = "Option::is_none")]
231 pub aliases: Option<Aliases>,
232
233 /// When a viewer requests the root URL for your distribution, the default root object is
234 /// the object that you want CloudFront to request from your origin. For example, if your
235 /// root URL is https://www.example.com, you can specify CloudFront to return the index.html
236 /// file as the default root object. You can specify a default root object so that viewers
237 /// see a specific file or object, instead of another object in your distribution (for
238 /// example, https://www.example.com/product-description.html). A default root object avoids
239 /// exposing the contents of your distribution. You can specify the object name or a path to
240 /// the object name (for example, index.html or exampleFolderName/index.html). Your string
241 /// can't begin with a forward slash (/). Only specify the object name or the path to the
242 /// object. If you don't want to specify a default root object when you create a
243 /// distribution, include an empty DefaultRootObject element. To delete the default root
244 /// object from an existing distribution, update the distribution configuration and include
245 /// an empty DefaultRootObject element. To replace the default root object, update the
246 /// distribution configuration and specify the new object. For more information about the
247 /// default root object, see Specify a default root object in the Amazon CloudFront
248 /// Developer Guide.
249 #[serde(skip_serializing_if = "Option::is_none")]
250 pub default_root_object: Option<String>,
251
252 /// A complex type that contains information about origins for this distribution.
253 pub origins: Origins,
254
255 /// A complex type that describes the default cache behavior if you don't specify a
256 /// CacheBehavior element or if files don't match any of the values of PathPattern in
257 /// CacheBehavior elements. You must create exactly one default cache behavior.
258 pub default_cache_behavior: DefaultCacheBehavior,
259
260 /// A comment to describe the distribution. The comment cannot be longer than 128
261 /// characters.
262 pub comment: String,
263
264 /// This field only supports standard distributions. You can't specify this field for multi-
265 /// tenant distributions. For more information, see Unsupported features for SaaS Manager
266 /// for Amazon CloudFront in the Amazon CloudFront Developer Guide. The price class that
267 /// corresponds with the maximum price that you want to pay for CloudFront service. If you
268 /// specify PriceClass_All, CloudFront responds to requests for your objects from all
269 /// CloudFront edge locations. If you specify a price class other than PriceClass_All,
270 /// CloudFront serves your objects from the CloudFront edge location that has the lowest
271 /// latency among the edge locations in your price class. Viewers who are in or near regions
272 /// that are excluded from your specified price class may encounter slower performance. For
273 /// more information about price classes, see Choosing the Price Class for a CloudFront
274 /// Distribution in the Amazon CloudFront Developer Guide. For information about CloudFront
275 /// pricing, including how price classes (such as Price Class 100) map to CloudFront
276 /// regions, see Amazon CloudFront Pricing.
277 #[serde(skip_serializing_if = "Option::is_none")]
278 pub price_class: Option<String>,
279
280 /// From this field, you can enable or disable the selected distribution.
281 #[serde(default)]
282 pub enabled: bool,
283
284 /// A complex type that determines the distribution's SSL/TLS configuration for
285 /// communicating with viewers.
286 #[serde(skip_serializing_if = "Option::is_none")]
287 pub viewer_certificate: Option<ViewerCertificate>,
288}
289
290impl DistributionConfig {
291 #[cfg(any(test, feature = "test-support"))]
292 /// Create a fixture instance for testing.
293 pub fn fixture() -> Self {
294 Self {
295 caller_reference: "test-caller_reference".into(),
296 aliases: Some(Aliases::fixture()),
297 default_root_object: Some("test-default_root_object".into()),
298 origins: Origins::fixture(),
299 default_cache_behavior: DefaultCacheBehavior::fixture(),
300 comment: "test-comment".into(),
301 price_class: Some("test-price_class".into()),
302 enabled: false,
303 viewer_certificate: Some(ViewerCertificate::fixture()),
304 }
305 }
306}
307
308/// A complex type that contains information about CNAMEs (alternate domain names), if any, for
309/// this distribution.
310///
311/// **AWS API**: `cloudfront.v1.Aliases`
312/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/Aliases>
313#[derive(Debug, Clone, Default, Serialize, Deserialize)]
314#[serde(rename_all = "PascalCase")]
315pub struct Aliases {
316 /// The number of CNAME aliases, if any, that you want to associate with this distribution.
317 pub quantity: i32,
318
319 /// A complex type that contains the CNAME aliases, if any, that you want to associate with
320 /// this distribution.
321 #[serde(default)]
322 #[serde(skip_serializing_if = "Vec::is_empty")]
323 pub items: Vec<String>,
324}
325
326impl Aliases {
327 #[cfg(any(test, feature = "test-support"))]
328 /// Create a fixture instance for testing.
329 pub fn fixture() -> Self {
330 Self {
331 quantity: 100,
332 items: vec![],
333 }
334 }
335}
336
337/// A complex type that determines the distribution's SSL/TLS configuration for communicating
338/// with viewers. If the distribution doesn't use Aliases (also known as alternate domain names
339/// or CNAMEs)—that is, if the distribution uses the CloudFront domain name such as
340/// d111111abcdef8.cloudfront.net—set CloudFrontDefaultCertificate to true and leave all other
341/// fields empty. If the distribution uses Aliases (alternate domain names or CNAMEs), use the
342/// fields in this type to specify the following settings: Which viewers the distribution
343/// accepts HTTPS connections from: only viewers that support server name indication (SNI)
344/// (recommended), or all viewers including those that don't support SNI. To accept HTTPS
345/// connections from only viewers that support SNI, set SSLSupportMethod to sni-only. This is
346/// recommended. Most browsers and clients support SNI. To accept HTTPS connections from all
347/// viewers, including those that don't support SNI, set SSLSupportMethod to vip. This is not
348/// recommended, and results in additional monthly charges from CloudFront. The minimum SSL/TLS
349/// protocol version that the distribution can use to communicate with viewers. To specify a
350/// minimum version, choose a value for MinimumProtocolVersion. For more information, see
351/// Security Policy in the Amazon CloudFront Developer Guide. The location of the SSL/TLS
352/// certificate, Certificate Manager (ACM) (recommended) or Identity and Access Management
353/// (IAM). You specify the location by setting a value in one of the following fields (not
354/// both): ACMCertificateArn IAMCertificateId All distributions support HTTPS connections from
355/// viewers. To require viewers to use HTTPS only, or to redirect them from HTTP to HTTPS, use
356/// ViewerProtocolPolicy in the CacheBehavior or DefaultCacheBehavior. To specify how CloudFront
357/// should use SSL/TLS to communicate with your custom origin, use CustomOriginConfig. For more
358/// information, see Using HTTPS with CloudFront and Using Alternate Domain Names and HTTPS in
359/// the Amazon CloudFront Developer Guide.
360///
361/// **AWS API**: `cloudfront.v1.ViewerCertificate`
362/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/ViewerCertificate>
363///
364/// ## Coverage
365/// 5 of 7 fields included.
366/// Omitted fields:
367/// - `Certificate` — not selected in manifest
368/// - `CertificateSource` — not selected in manifest
369#[derive(Debug, Clone, Default, Serialize, Deserialize)]
370#[serde(rename_all = "PascalCase")]
371pub struct ViewerCertificate {
372 /// If the distribution uses the CloudFront domain name such as
373 /// d111111abcdef8.cloudfront.net, set this field to true. If the distribution uses Aliases
374 /// (alternate domain names or CNAMEs), set this field to false and specify values for the
375 /// following fields: ACMCertificateArn or IAMCertificateId (specify a value for one, not
376 /// both) MinimumProtocolVersion SSLSupportMethod
377 #[serde(skip_serializing_if = "Option::is_none")]
378 pub cloud_front_default_certificate: Option<bool>,
379
380 /// This field only supports standard distributions. You can't specify this field for multi-
381 /// tenant distributions. For more information, see Unsupported features for SaaS Manager
382 /// for Amazon CloudFront in the Amazon CloudFront Developer Guide. If the distribution uses
383 /// Aliases (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in
384 /// Identity and Access Management (IAM), provide the ID of the IAM certificate. If you
385 /// specify an IAM certificate ID, you must also specify values for MinimumProtocolVersion
386 /// and SSLSupportMethod.
387 #[serde(rename = "IAMCertificateId")]
388 #[serde(skip_serializing_if = "Option::is_none")]
389 pub iam_certificate_id: Option<String>,
390
391 /// If the distribution uses Aliases (alternate domain names or CNAMEs) and the SSL/TLS
392 /// certificate is stored in Certificate Manager (ACM), provide the Amazon Resource Name
393 /// (ARN) of the ACM certificate. CloudFront only supports ACM certificates in the US East
394 /// (N. Virginia) Region (us-east-1). If you specify an ACM certificate ARN, you must also
395 /// specify values for MinimumProtocolVersion and SSLSupportMethod.
396 #[serde(rename = "ACMCertificateArn")]
397 #[serde(skip_serializing_if = "Option::is_none")]
398 pub acm_certificate_arn: Option<String>,
399
400 /// If the distribution uses Aliases (alternate domain names or CNAMEs), specify which
401 /// viewers the distribution accepts HTTPS connections from. sni-only – The distribution
402 /// accepts HTTPS connections from only viewers that support server name indication (SNI).
403 /// This is recommended. Most browsers and clients support SNI. vip – The distribution
404 /// accepts HTTPS connections from all viewers including those that don't support SNI. This
405 /// is not recommended, and results in additional monthly charges from CloudFront. static-ip
406 /// - Do not specify this value unless your distribution has been enabled for this feature
407 /// by the CloudFront team. If you have a use case that requires static IP addresses for a
408 /// distribution, contact CloudFront through the Amazon Web ServicesSupport Center. If the
409 /// distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net,
410 /// don't set a value for this field.
411 #[serde(rename = "SSLSupportMethod")]
412 #[serde(skip_serializing_if = "Option::is_none")]
413 pub ssl_support_method: Option<String>,
414
415 /// If the distribution uses Aliases (alternate domain names or CNAMEs), specify the
416 /// security policy that you want CloudFront to use for HTTPS connections with viewers. The
417 /// security policy determines two settings: The minimum SSL/TLS protocol that CloudFront
418 /// can use to communicate with viewers. The ciphers that CloudFront can use to encrypt the
419 /// content that it returns to viewers. For more information, see Security Policy and
420 /// Supported Protocols and Ciphers Between Viewers and CloudFront in the Amazon CloudFront
421 /// Developer Guide. On the CloudFront console, this setting is called Security Policy. When
422 /// you're using SNI only (you set SSLSupportMethod to sni-only), you must specify TLSv1 or
423 /// higher. If the distribution uses the CloudFront domain name such as
424 /// d111111abcdef8.cloudfront.net (you set CloudFrontDefaultCertificate to true), CloudFront
425 /// automatically sets the security policy to TLSv1 regardless of the value that you set
426 /// here.
427 #[serde(skip_serializing_if = "Option::is_none")]
428 pub minimum_protocol_version: Option<String>,
429}
430
431impl ViewerCertificate {
432 #[cfg(any(test, feature = "test-support"))]
433 /// Create a fixture instance for testing.
434 pub fn fixture() -> Self {
435 Self {
436 cloud_front_default_certificate: Some(false),
437 iam_certificate_id: Some("test-iam_certificate_id".into()),
438 acm_certificate_arn: Some("test-acm_certificate_arn".into()),
439 ssl_support_method: Some("test-ssl_support_method".into()),
440 minimum_protocol_version: Some("test-minimum_protocol_version".into()),
441 }
442 }
443}
444
445/// Contains information about the origins for this distribution.
446///
447/// **AWS API**: `cloudfront.v1.Origins`
448/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/Origins>
449#[derive(Debug, Clone, Default, Serialize, Deserialize)]
450#[serde(rename_all = "PascalCase")]
451pub struct Origins {
452 /// The number of origins for this distribution.
453 pub quantity: i32,
454
455 /// A list of origins.
456 #[serde(default)]
457 pub items: Vec<Origin>,
458}
459
460impl Origins {
461 #[cfg(any(test, feature = "test-support"))]
462 /// Create a fixture instance for testing.
463 pub fn fixture() -> Self {
464 Self {
465 quantity: 100,
466 items: vec![],
467 }
468 }
469}
470
471/// An origin. An origin is the location where content is stored, and from which CloudFront gets
472/// content to serve to viewers. To specify an origin: Use S3OriginConfig to specify an Amazon
473/// S3 bucket that is not configured with static website hosting. Use VpcOriginConfig to specify
474/// a VPC origin. Use CustomOriginConfig to specify all other kinds of origins, including: An
475/// Amazon S3 bucket that is configured with static website hosting An Elastic Load Balancing
476/// load balancer An Elemental MediaPackage endpoint An Elemental MediaStore container Any other
477/// HTTP server, running on an Amazon EC2 instance or any other kind of host For the current
478/// maximum number of origins that you can specify per distribution, see General Quotas on Web
479/// Distributions in the Amazon CloudFront Developer Guide (quotas were formerly referred to as
480/// limits).
481///
482/// **AWS API**: `cloudfront.v1.Origin`
483/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/Origin>
484///
485/// ## Coverage
486/// 4 of 12 fields included.
487/// Omitted fields:
488/// - `OriginPath` — not selected in manifest
489/// - `CustomHeaders` — not selected in manifest
490/// - `CustomOriginConfig` — not selected in manifest
491/// - `VpcOriginConfig` — not selected in manifest
492/// - `ConnectionAttempts` — not selected in manifest
493/// - `ConnectionTimeout` — not selected in manifest
494/// - `ResponseCompletionTimeout` — not selected in manifest
495/// - `OriginShield` — not selected in manifest
496#[derive(Debug, Clone, Default, Serialize, Deserialize)]
497#[serde(rename_all = "PascalCase")]
498pub struct Origin {
499 /// A unique identifier for the origin. This value must be unique within the distribution.
500 /// Use this value to specify the TargetOriginId in a CacheBehavior or DefaultCacheBehavior.
501 pub id: String,
502
503 /// The domain name for the origin. For more information, see Origin Domain Name in the
504 /// Amazon CloudFront Developer Guide.
505 pub domain_name: String,
506
507 /// Use this type to specify an origin that is an Amazon S3 bucket that is not configured
508 /// with static website hosting. To specify any other type of origin, including an Amazon S3
509 /// bucket that is configured with static website hosting, use the CustomOriginConfig type
510 /// instead.
511 #[serde(skip_serializing_if = "Option::is_none")]
512 pub s3_origin_config: Option<S3OriginConfig>,
513
514 /// The unique identifier of an origin access control for this origin. For more information,
515 /// see Restricting access to an Amazon S3 origin in the Amazon CloudFront Developer Guide.
516 #[serde(skip_serializing_if = "Option::is_none")]
517 pub origin_access_control_id: Option<String>,
518}
519
520impl Origin {
521 #[cfg(any(test, feature = "test-support"))]
522 /// Create a fixture instance for testing.
523 pub fn fixture() -> Self {
524 Self {
525 id: "test-id".into(),
526 domain_name: "test-domain_name".into(),
527 s3_origin_config: Some(S3OriginConfig::fixture()),
528 origin_access_control_id: Some("test-origin_access_control_id".into()),
529 }
530 }
531}
532
533/// A complex type that contains information about the Amazon S3 origin. If the origin is a
534/// custom origin or an S3 bucket that is configured as a website endpoint, use the
535/// CustomOriginConfig element instead.
536///
537/// **AWS API**: `cloudfront.v1.S3OriginConfig`
538/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/S3OriginConfig>
539///
540/// ## Coverage
541/// 1 of 2 fields included.
542/// Omitted fields:
543/// - `OriginReadTimeout` — not selected in manifest
544#[derive(Debug, Clone, Default, Serialize, Deserialize)]
545#[serde(rename_all = "PascalCase")]
546pub struct S3OriginConfig {
547 /// If you're using origin access control (OAC) instead of origin access identity, specify
548 /// an empty OriginAccessIdentity element. For more information, see Restricting access to
549 /// an Amazon Web Services in the Amazon CloudFront Developer Guide. The CloudFront origin
550 /// access identity to associate with the origin. Use an origin access identity to configure
551 /// the origin so that viewers can only access objects in an Amazon S3 bucket through
552 /// CloudFront. The format of the value is: origin-access-identity/cloudfront/ID-of-origin-
553 /// access-identity The ID-of-origin-access-identity is the value that CloudFront returned
554 /// in the ID element when you created the origin access identity. If you want viewers to be
555 /// able to access objects using either the CloudFront URL or the Amazon S3 URL, specify an
556 /// empty OriginAccessIdentity element. To delete the origin access identity from an
557 /// existing distribution, update the distribution configuration and include an empty
558 /// OriginAccessIdentity element. To replace the origin access identity, update the
559 /// distribution configuration and specify the new origin access identity. For more
560 /// information about the origin access identity, see Serving Private Content through
561 /// CloudFront in the Amazon CloudFront Developer Guide.
562 pub origin_access_identity: String,
563}
564
565impl S3OriginConfig {
566 #[cfg(any(test, feature = "test-support"))]
567 /// Create a fixture instance for testing.
568 pub fn fixture() -> Self {
569 Self {
570 origin_access_identity: "test-origin_access_identity".into(),
571 }
572 }
573}
574
575/// A complex type that describes the default cache behavior if you don't specify a
576/// CacheBehavior element or if request URLs don't match any of the values of PathPattern in
577/// CacheBehavior elements. You must create exactly one default cache behavior. If your minimum
578/// TTL is greater than 0, CloudFront will cache content for at least the duration specified in
579/// the cache policy's minimum TTL, even if the Cache-Control: no-cache, no-store, or private
580/// directives are present in the origin headers.
581///
582/// **AWS API**: `cloudfront.v1.DefaultCacheBehavior`
583/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/DefaultCacheBehavior>
584///
585/// ## Coverage
586/// 2 of 19 fields included.
587/// Omitted fields:
588/// - `TrustedSigners` — not selected in manifest
589/// - `TrustedKeyGroups` — not selected in manifest
590/// - `AllowedMethods` — not selected in manifest
591/// - `SmoothStreaming` — not selected in manifest
592/// - `Compress` — not selected in manifest
593/// - `LambdaFunctionAssociations` — not selected in manifest
594/// - `FunctionAssociations` — not selected in manifest
595/// - `FieldLevelEncryptionId` — not selected in manifest
596/// - `RealtimeLogConfigArn` — not selected in manifest
597/// - `CachePolicyId` — not selected in manifest
598/// - `OriginRequestPolicyId` — not selected in manifest
599/// - `ResponseHeadersPolicyId` — not selected in manifest
600/// - `GrpcConfig` — not selected in manifest
601/// - `ForwardedValues` — not selected in manifest
602/// - `MinTTL` — not selected in manifest
603/// - `DefaultTTL` — not selected in manifest
604/// - `MaxTTL` — not selected in manifest
605#[derive(Debug, Clone, Default, Serialize, Deserialize)]
606#[serde(rename_all = "PascalCase")]
607pub struct DefaultCacheBehavior {
608 /// The value of ID for the origin that you want CloudFront to route requests to when they
609 /// use the default cache behavior.
610 pub target_origin_id: String,
611
612 /// The protocol that viewers can use to access the files in the origin specified by
613 /// TargetOriginId when a request matches the path pattern in PathPattern. You can specify
614 /// the following options: allow-all: Viewers can use HTTP or HTTPS. redirect-to-https: If a
615 /// viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved
616 /// Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the
617 /// request using the new URL. https-only: If a viewer sends an HTTP request, CloudFront
618 /// returns an HTTP status code of 403 (Forbidden). For more information about requiring the
619 /// HTTPS protocol, see Requiring HTTPS Between Viewers and CloudFront in the Amazon
620 /// CloudFront Developer Guide. The only way to guarantee that viewers retrieve an object
621 /// that was fetched from the origin using HTTPS is never to use any other protocol to fetch
622 /// the object. If you have recently changed from HTTP to HTTPS, we recommend that you clear
623 /// your objects' cache because cached objects are protocol agnostic. That means that an
624 /// edge location will return an object from the cache regardless of whether the current
625 /// request protocol matches the protocol used previously. For more information, see
626 /// Managing Cache Expiration in the Amazon CloudFront Developer Guide.
627 pub viewer_protocol_policy: String,
628}
629
630impl DefaultCacheBehavior {
631 #[cfg(any(test, feature = "test-support"))]
632 /// Create a fixture instance for testing.
633 pub fn fixture() -> Self {
634 Self {
635 target_origin_id: "test-target_origin_id".into(),
636 viewer_protocol_policy: "test-viewer_protocol_policy".into(),
637 }
638 }
639}
640
641/// A CloudFront origin access control, including its unique identifier.
642///
643/// **AWS API**: `cloudfront.v1.OriginAccessControl`
644/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/OriginAccessControl>
645#[derive(Debug, Clone, Default, Serialize, Deserialize)]
646#[serde(rename_all = "PascalCase")]
647pub struct OriginAccessControl {
648 /// The unique identifier of the origin access control.
649 pub id: String,
650
651 /// The origin access control.
652 #[serde(skip_serializing_if = "Option::is_none")]
653 pub origin_access_control_config: Option<OriginAccessControlConfig>,
654}
655
656impl OriginAccessControl {
657 #[cfg(any(test, feature = "test-support"))]
658 /// Create a fixture instance for testing.
659 pub fn fixture() -> Self {
660 Self {
661 id: "test-id".into(),
662 origin_access_control_config: Some(OriginAccessControlConfig::fixture()),
663 }
664 }
665}
666
667/// A CloudFront origin access control configuration.
668///
669/// **AWS API**: `cloudfront.v1.OriginAccessControlConfig`
670/// **Reference**: <https://docs.aws.amazon.com/cloudfront/latest/APIReference/OriginAccessControlConfig>
671#[derive(Debug, Clone, Default, Serialize, Deserialize)]
672#[serde(rename_all = "PascalCase")]
673pub struct OriginAccessControlConfig {
674 /// A name to identify the origin access control. You can specify up to 64 characters.
675 pub name: String,
676
677 /// A description of the origin access control.
678 #[serde(skip_serializing_if = "Option::is_none")]
679 pub description: Option<String>,
680
681 /// The signing protocol of the origin access control, which determines how CloudFront signs
682 /// (authenticates) requests. The only valid value is sigv4.
683 pub signing_protocol: String,
684
685 /// Specifies which requests CloudFront signs (adds authentication information to). Specify
686 /// always for the most common use case. For more information, see origin access control
687 /// advanced settings in the Amazon CloudFront Developer Guide. This field can have one of
688 /// the following values: always – CloudFront signs all origin requests, overwriting the
689 /// Authorization header from the viewer request if one exists. never – CloudFront doesn't
690 /// sign any origin requests. This value turns off origin access control for all origins in
691 /// all distributions that use this origin access control. no-override – If the viewer
692 /// request doesn't contain the Authorization header, then CloudFront signs the origin
693 /// request. If the viewer request contains the Authorization header, then CloudFront
694 /// doesn't sign the origin request and instead passes along the Authorization header from
695 /// the viewer request. WARNING: To pass along the Authorization header from the viewer
696 /// request, you must add the Authorization header to a cache policy for all cache behaviors
697 /// that use origins associated with this origin access control.
698 pub signing_behavior: String,
699
700 /// The type of origin that this origin access control is for.
701 pub origin_access_control_origin_type: String,
702}
703
704impl OriginAccessControlConfig {
705 #[cfg(any(test, feature = "test-support"))]
706 /// Create a fixture instance for testing.
707 pub fn fixture() -> Self {
708 Self {
709 name: "test-name".into(),
710 description: Some("test-description".into()),
711 signing_protocol: "test-signing_protocol".into(),
712 signing_behavior: "test-signing_behavior".into(),
713 origin_access_control_origin_type: "test-origin_access_control_origin_type".into(),
714 }
715 }
716}