-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_main_get_placements_request.go
More file actions
378 lines (312 loc) · 10.7 KB
/
model_main_get_placements_request.go
File metadata and controls
378 lines (312 loc) · 10.7 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
/*
Machines API
This site hosts documentation generated from the Fly.io Machines API OpenAPI specification. Visit our complete [Machines API docs](https://fly.io/docs/machines/api/) for how to get started, more information about each endpoint, parameter descriptions, and examples.
API version: 1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package machines
import (
"encoding/json"
"bytes"
"fmt"
)
// checks if the MainGetPlacementsRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &MainGetPlacementsRequest{}
// MainGetPlacementsRequest struct for MainGetPlacementsRequest
type MainGetPlacementsRequest struct {
// Resource requirements for the Machine to simulate. Defaults to a performance-1x machine
Compute *FlyMachineGuest `json:"compute,omitempty"`
// Number of machines to simulate placement. Defaults to 0, which returns the org-specific limit for each region.
Count *int64 `json:"count,omitempty"`
OrgSlug string `json:"org_slug"`
// Region expression for placement as a comma-delimited set of regions or aliases. Defaults to \"[region],any\", to prefer the API endpoint's local region with any other region as fallback.
Region *string `json:"region,omitempty"`
VolumeName *string `json:"volume_name,omitempty"`
VolumeSizeBytes *int64 `json:"volume_size_bytes,omitempty"`
// Optional weights to override default placement preferences.
Weights *map[string]int64 `json:"weights,omitempty"`
}
type _MainGetPlacementsRequest MainGetPlacementsRequest
// NewMainGetPlacementsRequest instantiates a new MainGetPlacementsRequest 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 NewMainGetPlacementsRequest(orgSlug string) *MainGetPlacementsRequest {
this := MainGetPlacementsRequest{}
this.OrgSlug = orgSlug
return &this
}
// NewMainGetPlacementsRequestWithDefaults instantiates a new MainGetPlacementsRequest 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 NewMainGetPlacementsRequestWithDefaults() *MainGetPlacementsRequest {
this := MainGetPlacementsRequest{}
return &this
}
// GetCompute returns the Compute field value if set, zero value otherwise.
func (o *MainGetPlacementsRequest) GetCompute() FlyMachineGuest {
if o == nil || IsNil(o.Compute) {
var ret FlyMachineGuest
return ret
}
return *o.Compute
}
// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetComputeOk() (*FlyMachineGuest, bool) {
if o == nil || IsNil(o.Compute) {
return nil, false
}
return o.Compute, true
}
// HasCompute returns a boolean if a field has been set.
func (o *MainGetPlacementsRequest) HasCompute() bool {
if o != nil && !IsNil(o.Compute) {
return true
}
return false
}
// SetCompute gets a reference to the given FlyMachineGuest and assigns it to the Compute field.
func (o *MainGetPlacementsRequest) SetCompute(v FlyMachineGuest) {
o.Compute = &v
}
// GetCount returns the Count field value if set, zero value otherwise.
func (o *MainGetPlacementsRequest) GetCount() int64 {
if o == nil || IsNil(o.Count) {
var ret int64
return ret
}
return *o.Count
}
// GetCountOk returns a tuple with the Count field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetCountOk() (*int64, bool) {
if o == nil || IsNil(o.Count) {
return nil, false
}
return o.Count, true
}
// HasCount returns a boolean if a field has been set.
func (o *MainGetPlacementsRequest) HasCount() bool {
if o != nil && !IsNil(o.Count) {
return true
}
return false
}
// SetCount gets a reference to the given int64 and assigns it to the Count field.
func (o *MainGetPlacementsRequest) SetCount(v int64) {
o.Count = &v
}
// GetOrgSlug returns the OrgSlug field value
func (o *MainGetPlacementsRequest) GetOrgSlug() string {
if o == nil {
var ret string
return ret
}
return o.OrgSlug
}
// GetOrgSlugOk returns a tuple with the OrgSlug field value
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetOrgSlugOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.OrgSlug, true
}
// SetOrgSlug sets field value
func (o *MainGetPlacementsRequest) SetOrgSlug(v string) {
o.OrgSlug = v
}
// GetRegion returns the Region field value if set, zero value otherwise.
func (o *MainGetPlacementsRequest) GetRegion() string {
if o == nil || IsNil(o.Region) {
var ret string
return ret
}
return *o.Region
}
// GetRegionOk returns a tuple with the Region field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetRegionOk() (*string, bool) {
if o == nil || IsNil(o.Region) {
return nil, false
}
return o.Region, true
}
// HasRegion returns a boolean if a field has been set.
func (o *MainGetPlacementsRequest) HasRegion() bool {
if o != nil && !IsNil(o.Region) {
return true
}
return false
}
// SetRegion gets a reference to the given string and assigns it to the Region field.
func (o *MainGetPlacementsRequest) SetRegion(v string) {
o.Region = &v
}
// GetVolumeName returns the VolumeName field value if set, zero value otherwise.
func (o *MainGetPlacementsRequest) GetVolumeName() string {
if o == nil || IsNil(o.VolumeName) {
var ret string
return ret
}
return *o.VolumeName
}
// GetVolumeNameOk returns a tuple with the VolumeName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetVolumeNameOk() (*string, bool) {
if o == nil || IsNil(o.VolumeName) {
return nil, false
}
return o.VolumeName, true
}
// HasVolumeName returns a boolean if a field has been set.
func (o *MainGetPlacementsRequest) HasVolumeName() bool {
if o != nil && !IsNil(o.VolumeName) {
return true
}
return false
}
// SetVolumeName gets a reference to the given string and assigns it to the VolumeName field.
func (o *MainGetPlacementsRequest) SetVolumeName(v string) {
o.VolumeName = &v
}
// GetVolumeSizeBytes returns the VolumeSizeBytes field value if set, zero value otherwise.
func (o *MainGetPlacementsRequest) GetVolumeSizeBytes() int64 {
if o == nil || IsNil(o.VolumeSizeBytes) {
var ret int64
return ret
}
return *o.VolumeSizeBytes
}
// GetVolumeSizeBytesOk returns a tuple with the VolumeSizeBytes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetVolumeSizeBytesOk() (*int64, bool) {
if o == nil || IsNil(o.VolumeSizeBytes) {
return nil, false
}
return o.VolumeSizeBytes, true
}
// HasVolumeSizeBytes returns a boolean if a field has been set.
func (o *MainGetPlacementsRequest) HasVolumeSizeBytes() bool {
if o != nil && !IsNil(o.VolumeSizeBytes) {
return true
}
return false
}
// SetVolumeSizeBytes gets a reference to the given int64 and assigns it to the VolumeSizeBytes field.
func (o *MainGetPlacementsRequest) SetVolumeSizeBytes(v int64) {
o.VolumeSizeBytes = &v
}
// GetWeights returns the Weights field value if set, zero value otherwise.
func (o *MainGetPlacementsRequest) GetWeights() map[string]int64 {
if o == nil || IsNil(o.Weights) {
var ret map[string]int64
return ret
}
return *o.Weights
}
// GetWeightsOk returns a tuple with the Weights field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MainGetPlacementsRequest) GetWeightsOk() (*map[string]int64, bool) {
if o == nil || IsNil(o.Weights) {
return nil, false
}
return o.Weights, true
}
// HasWeights returns a boolean if a field has been set.
func (o *MainGetPlacementsRequest) HasWeights() bool {
if o != nil && !IsNil(o.Weights) {
return true
}
return false
}
// SetWeights gets a reference to the given map[string]int64 and assigns it to the Weights field.
func (o *MainGetPlacementsRequest) SetWeights(v map[string]int64) {
o.Weights = &v
}
func (o MainGetPlacementsRequest) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o MainGetPlacementsRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Compute) {
toSerialize["compute"] = o.Compute
}
if !IsNil(o.Count) {
toSerialize["count"] = o.Count
}
toSerialize["org_slug"] = o.OrgSlug
if !IsNil(o.Region) {
toSerialize["region"] = o.Region
}
if !IsNil(o.VolumeName) {
toSerialize["volume_name"] = o.VolumeName
}
if !IsNil(o.VolumeSizeBytes) {
toSerialize["volume_size_bytes"] = o.VolumeSizeBytes
}
if !IsNil(o.Weights) {
toSerialize["weights"] = o.Weights
}
return toSerialize, nil
}
func (o *MainGetPlacementsRequest) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"org_slug",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varMainGetPlacementsRequest := _MainGetPlacementsRequest{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varMainGetPlacementsRequest)
if err != nil {
return err
}
*o = MainGetPlacementsRequest(varMainGetPlacementsRequest)
return err
}
type NullableMainGetPlacementsRequest struct {
value *MainGetPlacementsRequest
isSet bool
}
func (v NullableMainGetPlacementsRequest) Get() *MainGetPlacementsRequest {
return v.value
}
func (v *NullableMainGetPlacementsRequest) Set(val *MainGetPlacementsRequest) {
v.value = val
v.isSet = true
}
func (v NullableMainGetPlacementsRequest) IsSet() bool {
return v.isSet
}
func (v *NullableMainGetPlacementsRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableMainGetPlacementsRequest(val *MainGetPlacementsRequest) *NullableMainGetPlacementsRequest {
return &NullableMainGetPlacementsRequest{value: val, isSet: true}
}
func (v NullableMainGetPlacementsRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableMainGetPlacementsRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}