{"id":15049992,"url":"https://github.com/nleiva/check-calendar","last_synced_at":"2025-10-19T22:16:05.727Z","repository":{"id":87030942,"uuid":"291800933","full_name":"nleiva/check-calendar","owner":"nleiva","description":"Simple app to verify whether a time slot is taken/busy in Google Calendar from Ansible.","archived":false,"fork":false,"pushed_at":"2020-10-09T19:04:36.000Z","size":40613,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-02-27T09:24:05.148Z","etag":null,"topics":["ansible","google-calendar"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nleiva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-31T19:03:32.000Z","updated_at":"2024-06-19T06:49:42.612Z","dependencies_parsed_at":null,"dependency_job_id":"77ff839c-5c35-4629-8d75-f3b81859b1e9","html_url":"https://github.com/nleiva/check-calendar","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nleiva%2Fcheck-calendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nleiva%2Fcheck-calendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nleiva%2Fcheck-calendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nleiva%2Fcheck-calendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nleiva","download_url":"https://codeload.github.com/nleiva/check-calendar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225402684,"owners_count":17468837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","google-calendar"],"created_at":"2024-09-24T21:24:08.148Z","updated_at":"2025-10-19T22:16:05.638Z","avatar_url":"https://github.com/nleiva.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Check Calendar\n\n![Ansible Lint](https://github.com/nleiva/check-calendar/workflows/Ansible%20Lint/badge.svg)\n\nSimple app to verify whether a timeslot is taken/busy or not from Ansible.\n\n## Requirements\n\n### Go\n\nIf you want to compile the examples, you need Go installed. Otherwise you can use the binaries included for convenience in [here](roles/go-role/library).\n\n\n### Google Calendar API\n\nYou need to [turn on the Google Calendar API](https://developers.google.com/calendar/quickstart/go#step_1_turn_on_the) and download your OAuth 2.0 client credentials (json file) from [API Credentials](https://console.developers.google.com/apis/credentials) as in the image below.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg title=\"API Console\" src=\"static/API.JPG\"\u003e\u003cbr\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\nName this file as `desktop.json`, as we reference it in the code.\n\n```go\nb, err := ioutil.ReadFile(\"desktop.json\")\nif err != nil {\n\treturn false, fmt.Errorf(\"Unable to read client secret file: %v\", err)\n}\n```\n\nThe file `token.json` will be automatically generated once an API Token has been granted. Store this file securely as it will have a refresh token that never expires.\n\n## Compiling\n\nTo compile your own binaries for multiple target Operating Systems (`GOOS`), run `make compile`. The binaries in this repo were compiled in an `amd64` platform (`GOARCH`).\n\n## Testing\n\n### Manually\n\nExecute `make test-manual`. You need an arguments file named `args.json` with something like:\n\n\n```json\n{\n    \"Name\": \"Test\",\n    \"Time\":  \"2020-09-01T19:50:00Z\"\n}\n```\n\n**Note**: Z is the zone designator for the zero UTC offset.\n\n### From Ansible\n\nExecute: `make test-ansible`.\n\n```yaml\n...\n- name: Test the module (from role)\n  calendar_linux:\n    name: Testing the Calendar module\n    time: \"{{ ansible_date_time.iso8601 }}\"\n  register: output\n...\n```\n\nIf you are running this during a big event or scheduled maintenance window, the module will return true so you can act accordingly. See this calendar example:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg title=\"Calendar\" src=\"static/calendar.png\"\u003e\u003cbr\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\n The output would look as follows. Notice `\"busy\": true` or `\"msg\": \"The timeslot 2020-09-02T17:53:43Z is busy: true\"`.\n\n ```ruby\n$ make test-ansible\n[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'\n\nPLAY [Test Calendar module] **********************************************************************************************************************************\n\nTASK [Gathering Facts] ***************************************************************************************************************************************\nok: [localhost]\n\nTASK [Print the time (ISO 8601) - Module input] **************************************************************************************************************\nok: [localhost] =\u003e {\n    \"ansible_date_time.iso8601\": \"2020-09-02T17:53:43Z\"\n}\n\nTASK [go-role : Test the module (from role)] *****************************************************************************************************************\nincluded: /home/centos/check-calendar/roles/go-role/tasks/Linux.yml for localhost\n\nTASK [go-role : Test the module (from role) on Linux [Linux]] ************************************************************************************************\nok: [localhost]\n\nTASK [Print out Calendar module output] **********************************************************************************************************************\nok: [localhost] =\u003e {\n    \"output\": {\n        \"busy\": true,\n        \"changed\": false,\n        \"failed\": false,\n        \"msg\": \"The timeslot 2020-09-02T17:53:43Z is busy: true\"\n    }\n}\n\nPLAY RECAP ***************************************************************************************************************************************************\nlocalhost                  : ok=5    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n ```\n\n## Art work\n\nRepo image from [Maria Letta's Free Gophers Pack](https://github.com/MariaLetta/free-gophers-pack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnleiva%2Fcheck-calendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnleiva%2Fcheck-calendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnleiva%2Fcheck-calendar/lists"}