From 11d9fd94ec4756c2be2cfd3deb8e758ef67ec87f Mon Sep 17 00:00:00 2001 From: Matthias Veit Date: Wed, 20 Mar 2024 08:33:19 +0100 Subject: [PATCH] [aws][fix] Custom headers as dict (#1998) --- fixcore/fixcore/model/graph_access.py | 2 +- .../aws/fix_plugin_aws/resource/cloudfront.py | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/fixcore/fixcore/model/graph_access.py b/fixcore/fixcore/model/graph_access.py index 93e2eaae76..96e35f951a 100644 --- a/fixcore/fixcore/model/graph_access.py +++ b/fixcore/fixcore/model/graph_access.py @@ -124,7 +124,7 @@ class Direction: EdgeKey = namedtuple("EdgeKey", ["from_node", "to_node", "edge_type"]) # Global list of properties to ignore when computing the history hash of a node. -PropsToIgnoreForHistory = {"ctime", "atime", "mtime", "last_update", "resource_version"} +PropsToIgnoreForHistory = {"ctime", "atime", "mtime", "age", "last_access", "last_update", "resource_version"} @define diff --git a/plugins/aws/fix_plugin_aws/resource/cloudfront.py b/plugins/aws/fix_plugin_aws/resource/cloudfront.py index cecf965d56..0aa5574ec7 100644 --- a/plugins/aws/fix_plugin_aws/resource/cloudfront.py +++ b/plugins/aws/fix_plugin_aws/resource/cloudfront.py @@ -87,19 +87,6 @@ def called_mutator_apis(cls) -> List[AwsApiSpec]: ] -@define(eq=False, slots=False) -class AwsCloudFrontOriginCustomHeader: - kind: ClassVar[str] = "aws_cloudfront_origin_custom_header" - kind_display: ClassVar[str] = "AWS CloudFront Origin Custom Header" - kind_description: ClassVar[str] = ( - "AWS CloudFront Origin Custom Header is a feature of Amazon CloudFront that" - " allows users to add custom headers to requests sent to the origin server." - ) - mapping: ClassVar[Dict[str, Bender]] = {"header_name": S("HeaderName"), "header_value": S("HeaderValue")} - header_name: Optional[str] = field(default=None) - header_value: Optional[str] = field(default=None) - - @define(eq=False, slots=False) class AwsCloudFrontCustomOriginConfig: kind: ClassVar[str] = "aws_cloudfront_custom_origin_config" @@ -152,7 +139,7 @@ class AwsCloudFrontOrigin: "id": S("Id"), "domain_name": S("DomainName"), "origin_path": S("OriginPath"), - "custom_header": S("CustomHeaders", "Items", default=[]) >> ForallBend(AwsCloudFrontOriginCustomHeader.mapping), + "custom_header": S("CustomHeaders", "Items", default=[]) >> ToDict("HeaderName", "HeaderValue"), "s3_origin_config": S("S3OriginConfig", "OriginAccessIdentity"), "custom_origin_config": S("CustomOriginConfig") >> Bend(AwsCloudFrontCustomOriginConfig.mapping), "connection_attempts": S("ConnectionAttempts"), @@ -163,7 +150,7 @@ class AwsCloudFrontOrigin: id: Optional[str] = field(default=None) domain_name: Optional[str] = field(default=None) origin_path: Optional[str] = field(default=None) - custom_header: List[AwsCloudFrontOriginCustomHeader] = field(factory=list) + custom_header: Dict[str, str] = field(factory=list) s3_origin_config: Optional[str] = field(default=None) custom_origin_config: Optional[AwsCloudFrontCustomOriginConfig] = field(default=None) connection_attempts: Optional[int] = field(default=None)