This is to keep few code snippets that you will find useful when managing CloodCBR
In the serverless.yml file set the API Key name. After adding Key authorisation you will need to update the HTTP requests done to CloodCBR API with header x-api-key
provider:
name: aws
runtime: python3.7
region: eu-west-1
stage: dev
apiKeys:
- DEV_KEY_NAME <----
In the HTTP method add private: true
get_project:
handler: handler.get_project
timeout: 10
events:
- http:
path: project/{id}
method: get
cors: true
private: true <----
# proj['casebase'] is the casebase name
query = {'query': {'bool': {'should': [{'match_all': {}}]}}, 'size': 1000}
res = es.search(index=proj['casebase'], body=query)
# proj['casebase'] is the casebase name
query = {'query': {'bool': {'should': [{'match_all': {}}]}}, 'size': 1000}
res = es.delete_by_query(index=proj['casebase'], body=query)