| `getCustomScript` | Offers the possibility to provide a custom Powershell script that further processes the result of the GET call. May be used in conjunction with setting `getUriExcludeIdentifier` to true so you can take custom actions given all found existing objects.<br><br>Using a custom script, variables from the outer script can be read and used within the script, so you may find it useful to access the following local variables in the script: <br><br>`$responseGet`: the string result of the GET call<br>`$apiEndpoint`: the apiEndpoint field of the subresource<br>`$entity`: the entity configuration options<br><br>As a further usage improvement, you can add additional properties (names need to be different from well-known properties, best add a `_` prefix to the variable name) to `$entity` configuration which contain Helm templating expressions that are resolved when rendering the chart. Then access these variables via the `$entity` object in the script. Here is an example:<br><br>`entity:`<br>  `_helm_chart_name_:` `_HT!{{ (index . "$").Chart.Name }}`<br>  `_helm_chart_version_:` `_HT!{{ (index . "$").Chart.Version }}`<br><br> where in the `getCustomScript` you can simply access the current Helm chart name with `$entity._helm_chart_name_` and version with `$entity._helm_chart_version_`<br><br> The script can return either a boolean value for general success of the GET call (translating to a 200 or 404 status code) or it may return a JSON with additional information useful for adjusting a subsequent PUT or DELETE call. The JSON is allowed to return the following fields that will update the local PowerShell variables accordingly if present:<br><br>`statusCode`: sets the virtual statusCode for further processing<br>`uriPut`: sets the full URI used for putting the `config` content.<br>`uriDelete`: sets the full URI used for deleting the entity.<br>`identifier`: sets the `identifier` for all further PUT or DELETE operations.<br><br>A JSON returned from `getCustomScript` may look like this: `{"statusCode":200, "uriPut":"https://host.com/API/notifications/groups/NOTIFICATION-VX-99"}`<br><br>An example of this coming together is the usage of notifications in VidiCore, to find out whether a particular notification needs to be updated it is required to get a list of all existing notifications and update the POST/DELETE uri to correctly address the targeted resource. See the VidiCore or MediaPortal Helm Chart for the implementation of this. | | `GET`
0 commit comments