What is the primary purpose of the "Get System Events" function in the Calendar Invite Server (CIS) Dashboard?
The "Get System Events" function is designed to allow system administrators and authorized code committers to retrieve a comprehensive list of all events across the entire Calendar Invite Server (CIS) system. This provides a system-wide view of event data, crucial for oversight and management.
Which AWS services are utilized to implement the "Get System Events" functionality?
The "Get System Events" function leverages two core AWS services: AWS Lambda, which handles the API requests for retrieving the system-wide events, and Amazon DynamoDB, which serves as the persistent storage and retrieval mechanism for all event data.
How is the "Get System Events" function triggered and what is its event processing flow?
An API Gateway request triggers the function. Unlike some other functions, it does not require a specific organizer as it aims to retrieve all system events. The processing flow involves querying DynamoDB to fetch all events, filtering these results based on timestamps, converting the raw DynamoDB data into a structured JSON format, and finally returning this formatted event list as an HTTP 200 response.
What are the key functions involved in retrieving and formatting system events?
The main functions involved are lambda_handler(event, __), which extracts request details and initiates the retrieval process; get_system_event_list(), which orchestrates the call to DynamoDB and the subsequent formatting; get_event_records(), which directly queries DynamoDB using a Global Secondary Index (GSI) and applies filtering for timestamps and result limits; and format_events_from(event_list), which transforms the DynamoDB output into a standardized JSON format.
What kind of data is stored in DynamoDB for events and what fields are included in the formatted output?
DynamoDB stores event records with pk and sk (partition and sort keys) both set to event#, along with detailed event information such as timestamps, organizer email, location, and status. When formatted, the event data includes fields like uid, mailto, organizer, status, created, dtstart, dtend, summary_html, description_html, and location_html.
What security measures are in place for the "Get System Events" function, given its access to sensitive data?
Due to its ability to access all system-wide event data, the "Get System Events" function is restricted to system administrators and authorized users only. Security considerations include using IAM policies to strictly control access to the function and implementing API Gateway authentication to prevent unauthorized data exposure. Additionally, queries utilize tenant-based filtering to ensure data isolation.
How does the system handle errors, specifically unauthorized access and DynamoDB query failures?
For unauthorized access, the system relies on IAM roles and API Gateway authentication to restrict entry. In the event of DynamoDB query failures, errors are logged, but the processing continues without disruption. Unhandled exceptions are also captured and result in an error response to maintain system stability.
What environmental variables are configurable for the "Get System Events" function?
Several environmental variables allow for configuration: REGION specifies the AWS region, DYNAMODB_TABLE indicates the name of the DynamoDB table, EVENT_VIEW_LENGTH sets the default maximum number of events returned per request, MAX_EVENT_VIEW_LENGTH defines the upper limit for event retrieval, and LOG_LEVEL controls the verbosity of logging.