Class: MistApi::Network
- Defined in:
- lib/mist_api/models/network.rb
Overview
Networks are usually subnets that have cross-site significance. ‘networks`in Org Settings will got merged into `networks`in Site Setting. For gateways, they can be used to define Service Routes.
Instance Attribute Summary collapse
-
#created_time ⇒ Float
When the object has been created, in epoch.
-
#disallow_mist_services ⇒ TrueClass | FalseClass
Whether to disallow Mist Devices in the network.
-
#gateway ⇒ String
Whether to disallow Mist Devices in the network.
-
#gateway6 ⇒ String
Whether to disallow Mist Devices in the network.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#internal_access ⇒ NetworkInternalAccess
Unique ID of the object instance in the Mist Organization.
-
#internet_access ⇒ NetworkInternetAccess
Whether this network has direct internet access.
-
#isolation ⇒ TrueClass | FalseClass
Whether to allow clients in the network to talk to each other.
-
#modified_time ⇒ Float
When the object has been modified for the last time, in epoch.
-
#multicast ⇒ NetworkMulticast
Whether to enable multicast support (only PIM-sparse mode is supported).
-
#name ⇒ String
Whether to enable multicast support (only PIM-sparse mode is supported).
-
#org_id ⇒ UUID | String
Whether to enable multicast support (only PIM-sparse mode is supported).
-
#routed_for_networks ⇒ Array[String]
For a Network (usually LAN), it can be routable to other networks (e.g. OSPF).
-
#subnet ⇒ String
For a Network (usually LAN), it can be routable to other networks (e.g. OSPF).
-
#subnet6 ⇒ String
For a Network (usually LAN), it can be routable to other networks (e.g. OSPF).
-
#tenants ⇒ Hash[String, NetworkTenant]
Property key must be the user/tenant name (i.e. “printer-1”) or a Variable (i.e. “{myvar}”).
-
#vlan_id ⇒ Object
Property key must be the user/tenant name (i.e. “printer-1”) or a Variable (i.e. “{myvar}”).
-
#vpn_access ⇒ Hash[String, NetworkVpnAccessConfig]
Property key is the VPN name.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(name = nil, created_time = SKIP, disallow_mist_services = false, gateway = SKIP, gateway6 = SKIP, id = SKIP, internal_access = SKIP, internet_access = SKIP, isolation = SKIP, modified_time = SKIP, multicast = SKIP, org_id = SKIP, routed_for_networks = SKIP, subnet = SKIP, subnet6 = SKIP, tenants = SKIP, vlan_id = SKIP, vpn_access = SKIP, additional_properties = nil) ⇒ Network
constructor
A new instance of Network.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(name = nil, created_time = SKIP, disallow_mist_services = false, gateway = SKIP, gateway6 = SKIP, id = SKIP, internal_access = SKIP, internet_access = SKIP, isolation = SKIP, modified_time = SKIP, multicast = SKIP, org_id = SKIP, routed_for_networks = SKIP, subnet = SKIP, subnet6 = SKIP, tenants = SKIP, vlan_id = SKIP, vpn_access = SKIP, additional_properties = nil) ⇒ Network
Returns a new instance of Network.
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 |
# File 'lib/mist_api/models/network.rb', line 144 def initialize(name = nil, created_time = SKIP, disallow_mist_services = false, gateway = SKIP, gateway6 = SKIP, id = SKIP, internal_access = SKIP, internet_access = SKIP, isolation = SKIP, modified_time = SKIP, multicast = SKIP, org_id = SKIP, routed_for_networks = SKIP, subnet = SKIP, subnet6 = SKIP, tenants = SKIP, vlan_id = SKIP, vpn_access = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @created_time = created_time unless created_time == SKIP @disallow_mist_services = disallow_mist_services unless disallow_mist_services == SKIP @gateway = gateway unless gateway == SKIP @gateway6 = gateway6 unless gateway6 == SKIP @id = id unless id == SKIP @internal_access = internal_access unless internal_access == SKIP @internet_access = internet_access unless internet_access == SKIP @isolation = isolation unless isolation == SKIP @modified_time = modified_time unless modified_time == SKIP @multicast = multicast unless multicast == SKIP @name = name @org_id = org_id unless org_id == SKIP @routed_for_networks = routed_for_networks unless routed_for_networks == SKIP @subnet = subnet unless subnet == SKIP @subnet6 = subnet6 unless subnet6 == SKIP @tenants = tenants unless tenants == SKIP @vlan_id = vlan_id unless vlan_id == SKIP @vpn_access = vpn_access unless vpn_access == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#created_time ⇒ Float
When the object has been created, in epoch
16 17 18 |
# File 'lib/mist_api/models/network.rb', line 16 def created_time @created_time end |
#disallow_mist_services ⇒ TrueClass | FalseClass
Whether to disallow Mist Devices in the network
20 21 22 |
# File 'lib/mist_api/models/network.rb', line 20 def disallow_mist_services @disallow_mist_services end |
#gateway ⇒ String
Whether to disallow Mist Devices in the network
24 25 26 |
# File 'lib/mist_api/models/network.rb', line 24 def gateway @gateway end |
#gateway6 ⇒ String
Whether to disallow Mist Devices in the network
28 29 30 |
# File 'lib/mist_api/models/network.rb', line 28 def gateway6 @gateway6 end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
32 33 34 |
# File 'lib/mist_api/models/network.rb', line 32 def id @id end |
#internal_access ⇒ NetworkInternalAccess
Unique ID of the object instance in the Mist Organization
36 37 38 |
# File 'lib/mist_api/models/network.rb', line 36 def internal_access @internal_access end |
#internet_access ⇒ NetworkInternetAccess
Whether this network has direct internet access
40 41 42 |
# File 'lib/mist_api/models/network.rb', line 40 def internet_access @internet_access end |
#isolation ⇒ TrueClass | FalseClass
Whether to allow clients in the network to talk to each other
44 45 46 |
# File 'lib/mist_api/models/network.rb', line 44 def isolation @isolation end |
#modified_time ⇒ Float
When the object has been modified for the last time, in epoch
48 49 50 |
# File 'lib/mist_api/models/network.rb', line 48 def modified_time @modified_time end |
#multicast ⇒ NetworkMulticast
Whether to enable multicast support (only PIM-sparse mode is supported)
52 53 54 |
# File 'lib/mist_api/models/network.rb', line 52 def multicast @multicast end |
#name ⇒ String
Whether to enable multicast support (only PIM-sparse mode is supported)
56 57 58 |
# File 'lib/mist_api/models/network.rb', line 56 def name @name end |
#org_id ⇒ UUID | String
Whether to enable multicast support (only PIM-sparse mode is supported)
60 61 62 |
# File 'lib/mist_api/models/network.rb', line 60 def org_id @org_id end |
#routed_for_networks ⇒ Array[String]
For a Network (usually LAN), it can be routable to other networks (e.g. OSPF)
65 66 67 |
# File 'lib/mist_api/models/network.rb', line 65 def routed_for_networks @routed_for_networks end |
#subnet ⇒ String
For a Network (usually LAN), it can be routable to other networks (e.g. OSPF)
70 71 72 |
# File 'lib/mist_api/models/network.rb', line 70 def subnet @subnet end |
#subnet6 ⇒ String
For a Network (usually LAN), it can be routable to other networks (e.g. OSPF)
75 76 77 |
# File 'lib/mist_api/models/network.rb', line 75 def subnet6 @subnet6 end |
#tenants ⇒ Hash[String, NetworkTenant]
Property key must be the user/tenant name (i.e. “printer-1”) or a Variable (i.e. “{myvar}”)
80 81 82 |
# File 'lib/mist_api/models/network.rb', line 80 def tenants @tenants end |
#vlan_id ⇒ Object
Property key must be the user/tenant name (i.e. “printer-1”) or a Variable (i.e. “{myvar}”)
85 86 87 |
# File 'lib/mist_api/models/network.rb', line 85 def vlan_id @vlan_id end |
#vpn_access ⇒ Hash[String, NetworkVpnAccessConfig]
Property key is the VPN name. Whether this network can be accessed from vpn
90 91 92 |
# File 'lib/mist_api/models/network.rb', line 90 def vpn_access @vpn_access end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/mist_api/models/network.rb', line 177 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil created_time = hash.key?('created_time') ? hash['created_time'] : SKIP disallow_mist_services = hash['disallow_mist_services'] ||= false gateway = hash.key?('gateway') ? hash['gateway'] : SKIP gateway6 = hash.key?('gateway6') ? hash['gateway6'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP internal_access = NetworkInternalAccess.from_hash(hash['internal_access']) if hash['internal_access'] internet_access = NetworkInternetAccess.from_hash(hash['internet_access']) if hash['internet_access'] isolation = hash.key?('isolation') ? hash['isolation'] : SKIP modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP multicast = NetworkMulticast.from_hash(hash['multicast']) if hash['multicast'] org_id = hash.key?('org_id') ? hash['org_id'] : SKIP routed_for_networks = hash.key?('routed_for_networks') ? hash['routed_for_networks'] : SKIP subnet = hash.key?('subnet') ? hash['subnet'] : SKIP subnet6 = hash.key?('subnet6') ? hash['subnet6'] : SKIP tenants = NetworkTenant.from_hash(hash['tenants']) if hash['tenants'] tenants = SKIP unless hash.key?('tenants') vlan_id = hash.key?('vlan_id') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:VlanIdWithVariable2), hash['vlan_id'] ) : SKIP vpn_access = NetworkVpnAccessConfig.from_hash(hash['vpn_access']) if hash['vpn_access'] vpn_access = SKIP unless hash.key?('vpn_access') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Network.new(name, created_time, disallow_mist_services, gateway, gateway6, id, internal_access, internet_access, isolation, modified_time, multicast, org_id, routed_for_networks, subnet, subnet6, tenants, vlan_id, vpn_access, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/mist_api/models/network.rb', line 93 def self.names @_hash = {} if @_hash.nil? @_hash['created_time'] = 'created_time' @_hash['disallow_mist_services'] = 'disallow_mist_services' @_hash['gateway'] = 'gateway' @_hash['gateway6'] = 'gateway6' @_hash['id'] = 'id' @_hash['internal_access'] = 'internal_access' @_hash['internet_access'] = 'internet_access' @_hash['isolation'] = 'isolation' @_hash['modified_time'] = 'modified_time' @_hash['multicast'] = 'multicast' @_hash['name'] = 'name' @_hash['org_id'] = 'org_id' @_hash['routed_for_networks'] = 'routed_for_networks' @_hash['subnet'] = 'subnet' @_hash['subnet6'] = 'subnet6' @_hash['tenants'] = 'tenants' @_hash['vlan_id'] = 'vlan_id' @_hash['vpn_access'] = 'vpn_access' @_hash end |
.nullables ⇒ Object
An array for nullable fields
140 141 142 |
# File 'lib/mist_api/models/network.rb', line 140 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/mist_api/models/network.rb', line 117 def self.optionals %w[ created_time disallow_mist_services gateway gateway6 id internal_access internet_access isolation modified_time multicast org_id routed_for_networks subnet subnet6 tenants vlan_id vpn_access ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/mist_api/models/network.rb', line 240 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/mist_api/models/network.rb', line 265 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time.inspect}, disallow_mist_services:"\ " #{@disallow_mist_services.inspect}, gateway: #{@gateway.inspect}, gateway6:"\ " #{@gateway6.inspect}, id: #{@id.inspect}, internal_access: #{@internal_access.inspect},"\ " internet_access: #{@internet_access.inspect}, isolation: #{@isolation.inspect},"\ " modified_time: #{@modified_time.inspect}, multicast: #{@multicast.inspect}, name:"\ " #{@name.inspect}, org_id: #{@org_id.inspect}, routed_for_networks:"\ " #{@routed_for_networks.inspect}, subnet: #{@subnet.inspect}, subnet6: #{@subnet6.inspect},"\ " tenants: #{@tenants.inspect}, vlan_id: #{@vlan_id.inspect}, vpn_access:"\ " #{@vpn_access.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
253 254 255 256 257 258 259 260 261 262 |
# File 'lib/mist_api/models/network.rb', line 253 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time}, disallow_mist_services:"\ " #{@disallow_mist_services}, gateway: #{@gateway}, gateway6: #{@gateway6}, id: #{@id},"\ " internal_access: #{@internal_access}, internet_access: #{@internet_access}, isolation:"\ " #{@isolation}, modified_time: #{@modified_time}, multicast: #{@multicast}, name: #{@name},"\ " org_id: #{@org_id}, routed_for_networks: #{@routed_for_networks}, subnet: #{@subnet},"\ " subnet6: #{@subnet6}, tenants: #{@tenants}, vlan_id: #{@vlan_id}, vpn_access:"\ " #{@vpn_access}, additional_properties: #{@additional_properties}>" end |