e8991a699fd722277bd5cd24433371285788a850
[yaffs-website] / web / modules / contrib / migrate_plus / migrate_example_advanced / config / install / migrate_plus.migration.wine_role_json.yml
1 # This migration demonstrates importing from a monolithic JSON file.
2 id: wine_role_json
3 label: JSON feed of roles (positions)
4 migration_group: wine
5 source:
6   # We use the JSON source plugin.
7   plugin: url
8   data_fetcher_plugin: http
9   data_parser_plugin: json
10   # The data_parser normally limits the fields passed on to the source plugin
11   # to fields configured to be used as part of the migration. To support more
12   # dynamic migrations, the JSON data parser supports including the original
13   # data for the current row. Simply include the 'include_raw_data' flag set
14   # to `true` to enable this. This option is disabled by default to minimize
15   # memory footprint for migrations that do not need this capability.
16   # include_raw_data: true
17   # Normally, this is one or more fully-qualified URLs or file paths. Because
18   # we can't hardcode your local URL, we provide a relative path here which
19   # hook_install() will rewrite to a full URL for the current site.
20   urls: /migrate_example_advanced_position?_format=json
21   # An xpath-like selector corresponding to the items to be imported.
22   item_selector: position
23   # Under 'fields', we list the data items to be imported. The first level keys
24   # are the source field names we want to populate (the names to be used as
25   # sources in the process configuration below). For each field we're importing,
26   # we provide a label (optional - this is for display in migration tools) and
27   # an xpath for retrieving that value. It's important to note that this xpath
28   # is relative to the elements retrieved by item_selector.
29   fields:
30     -
31       name: machine_name
32       label: 'Unique position identifier'
33       selector: sourceid
34     -
35       name: friendly_name
36       label: 'Position name'
37       selector: name
38   # Under 'ids', we identify source fields populated above which will uniquely
39   # identify each imported item. The 'type' makes sure the migration map table
40   # uses the proper schema type for stored the IDs.
41   ids:
42     machine_name:
43       type: string
44 process:
45   # Note that the source field names here (machine_name and friendly_name) were
46   # defined by the 'fields' configuration for the source plugin above.
47   id: machine_name
48   label: friendly_name
49 destination:
50   plugin: entity:user_role
51 migration_dependencies: {}
52 dependencies:
53   enforced:
54     module:
55       - migrate_example_advanced