/
a_w_s_subnet.go
110 lines (83 loc) · 2.24 KB
/
a_w_s_subnet.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
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// AWSSubnet AWSSubnet represents a object of AWS availability subnet.
//
// swagger:model AWSSubnet
type AWSSubnet struct {
// availability zone
AvailabilityZone string `json:"availability_zone,omitempty"`
// availability zone ID
AvailabilityZoneID string `json:"availability_zone_id,omitempty"`
// available IP address count
AvailableIPAddressCount int64 `json:"available_ip_address_count,omitempty"`
// default for az
DefaultForAz bool `json:"default,omitempty"`
// ID
ID string `json:"id,omitempty"`
// IPv4 c ID r
IPV4CIDR string `json:"ipv4cidr,omitempty"`
// IPv6 c ID r
IPV6CIDR string `json:"ipv6cidr,omitempty"`
// is default subnet
IsDefaultSubnet bool `json:"isDefaultSubnet,omitempty"`
// name
Name string `json:"name,omitempty"`
// state
State string `json:"state,omitempty"`
// tags
Tags []*AWSTag `json:"tags"`
}
// Validate validates this a w s subnet
func (m *AWSSubnet) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTags(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AWSSubnet) validateTags(formats strfmt.Registry) error {
if swag.IsZero(m.Tags) { // not required
return nil
}
for i := 0; i < len(m.Tags); i++ {
if swag.IsZero(m.Tags[i]) { // not required
continue
}
if m.Tags[i] != nil {
if err := m.Tags[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("tags" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AWSSubnet) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AWSSubnet) UnmarshalBinary(b []byte) error {
var res AWSSubnet
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}