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
|
package schema
import "time"
// Network defines the schema of a network.
type Network struct {
ID int64 `json:"id"`
Name string `json:"name"`
Created time.Time `json:"created"`
IPRange string `json:"ip_range"`
Subnets []NetworkSubnet `json:"subnets"`
Routes []NetworkRoute `json:"routes"`
Servers []int64 `json:"servers"`
Protection NetworkProtection `json:"protection"`
Labels map[string]string `json:"labels"`
ExposeRoutesToVSwitch bool `json:"expose_routes_to_vswitch"`
}
// NetworkSubnet represents a subnet of a network.
type NetworkSubnet struct {
Type string `json:"type"`
IPRange string `json:"ip_range"`
NetworkZone string `json:"network_zone"`
Gateway string `json:"gateway,omitempty"`
VSwitchID int64 `json:"vswitch_id,omitempty"`
}
// NetworkRoute represents a route of a network.
type NetworkRoute struct {
Destination string `json:"destination"`
Gateway string `json:"gateway"`
}
// NetworkProtection represents the protection level of a network.
type NetworkProtection struct {
Delete bool `json:"delete"`
}
// NetworkUpdateRequest defines the schema of the request to update a network.
type NetworkUpdateRequest struct {
Name string `json:"name,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
ExposeRoutesToVSwitch *bool `json:"expose_routes_to_vswitch,omitempty"`
}
// NetworkUpdateResponse defines the schema of the response when updating a network.
type NetworkUpdateResponse struct {
Network Network `json:"network"`
}
// NetworkListResponse defines the schema of the response when
// listing networks.
type NetworkListResponse struct {
Networks []Network `json:"networks"`
}
// NetworkGetResponse defines the schema of the response when
// retrieving a single network.
type NetworkGetResponse struct {
Network Network `json:"network"`
}
// NetworkCreateRequest defines the schema of the request to create a network.
type NetworkCreateRequest struct {
Name string `json:"name"`
IPRange string `json:"ip_range"`
Subnets []NetworkSubnet `json:"subnets,omitempty"`
Routes []NetworkRoute `json:"routes,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
ExposeRoutesToVSwitch bool `json:"expose_routes_to_vswitch"`
}
// NetworkCreateResponse defines the schema of the response when
// creating a network.
type NetworkCreateResponse struct {
Network Network `json:"network"`
}
// NetworkActionChangeIPRangeRequest defines the schema of the request to
// change the IP range of a network.
type NetworkActionChangeIPRangeRequest struct {
IPRange string `json:"ip_range"`
}
// NetworkActionChangeIPRangeResponse defines the schema of the response when
// changing the IP range of a network.
type NetworkActionChangeIPRangeResponse struct {
Action Action `json:"action"`
}
// NetworkActionAddSubnetRequest defines the schema of the request to
// add a subnet to a network.
type NetworkActionAddSubnetRequest struct {
Type string `json:"type"`
IPRange string `json:"ip_range,omitempty"`
NetworkZone string `json:"network_zone"`
Gateway string `json:"gateway"`
VSwitchID int64 `json:"vswitch_id,omitempty"`
}
// NetworkActionAddSubnetResponse defines the schema of the response when
// adding a subnet to a network.
type NetworkActionAddSubnetResponse struct {
Action Action `json:"action"`
}
// NetworkActionDeleteSubnetRequest defines the schema of the request to
// delete a subnet from a network.
type NetworkActionDeleteSubnetRequest struct {
IPRange string `json:"ip_range"`
}
// NetworkActionDeleteSubnetResponse defines the schema of the response when
// deleting a subnet from a network.
type NetworkActionDeleteSubnetResponse struct {
Action Action `json:"action"`
}
// NetworkActionAddRouteRequest defines the schema of the request to
// add a route to a network.
type NetworkActionAddRouteRequest struct {
Destination string `json:"destination"`
Gateway string `json:"gateway"`
}
// NetworkActionAddRouteResponse defines the schema of the response when
// adding a route to a network.
type NetworkActionAddRouteResponse struct {
Action Action `json:"action"`
}
// NetworkActionDeleteRouteRequest defines the schema of the request to
// delete a route from a network.
type NetworkActionDeleteRouteRequest struct {
Destination string `json:"destination"`
Gateway string `json:"gateway"`
}
// NetworkActionDeleteRouteResponse defines the schema of the response when
// deleting a route from a network.
type NetworkActionDeleteRouteResponse struct {
Action Action `json:"action"`
}
// NetworkActionChangeProtectionRequest defines the schema of the request to
// change the resource protection of a network.
type NetworkActionChangeProtectionRequest struct {
Delete *bool `json:"delete,omitempty"`
}
// NetworkActionChangeProtectionResponse defines the schema of the response when
// changing the resource protection of a network.
type NetworkActionChangeProtectionResponse struct {
Action Action `json:"action"`
}
|