1// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates.  All rights reserved.
2// 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.
3// Code generated. DO NOT EDIT.
4
5// Data Integration API
6//
7// Use the Data Integration Service APIs to perform common extract, load, and transform (ETL) tasks.
8//
9
10package dataintegration
11
12import (
13	"encoding/json"
14	"github.com/oracle/oci-go-sdk/common"
15)
16
17// TypeListRule The type list rule which defines how fields are projected.
18type TypeListRule struct {
19
20	// The key of the object.
21	Key *string `mandatory:"false" json:"key"`
22
23	// The model version of an object.
24	ModelVersion *string `mandatory:"false" json:"modelVersion"`
25
26	ParentRef *ParentReference `mandatory:"false" json:"parentRef"`
27
28	// Specifies whether the rule uses a java regex syntax.
29	IsJavaRegexSyntax *bool `mandatory:"false" json:"isJavaRegexSyntax"`
30
31	ConfigValues *ConfigValues `mandatory:"false" json:"configValues"`
32
33	// The status of an object that can be set to value 1 for shallow references across objects, other values reserved.
34	ObjectStatus *int `mandatory:"false" json:"objectStatus"`
35
36	// Detailed description for the object.
37	Description *string `mandatory:"false" json:"description"`
38
39	// skipRemainingRulesOnMatch
40	IsSkipRemainingRulesOnMatch *bool `mandatory:"false" json:"isSkipRemainingRulesOnMatch"`
41
42	// Reference to a typed object, this can be either a key value to an object within the document, a shall referenced to a TypedObject or a full TypedObject definition.
43	Scope *interface{} `mandatory:"false" json:"scope"`
44
45	// cascade
46	IsCascade *bool `mandatory:"false" json:"isCascade"`
47
48	// caseSensitive
49	IsCaseSensitive *bool `mandatory:"false" json:"isCaseSensitive"`
50
51	// types
52	Types []BaseType `mandatory:"false" json:"types"`
53
54	// matchingStrategy
55	MatchingStrategy TypeListRuleMatchingStrategyEnum `mandatory:"false" json:"matchingStrategy,omitempty"`
56
57	// ruleType
58	RuleType TypeListRuleRuleTypeEnum `mandatory:"false" json:"ruleType,omitempty"`
59}
60
61//GetKey returns Key
62func (m TypeListRule) GetKey() *string {
63	return m.Key
64}
65
66//GetModelVersion returns ModelVersion
67func (m TypeListRule) GetModelVersion() *string {
68	return m.ModelVersion
69}
70
71//GetParentRef returns ParentRef
72func (m TypeListRule) GetParentRef() *ParentReference {
73	return m.ParentRef
74}
75
76//GetIsJavaRegexSyntax returns IsJavaRegexSyntax
77func (m TypeListRule) GetIsJavaRegexSyntax() *bool {
78	return m.IsJavaRegexSyntax
79}
80
81//GetConfigValues returns ConfigValues
82func (m TypeListRule) GetConfigValues() *ConfigValues {
83	return m.ConfigValues
84}
85
86//GetObjectStatus returns ObjectStatus
87func (m TypeListRule) GetObjectStatus() *int {
88	return m.ObjectStatus
89}
90
91//GetDescription returns Description
92func (m TypeListRule) GetDescription() *string {
93	return m.Description
94}
95
96func (m TypeListRule) String() string {
97	return common.PointerString(m)
98}
99
100// MarshalJSON marshals to json representation
101func (m TypeListRule) MarshalJSON() (buff []byte, e error) {
102	type MarshalTypeTypeListRule TypeListRule
103	s := struct {
104		DiscriminatorParam string `json:"modelType"`
105		MarshalTypeTypeListRule
106	}{
107		"TYPE_LIST_RULE",
108		(MarshalTypeTypeListRule)(m),
109	}
110
111	return json.Marshal(&s)
112}
113
114// UnmarshalJSON unmarshals from json
115func (m *TypeListRule) UnmarshalJSON(data []byte) (e error) {
116	model := struct {
117		Key                         *string                          `json:"key"`
118		ModelVersion                *string                          `json:"modelVersion"`
119		ParentRef                   *ParentReference                 `json:"parentRef"`
120		IsJavaRegexSyntax           *bool                            `json:"isJavaRegexSyntax"`
121		ConfigValues                *ConfigValues                    `json:"configValues"`
122		ObjectStatus                *int                             `json:"objectStatus"`
123		Description                 *string                          `json:"description"`
124		IsSkipRemainingRulesOnMatch *bool                            `json:"isSkipRemainingRulesOnMatch"`
125		Scope                       *interface{}                     `json:"scope"`
126		IsCascade                   *bool                            `json:"isCascade"`
127		MatchingStrategy            TypeListRuleMatchingStrategyEnum `json:"matchingStrategy"`
128		IsCaseSensitive             *bool                            `json:"isCaseSensitive"`
129		RuleType                    TypeListRuleRuleTypeEnum         `json:"ruleType"`
130		Types                       []basetype                       `json:"types"`
131	}{}
132
133	e = json.Unmarshal(data, &model)
134	if e != nil {
135		return
136	}
137	var nn interface{}
138	m.Key = model.Key
139
140	m.ModelVersion = model.ModelVersion
141
142	m.ParentRef = model.ParentRef
143
144	m.IsJavaRegexSyntax = model.IsJavaRegexSyntax
145
146	m.ConfigValues = model.ConfigValues
147
148	m.ObjectStatus = model.ObjectStatus
149
150	m.Description = model.Description
151
152	m.IsSkipRemainingRulesOnMatch = model.IsSkipRemainingRulesOnMatch
153
154	m.Scope = model.Scope
155
156	m.IsCascade = model.IsCascade
157
158	m.MatchingStrategy = model.MatchingStrategy
159
160	m.IsCaseSensitive = model.IsCaseSensitive
161
162	m.RuleType = model.RuleType
163
164	m.Types = make([]BaseType, len(model.Types))
165	for i, n := range model.Types {
166		nn, e = n.UnmarshalPolymorphicJSON(n.JsonData)
167		if e != nil {
168			return e
169		}
170		if nn != nil {
171			m.Types[i] = nn.(BaseType)
172		} else {
173			m.Types[i] = nil
174		}
175	}
176
177	return
178}
179
180// TypeListRuleMatchingStrategyEnum Enum with underlying type: string
181type TypeListRuleMatchingStrategyEnum string
182
183// Set of constants representing the allowable values for TypeListRuleMatchingStrategyEnum
184const (
185	TypeListRuleMatchingStrategyNameOrTags TypeListRuleMatchingStrategyEnum = "NAME_OR_TAGS"
186	TypeListRuleMatchingStrategyTagsOnly   TypeListRuleMatchingStrategyEnum = "TAGS_ONLY"
187	TypeListRuleMatchingStrategyNameOnly   TypeListRuleMatchingStrategyEnum = "NAME_ONLY"
188)
189
190var mappingTypeListRuleMatchingStrategy = map[string]TypeListRuleMatchingStrategyEnum{
191	"NAME_OR_TAGS": TypeListRuleMatchingStrategyNameOrTags,
192	"TAGS_ONLY":    TypeListRuleMatchingStrategyTagsOnly,
193	"NAME_ONLY":    TypeListRuleMatchingStrategyNameOnly,
194}
195
196// GetTypeListRuleMatchingStrategyEnumValues Enumerates the set of values for TypeListRuleMatchingStrategyEnum
197func GetTypeListRuleMatchingStrategyEnumValues() []TypeListRuleMatchingStrategyEnum {
198	values := make([]TypeListRuleMatchingStrategyEnum, 0)
199	for _, v := range mappingTypeListRuleMatchingStrategy {
200		values = append(values, v)
201	}
202	return values
203}
204
205// TypeListRuleRuleTypeEnum Enum with underlying type: string
206type TypeListRuleRuleTypeEnum string
207
208// Set of constants representing the allowable values for TypeListRuleRuleTypeEnum
209const (
210	TypeListRuleRuleTypeInclude TypeListRuleRuleTypeEnum = "INCLUDE"
211	TypeListRuleRuleTypeExclude TypeListRuleRuleTypeEnum = "EXCLUDE"
212)
213
214var mappingTypeListRuleRuleType = map[string]TypeListRuleRuleTypeEnum{
215	"INCLUDE": TypeListRuleRuleTypeInclude,
216	"EXCLUDE": TypeListRuleRuleTypeExclude,
217}
218
219// GetTypeListRuleRuleTypeEnumValues Enumerates the set of values for TypeListRuleRuleTypeEnum
220func GetTypeListRuleRuleTypeEnumValues() []TypeListRuleRuleTypeEnum {
221	values := make([]TypeListRuleRuleTypeEnum, 0)
222	for _, v := range mappingTypeListRuleRuleType {
223		values = append(values, v)
224	}
225	return values
226}
227