Class: Cumulus::CloudFront::CacheBehaviorDiff
- Inherits:
-
Cumulus::Common::Diff
- Object
- Cumulus::Common::Diff
- Cumulus::CloudFront::CacheBehaviorDiff
- Includes:
- CacheBehaviorChange
- Defined in:
- lib/cloudfront/models/CacheBehaviorDiff.rb
Overview
Public: Represents a single difference between local configuration and AWS configuration of zones.
Constant Summary
Constants included from CacheBehaviorChange
Cumulus::CloudFront::CacheBehaviorChange::COMPRESS, Cumulus::CloudFront::CacheBehaviorChange::COOKIES, Cumulus::CloudFront::CacheBehaviorChange::COOKIES_WHITELIST, Cumulus::CloudFront::CacheBehaviorChange::DEFTTL, Cumulus::CloudFront::CacheBehaviorChange::FIELD_LEVEL_ENCRYPTION_ID, Cumulus::CloudFront::CacheBehaviorChange::HEADERS, Cumulus::CloudFront::CacheBehaviorChange::LAMBDA_FUNCTION_ASSOCIATIONS, Cumulus::CloudFront::CacheBehaviorChange::MAXTTL, Cumulus::CloudFront::CacheBehaviorChange::METHODS_ALLOWED, Cumulus::CloudFront::CacheBehaviorChange::METHODS_CACHED, Cumulus::CloudFront::CacheBehaviorChange::MINTTL, Cumulus::CloudFront::CacheBehaviorChange::PATH, Cumulus::CloudFront::CacheBehaviorChange::QUERY, Cumulus::CloudFront::CacheBehaviorChange::QUERY_STRING_CACHE_KEYS, Cumulus::CloudFront::CacheBehaviorChange::SIGNERS, Cumulus::CloudFront::CacheBehaviorChange::STREAMING, Cumulus::CloudFront::CacheBehaviorChange::TARGET, Cumulus::CloudFront::CacheBehaviorChange::VIEWER_PROTOCOL
Constants included from Cumulus::Common::DiffChange
Cumulus::Common::DiffChange::ADD, Cumulus::Common::DiffChange::MODIFIED, Cumulus::Common::DiffChange::UNMANAGED
Instance Attribute Summary collapse
-
#allowed_methods ⇒ Object
Returns the value of attribute allowed_methods.
-
#cached_methods ⇒ Object
Returns the value of attribute cached_methods.
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#lambda_function_associations ⇒ Object
Returns the value of attribute lambda_function_associations.
-
#query_string_cache_keys ⇒ Object
Returns the value of attribute query_string_cache_keys.
-
#signers ⇒ Object
Returns the value of attribute signers.
Attributes inherited from Cumulus::Common::Diff
#aws, #changes, #info_only, #local, #type
Class Method Summary collapse
-
.allowed_methods(added_allowed_methods, removed_allowed_methods, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior allowed methods.
-
.cached_methods(added_cached_methods, removed_cached_methods, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior cached methods.
-
.cookies_whitelist(added_cookies, removed_cookies, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior cookies whitelist.
-
.headers(added_headers, removed_headers, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior headers.
-
.lambda_function_associations(added_assocs, removed_assocs, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior lambda function associations.
-
.query_string_cache_keys(added_keys, removed_keys, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior query string cache keys.
-
.signers(added_signers, removed_signers, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior trusted signers.
Instance Method Summary collapse
Methods included from Cumulus::Common::DiffChange
Methods inherited from Cumulus::Common::Diff
#add_string, added, #initialize, #local_name, modified, #to_s, unmanaged, #unmanaged_string
Constructor Details
This class inherits a constructor from Cumulus::Common::Diff
Instance Attribute Details
#allowed_methods ⇒ Object
Returns the value of attribute allowed_methods.
41 42 43 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 41 def allowed_methods @allowed_methods end |
#cached_methods ⇒ Object
Returns the value of attribute cached_methods.
42 43 44 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 42 def cached_methods @cached_methods end |
#cookies ⇒ Object
Returns the value of attribute cookies.
37 38 39 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 37 def @cookies end |
#headers ⇒ Object
Returns the value of attribute headers.
39 40 41 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 39 def headers @headers end |
#lambda_function_associations ⇒ Object
Returns the value of attribute lambda_function_associations.
43 44 45 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 43 def lambda_function_associations @lambda_function_associations end |
#query_string_cache_keys ⇒ Object
Returns the value of attribute query_string_cache_keys.
38 39 40 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 38 def query_string_cache_keys @query_string_cache_keys end |
#signers ⇒ Object
Returns the value of attribute signers.
40 41 42 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 40 def signers @signers end |
Class Method Details
.allowed_methods(added_allowed_methods, removed_allowed_methods, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior allowed methods
added_allowed_methods - the allowed methods that were added removed_allowed_methods - the allowed methods that were removed local - the local configuration for the zone
Returns the diff
105 106 107 108 109 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 105 def self.allowed_methods(added_allowed_methods, removed_allowed_methods, local) diff = CacheBehaviorDiff.new(METHODS_ALLOWED, nil, local) diff.allowed_methods = Common::ListChange.new(added_allowed_methods, removed_allowed_methods) diff end |
.cached_methods(added_cached_methods, removed_cached_methods, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior cached methods
added_cached_methods - the cached methods that were added removed_cached_methods - the cached methods that were removed local - the local configuration for the zone
Returns the diff
118 119 120 121 122 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 118 def self.cached_methods(added_cached_methods, removed_cached_methods, local) diff = CacheBehaviorDiff.new(METHODS_CACHED, nil, local) diff.cached_methods = Common::ListChange.new(added_cached_methods, removed_cached_methods) diff end |
.cookies_whitelist(added_cookies, removed_cookies, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior cookies whitelist
added_cookies - the cookies that were added removed_cookies - the cookies that were removed local - the local configuration for the zone
Returns the diff
52 53 54 55 56 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 52 def self.(, , local) diff = CacheBehaviorDiff.new(COOKIES_WHITELIST, nil, local) diff. = Common::ListChange.new(, ) diff end |
.headers(added_headers, removed_headers, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior headers
added_headers - the headers that were added removed_headers - the headers that were removed local - the local configuration for the zone
Returns the diff
79 80 81 82 83 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 79 def self.headers(added_headers, removed_headers, local) diff = CacheBehaviorDiff.new(HEADERS, nil, local) diff.headers = Common::ListChange.new(added_headers, removed_headers) diff end |
.lambda_function_associations(added_assocs, removed_assocs, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior lambda function associations
added_assocs - the cached methods that were added removed_assocs - the cached methods that were removed local - the local configuration for the zone
Returns the diff
131 132 133 134 135 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 131 def self.lambda_function_associations(added_assocs, removed_assocs, local) diff = CacheBehaviorDiff.new(LAMBDA_FUNCTION_ASSOCIATIONS, nil, local) diff.lambda_function_associations = Common::ListChange.new(added_assocs, removed_assocs) diff end |
.query_string_cache_keys(added_keys, removed_keys, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior query string cache keys
added_keys - the keys that were added removed_keys - the keys that were removed local - the local configuration for the zone
Returns the diff
66 67 68 69 70 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 66 def self.query_string_cache_keys(added_keys, removed_keys, local) diff = CacheBehaviorDiff.new(QUERY_STRING_CACHE_KEYS, nil, local) diff.query_string_cache_keys = Common::ListChange.new(added_keys, removed_keys) diff end |
.signers(added_signers, removed_signers, local) ⇒ Object
Public: Static method that produces a diff representing changes in CacheBehavior trusted signers
added_signers - the trusted signers that were added removed_signers - the trusted signers that were removed local - the local configuration for the zone
Returns the diff
92 93 94 95 96 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 92 def self.signers(added_signers, removed_signers, local) diff = CacheBehaviorDiff.new(SIGNERS, nil, local) diff.signers = Common::ListChange.new(added_signers, removed_signers) diff end |
Instance Method Details
#asset_type ⇒ Object
250 251 252 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 250 def asset_type "Cache Behavior" end |
#aws_name ⇒ Object
254 255 256 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 254 def aws_name "#{@aws.target_origin_id}/#{@aws.path_pattern}" end |
#diff_string ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/cloudfront/models/CacheBehaviorDiff.rb', line 137 def diff_string case @type when PATH [ "path:", Colors.aws_changes("\tAWS - #{@aws.path_pattern}"), Colors.local_changes("\tLocal - #{@local.path_pattern}"), ].join("\n") when TARGET [ "target origin id:", Colors.aws_changes("\tAWS - #{@aws.target_origin_id}"), Colors.local_changes("\tLocal - #{@local.target_origin_id}"), ].join("\n") when QUERY [ "forward query strings:", Colors.aws_changes("\tAWS - #{@aws.forwarded_values.query_string}"), Colors.local_changes("\tLocal - #{@local.forward_query_strings}"), ].join("\n") when COOKIES [ "forwarded cookies:", Colors.aws_changes("\tAWS - #{@aws.forwarded_values..forward}"), Colors.local_changes("\tLocal - #{@local.}"), ].join("\n") when COOKIES_WHITELIST [ "whitelisted forwarded cookies:", .removed.map{ |removed| Colors.removed("\t#{removed}")}, .added.map{ |added| Colors.added("\t#{added}")}, ].flatten.join("\n") when QUERY_STRING_CACHE_KEYS [ "Query String Cache Keys:", query_string_cache_keys.removed.map{ |removed| Colors.removed("\t#{removed}") }, query_string_cache_keys.added.map{ |added| Colors.added("\t#{added}")} ].flatten.join("\n") when HEADERS [ "forwarded headers:", headers.removed.map{ |removed| Colors.removed("\t#{removed}")}, headers.added.map{ |added| Colors.added("\t#{added}")}, ].flatten.join("\n") when SIGNERS [ "trusted signers:", signers.removed.map{ |removed| Colors.removed("\t#{removed}")}, signers.added.map{ |added| Colors.added("\t#{added}")}, ].flatten.join("\n") when VIEWER_PROTOCOL [ "viewer protocol policy:", Colors.aws_changes("\tAWS - #{@aws.viewer_protocol_policy}"), Colors.local_changes("\tLocal - #{@local.viewer_protocol_policy}"), ].join("\n") when MINTTL [ "min ttl:", Colors.aws_changes("\tAWS - #{@aws.min_ttl}"), Colors.local_changes("\tLocal - #{@local.min_ttl}"), ].join("\n") when MAXTTL [ "max ttl:", Colors.aws_changes("\tAWS - #{@aws.max_ttl}"), Colors.local_changes("\tLocal - #{@local.max_ttl}"), ].join("\n") when DEFTTL [ "default ttl:", Colors.aws_changes("\tAWS - #{@aws.default_ttl}"), Colors.local_changes("\tLocal - #{@local.default_ttl}"), ].join("\n") when STREAMING [ "smooth streaming:", Colors.aws_changes("\tAWS - #{@aws.smooth_streaming}"), Colors.local_changes("\tLocal - #{@local.smooth_streaming}"), ].join("\n") when METHODS_ALLOWED [ "allowed methods:", allowed_methods.removed.map{ |removed| Colors.removed("\t#{removed}")}, allowed_methods.added.map{ |added| Colors.added("\t#{added}")}, ].flatten.join("\n") when METHODS_CACHED [ "cached methods:", cached_methods.removed.map{ |removed| Colors.removed("\t#{removed}")}, cached_methods.added.map{ |added| Colors.added("\t#{added}")}, ].flatten.join("\n") when COMPRESS [ "compress:", Colors.aws_changes("\tAWS - #{@aws.compress}"), Colors.local_changes("\tLocal - #{@local.compress}"), ].join("\n") when LAMBDA_FUNCTION_ASSOCIATIONS [ "lambda_function_associations", lambda_function_associations.removed.map { |removed| Colors.removed("\t#{removed}")}, lambda_function_associations.added.map { |added| Colors.added("\t#{added}") } ].join("\n") when FIELD_LEVEL_ENCRYPTION_ID [ "field level encryption id", Colors.aws_changes("\tAWS - #{@aws.field_level_encryption_id}"), Colors.local_changes("\tLocal - #{@local.field_level_encryption_id}") ].join("\n") end end |