-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_team_permission_setting_attributes.go
256 lines (224 loc) · 8.49 KB
/
model_team_permission_setting_attributes.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
254
255
256
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
package datadogV2
import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// TeamPermissionSettingAttributes Team permission setting attributes
type TeamPermissionSettingAttributes struct {
// The identifier for the action
Action *TeamPermissionSettingSerializerAction `json:"action,omitempty"`
// Whether or not the permission setting is editable by the current user
Editable *bool `json:"editable,omitempty"`
// Possible values for action
Options []TeamPermissionSettingValue `json:"options,omitempty"`
// The team permission name
Title *string `json:"title,omitempty"`
// What type of user is allowed to perform the specified action
Value *TeamPermissionSettingValue `json:"value,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{}
}
// NewTeamPermissionSettingAttributes instantiates a new TeamPermissionSettingAttributes object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewTeamPermissionSettingAttributes() *TeamPermissionSettingAttributes {
this := TeamPermissionSettingAttributes{}
return &this
}
// NewTeamPermissionSettingAttributesWithDefaults instantiates a new TeamPermissionSettingAttributes object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewTeamPermissionSettingAttributesWithDefaults() *TeamPermissionSettingAttributes {
this := TeamPermissionSettingAttributes{}
return &this
}
// GetAction returns the Action field value if set, zero value otherwise.
func (o *TeamPermissionSettingAttributes) GetAction() TeamPermissionSettingSerializerAction {
if o == nil || o.Action == nil {
var ret TeamPermissionSettingSerializerAction
return ret
}
return *o.Action
}
// GetActionOk returns a tuple with the Action field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TeamPermissionSettingAttributes) GetActionOk() (*TeamPermissionSettingSerializerAction, bool) {
if o == nil || o.Action == nil {
return nil, false
}
return o.Action, true
}
// HasAction returns a boolean if a field has been set.
func (o *TeamPermissionSettingAttributes) HasAction() bool {
return o != nil && o.Action != nil
}
// SetAction gets a reference to the given TeamPermissionSettingSerializerAction and assigns it to the Action field.
func (o *TeamPermissionSettingAttributes) SetAction(v TeamPermissionSettingSerializerAction) {
o.Action = &v
}
// GetEditable returns the Editable field value if set, zero value otherwise.
func (o *TeamPermissionSettingAttributes) GetEditable() bool {
if o == nil || o.Editable == nil {
var ret bool
return ret
}
return *o.Editable
}
// GetEditableOk returns a tuple with the Editable field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TeamPermissionSettingAttributes) GetEditableOk() (*bool, bool) {
if o == nil || o.Editable == nil {
return nil, false
}
return o.Editable, true
}
// HasEditable returns a boolean if a field has been set.
func (o *TeamPermissionSettingAttributes) HasEditable() bool {
return o != nil && o.Editable != nil
}
// SetEditable gets a reference to the given bool and assigns it to the Editable field.
func (o *TeamPermissionSettingAttributes) SetEditable(v bool) {
o.Editable = &v
}
// GetOptions returns the Options field value if set, zero value otherwise.
func (o *TeamPermissionSettingAttributes) GetOptions() []TeamPermissionSettingValue {
if o == nil || o.Options == nil {
var ret []TeamPermissionSettingValue
return ret
}
return o.Options
}
// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TeamPermissionSettingAttributes) GetOptionsOk() (*[]TeamPermissionSettingValue, bool) {
if o == nil || o.Options == nil {
return nil, false
}
return &o.Options, true
}
// HasOptions returns a boolean if a field has been set.
func (o *TeamPermissionSettingAttributes) HasOptions() bool {
return o != nil && o.Options != nil
}
// SetOptions gets a reference to the given []TeamPermissionSettingValue and assigns it to the Options field.
func (o *TeamPermissionSettingAttributes) SetOptions(v []TeamPermissionSettingValue) {
o.Options = v
}
// GetTitle returns the Title field value if set, zero value otherwise.
func (o *TeamPermissionSettingAttributes) GetTitle() string {
if o == nil || o.Title == nil {
var ret string
return ret
}
return *o.Title
}
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TeamPermissionSettingAttributes) GetTitleOk() (*string, bool) {
if o == nil || o.Title == nil {
return nil, false
}
return o.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (o *TeamPermissionSettingAttributes) HasTitle() bool {
return o != nil && o.Title != nil
}
// SetTitle gets a reference to the given string and assigns it to the Title field.
func (o *TeamPermissionSettingAttributes) SetTitle(v string) {
o.Title = &v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *TeamPermissionSettingAttributes) GetValue() TeamPermissionSettingValue {
if o == nil || o.Value == nil {
var ret TeamPermissionSettingValue
return ret
}
return *o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TeamPermissionSettingAttributes) GetValueOk() (*TeamPermissionSettingValue, bool) {
if o == nil || o.Value == nil {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *TeamPermissionSettingAttributes) HasValue() bool {
return o != nil && o.Value != nil
}
// SetValue gets a reference to the given TeamPermissionSettingValue and assigns it to the Value field.
func (o *TeamPermissionSettingAttributes) SetValue(v TeamPermissionSettingValue) {
o.Value = &v
}
// MarshalJSON serializes the struct using spec logic.
func (o TeamPermissionSettingAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Action != nil {
toSerialize["action"] = o.Action
}
if o.Editable != nil {
toSerialize["editable"] = o.Editable
}
if o.Options != nil {
toSerialize["options"] = o.Options
}
if o.Title != nil {
toSerialize["title"] = o.Title
}
if o.Value != nil {
toSerialize["value"] = o.Value
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *TeamPermissionSettingAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Action *TeamPermissionSettingSerializerAction `json:"action,omitempty"`
Editable *bool `json:"editable,omitempty"`
Options []TeamPermissionSettingValue `json:"options,omitempty"`
Title *string `json:"title,omitempty"`
Value *TeamPermissionSettingValue `json:"value,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"action", "editable", "options", "title", "value"})
} else {
return err
}
hasInvalidField := false
if all.Action != nil && !all.Action.IsValid() {
hasInvalidField = true
} else {
o.Action = all.Action
}
o.Editable = all.Editable
o.Options = all.Options
o.Title = all.Title
if all.Value != nil && !all.Value.IsValid() {
hasInvalidField = true
} else {
o.Value = all.Value
}
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}