-
Notifications
You must be signed in to change notification settings - Fork 82
/
sort_field.go
183 lines (146 loc) · 5.83 KB
/
sort_field.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
// Copyright (c) 2016, 2018, 2023, 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.
// LogAnalytics API
//
// The LogAnalytics API for the LogAnalytics service.
//
package loganalytics
import (
"encoding/json"
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// SortField Field outlining queryString sort command fields and their corresponding sort order.
type SortField struct {
// Field display name - will be alias if field is renamed by queryStrng.
DisplayName *string `mandatory:"false" json:"displayName"`
// Field denoting if this is a declaration of the field in the queryString.
IsDeclared *bool `mandatory:"false" json:"isDeclared"`
// Same as displayName unless field renamed in which case this will hold the original display names for the field
// across all renames.
OriginalDisplayNames []string `mandatory:"false" json:"originalDisplayNames"`
// Internal identifier for the field.
InternalName *string `mandatory:"false" json:"internalName"`
// Identifies if this field can be used as a grouping field in any grouping command.
IsGroupable *bool `mandatory:"false" json:"isGroupable"`
// Identifies if this field format is a duration.
IsDuration *bool `mandatory:"false" json:"isDuration"`
// Alias of field if renamed by queryStrng.
Alias *string `mandatory:"false" json:"alias"`
// Query used to derive this field if specified.
FilterQueryString *string `mandatory:"false" json:"filterQueryString"`
// Field denoting field unit type.
UnitType *string `mandatory:"false" json:"unitType"`
// Sort order for the field specified in the queryString.
Direction SortFieldDirectionEnum `mandatory:"false" json:"direction,omitempty"`
// Field denoting field data type.
ValueType ValueTypeEnum `mandatory:"false" json:"valueType,omitempty"`
}
//GetDisplayName returns DisplayName
func (m SortField) GetDisplayName() *string {
return m.DisplayName
}
//GetIsDeclared returns IsDeclared
func (m SortField) GetIsDeclared() *bool {
return m.IsDeclared
}
//GetOriginalDisplayNames returns OriginalDisplayNames
func (m SortField) GetOriginalDisplayNames() []string {
return m.OriginalDisplayNames
}
//GetInternalName returns InternalName
func (m SortField) GetInternalName() *string {
return m.InternalName
}
//GetValueType returns ValueType
func (m SortField) GetValueType() ValueTypeEnum {
return m.ValueType
}
//GetIsGroupable returns IsGroupable
func (m SortField) GetIsGroupable() *bool {
return m.IsGroupable
}
//GetIsDuration returns IsDuration
func (m SortField) GetIsDuration() *bool {
return m.IsDuration
}
//GetAlias returns Alias
func (m SortField) GetAlias() *string {
return m.Alias
}
//GetFilterQueryString returns FilterQueryString
func (m SortField) GetFilterQueryString() *string {
return m.FilterQueryString
}
//GetUnitType returns UnitType
func (m SortField) GetUnitType() *string {
return m.UnitType
}
func (m SortField) 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 SortField) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if _, ok := GetMappingSortFieldDirectionEnum(string(m.Direction)); !ok && m.Direction != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Direction: %s. Supported values are: %s.", m.Direction, strings.Join(GetSortFieldDirectionEnumStringValues(), ",")))
}
if _, ok := GetMappingValueTypeEnum(string(m.ValueType)); !ok && m.ValueType != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ValueType: %s. Supported values are: %s.", m.ValueType, strings.Join(GetValueTypeEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// MarshalJSON marshals to json representation
func (m SortField) MarshalJSON() (buff []byte, e error) {
type MarshalTypeSortField SortField
s := struct {
DiscriminatorParam string `json:"name"`
MarshalTypeSortField
}{
"SORT",
(MarshalTypeSortField)(m),
}
return json.Marshal(&s)
}
// SortFieldDirectionEnum Enum with underlying type: string
type SortFieldDirectionEnum string
// Set of constants representing the allowable values for SortFieldDirectionEnum
const (
SortFieldDirectionAscending SortFieldDirectionEnum = "ASCENDING"
SortFieldDirectionDescending SortFieldDirectionEnum = "DESCENDING"
)
var mappingSortFieldDirectionEnum = map[string]SortFieldDirectionEnum{
"ASCENDING": SortFieldDirectionAscending,
"DESCENDING": SortFieldDirectionDescending,
}
var mappingSortFieldDirectionEnumLowerCase = map[string]SortFieldDirectionEnum{
"ascending": SortFieldDirectionAscending,
"descending": SortFieldDirectionDescending,
}
// GetSortFieldDirectionEnumValues Enumerates the set of values for SortFieldDirectionEnum
func GetSortFieldDirectionEnumValues() []SortFieldDirectionEnum {
values := make([]SortFieldDirectionEnum, 0)
for _, v := range mappingSortFieldDirectionEnum {
values = append(values, v)
}
return values
}
// GetSortFieldDirectionEnumStringValues Enumerates the set of values in String for SortFieldDirectionEnum
func GetSortFieldDirectionEnumStringValues() []string {
return []string{
"ASCENDING",
"DESCENDING",
}
}
// GetMappingSortFieldDirectionEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingSortFieldDirectionEnum(val string) (SortFieldDirectionEnum, bool) {
enum, ok := mappingSortFieldDirectionEnumLowerCase[strings.ToLower(val)]
return enum, ok
}