Module: PuppetX::Puppetlabs::Route53Record

Defined in:
lib/puppet_x/puppetlabs/route53_record.rb

Instance Method Summary collapse

Instance Method Details

#create_properties_and_paramsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/puppet_x/puppetlabs/route53_record.rb', line 4

def create_properties_and_params
  ensurable
  newproperty(:zone) do
    desc 'The zone associated with this record.'
    validate do |value|
      fail 'The name of the zone must not be blank' if value.empty?
      fail 'Zone names must end with a .' if value[-1] != '.'
    end
  end

  newparam(:name) do
    desc 'The name of DNS record.'
    isnamevar
    validate do |value|
      fail 'The name of the record must not be blank' if value.empty?
      fail 'Record names must end with a .' if value[-1] != '.'
    end
  end

  newproperty(:ttl) do
    desc 'The time to live for the record.'
    munge do |value|
      value.to_i
    end
    validate do |value|
      fail 'TTL values must be integers' unless value.to_i.to_s == value.to_s
    end
  end

  newproperty(:values, :array_matching => :all) do
    desc 'The values of the record.'
    validate do |value|
      fail 'The value of the record must not be blank' if value.empty?
    end
    def insync?(is)
      is.to_set == should.to_set
    end
  end

  autorequire(:route53_zone) do
    self[:zone]
  end
end