github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/ces/v1/events/ListEventDetail.go (about) 1 package events 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type ListEventDetailOpts struct { 9 // Specifies the event name. 10 EventName string 11 // Specifies the event type. Possible types are EVENT.SYS (system event) and EVENT.CUSTOM (custom event). 12 EventType string `q:"event_type" required:"true"` 13 // Specifies the event name. The name can be a system event name or a custom event name. 14 EventSource string `q:"event_source,omitempty"` 15 // Specifies the event severity. Possible severities are Critical, Major, Minor, and Info. 16 EventLevel string `q:"event_level,omitempty"` 17 // Specifies the name of the user who reports the event monitoring data. It can also be a project ID. 18 EventUser string `q:"event_user,omitempty"` 19 // Specifies the event status. Possible statuses are normal, warning, or incident. 20 EventState string `q:"event_state,omitempty"` 21 // Specifies the start time of the query. The time is a UNIX timestamp and the unit is ms. Example: 1605952700911 22 From int64 `q:"from,omitempty"` 23 // No 24 // Specifies the end time of the query. The time is a UNIX timestamp and the unit is ms. The from value must be smaller than the to value. 25 To int64 `q:"to,omitempty"` 26 // Specifies the start value of pagination. The value is an integer. The default value is 0. 27 Start int `q:"start,omitempty"` 28 // Specifies the maximum number of records that can be queried at a time. Supported range: 1 to 100 (default) 29 Limit int `q:"limit,omitempty"` 30 } 31 32 func ListEventDetail(client *golangsdk.ServiceClient, opts ListEventDetailOpts) (*ListEventDetailResponse, error) { 33 url, err := golangsdk.NewURLBuilder().WithEndpoints("event", opts.EventName).WithQueryParams(&opts).Build() 34 if err != nil { 35 return nil, err 36 } 37 38 // GET /V1.0/{project_id}/event/{event_name} 39 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 40 if err != nil { 41 return nil, err 42 } 43 44 var res ListEventDetailResponse 45 err = extract.Into(raw.Body, &res) 46 return &res, err 47 } 48 49 type ListEventDetailResponse struct { 50 // Specifies the event name. The name can be a system event name or a custom event name. 51 EventName string `json:"event_name,omitempty"` 52 // Specifies the event type. Possible types are EVENT.SYS (system event) and EVENT.CUSTOM (custom event). 53 EventType string `json:"event_type,omitempty"` 54 // Specifies the name of the user who reports the event. It can also be a project ID. 55 EventUsers []string `json:"event_users,omitempty"` 56 // Specifies the event source. If the event is a system event, the source is the namespace of each service. 57 // To view the namespace of each service, see A.1 Services Interconnected with Cloud Eye. If the event is a custom event, the event source is defined by the user. 58 EventSources []string `json:"event_sources,omitempty"` 59 // Specifies details about one or more events. 60 EventInfo []EventInfoDetail `json:"event_info,omitempty"` 61 // Specifies the number of metadata records in the query result. 62 MetaData TotalMetaData `json:"meta_data,omitempty"` 63 } 64 65 type EventInfoDetail struct { 66 // Specifies the event name. Start with a letter. Enter 1 to 64 characters. Only letters, digits, and underscores (_) are allowed. 67 EventName string `json:"event_name"` 68 // Specifies the event source in the format of service.item. service and item each must start with 69 // a letter and contain 3 to 32 characters, including only letters, digits, and underscores (_). 70 EventSource string `json:"event_source"` 71 // Specifies when the event occurred, which is a UNIX timestamp (ms). 72 // Since there is a latency between the client and the server, the data timestamp to be inserted should be within 73 // the period that starts from one hour before the current time plus 20s to 10 minutes after the current time minus 20s. 74 // In this way, the timestamp will be inserted to the database without being affected by the latency. 75 Time int64 `json:"time"` 76 // Specifies the event details. 77 Detail EventItemDetail `json:"detail"` 78 // Specifies the event ID. 79 EventId string `json:"event_id,omitempty"` 80 } 81 82 type TotalMetaData struct { 83 // Specifies the total number of events. 84 Total int `json:"total,omitempty"` 85 }