Functions
- sort_parent
-
Sort according to parent attribute.
- sort_parents
-
Sort arrayref of
nameswith data fromitemsusing parentattr. - rest
-
Convenience wrapper for direct REST calls for
method,operationand optionsropts. - get_id
-
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.Options
-
Function to initialise tagstore or return cached version based on tagstore project name.
-
Function to postprocess sync operations when a tagstore is used.
Methods
- sync
-
For an
operation(likeuser,group,service, ...), given an hashref ofitems(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,updateanddeleteand the values an arrayref of responses.For
endpointoperations, as they have no name, use the<<interface_<url>>> as the name for theitemshashref.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
itemshashref, will be deleted (instead of disabled). - keep: when the keep option is true, existing items that are not in the
itemshashref are ignored. This precedes any value ofdeleteoption.
- get_item
-
Retrieve and augment an item with
namefrom hashrefitems.Modification to the data
- _process_response
-
Helper function for all 3 sync phases
resis updated in place.Returns 1 on success, undef otherwise (and reports an error).
- create
-
Create
operationitems in arrayreftocreatefrom configureditems(using name attriutenameattr), with result hashrefres.resis updated in place.postprocessis a anonymous function called after a succesful REST call, and is passed following arguments: - update
-
Update
operationitems in arrayrefcheckupdatefromfounditems with configureditems, with result hashrefres.resis updated in place. - delete
-
Delete (or disable)
operationitems in arrayreftoremovefromfoundexisting items, with optionsopts(fordeleteandignore) and result hashrefres.resis updated in place.When
ignoreoption is true, nothing will happen. Whendeleteis true, items will be delete; when items will be disabled. - sync_rolemap
-
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 => { ... }, }
Options