Class: SprinkleDNS::EntryPolicyService
- Inherits:
-
Object
- Object
- SprinkleDNS::EntryPolicyService
- Defined in:
- lib/sprinkle_dns/entry_policy_service.rb
Instance Method Summary collapse
- #compile ⇒ Object
- #entries_not_touched ⇒ Object
- #entries_to_change ⇒ Object
- #entries_to_change? ⇒ Boolean
- #entries_to_create ⇒ Object
- #entries_to_delete ⇒ Object
- #entries_to_update ⇒ Object
-
#initialize(hosted_zone, configuration) ⇒ EntryPolicyService
constructor
A new instance of EntryPolicyService.
Constructor Details
#initialize(hosted_zone, configuration) ⇒ EntryPolicyService
Returns a new instance of EntryPolicyService.
3 4 5 6 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 3 def initialize(hosted_zone, configuration) @hosted_zone = hosted_zone @configuration = configuration end |
Instance Method Details
#compile ⇒ Object
42 43 44 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 42 def compile generate_change_batch end |
#entries_not_touched ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 16 def entries_not_touched not_touched = @hosted_zone.entries.select{|hze| hze.referenced? && !hze.changed? && !hze.new?} if @configuration.delete? not_touched else (not_touched + @hosted_zone.entries.select{|hze| !hze.referenced?}).flatten end end |
#entries_to_change ⇒ Object
34 35 36 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 34 def entries_to_change [entries_to_create, entries_to_update, entries_to_delete].sum(&:size) end |
#entries_to_change? ⇒ Boolean
38 39 40 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 38 def entries_to_change? entries_to_change > 0 end |
#entries_to_create ⇒ Object
8 9 10 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 8 def entries_to_create @hosted_zone.entries.select{|hze| hze.referenced? && hze.new?} end |
#entries_to_delete ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 26 def entries_to_delete if @configuration.delete? @hosted_zone.entries.select{|hze| !hze.referenced?} else [] end end |
#entries_to_update ⇒ Object
12 13 14 |
# File 'lib/sprinkle_dns/entry_policy_service.rb', line 12 def entries_to_update @hosted_zone.entries.select{|hze| hze.referenced? && hze.changed? && !hze.new?} end |