...
If the placeholder {DEFAULT_REQUESTINFO}
is used a user has to be created with role and type SYSTEM and userName CRONJOB. Please Note, the created user must be active. Following is a sample create request:
Code Block |
---|
curl --location --request POST 'https://egov-micro-dev.egovernments.org/user/users/_createnovalidate' \ --header 'Content-Type: application/json' \ --data-raw '{ "requestInfo": { "apiId": "Rainmaker", "ver": ".01", "ts": null, "action": "_update", "did": "1", "key": "", "msgId": "20170310130900|en_IN", "authToken": "5eb3655f-31b1-4cd5-b8c2-4f9c033510d4" }, "user": { "userName": "CRONJOB", "name": "System cron job", "gender": null, "mobileNumber": "9191919191", "type": "SYSTEM", "roles": [ { "id": null, "name": "System user", "code": "SYSTEM", "description": null, "createdBy": null, "createdDate": null, "lastModifiedBy": null, "lastModifiedDate": null, "tenantId": null } ], "tenantId": "pb" } }' |
If the user service build running on current environment encrypts PIIs while storing DB records then in “DataSecurity” module and “DecryptionABAC“ master of mdms ex:- https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/DataSecurity/DecryptionABAC.json In “ALL_ACCESS“ section add following values in “roleAttributeAccessList“.
Code Block | ||
---|---|---|
| ||
{
"roleCode": "SYSTEM",
"attributeAccessList": [
{
"attribute": {
"jsonPath": "*/name"
},
"accessType": "PLAIN"
},
{
"attribute": {
"jsonPath": "*/mobileNumber"
},
"accessType": "PLAIN"
}
]
} |
Kubernetes:
The following is the kubernetes configuration for the cron job:
Code Block |
---|
apiVersion: batch/v1beta1 kind: CronJob metadata: name: daily spec: schedule: "1 0 * * *" jobTemplate: spec: template: spec: containers: - name: daily image: talele08/api-cronjob-image-24 command: ["python3","cronJobAPIConfig.py"] args: ["daily"] env: - name: JOB_NAME valueFrom: fieldRef: fieldPath: metadata.name restartPolicy: OnFailure |
The cron job timing can be adjusted using the schedule
property. The above value schedule: "1 0 * * *"
will trigger the cron job everyday at 00:01 AM.
...
The above configurations, dockerfile and the python script to be called by cron job are uploaded in the link described below:
https://github.com/egovernments/utilities/tree/API_CRON/scripts/egov-api-cron-job
Localization:
Following is the message cURL to be pushed in localization:
...