File: model_firewallrule_properties.go

package info (click to toggle)
golang-github-ionos-cloud-sdk-go 6.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,332 kB
  • sloc: sh: 35; makefile: 3
file content (611 lines) | stat: -rw-r--r-- 16,927 bytes parent folder | download
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/*
 * CLOUD API
 *
 *  IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool.    Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on.
 *
 * API version: 6.0
 */

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package ionoscloud

import (
	"encoding/json"
)

// FirewallruleProperties struct for FirewallruleProperties
type FirewallruleProperties struct {
	// The name of the  resource.
	Name *string `json:"name,omitempty"`
	// The protocol for the rule. Property cannot be modified after it is created (disallowed in update requests).
	Protocol *string `json:"protocol"`
	// Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows traffic from any MAC address.
	// to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetSourceMacNil`
	SourceMac *string `json:"sourceMac,omitempty"`
	// The IP version for this rule. If sourceIp or targetIp are specified, you can omit this value - the IP version will then be deduced from the IP address(es) used; if you specify it anyway, it must match the specified IP address(es). If neither sourceIp nor targetIp are specified, this rule allows traffic only for the specified IP version. If neither sourceIp, targetIp nor ipVersion are specified, this rule will only allow IPv4 traffic.
	// to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpVersionNil`
	IpVersion *string `json:"ipVersion,omitempty"`
	// Only traffic originating from the respective IP address (or CIDR block) is allowed. Value null allows traffic from any IP address (according to the selected ipVersion).
	// to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetSourceIpNil`
	SourceIp *string `json:"sourceIp,omitempty"`
	// If the target NIC has multiple IP addresses, only the traffic directed to the respective IP address (or CIDR block) of the NIC is allowed. Value null allows traffic to any target IP address (according to the selected ipVersion).
	// to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetTargetIpNil`
	TargetIp *string `json:"targetIp,omitempty"`
	// Defines the allowed code (from 0 to 254) if protocol ICMP or ICMPv6 is chosen. Value null allows all codes.
	// to set this field to `nil` in order to be marshalled, the explicit nil address `Nilint32` can be used, or the setter `SetIcmpCodeNil`
	IcmpCode *int32 `json:"icmpCode,omitempty"`
	// Defines the allowed type (from 0 to 254) if the protocol ICMP or ICMPv6 is chosen. Value null allows all types.
	// to set this field to `nil` in order to be marshalled, the explicit nil address `Nilint32` can be used, or the setter `SetIcmpTypeNil`
	IcmpType *int32 `json:"icmpType,omitempty"`
	// Defines the start range of the allowed port (from 1 to 65535) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd value null to allow all ports.
	PortRangeStart *int32 `json:"portRangeStart,omitempty"`
	// Defines the end range of the allowed port (from 1 to 65535) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.
	PortRangeEnd *int32 `json:"portRangeEnd,omitempty"`
	// The type of the firewall rule. If not specified, the default INGRESS value is used.
	Type *string `json:"type,omitempty"`
}

// NewFirewallruleProperties instantiates a new FirewallruleProperties 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 NewFirewallruleProperties(protocol string) *FirewallruleProperties {
	this := FirewallruleProperties{}

	this.Protocol = &protocol

	return &this
}

// NewFirewallrulePropertiesWithDefaults instantiates a new FirewallruleProperties 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 NewFirewallrulePropertiesWithDefaults() *FirewallruleProperties {
	this := FirewallruleProperties{}
	return &this
}

// GetName returns the Name field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetName() *string {
	if o == nil {
		return nil
	}

	return o.Name

}

// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Name, true
}

// SetName sets field value
func (o *FirewallruleProperties) SetName(v string) {

	o.Name = &v

}

// HasName returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasName() bool {
	if o != nil && o.Name != nil {
		return true
	}

	return false
}

// GetProtocol returns the Protocol field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetProtocol() *string {
	if o == nil {
		return nil
	}

	return o.Protocol

}

// GetProtocolOk returns a tuple with the Protocol field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetProtocolOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Protocol, true
}

// SetProtocol sets field value
func (o *FirewallruleProperties) SetProtocol(v string) {

	o.Protocol = &v

}

// HasProtocol returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasProtocol() bool {
	if o != nil && o.Protocol != nil {
		return true
	}

	return false
}

// GetSourceMac returns the SourceMac field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetSourceMac() *string {
	if o == nil {
		return nil
	}

	return o.SourceMac

}

// GetSourceMacOk returns a tuple with the SourceMac field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetSourceMacOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.SourceMac, true
}

// SetSourceMac sets field value
func (o *FirewallruleProperties) SetSourceMac(v string) {

	o.SourceMac = &v

}

// sets SourceMac to the explicit address that will be encoded as nil when marshaled
func (o *FirewallruleProperties) SetSourceMacNil() {
	o.SourceMac = &Nilstring
}

// HasSourceMac returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasSourceMac() bool {
	if o != nil && o.SourceMac != nil {
		return true
	}

	return false
}

// GetIpVersion returns the IpVersion field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetIpVersion() *string {
	if o == nil {
		return nil
	}

	return o.IpVersion

}

// GetIpVersionOk returns a tuple with the IpVersion field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetIpVersionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.IpVersion, true
}

// SetIpVersion sets field value
func (o *FirewallruleProperties) SetIpVersion(v string) {

	o.IpVersion = &v

}

// sets IpVersion to the explicit address that will be encoded as nil when marshaled
func (o *FirewallruleProperties) SetIpVersionNil() {
	o.IpVersion = &Nilstring
}

// HasIpVersion returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasIpVersion() bool {
	if o != nil && o.IpVersion != nil {
		return true
	}

	return false
}

// GetSourceIp returns the SourceIp field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetSourceIp() *string {
	if o == nil {
		return nil
	}

	return o.SourceIp

}

// GetSourceIpOk returns a tuple with the SourceIp field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetSourceIpOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.SourceIp, true
}

// SetSourceIp sets field value
func (o *FirewallruleProperties) SetSourceIp(v string) {

	o.SourceIp = &v

}

// sets SourceIp to the explicit address that will be encoded as nil when marshaled
func (o *FirewallruleProperties) SetSourceIpNil() {
	o.SourceIp = &Nilstring
}

// HasSourceIp returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasSourceIp() bool {
	if o != nil && o.SourceIp != nil {
		return true
	}

	return false
}

// GetTargetIp returns the TargetIp field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetTargetIp() *string {
	if o == nil {
		return nil
	}

	return o.TargetIp

}

// GetTargetIpOk returns a tuple with the TargetIp field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetTargetIpOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.TargetIp, true
}

// SetTargetIp sets field value
func (o *FirewallruleProperties) SetTargetIp(v string) {

	o.TargetIp = &v

}

// sets TargetIp to the explicit address that will be encoded as nil when marshaled
func (o *FirewallruleProperties) SetTargetIpNil() {
	o.TargetIp = &Nilstring
}

// HasTargetIp returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasTargetIp() bool {
	if o != nil && o.TargetIp != nil {
		return true
	}

	return false
}

// GetIcmpCode returns the IcmpCode field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetIcmpCode() *int32 {
	if o == nil {
		return nil
	}

	return o.IcmpCode

}

// GetIcmpCodeOk returns a tuple with the IcmpCode field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetIcmpCodeOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.IcmpCode, true
}

// SetIcmpCode sets field value
func (o *FirewallruleProperties) SetIcmpCode(v int32) {

	o.IcmpCode = &v

}

// sets IcmpCode to the explicit address that will be encoded as nil when marshaled
func (o *FirewallruleProperties) SetIcmpCodeNil() {
	o.IcmpCode = &Nilint32
}

// HasIcmpCode returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasIcmpCode() bool {
	if o != nil && o.IcmpCode != nil {
		return true
	}

	return false
}

// GetIcmpType returns the IcmpType field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetIcmpType() *int32 {
	if o == nil {
		return nil
	}

	return o.IcmpType

}

// GetIcmpTypeOk returns a tuple with the IcmpType field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetIcmpTypeOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.IcmpType, true
}

// SetIcmpType sets field value
func (o *FirewallruleProperties) SetIcmpType(v int32) {

	o.IcmpType = &v

}

// sets IcmpType to the explicit address that will be encoded as nil when marshaled
func (o *FirewallruleProperties) SetIcmpTypeNil() {
	o.IcmpType = &Nilint32
}

// HasIcmpType returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasIcmpType() bool {
	if o != nil && o.IcmpType != nil {
		return true
	}

	return false
}

// GetPortRangeStart returns the PortRangeStart field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetPortRangeStart() *int32 {
	if o == nil {
		return nil
	}

	return o.PortRangeStart

}

// GetPortRangeStartOk returns a tuple with the PortRangeStart field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetPortRangeStartOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.PortRangeStart, true
}

// SetPortRangeStart sets field value
func (o *FirewallruleProperties) SetPortRangeStart(v int32) {

	o.PortRangeStart = &v

}

// HasPortRangeStart returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasPortRangeStart() bool {
	if o != nil && o.PortRangeStart != nil {
		return true
	}

	return false
}

// GetPortRangeEnd returns the PortRangeEnd field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetPortRangeEnd() *int32 {
	if o == nil {
		return nil
	}

	return o.PortRangeEnd

}

// GetPortRangeEndOk returns a tuple with the PortRangeEnd field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetPortRangeEndOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.PortRangeEnd, true
}

// SetPortRangeEnd sets field value
func (o *FirewallruleProperties) SetPortRangeEnd(v int32) {

	o.PortRangeEnd = &v

}

// HasPortRangeEnd returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasPortRangeEnd() bool {
	if o != nil && o.PortRangeEnd != nil {
		return true
	}

	return false
}

// GetType returns the Type field value
// If the value is explicit nil, nil is returned
func (o *FirewallruleProperties) GetType() *string {
	if o == nil {
		return nil
	}

	return o.Type

}

// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *FirewallruleProperties) GetTypeOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Type, true
}

// SetType sets field value
func (o *FirewallruleProperties) SetType(v string) {

	o.Type = &v

}

// HasType returns a boolean if a field has been set.
func (o *FirewallruleProperties) HasType() bool {
	if o != nil && o.Type != nil {
		return true
	}

	return false
}

func (o FirewallruleProperties) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Name != nil {
		toSerialize["name"] = o.Name
	}

	if o.Protocol != nil {
		toSerialize["protocol"] = o.Protocol
	}

	if o.SourceMac == &Nilstring {
		toSerialize["sourceMac"] = nil
	} else if o.SourceMac != nil {
		toSerialize["sourceMac"] = o.SourceMac
	}

	if o.IpVersion == &Nilstring {
		toSerialize["ipVersion"] = nil
	} else if o.IpVersion != nil {
		toSerialize["ipVersion"] = o.IpVersion
	}

	if o.SourceIp == &Nilstring {
		toSerialize["sourceIp"] = nil
	} else if o.SourceIp != nil {
		toSerialize["sourceIp"] = o.SourceIp
	}

	if o.TargetIp == &Nilstring {
		toSerialize["targetIp"] = nil
	} else if o.TargetIp != nil {
		toSerialize["targetIp"] = o.TargetIp
	}

	if o.IcmpCode == &Nilint32 {
		toSerialize["icmpCode"] = nil
	} else if o.IcmpCode != nil {
		toSerialize["icmpCode"] = o.IcmpCode
	}

	if o.IcmpType == &Nilint32 {
		toSerialize["icmpType"] = nil
	} else if o.IcmpType != nil {
		toSerialize["icmpType"] = o.IcmpType
	}
	if o.PortRangeStart != nil {
		toSerialize["portRangeStart"] = o.PortRangeStart
	}

	if o.PortRangeEnd != nil {
		toSerialize["portRangeEnd"] = o.PortRangeEnd
	}

	if o.Type != nil {
		toSerialize["type"] = o.Type
	}

	return json.Marshal(toSerialize)
}

type NullableFirewallruleProperties struct {
	value *FirewallruleProperties
	isSet bool
}

func (v NullableFirewallruleProperties) Get() *FirewallruleProperties {
	return v.value
}

func (v *NullableFirewallruleProperties) Set(val *FirewallruleProperties) {
	v.value = val
	v.isSet = true
}

func (v NullableFirewallruleProperties) IsSet() bool {
	return v.isSet
}

func (v *NullableFirewallruleProperties) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableFirewallruleProperties(val *FirewallruleProperties) *NullableFirewallruleProperties {
	return &NullableFirewallruleProperties{value: val, isSet: true}
}

func (v NullableFirewallruleProperties) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableFirewallruleProperties) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}