foliolib.folio.api.scheduler.Scheduler

class foliolib.folio.api.scheduler.Scheduler(tenant: str)

Bases: foliolib.folio.FolioApi

Mod Scheduler API

Mod Scheduler API

Base class of the Folio API

Parameters

tenant (str) – Tenant id

Methods

createschedulertimers(timerDescriptor)

Create timer for a module

deleteschedulertimerbyid(id_)

delete scheduler timer by id

getschedulertimerbyid(id_)

Retrieve scheduler timer by id

getschedulertimers(**kwargs)

Retrieve timer list

updateschedulertimerbyid(timerDescriptor, id_)

Update scheduler timer by id

createschedulertimers(timerDescriptor)

Create timer for a module

POST /scheduler/timers

Parameters

timerDescriptor (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Error response in JSON format for validation errors.

  • OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "TimerDescriptor",
    "description": "Timer",
    "type": "object",
    "properties": {
        "id": {
            "description": "Timer identifier",
            "type": "string",
            "format": "uuid"
        },
        "modified": {
            "description": "Whether modified",
            "type": "boolean"
        },
        "routingEntry": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "title": "RoutingEntry",
            "description": "Okapi proxy routing entry",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "methods": {
                    "description": "List of methods GET, POST,.. * (for all)",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "pathPattern": {
                    "description": "Path pattern match. * matches any path. {x} matches one or more characters but not slash",
                    "type": "string"
                },
                "path": {
                    "description": "Path prefix match",
                    "type": "string"
                },
                "rewritePath": {
                    "description": "Rewrite path. e.g. have filter rewrite '/*' to '/events/*'",
                    "type": "string"
                },
                "phase": {
                    "description": "If given, may be auth, pre or post",
                    "type": "string"
                },
                "level": {
                    "description": "Processing level. Default is 50 (handlers)",
                    "type": "string"
                },
                "type": {
                    "description": "Proxy handling. One of: request-response, request-only, headers, redirect, system, internal, request-response-1.0. The default is request-response",
                    "type": "string"
                },
                "redirectPath": {
                    "description": "If given, path that we internally redirect to",
                    "type": "string"
                },
                "unit": {
                    "$schema": "http://json-schema.org/draft-04/schema#",
                    "id": "timerDelay.json",
                    "title": "Timer Delay Schema",
                    "description": "Timer Delay unit",
                    "type": "string",
                    "enum": [
                        "millisecond",
                        "second",
                        "minute",
                        "hour",
                        "day"
                    ]
                },
                "delay": {
                    "description": "Delay between calls; a value of zero disables timer",
                    "type": "string"
                },
                "schedule": {
                    "description": "Timer schedule using cron-utils",
                    "type": "object",
                    "properties": {
                        "cron": {
                            "description": "crontab specification",
                            "type": "string"
                        },
                        "zone": {
                            "description": "time zone (UTC is the default); See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZoneId.html",
                            "type": "string",
                            "default": "UTC"
                        }
                    },
                    "required": [
                        "cron"
                    ]
                },
                "permissionsRequired": {
                    "description": "Required permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "permissionsDesired": {
                    "description": "Desired permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "modulePermissions": {
                    "description": "Module permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "permissionsRequiredTenant": {
                    "description": "Required permissions that replace permissionsRequired when the user is authenticated and either the tenant matches each {tenantId} in pathPattern or pathPattern doesn't contain {tenantId}",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "delegateCORS": {
                    "description": "Okapi handles CORS by default. Set to true to delegate CORS handling to the module. This only applies to calls made via /_/invoke/tenant/<tid>/<path>. No OPTIONS entry in the methods array is needed for this.",
                    "type": "boolean"
                }
            }
        },
        "enabled": {
            "description": "Whether enabled",
            "type": "boolean"
        }
    },
    "required": [
        "routingEntry",
        "enabled"
    ]
}
deleteschedulertimerbyid(id_)

delete scheduler timer by id

DELETE /scheduler/timers/{id}

Raises

OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.

getschedulertimerbyid(id_)

Retrieve scheduler timer by id

GET /scheduler/timers/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestNotFound – Error response if entity is not found by id (in json format)

  • OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "TimerDescriptor",
    "description": "Timer",
    "type": "object",
    "properties": {
        "id": {
            "description": "Timer identifier",
            "type": "string",
            "format": "uuid"
        },
        "modified": {
            "description": "Whether modified",
            "type": "boolean"
        },
        "routingEntry": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "title": "RoutingEntry",
            "description": "Okapi proxy routing entry",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "methods": {
                    "description": "List of methods GET, POST,.. * (for all)",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "pathPattern": {
                    "description": "Path pattern match. * matches any path. {x} matches one or more characters but not slash",
                    "type": "string"
                },
                "path": {
                    "description": "Path prefix match",
                    "type": "string"
                },
                "rewritePath": {
                    "description": "Rewrite path. e.g. have filter rewrite '/*' to '/events/*'",
                    "type": "string"
                },
                "phase": {
                    "description": "If given, may be auth, pre or post",
                    "type": "string"
                },
                "level": {
                    "description": "Processing level. Default is 50 (handlers)",
                    "type": "string"
                },
                "type": {
                    "description": "Proxy handling. One of: request-response, request-only, headers, redirect, system, internal, request-response-1.0. The default is request-response",
                    "type": "string"
                },
                "redirectPath": {
                    "description": "If given, path that we internally redirect to",
                    "type": "string"
                },
                "unit": {
                    "$schema": "http://json-schema.org/draft-04/schema#",
                    "id": "timerDelay.json",
                    "title": "Timer Delay Schema",
                    "description": "Timer Delay unit",
                    "type": "string",
                    "enum": [
                        "millisecond",
                        "second",
                        "minute",
                        "hour",
                        "day"
                    ]
                },
                "delay": {
                    "description": "Delay between calls; a value of zero disables timer",
                    "type": "string"
                },
                "schedule": {
                    "description": "Timer schedule using cron-utils",
                    "type": "object",
                    "properties": {
                        "cron": {
                            "description": "crontab specification",
                            "type": "string"
                        },
                        "zone": {
                            "description": "time zone (UTC is the default); See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZoneId.html",
                            "type": "string",
                            "default": "UTC"
                        }
                    },
                    "required": [
                        "cron"
                    ]
                },
                "permissionsRequired": {
                    "description": "Required permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "permissionsDesired": {
                    "description": "Desired permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "modulePermissions": {
                    "description": "Module permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "permissionsRequiredTenant": {
                    "description": "Required permissions that replace permissionsRequired when the user is authenticated and either the tenant matches each {tenantId} in pathPattern or pathPattern doesn't contain {tenantId}",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "delegateCORS": {
                    "description": "Okapi handles CORS by default. Set to true to delegate CORS handling to the module. This only applies to calls made via /_/invoke/tenant/<tid>/<path>. No OPTIONS entry in the methods array is needed for this.",
                    "type": "boolean"
                }
            }
        },
        "enabled": {
            "description": "Whether enabled",
            "type": "boolean"
        }
    },
    "required": [
        "routingEntry",
        "enabled"
    ]
}
getschedulertimers(**kwargs)

Retrieve timer list

GET /scheduler/timers

Keyword Arguments
  • offset (int) – Skip over a number of elements by specifying an offset value for the query. (minimum: 0, default: 0)

  • limit (int) – Limit the number of elements returned in the response. (minimum: 0, maximum: 500, default: 10)

Returns

See Schema below.

Return type

dict

Raises

OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Timer Descriptor list",
    "description": "Timer Descriptor List",
    "properties": {
        "timerDescriptors": {
            "description": "List of timer descriptors",
            "type": "array",
            "items": {
                "$schema": "http://json-schema.org/draft-04/schema#",
                "title": "TimerDescriptor",
                "description": "Timer",
                "type": "object",
                "properties": {
                    "id": {
                        "description": "Timer identifier",
                        "type": "string",
                        "format": "uuid"
                    },
                    "modified": {
                        "description": "Whether modified",
                        "type": "boolean"
                    },
                    "routingEntry": {
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "title": "RoutingEntry",
                        "description": "Okapi proxy routing entry",
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "methods": {
                                "description": "List of methods GET, POST,.. * (for all)",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "pathPattern": {
                                "description": "Path pattern match. * matches any path. {x} matches one or more characters but not slash",
                                "type": "string"
                            },
                            "path": {
                                "description": "Path prefix match",
                                "type": "string"
                            },
                            "rewritePath": {
                                "description": "Rewrite path. e.g. have filter rewrite '/*' to '/events/*'",
                                "type": "string"
                            },
                            "phase": {
                                "description": "If given, may be auth, pre or post",
                                "type": "string"
                            },
                            "level": {
                                "description": "Processing level. Default is 50 (handlers)",
                                "type": "string"
                            },
                            "type": {
                                "description": "Proxy handling. One of: request-response, request-only, headers, redirect, system, internal, request-response-1.0. The default is request-response",
                                "type": "string"
                            },
                            "redirectPath": {
                                "description": "If given, path that we internally redirect to",
                                "type": "string"
                            },
                            "unit": {
                                "$schema": "http://json-schema.org/draft-04/schema#",
                                "id": "timerDelay.json",
                                "title": "Timer Delay Schema",
                                "description": "Timer Delay unit",
                                "type": "string",
                                "enum": [
                                    "millisecond",
                                    "second",
                                    "minute",
                                    "hour",
                                    "day"
                                ]
                            },
                            "delay": {
                                "description": "Delay between calls; a value of zero disables timer",
                                "type": "string"
                            },
                            "schedule": {
                                "description": "Timer schedule using cron-utils",
                                "type": "object",
                                "properties": {
                                    "cron": {
                                        "description": "crontab specification",
                                        "type": "string"
                                    },
                                    "zone": {
                                        "description": "time zone (UTC is the default); See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZoneId.html",
                                        "type": "string",
                                        "default": "UTC"
                                    }
                                },
                                "required": [
                                    "cron"
                                ]
                            },
                            "permissionsRequired": {
                                "description": "Required permissions for this entry",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "permissionsDesired": {
                                "description": "Desired permissions for this entry",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "modulePermissions": {
                                "description": "Module permissions for this entry",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "permissionsRequiredTenant": {
                                "description": "Required permissions that replace permissionsRequired when the user is authenticated and either the tenant matches each {tenantId} in pathPattern or pathPattern doesn't contain {tenantId}",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "delegateCORS": {
                                "description": "Okapi handles CORS by default. Set to true to delegate CORS handling to the module. This only applies to calls made via /_/invoke/tenant/<tid>/<path>. No OPTIONS entry in the methods array is needed for this.",
                                "type": "boolean"
                            }
                        }
                    },
                    "enabled": {
                        "description": "Whether enabled",
                        "type": "boolean"
                    }
                },
                "required": [
                    "routingEntry",
                    "enabled"
                ]
            }
        },
        "totalRecords": {
            "type": "integer"
        }
    }
}
updateschedulertimerbyid(timerDescriptor, id_)

Update scheduler timer by id

PUT /scheduler/timers/{id}

Parameters

timerDescriptor (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestNotFound – Error response if entity is not found by id (in json format)

  • OkapiRequestFatalError – Error response for unhandled or critical server exceptions, e.g. NullPointerException.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "TimerDescriptor",
    "description": "Timer",
    "type": "object",
    "properties": {
        "id": {
            "description": "Timer identifier",
            "type": "string",
            "format": "uuid"
        },
        "modified": {
            "description": "Whether modified",
            "type": "boolean"
        },
        "routingEntry": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "title": "RoutingEntry",
            "description": "Okapi proxy routing entry",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "methods": {
                    "description": "List of methods GET, POST,.. * (for all)",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "pathPattern": {
                    "description": "Path pattern match. * matches any path. {x} matches one or more characters but not slash",
                    "type": "string"
                },
                "path": {
                    "description": "Path prefix match",
                    "type": "string"
                },
                "rewritePath": {
                    "description": "Rewrite path. e.g. have filter rewrite '/*' to '/events/*'",
                    "type": "string"
                },
                "phase": {
                    "description": "If given, may be auth, pre or post",
                    "type": "string"
                },
                "level": {
                    "description": "Processing level. Default is 50 (handlers)",
                    "type": "string"
                },
                "type": {
                    "description": "Proxy handling. One of: request-response, request-only, headers, redirect, system, internal, request-response-1.0. The default is request-response",
                    "type": "string"
                },
                "redirectPath": {
                    "description": "If given, path that we internally redirect to",
                    "type": "string"
                },
                "unit": {
                    "$schema": "http://json-schema.org/draft-04/schema#",
                    "id": "timerDelay.json",
                    "title": "Timer Delay Schema",
                    "description": "Timer Delay unit",
                    "type": "string",
                    "enum": [
                        "millisecond",
                        "second",
                        "minute",
                        "hour",
                        "day"
                    ]
                },
                "delay": {
                    "description": "Delay between calls; a value of zero disables timer",
                    "type": "string"
                },
                "schedule": {
                    "description": "Timer schedule using cron-utils",
                    "type": "object",
                    "properties": {
                        "cron": {
                            "description": "crontab specification",
                            "type": "string"
                        },
                        "zone": {
                            "description": "time zone (UTC is the default); See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/ZoneId.html",
                            "type": "string",
                            "default": "UTC"
                        }
                    },
                    "required": [
                        "cron"
                    ]
                },
                "permissionsRequired": {
                    "description": "Required permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "permissionsDesired": {
                    "description": "Desired permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "modulePermissions": {
                    "description": "Module permissions for this entry",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "permissionsRequiredTenant": {
                    "description": "Required permissions that replace permissionsRequired when the user is authenticated and either the tenant matches each {tenantId} in pathPattern or pathPattern doesn't contain {tenantId}",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "delegateCORS": {
                    "description": "Okapi handles CORS by default. Set to true to delegate CORS handling to the module. This only applies to calls made via /_/invoke/tenant/<tid>/<path>. No OPTIONS entry in the methods array is needed for this.",
                    "type": "boolean"
                }
            }
        },
        "enabled": {
            "description": "Whether enabled",
            "type": "boolean"
        }
    },
    "required": [
        "routingEntry",
        "enabled"
    ]
}