Class: MistApi::TunnelConfig

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/tunnel_config.rb

Overview

TunnelConfig Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(auto_provision = SKIP, ike_lifetime = SKIP, ike_mode = TunnelConfigIkeModeEnum::MAIN, ike_proposals = SKIP, ipsec_lifetime = SKIP, ipsec_proposals = SKIP, local_id = SKIP, local_subnets = SKIP, mode = TunnelConfigTunnelModeEnum::ACTIVESTANDBY, networks = SKIP, primary = SKIP, probe = SKIP, protocol = SKIP, provider = SKIP, psk = SKIP, remote_subnets = SKIP, secondary = SKIP, version = TunnelConfigVersionEnum::ENUM_2) ⇒ TunnelConfig

Returns a new instance of TunnelConfig.



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/tunnel_config.rb', line 146

def initialize(auto_provision = SKIP, ike_lifetime = SKIP,
               ike_mode = TunnelConfigIkeModeEnum::MAIN,
               ike_proposals = SKIP, ipsec_lifetime = SKIP,
               ipsec_proposals = SKIP, local_id = SKIP,
               local_subnets = SKIP,
               mode = TunnelConfigTunnelModeEnum::ACTIVESTANDBY,
               networks = SKIP, primary = SKIP, probe = SKIP,
               protocol = SKIP, provider = SKIP, psk = SKIP,
               remote_subnets = SKIP, secondary = SKIP,
               version = TunnelConfigVersionEnum::ENUM_2)
  @auto_provision = auto_provision unless auto_provision == SKIP
  @ike_lifetime = ike_lifetime unless ike_lifetime == SKIP
  @ike_mode = ike_mode unless ike_mode == SKIP
  @ike_proposals = ike_proposals unless ike_proposals == SKIP
  @ipsec_lifetime = ipsec_lifetime unless ipsec_lifetime == SKIP
  @ipsec_proposals = ipsec_proposals unless ipsec_proposals == SKIP
  @local_id = local_id unless local_id == SKIP
  @local_subnets = local_subnets unless local_subnets == SKIP
  @mode = mode unless mode == SKIP
  @networks = networks unless networks == SKIP
  @primary = primary unless primary == SKIP
  @probe = probe unless probe == SKIP
  @protocol = protocol unless protocol == SKIP
  @provider = provider unless provider == SKIP
  @psk = psk unless psk == SKIP
  @remote_subnets = remote_subnets unless remote_subnets == SKIP
  @secondary = secondary unless secondary == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#auto_provisionTunnelConfigAutoProvision

Auto Provisioning configuration for the tunne. This takes precedence over the ‘primary` and `secondary` nodes.



15
16
17
# File 'lib/mist_api/models/tunnel_config.rb', line 15

def auto_provision
  @auto_provision
end

#ike_lifetimeInteger

Only if ‘provider`==`custom-ipsec`

Returns:

  • (Integer)


19
20
21
# File 'lib/mist_api/models/tunnel_config.rb', line 19

def ike_lifetime
  @ike_lifetime
end

#ike_modeTunnelConfigIkeModeEnum

Only if ‘provider`==`custom-ipsec`. enum: `aggressive`, `main`



23
24
25
# File 'lib/mist_api/models/tunnel_config.rb', line 23

def ike_mode
  @ike_mode
end

#ike_proposalsArray[TunnelConfigIkeProposal]

If ‘provider`==`custom-ipsec`

Returns:



27
28
29
# File 'lib/mist_api/models/tunnel_config.rb', line 27

def ike_proposals
  @ike_proposals
end

#ipsec_lifetimeInteger

If ‘provider`==`custom-ipsec`

Returns:

  • (Integer)


31
32
33
# File 'lib/mist_api/models/tunnel_config.rb', line 31

def ipsec_lifetime
  @ipsec_lifetime
end

#ipsec_proposalsArray[TunnelConfigIpsecProposal]

Only if ‘provider`==`custom-ipsec`

Returns:



35
36
37
# File 'lib/mist_api/models/tunnel_config.rb', line 35

def ipsec_proposals
  @ipsec_proposals
end

#local_idString

Required if ‘provider`==`zscaler-ipsec`, `provider`==`jse-ipsec` or `provider`==`custom-ipsec`

Returns:

  • (String)


40
41
42
# File 'lib/mist_api/models/tunnel_config.rb', line 40

def local_id
  @local_id
end

#local_subnetsArray[String]

List of Local protected subnet for policy-based IPSec negotiation

Returns:

  • (Array[String])


44
45
46
# File 'lib/mist_api/models/tunnel_config.rb', line 44

def local_subnets
  @local_subnets
end

#modeTunnelConfigTunnelModeEnum

Required if ‘provider`==`zscaler-gre`, `provider`==`jse-ipsec`. enum: `active-active`, `active-standby`



49
50
51
# File 'lib/mist_api/models/tunnel_config.rb', line 49

def mode
  @mode
end

#networksArray[String]

If ‘provider`==`custom-ipsec` or `provider`==`prisma-ipsec`, networks reachable via this tunnel

Returns:

  • (Array[String])


54
55
56
# File 'lib/mist_api/models/tunnel_config.rb', line 54

def networks
  @networks
end

#primaryTunnelConfigNode

Only if ‘provider`==`zscaler-ipsec`, `provider`==`jse-ipsec` or `provider`==`custom-ipsec`

Returns:



59
60
61
# File 'lib/mist_api/models/tunnel_config.rb', line 59

def primary
  @primary
end

#probeTunnelConfigProbe

Only if ‘provider`==`custom-ipsec`

Returns:



63
64
65
# File 'lib/mist_api/models/tunnel_config.rb', line 63

def probe
  @probe
end

#protocolTunnelConfigProtocolEnum

Only if ‘provider`==`custom-ipsec`. enum: `gre`, `ipsec`



67
68
69
# File 'lib/mist_api/models/tunnel_config.rb', line 67

def protocol
  @protocol
end

#providerTunnelConfigProviderEnum

Only if ‘auto_provision.enabled`==`false`. enum: `custom-ipsec`, `custom-gre`, `jse-ipsec`, `prisma-ipsec`, `zscaler-gre`, `zscaler-ipsec`



72
73
74
# File 'lib/mist_api/models/tunnel_config.rb', line 72

def provider
  @provider
end

#pskString

Required if ‘provider`==`zscaler-ipsec`, `provider`==`jse-ipsec` or `provider`==`custom-ipsec`

Returns:

  • (String)


77
78
79
# File 'lib/mist_api/models/tunnel_config.rb', line 77

def psk
  @psk
end

#remote_subnetsArray[String]

List of Remote protected subnet for policy-based IPSec negotiation

Returns:

  • (Array[String])


81
82
83
# File 'lib/mist_api/models/tunnel_config.rb', line 81

def remote_subnets
  @remote_subnets
end

#secondaryTunnelConfigNode

Only if ‘provider`==`zscaler-ipsec`, `provider`==`jse-ipsec` or `provider`==`custom-ipsec`

Returns:



86
87
88
# File 'lib/mist_api/models/tunnel_config.rb', line 86

def secondary
  @secondary
end

#versionTunnelConfigVersionEnum

Only if ‘provider`==`custom-gre` or `provider`==`custom-ipsec`. enum: `1`, `2`



91
92
93
# File 'lib/mist_api/models/tunnel_config.rb', line 91

def version
  @version
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
237
238
239
240
# File 'lib/mist_api/models/tunnel_config.rb', line 177

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  auto_provision = TunnelConfigAutoProvision.from_hash(hash['auto_provision']) if
    hash['auto_provision']
  ike_lifetime = hash.key?('ike_lifetime') ? hash['ike_lifetime'] : SKIP
  ike_mode = hash['ike_mode'] ||= TunnelConfigIkeModeEnum::MAIN
  # Parameter is an array, so we need to iterate through it
  ike_proposals = nil
  unless hash['ike_proposals'].nil?
    ike_proposals = []
    hash['ike_proposals'].each do |structure|
      ike_proposals << (TunnelConfigIkeProposal.from_hash(structure) if structure)
    end
  end

  ike_proposals = SKIP unless hash.key?('ike_proposals')
  ipsec_lifetime =
    hash.key?('ipsec_lifetime') ? hash['ipsec_lifetime'] : SKIP
  # Parameter is an array, so we need to iterate through it
  ipsec_proposals = nil
  unless hash['ipsec_proposals'].nil?
    ipsec_proposals = []
    hash['ipsec_proposals'].each do |structure|
      ipsec_proposals << (TunnelConfigIpsecProposal.from_hash(structure) if structure)
    end
  end

  ipsec_proposals = SKIP unless hash.key?('ipsec_proposals')
  local_id = hash.key?('local_id') ? hash['local_id'] : SKIP
  local_subnets = hash.key?('local_subnets') ? hash['local_subnets'] : SKIP
  mode = hash['mode'] ||= TunnelConfigTunnelModeEnum::ACTIVESTANDBY
  networks = hash.key?('networks') ? hash['networks'] : SKIP
  primary = TunnelConfigNode.from_hash(hash['primary']) if hash['primary']
  probe = TunnelConfigProbe.from_hash(hash['probe']) if hash['probe']
  protocol = hash.key?('protocol') ? hash['protocol'] : SKIP
  provider = hash.key?('provider') ? hash['provider'] : SKIP
  psk = hash.key?('psk') ? hash['psk'] : SKIP
  remote_subnets =
    hash.key?('remote_subnets') ? hash['remote_subnets'] : SKIP
  secondary = TunnelConfigNode.from_hash(hash['secondary']) if hash['secondary']
  version = hash['version'] ||= TunnelConfigVersionEnum::ENUM_2

  # Create object from extracted values.
  TunnelConfig.new(auto_provision,
                   ike_lifetime,
                   ike_mode,
                   ike_proposals,
                   ipsec_lifetime,
                   ipsec_proposals,
                   local_id,
                   local_subnets,
                   mode,
                   networks,
                   primary,
                   probe,
                   protocol,
                   provider,
                   psk,
                   remote_subnets,
                   secondary,
                   version)
end

.namesObject

A mapping from model property names to API property names.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/mist_api/models/tunnel_config.rb', line 94

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auto_provision'] = 'auto_provision'
  @_hash['ike_lifetime'] = 'ike_lifetime'
  @_hash['ike_mode'] = 'ike_mode'
  @_hash['ike_proposals'] = 'ike_proposals'
  @_hash['ipsec_lifetime'] = 'ipsec_lifetime'
  @_hash['ipsec_proposals'] = 'ipsec_proposals'
  @_hash['local_id'] = 'local_id'
  @_hash['local_subnets'] = 'local_subnets'
  @_hash['mode'] = 'mode'
  @_hash['networks'] = 'networks'
  @_hash['primary'] = 'primary'
  @_hash['probe'] = 'probe'
  @_hash['protocol'] = 'protocol'
  @_hash['provider'] = 'provider'
  @_hash['psk'] = 'psk'
  @_hash['remote_subnets'] = 'remote_subnets'
  @_hash['secondary'] = 'secondary'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



142
143
144
# File 'lib/mist_api/models/tunnel_config.rb', line 142

def self.nullables
  []
end

.optionalsObject

An array for optional fields



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/mist_api/models/tunnel_config.rb', line 118

def self.optionals
  %w[
    auto_provision
    ike_lifetime
    ike_mode
    ike_proposals
    ipsec_lifetime
    ipsec_proposals
    local_id
    local_subnets
    mode
    networks
    primary
    probe
    protocol
    provider
    psk
    remote_subnets
    secondary
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/mist_api/models/tunnel_config.rb', line 255

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_provision: #{@auto_provision.inspect}, ike_lifetime:"\
  " #{@ike_lifetime.inspect}, ike_mode: #{@ike_mode.inspect}, ike_proposals:"\
  " #{@ike_proposals.inspect}, ipsec_lifetime: #{@ipsec_lifetime.inspect}, ipsec_proposals:"\
  " #{@ipsec_proposals.inspect}, local_id: #{@local_id.inspect}, local_subnets:"\
  " #{@local_subnets.inspect}, mode: #{@mode.inspect}, networks: #{@networks.inspect},"\
  " primary: #{@primary.inspect}, probe: #{@probe.inspect}, protocol: #{@protocol.inspect},"\
  " provider: #{@provider.inspect}, psk: #{@psk.inspect}, remote_subnets:"\
  " #{@remote_subnets.inspect}, secondary: #{@secondary.inspect}, version:"\
  " #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



243
244
245
246
247
248
249
250
251
252
# File 'lib/mist_api/models/tunnel_config.rb', line 243

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_provision: #{@auto_provision}, ike_lifetime: #{@ike_lifetime},"\
  " ike_mode: #{@ike_mode}, ike_proposals: #{@ike_proposals}, ipsec_lifetime:"\
  " #{@ipsec_lifetime}, ipsec_proposals: #{@ipsec_proposals}, local_id: #{@local_id},"\
  " local_subnets: #{@local_subnets}, mode: #{@mode}, networks: #{@networks}, primary:"\
  " #{@primary}, probe: #{@probe}, protocol: #{@protocol}, provider: #{@provider}, psk:"\
  " #{@psk}, remote_subnets: #{@remote_subnets}, secondary: #{@secondary}, version:"\
  " #{@version}>"
end