event.go raw
1 /**
2 * Copyright 2016-2024 IBM Corp.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
8 * on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 * See the License for the specific language governing permissions and limitations under the License.
10 */
11
12 // AUTOMATICALLY GENERATED CODE - DO NOT MODIFY
13
14 package services
15
16 import (
17 "fmt"
18 "strings"
19
20 "github.com/softlayer/softlayer-go/datatypes"
21 "github.com/softlayer/softlayer-go/session"
22 "github.com/softlayer/softlayer-go/sl"
23 )
24
25 // The SoftLayer_Event_Log data type contains an event detail occurred upon various SoftLayer resources.
26 type Event_Log struct {
27 Session session.SLSession
28 Options sl.Options
29 }
30
31 // GetEventLogService returns an instance of the Event_Log SoftLayer service
32 func GetEventLogService(sess session.SLSession) Event_Log {
33 return Event_Log{Session: sess}
34 }
35
36 func (r Event_Log) Id(id int) Event_Log {
37 r.Options.Id = &id
38 return r
39 }
40
41 func (r Event_Log) Mask(mask string) Event_Log {
42 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
43 mask = fmt.Sprintf("mask[%s]", mask)
44 }
45
46 r.Options.Mask = mask
47 return r
48 }
49
50 func (r Event_Log) Filter(filter string) Event_Log {
51 r.Options.Filter = filter
52 return r
53 }
54
55 func (r Event_Log) Limit(limit int) Event_Log {
56 r.Options.Limit = &limit
57 return r
58 }
59
60 func (r Event_Log) Offset(offset int) Event_Log {
61 r.Options.Offset = &offset
62 return r
63 }
64
65 // This all indexed event names.
66 func (r Event_Log) GetAllEventNames(objectName *string) (resp []string, err error) {
67 params := []interface{}{
68 objectName,
69 }
70 err = r.Session.DoRequest("SoftLayer_Event_Log", "getAllEventNames", params, &r.Options, &resp)
71 return
72 }
73
74 // This all indexed event object names.
75 func (r Event_Log) GetAllEventObjectNames() (resp []string, err error) {
76 err = r.Session.DoRequest("SoftLayer_Event_Log", "getAllEventObjectNames", nil, &r.Options, &resp)
77 return
78 }
79
80 // no documentation yet
81 func (r Event_Log) GetAllObjects() (resp []datatypes.Event_Log, err error) {
82 err = r.Session.DoRequest("SoftLayer_Event_Log", "getAllObjects", nil, &r.Options, &resp)
83 return
84 }
85
86 // no documentation yet
87 func (r Event_Log) GetAllUserTypes() (resp []string, err error) {
88 err = r.Session.DoRequest("SoftLayer_Event_Log", "getAllUserTypes", nil, &r.Options, &resp)
89 return
90 }
91
92 // Retrieve
93 func (r Event_Log) GetUser() (resp datatypes.User_Customer, err error) {
94 err = r.Session.DoRequest("SoftLayer_Event_Log", "getUser", nil, &r.Options, &resp)
95 return
96 }
97