Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ngs/Go-Google-email-audit-api
Go Client Library for G Suite Email Audit API
https://github.com/ngs/Go-Google-email-audit-api
Last synced: about 2 months ago
JSON representation
Go Client Library for G Suite Email Audit API
- Host: GitHub
- URL: https://github.com/ngs/Go-Google-email-audit-api
- Owner: ngs-archives
- License: bsd-3-clause
- Archived: true
- Created: 2016-10-24T02:34:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-26T12:55:17.000Z (almost 8 years ago)
- Last Synced: 2024-04-14T00:54:36.124Z (5 months ago)
- Language: Go
- Homepage: https://godoc.org/github.com/ngs/go-google-email-audit-api/emailaudit
- Size: 25.4 KB
- Stars: 8
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-google-email-audit-api
[![Build Status](https://travis-ci.org/ngs/go-google-email-audit-api.svg?branch=master)](https://travis-ci.org/ngs/go-google-email-audit-api)
[![GoDoc](https://godoc.org/github.com/ngs/go-google-email-audit-api/emailaudit?status.svg)](https://godoc.org/github.com/ngs/go-google-email-audit-api/emailaudit)
[![Go Report Card](https://goreportcard.com/badge/github.com/ngs/go-google-email-audit-api)](https://goreportcard.com/report/github.com/ngs/go-google-email-audit-api)
[![Coverage Status](https://coveralls.io/repos/github/ngs/go-google-email-audit-api/badge.svg?branch=master)](https://coveralls.io/github/ngs/go-google-email-audit-api?branch=master)Go Client Library for [Google Email Audit API]
```sh
go get -u github.com/ngs/go-google-email-audit-api/emailaudit
```## Email Monitor API
```go
import (
// ...
"github.com/ngs/go-google-email-audit-api/emailaudit"
)func main() {
// ...
srv, err := emailaudit.New(client) // client = http.Client
if err != nil {
log.Fatalf("Unable to retrieve Email Audit API Client %v", err)
}
endDate := time.Date(2116, time.October, 31, 23, 59, 59, 0, time.UTC)// Create or update Email Monitor
monitor, err := srv.MailMonitor.Update("example.com",
"ngs", "kyohei", endDate,
emailaudit.MailMonitorLevels{
IncomingEmail: emailaudit.FullMessageLevel,
OutgoingEmail: emailaudit.FullMessageLevel,
Draft: emailaudit.FullMessageLevel,
Chat: emailaudit.FullMessageLevel,
},
)
if err != nil {
log.Fatalf("Unable to update email monitor. %v", err)
}// List Email Monitors
monitors, err := srv.MailMonitor.List("example.com", "ngs")
if err != nil {
log.Fatalf("Unable to list email monitor. %v", err)
}
for _, m := range monitors {
fmt.Printf("%v %v@%v chat:%v draft:%v incoming:%v outgoing:%v\n",
m.Updated, m.DestUserName, m.DomainName,
m.MonitorLevels.Chat, m.MonitorLevels.Draft,
m.MonitorLevels.IncomingEmail, m.MonitorLevels.OutgoingEmail)
}// Disable Email Monitor
err = srv.MailMonitor.Disable("example.com", "ngs", "kyohei")
if err != nil {
log.Fatalf("Unable to disable email monitor. %v", err)
}
}
```## Mailbox Download
Not yet implemented
## Author
[Atsushi Nagase]
## License
See [LICENSE]
[Google Email Audit API]: https://developers.google.com/admin-sdk/email-audit/
[Atsushi Nagase]: https://ngs.io
[LICENSE]: LICENSE