Struct aws_sdk_cloudfront::model::DefaultCacheBehavior
source · #[non_exhaustive]pub struct DefaultCacheBehavior { /* private fields */ }
Expand description
A complex type that describes the default cache behavior if you don’t specify a CacheBehavior
element or if request URLs don’t match any of the values of PathPattern
in CacheBehavior
elements. You must create exactly one default cache behavior.
Implementations§
source§impl DefaultCacheBehavior
impl DefaultCacheBehavior
sourcepub fn target_origin_id(&self) -> Option<&str>
pub fn target_origin_id(&self) -> Option<&str>
The value of ID
for the origin that you want CloudFront to route requests to when they use the default cache behavior.
sourcepub fn trusted_signers(&self) -> Option<&TrustedSigners>
pub fn trusted_signers(&self) -> Option<&TrustedSigners>
We recommend using TrustedKeyGroups
instead of TrustedSigners
.
A list of Amazon Web Services account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies.
When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in a trusted signer’s Amazon Web Services account. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide.
sourcepub fn trusted_key_groups(&self) -> Option<&TrustedKeyGroups>
pub fn trusted_key_groups(&self) -> Option<&TrustedKeyGroups>
A list of key groups that CloudFront can use to validate signed URLs or signed cookies.
When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide.
sourcepub fn viewer_protocol_policy(&self) -> Option<&ViewerProtocolPolicy>
pub fn viewer_protocol_policy(&self) -> Option<&ViewerProtocolPolicy>
The protocol that viewers can use to access the files in the origin specified by TargetOriginId
when a request matches the path pattern in PathPattern
. You can specify the following options:
-
allow-all
: Viewers can use HTTP or HTTPS. -
redirect-to-https
: If a viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the request using the new URL. -
https-only
: If a viewer sends an HTTP request, CloudFront returns an HTTP status code of 403 (Forbidden).
For more information about requiring the HTTPS protocol, see Requiring HTTPS Between Viewers and CloudFront in the Amazon CloudFront Developer Guide.
The only way to guarantee that viewers retrieve an object that was fetched from the origin using HTTPS is never to use any other protocol to fetch the object. If you have recently changed from HTTP to HTTPS, we recommend that you clear your objects’ cache because cached objects are protocol agnostic. That means that an edge location will return an object from the cache regardless of whether the current request protocol matches the protocol used previously. For more information, see Managing Cache Expiration in the Amazon CloudFront Developer Guide.
sourcepub fn allowed_methods(&self) -> Option<&AllowedMethods>
pub fn allowed_methods(&self) -> Option<&AllowedMethods>
A complex type that controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin. There are three choices:
-
CloudFront forwards only
GET
andHEAD
requests. -
CloudFront forwards only
GET
,HEAD
, andOPTIONS
requests. -
CloudFront forwards
GET, HEAD, OPTIONS, PUT, PATCH, POST
, andDELETE
requests.
If you pick the third choice, you may need to restrict access to your Amazon S3 bucket or to your custom origin so users can't perform operations that you don't want them to. For example, you might not want users to have permissions to delete objects from your origin.
sourcepub fn smooth_streaming(&self) -> Option<bool>
pub fn smooth_streaming(&self) -> Option<bool>
Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify true
; if not, specify false
. If you specify true
for SmoothStreaming
, you can still distribute other content using this cache behavior if the content matches the value of PathPattern
.
sourcepub fn compress(&self) -> Option<bool>
pub fn compress(&self) -> Option<bool>
Whether you want CloudFront to automatically compress certain files for this cache behavior. If so, specify true
; if not, specify false
. For more information, see Serving Compressed Files in the Amazon CloudFront Developer Guide.
sourcepub fn lambda_function_associations(
&self
) -> Option<&LambdaFunctionAssociations>
pub fn lambda_function_associations(
&self
) -> Option<&LambdaFunctionAssociations>
A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.
sourcepub fn function_associations(&self) -> Option<&FunctionAssociations>
pub fn function_associations(&self) -> Option<&FunctionAssociations>
A list of CloudFront functions that are associated with this cache behavior. CloudFront functions must be published to the LIVE
stage to associate them with a cache behavior.
sourcepub fn field_level_encryption_id(&self) -> Option<&str>
pub fn field_level_encryption_id(&self) -> Option<&str>
The value of ID
for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for the default cache behavior.
sourcepub fn realtime_log_config_arn(&self) -> Option<&str>
pub fn realtime_log_config_arn(&self) -> Option<&str>
The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior. For more information, see Real-time logs in the Amazon CloudFront Developer Guide.
sourcepub fn cache_policy_id(&self) -> Option<&str>
pub fn cache_policy_id(&self) -> Option<&str>
The unique identifier of the cache policy that is attached to the default cache behavior. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide.
A DefaultCacheBehavior
must include either a CachePolicyId
or ForwardedValues
. We recommend that you use a CachePolicyId
.
sourcepub fn origin_request_policy_id(&self) -> Option<&str>
pub fn origin_request_policy_id(&self) -> Option<&str>
The unique identifier of the origin request policy that is attached to the default cache behavior. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide.
sourcepub fn response_headers_policy_id(&self) -> Option<&str>
pub fn response_headers_policy_id(&self) -> Option<&str>
The identifier for a response headers policy.
sourcepub fn forwarded_values(&self) -> Option<&ForwardedValues>
👎Deprecated
pub fn forwarded_values(&self) -> Option<&ForwardedValues>
This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see Working with policies in the Amazon CloudFront Developer Guide.
If you want to include values in the cache key, use a cache policy. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide.
If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide.
A DefaultCacheBehavior
must include either a CachePolicyId
or ForwardedValues
. We recommend that you use a CachePolicyId
.
A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.
sourcepub fn min_ttl(&self) -> Option<i64>
👎Deprecated
pub fn min_ttl(&self) -> Option<i64>
This field is deprecated. We recommend that you use the MinTTL
field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide.
The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
You must specify 0
for MinTTL
if you configure CloudFront to forward all headers to your origin (under Headers
, if you specify 1
for Quantity
and *
for Name
).
sourcepub fn default_ttl(&self) -> Option<i64>
👎Deprecated
pub fn default_ttl(&self) -> Option<i64>
This field is deprecated. We recommend that you use the DefaultTTL
field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide.
The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as Cache-Control max-age
, Cache-Control s-maxage
, and Expires
to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
sourcepub fn max_ttl(&self) -> Option<i64>
👎Deprecated
pub fn max_ttl(&self) -> Option<i64>
This field is deprecated. We recommend that you use the MaxTTL
field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide.
The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as Cache-Control max-age
, Cache-Control s-maxage
, and Expires
to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
source§impl DefaultCacheBehavior
impl DefaultCacheBehavior
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a new builder-style object to manufacture DefaultCacheBehavior
.
Examples found in repository?
9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972
pub fn deser_structure_crate_model_default_cache_behavior(
decoder: &mut aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::model::DefaultCacheBehavior, aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::model::DefaultCacheBehavior::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("TargetOriginId") /* TargetOriginId com.amazonaws.cloudfront#DefaultCacheBehavior$TargetOriginId */ => {
let var_372 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_target_origin_id(var_372);
}
,
s if s.matches("TrustedSigners") /* TrustedSigners com.amazonaws.cloudfront#DefaultCacheBehavior$TrustedSigners */ => {
let var_373 =
Some(
crate::xml_deser::deser_structure_crate_model_trusted_signers(&mut tag)
?
)
;
builder = builder.set_trusted_signers(var_373);
}
,
s if s.matches("TrustedKeyGroups") /* TrustedKeyGroups com.amazonaws.cloudfront#DefaultCacheBehavior$TrustedKeyGroups */ => {
let var_374 =
Some(
crate::xml_deser::deser_structure_crate_model_trusted_key_groups(&mut tag)
?
)
;
builder = builder.set_trusted_key_groups(var_374);
}
,
s if s.matches("ViewerProtocolPolicy") /* ViewerProtocolPolicy com.amazonaws.cloudfront#DefaultCacheBehavior$ViewerProtocolPolicy */ => {
let var_375 =
Some(
Result::<crate::model::ViewerProtocolPolicy, aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::model::ViewerProtocolPolicy::from(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_viewer_protocol_policy(var_375);
}
,
s if s.matches("AllowedMethods") /* AllowedMethods com.amazonaws.cloudfront#DefaultCacheBehavior$AllowedMethods */ => {
let var_376 =
Some(
crate::xml_deser::deser_structure_crate_model_allowed_methods(&mut tag)
?
)
;
builder = builder.set_allowed_methods(var_376);
}
,
s if s.matches("SmoothStreaming") /* SmoothStreaming com.amazonaws.cloudfront#DefaultCacheBehavior$SmoothStreaming */ => {
let var_377 =
Some(
{
<bool as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.cloudfront#boolean`)"))
}
?
)
;
builder = builder.set_smooth_streaming(var_377);
}
,
s if s.matches("Compress") /* Compress com.amazonaws.cloudfront#DefaultCacheBehavior$Compress */ => {
let var_378 =
Some(
{
<bool as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.cloudfront#boolean`)"))
}
?
)
;
builder = builder.set_compress(var_378);
}
,
s if s.matches("LambdaFunctionAssociations") /* LambdaFunctionAssociations com.amazonaws.cloudfront#DefaultCacheBehavior$LambdaFunctionAssociations */ => {
let var_379 =
Some(
crate::xml_deser::deser_structure_crate_model_lambda_function_associations(&mut tag)
?
)
;
builder = builder.set_lambda_function_associations(var_379);
}
,
s if s.matches("FunctionAssociations") /* FunctionAssociations com.amazonaws.cloudfront#DefaultCacheBehavior$FunctionAssociations */ => {
let var_380 =
Some(
crate::xml_deser::deser_structure_crate_model_function_associations(&mut tag)
?
)
;
builder = builder.set_function_associations(var_380);
}
,
s if s.matches("FieldLevelEncryptionId") /* FieldLevelEncryptionId com.amazonaws.cloudfront#DefaultCacheBehavior$FieldLevelEncryptionId */ => {
let var_381 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_field_level_encryption_id(var_381);
}
,
s if s.matches("RealtimeLogConfigArn") /* RealtimeLogConfigArn com.amazonaws.cloudfront#DefaultCacheBehavior$RealtimeLogConfigArn */ => {
let var_382 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_realtime_log_config_arn(var_382);
}
,
s if s.matches("CachePolicyId") /* CachePolicyId com.amazonaws.cloudfront#DefaultCacheBehavior$CachePolicyId */ => {
let var_383 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_cache_policy_id(var_383);
}
,
s if s.matches("OriginRequestPolicyId") /* OriginRequestPolicyId com.amazonaws.cloudfront#DefaultCacheBehavior$OriginRequestPolicyId */ => {
let var_384 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_origin_request_policy_id(var_384);
}
,
s if s.matches("ResponseHeadersPolicyId") /* ResponseHeadersPolicyId com.amazonaws.cloudfront#DefaultCacheBehavior$ResponseHeadersPolicyId */ => {
let var_385 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_response_headers_policy_id(var_385);
}
,
s if s.matches("ForwardedValues") /* ForwardedValues com.amazonaws.cloudfront#DefaultCacheBehavior$ForwardedValues */ => {
let var_386 =
Some(
crate::xml_deser::deser_structure_crate_model_forwarded_values(&mut tag)
?
)
;
builder = builder.set_forwarded_values(var_386);
}
,
s if s.matches("MinTTL") /* MinTTL com.amazonaws.cloudfront#DefaultCacheBehavior$MinTTL */ => {
let var_387 =
Some(
{
<i64 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.cloudfront#long`)"))
}
?
)
;
builder = builder.set_min_ttl(var_387);
}
,
s if s.matches("DefaultTTL") /* DefaultTTL com.amazonaws.cloudfront#DefaultCacheBehavior$DefaultTTL */ => {
let var_388 =
Some(
{
<i64 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.cloudfront#long`)"))
}
?
)
;
builder = builder.set_default_ttl(var_388);
}
,
s if s.matches("MaxTTL") /* MaxTTL com.amazonaws.cloudfront#DefaultCacheBehavior$MaxTTL */ => {
let var_389 =
Some(
{
<i64 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.cloudfront#long`)"))
}
?
)
;
builder = builder.set_max_ttl(var_389);
}
,
_ => {}
}
}
Ok(builder.build())
}
Trait Implementations§
source§impl Clone for DefaultCacheBehavior
impl Clone for DefaultCacheBehavior
source§fn clone(&self) -> DefaultCacheBehavior
fn clone(&self) -> DefaultCacheBehavior
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more