Puppet Function: wmflib::googlebot_ranges_json

Defined in:
modules/wmflib/functions/googlebot_ranges_json.pp
Function type:
Puppet Language

Summary

Converts the given IP ranges into a Googlebot format hash

Overview

wmflib::googlebot_ranges_json(Array[Wmflib::IP::Address::CIDR] $prefixes, String[1] $created) ⇒ Hash[String[1], Any]

SPDX-License-Identifier: Apache-2.0

Parameters:

  • prefixes (Array[Wmflib::IP::Address::CIDR]) —

    IP prefixes to include in the file

  • created (String[1]) —

    RFC 3339 datetime to include as the created timestamp

Returns:



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'modules/wmflib/functions/googlebot_ranges_json.pp', line 5

function wmflib::googlebot_ranges_json (
  Array[Wmflib::IP::Address::CIDR] $prefixes,
  String[1]                        $created,
) >> Hash[String[1], Any] {
  {
    'prefixes'     => $prefixes.map |$prefix| {
      $version = wmflib::ip_family($prefix)
      $key = "ipv${version}Prefix"
      $ret = {$key => $prefix}
      $ret
    },
    'creationTime' => $created,
  }
}