-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventlogentryreport.go
73 lines (55 loc) · 2.37 KB
/
eventlogentryreport.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package eventlogentryreport
import (
"errors"
)
const (
eventlogEntryReportEndpoint = "/eventlogEntryReport"
)
type EventLogEntryReportTaskInfo struct {
// Status of running task
Status string `json:"status,omitempty"`
// Number of items processed
ProgressItemsComplete int `json:"progressItemsComplete,omitempty"`
// End time
ProgressEndTime int `json:"progressEndTime,omitempty"`
// Error message
ErrorMessage string `json:"errorMessage,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
}
type EventLogEntryReport struct {
// The start time in the time range used to generate the event log report
StartTime int `json:"startTime,omitempty"`
// The end time in the time range used to generate the event log report
EndTime int `json:"endTime,omitempty"`
Page int `json:"page,omitempty"`
PageSize string `json:"pageSize,omitempty"`
// Filters the list based on the category for which the events were recorded.
Category string `json:"category,omitempty"`
// Filters the list based on areas within a category where the events were recorded
Subcategories []string `json:"subcategories,omitempty"`
// Filters the list based on the outcome (i.e., Failure or Success) of the events recorded
ActionResult string `json:"actionResult,omitempty"`
// The search string used to match against the event log message
Message string `json:"message,omitempty"`
// The search string used to match against the error code in event log entries
ErrorCode string `json:"errorCode,omitempty"`
// The search string used to match against the status code in event log entries
StatusCode string `json:"statusCode,omitempty"`
}
func (service *Service) GetAll() ([]EventLogEntryReportTaskInfo, error) {
var eventLogEntryReport []EventLogEntryReportTaskInfo
err := service.Client.Read(eventlogEntryReportEndpoint, &eventLogEntryReport)
return eventLogEntryReport, err
}
func (service *Service) Create(eventLog *EventLogEntryReport) (*EventLogEntryReport, error) {
resp, err := service.Client.Create(eventlogEntryReportEndpoint, eventLog)
if err != nil {
return nil, err
}
createdEventLogReport, ok := resp.(*EventLogEntryReport)
if !ok {
return nil, errors.New("object returned from api was not an event log entry report pointer")
}
service.Client.Logger.Printf("[DEBUG]returning event log entry report from create: %d", createdEventLogReport)
return createdEventLogReport, nil
}