/
awr_query_result.go
253 lines (225 loc) · 9.29 KB
/
awr_query_result.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Database Management API
//
// Use the Database Management API to perform tasks such as obtaining performance and resource usage metrics
// for a fleet of Managed Databases or a specific Managed Database, creating Managed Database Groups, and
// running a SQL job on a Managed Database or Managed Database Group.
//
package databasemanagement
import (
"encoding/json"
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// AwrQueryResult The AWR query result.
type AwrQueryResult interface {
// The name of the query result.
GetName() *string
// The version of the query result.
GetVersion() *string
// The ID assigned to the query instance.
GetQueryKey() *string
// The time taken to query the database tier (in seconds).
GetDbQueryTimeInSecs() *float64
}
type awrqueryresult struct {
JsonData []byte
Version *string `mandatory:"false" json:"version"`
QueryKey *string `mandatory:"false" json:"queryKey"`
DbQueryTimeInSecs *float64 `mandatory:"false" json:"dbQueryTimeInSecs"`
Name *string `mandatory:"true" json:"name"`
AwrResultType string `json:"awrResultType"`
}
// UnmarshalJSON unmarshals json
func (m *awrqueryresult) UnmarshalJSON(data []byte) error {
m.JsonData = data
type Unmarshalerawrqueryresult awrqueryresult
s := struct {
Model Unmarshalerawrqueryresult
}{}
err := json.Unmarshal(data, &s.Model)
if err != nil {
return err
}
m.Name = s.Model.Name
m.Version = s.Model.Version
m.QueryKey = s.Model.QueryKey
m.DbQueryTimeInSecs = s.Model.DbQueryTimeInSecs
m.AwrResultType = s.Model.AwrResultType
return err
}
// UnmarshalPolymorphicJSON unmarshals polymorphic json
func (m *awrqueryresult) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
if data == nil || string(data) == "null" {
return nil, nil
}
var err error
switch m.AwrResultType {
case "AWRDB_DB_PARAMETER_CHANGE":
mm := AwrDbParameterChangeCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_ASH_CPU_USAGE_SET":
mm := AwrDbCpuUsageCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_EVENT_HISTOGRAM_SET":
mm := AwrDbWaitEventBucketCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_DB_PARAMETER_SET":
mm := AwrDbParameterCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_SYSSTAT_SET":
mm := AwrDbSysstatCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_TOP_EVENT_SET":
mm := AwrDbTopWaitEventCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_SNAPSHOT_SET":
mm := AwrDbSnapshotCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_SET":
mm := AwrDbCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_SNAPSHOT_RANGE_SET":
mm := AwrDbSnapshotRangeCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_DB_REPORT":
mm := AwrDbReport{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_METRICS_SET":
mm := AwrDbMetricCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_EVENT_SET":
mm := AwrDbWaitEventCollection{}
err = json.Unmarshal(data, &mm)
return mm, err
case "AWRDB_SQL_REPORT":
mm := AwrDbSqlReport{}
err = json.Unmarshal(data, &mm)
return mm, err
default:
common.Logf("Recieved unsupported enum value for AwrQueryResult: %s.", m.AwrResultType)
return *m, nil
}
}
// GetVersion returns Version
func (m awrqueryresult) GetVersion() *string {
return m.Version
}
// GetQueryKey returns QueryKey
func (m awrqueryresult) GetQueryKey() *string {
return m.QueryKey
}
// GetDbQueryTimeInSecs returns DbQueryTimeInSecs
func (m awrqueryresult) GetDbQueryTimeInSecs() *float64 {
return m.DbQueryTimeInSecs
}
// GetName returns Name
func (m awrqueryresult) GetName() *string {
return m.Name
}
func (m awrqueryresult) String() string {
return common.PointerString(m)
}
// ValidateEnumValue returns an error when providing an unsupported enum value
// This function is being called during constructing API request process
// Not recommended for calling this function directly
func (m awrqueryresult) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// AwrQueryResultAwrResultTypeEnum Enum with underlying type: string
type AwrQueryResultAwrResultTypeEnum string
// Set of constants representing the allowable values for AwrQueryResultAwrResultTypeEnum
const (
AwrQueryResultAwrResultTypeSet AwrQueryResultAwrResultTypeEnum = "AWRDB_SET"
AwrQueryResultAwrResultTypeSnapshotRangeSet AwrQueryResultAwrResultTypeEnum = "AWRDB_SNAPSHOT_RANGE_SET"
AwrQueryResultAwrResultTypeSnapshotSet AwrQueryResultAwrResultTypeEnum = "AWRDB_SNAPSHOT_SET"
AwrQueryResultAwrResultTypeMetricsSet AwrQueryResultAwrResultTypeEnum = "AWRDB_METRICS_SET"
AwrQueryResultAwrResultTypeSysstatSet AwrQueryResultAwrResultTypeEnum = "AWRDB_SYSSTAT_SET"
AwrQueryResultAwrResultTypeTopEventSet AwrQueryResultAwrResultTypeEnum = "AWRDB_TOP_EVENT_SET"
AwrQueryResultAwrResultTypeEventSet AwrQueryResultAwrResultTypeEnum = "AWRDB_EVENT_SET"
AwrQueryResultAwrResultTypeEventHistogram AwrQueryResultAwrResultTypeEnum = "AWRDB_EVENT_HISTOGRAM"
AwrQueryResultAwrResultTypeDbParameterSet AwrQueryResultAwrResultTypeEnum = "AWRDB_DB_PARAMETER_SET"
AwrQueryResultAwrResultTypeDbParameterChange AwrQueryResultAwrResultTypeEnum = "AWRDB_DB_PARAMETER_CHANGE"
AwrQueryResultAwrResultTypeAshCpuUsageSet AwrQueryResultAwrResultTypeEnum = "AWRDB_ASH_CPU_USAGE_SET"
AwrQueryResultAwrResultTypeDbReport AwrQueryResultAwrResultTypeEnum = "AWRDB_DB_REPORT"
AwrQueryResultAwrResultTypeSqlReport AwrQueryResultAwrResultTypeEnum = "AWRDB_SQL_REPORT"
)
var mappingAwrQueryResultAwrResultTypeEnum = map[string]AwrQueryResultAwrResultTypeEnum{
"AWRDB_SET": AwrQueryResultAwrResultTypeSet,
"AWRDB_SNAPSHOT_RANGE_SET": AwrQueryResultAwrResultTypeSnapshotRangeSet,
"AWRDB_SNAPSHOT_SET": AwrQueryResultAwrResultTypeSnapshotSet,
"AWRDB_METRICS_SET": AwrQueryResultAwrResultTypeMetricsSet,
"AWRDB_SYSSTAT_SET": AwrQueryResultAwrResultTypeSysstatSet,
"AWRDB_TOP_EVENT_SET": AwrQueryResultAwrResultTypeTopEventSet,
"AWRDB_EVENT_SET": AwrQueryResultAwrResultTypeEventSet,
"AWRDB_EVENT_HISTOGRAM": AwrQueryResultAwrResultTypeEventHistogram,
"AWRDB_DB_PARAMETER_SET": AwrQueryResultAwrResultTypeDbParameterSet,
"AWRDB_DB_PARAMETER_CHANGE": AwrQueryResultAwrResultTypeDbParameterChange,
"AWRDB_ASH_CPU_USAGE_SET": AwrQueryResultAwrResultTypeAshCpuUsageSet,
"AWRDB_DB_REPORT": AwrQueryResultAwrResultTypeDbReport,
"AWRDB_SQL_REPORT": AwrQueryResultAwrResultTypeSqlReport,
}
var mappingAwrQueryResultAwrResultTypeEnumLowerCase = map[string]AwrQueryResultAwrResultTypeEnum{
"awrdb_set": AwrQueryResultAwrResultTypeSet,
"awrdb_snapshot_range_set": AwrQueryResultAwrResultTypeSnapshotRangeSet,
"awrdb_snapshot_set": AwrQueryResultAwrResultTypeSnapshotSet,
"awrdb_metrics_set": AwrQueryResultAwrResultTypeMetricsSet,
"awrdb_sysstat_set": AwrQueryResultAwrResultTypeSysstatSet,
"awrdb_top_event_set": AwrQueryResultAwrResultTypeTopEventSet,
"awrdb_event_set": AwrQueryResultAwrResultTypeEventSet,
"awrdb_event_histogram": AwrQueryResultAwrResultTypeEventHistogram,
"awrdb_db_parameter_set": AwrQueryResultAwrResultTypeDbParameterSet,
"awrdb_db_parameter_change": AwrQueryResultAwrResultTypeDbParameterChange,
"awrdb_ash_cpu_usage_set": AwrQueryResultAwrResultTypeAshCpuUsageSet,
"awrdb_db_report": AwrQueryResultAwrResultTypeDbReport,
"awrdb_sql_report": AwrQueryResultAwrResultTypeSqlReport,
}
// GetAwrQueryResultAwrResultTypeEnumValues Enumerates the set of values for AwrQueryResultAwrResultTypeEnum
func GetAwrQueryResultAwrResultTypeEnumValues() []AwrQueryResultAwrResultTypeEnum {
values := make([]AwrQueryResultAwrResultTypeEnum, 0)
for _, v := range mappingAwrQueryResultAwrResultTypeEnum {
values = append(values, v)
}
return values
}
// GetAwrQueryResultAwrResultTypeEnumStringValues Enumerates the set of values in String for AwrQueryResultAwrResultTypeEnum
func GetAwrQueryResultAwrResultTypeEnumStringValues() []string {
return []string{
"AWRDB_SET",
"AWRDB_SNAPSHOT_RANGE_SET",
"AWRDB_SNAPSHOT_SET",
"AWRDB_METRICS_SET",
"AWRDB_SYSSTAT_SET",
"AWRDB_TOP_EVENT_SET",
"AWRDB_EVENT_SET",
"AWRDB_EVENT_HISTOGRAM",
"AWRDB_DB_PARAMETER_SET",
"AWRDB_DB_PARAMETER_CHANGE",
"AWRDB_ASH_CPU_USAGE_SET",
"AWRDB_DB_REPORT",
"AWRDB_SQL_REPORT",
}
}
// GetMappingAwrQueryResultAwrResultTypeEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingAwrQueryResultAwrResultTypeEnum(val string) (AwrQueryResultAwrResultTypeEnum, bool) {
enum, ok := mappingAwrQueryResultAwrResultTypeEnumLowerCase[strings.ToLower(val)]
return enum, ok
}