1/* 2* Copyright 2018 - Present Okta, Inc. 3* 4* Licensed under the Apache License, Version 2.0 (the "License"); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an "AS IS" BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15 */ 16 17// AUTO-GENERATED! DO NOT EDIT FILE DIRECTLY 18 19package okta 20 21import ( 22 "context" 23 "fmt" 24 "github.com/okta/okta-sdk-golang/v2/okta/query" 25 "time" 26) 27 28type LogEventResource resource 29 30type LogEvent struct { 31 Actor *LogActor `json:"actor,omitempty"` 32 AuthenticationContext *LogAuthenticationContext `json:"authenticationContext,omitempty"` 33 Client *LogClient `json:"client,omitempty"` 34 DebugContext *LogDebugContext `json:"debugContext,omitempty"` 35 DisplayMessage string `json:"displayMessage,omitempty"` 36 EventType string `json:"eventType,omitempty"` 37 LegacyEventType string `json:"legacyEventType,omitempty"` 38 Outcome *LogOutcome `json:"outcome,omitempty"` 39 Published *time.Time `json:"published,omitempty"` 40 Request *LogRequest `json:"request,omitempty"` 41 SecurityContext *LogSecurityContext `json:"securityContext,omitempty"` 42 Severity string `json:"severity,omitempty"` 43 Target []*LogTarget `json:"target,omitempty"` 44 Transaction *LogTransaction `json:"transaction,omitempty"` 45 Uuid string `json:"uuid,omitempty"` 46 Version string `json:"version,omitempty"` 47} 48 49// The Okta System Log API provides read access to your organization’s system log. This API provides more functionality than the Events API 50func (m *LogEventResource) GetLogs(ctx context.Context, qp *query.Params) ([]*LogEvent, *Response, error) { 51 url := fmt.Sprintf("/api/v1/logs") 52 if qp != nil { 53 url = url + qp.String() 54 } 55 56 req, err := m.client.requestExecutor.WithAccept("application/json").WithContentType("application/json").NewRequest("GET", url, nil) 57 if err != nil { 58 return nil, nil, err 59 } 60 61 var logEvent []*LogEvent 62 63 resp, err := m.client.requestExecutor.Do(ctx, req, &logEvent) 64 if err != nil { 65 return nil, resp, err 66 } 67 68 return logEvent, resp, nil 69} 70