Sort according to parent attribute.


Sort arrayref of names with data from items using parent attr.


Convenience wrapper for direct REST calls for method, operation and options ropts.


Return the ID of an operation. If the name is an ID, return the ID without a lookup. If the operation is 'region', return the name.


error: report an error when no id is found
msg: use the value as (part of) the reported message

Function to initialise tagstore or return cached version based on tagstore project name.


Function to postprocess sync operations when a tagstore is used.



For an operation (like user, group, service, ...), given an hashref of items (key is the name), compare it with all existing items:

Non-existing ones are added/created
Existing ones are possibly updated
Existing ones that are not requested are disbaled

Returns a hasref with responses for the created items. The keys are create, update and delete and the values an arrayref of responses.

For endpoint operations, as they have no name, use the <<interface_<url>>> as the name for the items hashref.

Following options are supported:

filter: a function to filter the existing items. Return a true value to keep the existing item (false will ignore it). By default, all existing items are considered.
delete: when the delete option is true, existing items that are not in the items hashref, will be deleted (instead of disabled).
keep: when the keep option is true, existing items that are not in the items hashref are ignored. This precedes any value of delete option.
tagstore: use project tagstore to track synced ids. If no filter is set, the tagstore is used to filter known ids as existing tags in the tagstore.

Retrieve and augment an item with name from hashref items.

Modification to the data

name is inserted (unless this is an endpoint)
any named ids (either from (other) operation(s) or parenting) are resolved to their actual id.

Helper function for all 3 sync phases

res is updated in place.

Returns 1 on success, undef otherwise (and reports an error).


Create operation items in arrayref tocreate from configured items (using name attriute nameattr), with result hashref res. res is updated in place.

postprocess is a anonymous function called after a succesful REST call, and is passed following arguments:

phase: one of create, update or delete, depending on what pahse of the sync the REST call is made.
operation: type of operation
name: name of the operation
result: result of the REST call

Update operation items in arrayref checkupdate from found items with configured items, with result hashref res. res is updated in place.


Delete (or disable) operation items in arrayref toremove from found existing items, with options opts (for delete and ignore) and result hashref res. res is updated in place.

When ignore option is true, nothing will happen. When delete is true, items will be delete; when items will be disabled.


Add missing roles for project/domain and group/user, and delete any when tagstore is used.

The roles are defined with a nested hashref, like the url is structured (with an arrayref of roles as value). E.g. $roles = { domain => { dom1 => { user => { user1 => [role1 role2], ... }, group => { ... }, }, ... project => { ... }, }


tagstore: use project tagstore to track synced roles.