-
Notifications
You must be signed in to change notification settings - Fork 82
/
filter.go
154 lines (137 loc) · 6.72 KB
/
filter.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
// Copyright (c) 2016, 2018, 2022, 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 (
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// Filter Query builder filter action to apply edit to queryString.
type Filter struct {
// Operator to apply when editing the query string.
Operator FilterOperatorEnum `mandatory:"true" json:"operator"`
// Field filter references when inserting filter into the query string. Field must be a valid logging analytics out-of-the-box field, virtual field calculated in the query or a user defined field.
FieldName *string `mandatory:"false" json:"fieldName"`
// Field values that will be inserted into the query string for the specified fieldName. Please note all values should reflect the fields data type otherwise the insert is subject to fail.
Values []interface{} `mandatory:"false" json:"values"`
}
func (m Filter) 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 Filter) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if _, ok := GetMappingFilterOperatorEnum(string(m.Operator)); !ok && m.Operator != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Operator: %s. Supported values are: %s.", m.Operator, strings.Join(GetFilterOperatorEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// FilterOperatorEnum Enum with underlying type: string
type FilterOperatorEnum string
// Set of constants representing the allowable values for FilterOperatorEnum
const (
FilterOperatorClear FilterOperatorEnum = "CLEAR"
FilterOperatorReplace FilterOperatorEnum = "REPLACE"
FilterOperatorEquals FilterOperatorEnum = "EQUALS"
FilterOperatorNotEquals FilterOperatorEnum = "NOT_EQUALS"
FilterOperatorStartsWith FilterOperatorEnum = "STARTS_WITH"
FilterOperatorDoesNotStartWith FilterOperatorEnum = "DOES_NOT_START_WITH"
FilterOperatorEndsWith FilterOperatorEnum = "ENDS_WITH"
FilterOperatorDoesNotEndWith FilterOperatorEnum = "DOES_NOT_END_WITH"
FilterOperatorContains FilterOperatorEnum = "CONTAINS"
FilterOperatorDoesNotContain FilterOperatorEnum = "DOES_NOT_CONTAIN"
FilterOperatorIsLessThan FilterOperatorEnum = "IS_LESS_THAN"
FilterOperatorIsLessThanOrEqualTo FilterOperatorEnum = "IS_LESS_THAN_OR_EQUAL_TO"
FilterOperatorIsGreaterThan FilterOperatorEnum = "IS_GREATER_THAN"
FilterOperatorIsGreaterThanOrEqualTo FilterOperatorEnum = "IS_GREATER_THAN_OR_EQUAL_TO"
FilterOperatorIsBetween FilterOperatorEnum = "IS_BETWEEN"
FilterOperatorIsNotBetween FilterOperatorEnum = "IS_NOT_BETWEEN"
FilterOperatorAddSubquery FilterOperatorEnum = "ADD_SUBQUERY"
FilterOperatorClearSubquery FilterOperatorEnum = "CLEAR_SUBQUERY"
)
var mappingFilterOperatorEnum = map[string]FilterOperatorEnum{
"CLEAR": FilterOperatorClear,
"REPLACE": FilterOperatorReplace,
"EQUALS": FilterOperatorEquals,
"NOT_EQUALS": FilterOperatorNotEquals,
"STARTS_WITH": FilterOperatorStartsWith,
"DOES_NOT_START_WITH": FilterOperatorDoesNotStartWith,
"ENDS_WITH": FilterOperatorEndsWith,
"DOES_NOT_END_WITH": FilterOperatorDoesNotEndWith,
"CONTAINS": FilterOperatorContains,
"DOES_NOT_CONTAIN": FilterOperatorDoesNotContain,
"IS_LESS_THAN": FilterOperatorIsLessThan,
"IS_LESS_THAN_OR_EQUAL_TO": FilterOperatorIsLessThanOrEqualTo,
"IS_GREATER_THAN": FilterOperatorIsGreaterThan,
"IS_GREATER_THAN_OR_EQUAL_TO": FilterOperatorIsGreaterThanOrEqualTo,
"IS_BETWEEN": FilterOperatorIsBetween,
"IS_NOT_BETWEEN": FilterOperatorIsNotBetween,
"ADD_SUBQUERY": FilterOperatorAddSubquery,
"CLEAR_SUBQUERY": FilterOperatorClearSubquery,
}
var mappingFilterOperatorEnumLowerCase = map[string]FilterOperatorEnum{
"clear": FilterOperatorClear,
"replace": FilterOperatorReplace,
"equals": FilterOperatorEquals,
"not_equals": FilterOperatorNotEquals,
"starts_with": FilterOperatorStartsWith,
"does_not_start_with": FilterOperatorDoesNotStartWith,
"ends_with": FilterOperatorEndsWith,
"does_not_end_with": FilterOperatorDoesNotEndWith,
"contains": FilterOperatorContains,
"does_not_contain": FilterOperatorDoesNotContain,
"is_less_than": FilterOperatorIsLessThan,
"is_less_than_or_equal_to": FilterOperatorIsLessThanOrEqualTo,
"is_greater_than": FilterOperatorIsGreaterThan,
"is_greater_than_or_equal_to": FilterOperatorIsGreaterThanOrEqualTo,
"is_between": FilterOperatorIsBetween,
"is_not_between": FilterOperatorIsNotBetween,
"add_subquery": FilterOperatorAddSubquery,
"clear_subquery": FilterOperatorClearSubquery,
}
// GetFilterOperatorEnumValues Enumerates the set of values for FilterOperatorEnum
func GetFilterOperatorEnumValues() []FilterOperatorEnum {
values := make([]FilterOperatorEnum, 0)
for _, v := range mappingFilterOperatorEnum {
values = append(values, v)
}
return values
}
// GetFilterOperatorEnumStringValues Enumerates the set of values in String for FilterOperatorEnum
func GetFilterOperatorEnumStringValues() []string {
return []string{
"CLEAR",
"REPLACE",
"EQUALS",
"NOT_EQUALS",
"STARTS_WITH",
"DOES_NOT_START_WITH",
"ENDS_WITH",
"DOES_NOT_END_WITH",
"CONTAINS",
"DOES_NOT_CONTAIN",
"IS_LESS_THAN",
"IS_LESS_THAN_OR_EQUAL_TO",
"IS_GREATER_THAN",
"IS_GREATER_THAN_OR_EQUAL_TO",
"IS_BETWEEN",
"IS_NOT_BETWEEN",
"ADD_SUBQUERY",
"CLEAR_SUBQUERY",
}
}
// GetMappingFilterOperatorEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingFilterOperatorEnum(val string) (FilterOperatorEnum, bool) {
enum, ok := mappingFilterOperatorEnumLowerCase[strings.ToLower(val)]
return enum, ok
}