Class: MistApi::Service

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

Overview

Applications used for the Gateway configurations

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(addresses = SKIP, app_categories = SKIP, app_subcategories = SKIP, apps = SKIP, client_limit_down = 0, client_limit_up = 0, created_time = SKIP, description = SKIP, dscp = SKIP, failover_policy = ServiceFailoverPolicyEnum::REVERTIBLE, hostnames = SKIP, id = SKIP, max_jitter = SKIP, max_latency = SKIP, max_loss = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, service_limit_down = 0, service_limit_up = 0, sle_enabled = false, specs = SKIP, ssr_relaxed_tcp_state_enforcement = false, traffic_class = ServiceTrafficClassEnum::BEST_EFFORT, traffic_type = 'data_best_effort', type = ServiceTypeEnum::CUSTOM, urls = SKIP, additional_properties = nil) ⇒ Service

Returns a new instance of Service.



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
# File 'lib/mist_api/models/service.rb', line 209

def initialize(addresses = SKIP, app_categories = SKIP,
               app_subcategories = SKIP, apps = SKIP, client_limit_down = 0,
               client_limit_up = 0, created_time = SKIP, description = SKIP,
               dscp = SKIP,
               failover_policy = ServiceFailoverPolicyEnum::REVERTIBLE,
               hostnames = SKIP, id = SKIP, max_jitter = SKIP,
               max_latency = SKIP, max_loss = SKIP, modified_time = SKIP,
               name = SKIP, org_id = SKIP, service_limit_down = 0,
               service_limit_up = 0, sle_enabled = false, specs = SKIP,
               ssr_relaxed_tcp_state_enforcement = false,
               traffic_class = ServiceTrafficClassEnum::BEST_EFFORT,
               traffic_type = 'data_best_effort',
               type = ServiceTypeEnum::CUSTOM, urls = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @addresses = addresses unless addresses == SKIP
  @app_categories = app_categories unless app_categories == SKIP
  @app_subcategories = app_subcategories unless app_subcategories == SKIP
  @apps = apps unless apps == SKIP
  @client_limit_down = client_limit_down unless client_limit_down == SKIP
  @client_limit_up = client_limit_up unless client_limit_up == SKIP
  @created_time = created_time unless created_time == SKIP
  @description = description unless description == SKIP
  @dscp = dscp unless dscp == SKIP
  @failover_policy = failover_policy unless failover_policy == SKIP
  @hostnames = hostnames unless hostnames == SKIP
  @id = id unless id == SKIP
  @max_jitter = max_jitter unless max_jitter == SKIP
  @max_latency = max_latency unless max_latency == SKIP
  @max_loss = max_loss unless max_loss == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name unless name == SKIP
  @org_id = org_id unless org_id == SKIP
  @service_limit_down = service_limit_down unless service_limit_down == SKIP
  @service_limit_up = service_limit_up unless service_limit_up == SKIP
  @sle_enabled = sle_enabled unless sle_enabled == SKIP
  @specs = specs unless specs == SKIP
  unless ssr_relaxed_tcp_state_enforcement == SKIP
    @ssr_relaxed_tcp_state_enforcement =
      ssr_relaxed_tcp_state_enforcement
  end
  @traffic_class = traffic_class unless traffic_class == SKIP
  @traffic_type = traffic_type unless traffic_type == SKIP
  @type = type unless type == SKIP
  @urls = urls unless urls == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressesArray[String]

If ‘type`==`custom`, IPv4 and/or IPv6 subnets (e.g. 10.0.0.0/8, fd28::/128)

Returns:

  • (Array[String])


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

def addresses
  @addresses
end

#app_categoriesArray[String]

When ‘type`==`app_categories`, list of application categories are available through [List App Category Definitions]($e/Constants%20Definitions/listAppCategoryDefinitions)

Returns:

  • (Array[String])


21
22
23
# File 'lib/mist_api/models/service.rb', line 21

def app_categories
  @app_categories
end

#app_subcategoriesArray[String]

When ‘type`==`app_categories`, list of application categories are available through [List App Sub Category Definitions]($e/Constants%20Definitions/listAppSubCategoryDefinitions)

Returns:

  • (Array[String])


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

def app_subcategories
  @app_subcategories
end

#appsArray[String]

When ‘type`==`apps`, list of applications are available through:

* [List Applications]($e/Constants%20Definitions/listApplications)
* [List Gateway

Applications]($e/Constants%20Definitions/listGatewayApplications)

* /insight/top_app_by-bytes?wired=true

Returns:

  • (Array[String])


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

def apps
  @apps
end

#client_limit_downInteger

0 means unlimited, value from 0 to 107374182

Returns:

  • (Integer)


39
40
41
# File 'lib/mist_api/models/service.rb', line 39

def client_limit_down
  @client_limit_down
end

#client_limit_upInteger

0 means unlimited, value from 0 to 107374182

Returns:

  • (Integer)


43
44
45
# File 'lib/mist_api/models/service.rb', line 43

def client_limit_up
  @client_limit_up
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


47
48
49
# File 'lib/mist_api/models/service.rb', line 47

def created_time
  @created_time
end

#descriptionString

When the object has been created, in epoch

Returns:

  • (String)


51
52
53
# File 'lib/mist_api/models/service.rb', line 51

def description
  @description
end

#dscpObject

For SSR only, when ‘traffic_type`==`custom`. 0-63 or variable

Returns:

  • (Object)


55
56
57
# File 'lib/mist_api/models/service.rb', line 55

def dscp
  @dscp
end

#failover_policyServiceFailoverPolicyEnum

enum: ‘non_revertible`, `none`, `revertible`



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

def failover_policy
  @failover_policy
end

#hostnamesArray[String]

If ‘type`==`custom`, web filtering

Returns:

  • (Array[String])


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

def hostnames
  @hostnames
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#max_jitterObject

For SSR only, when ‘traffic_type`==`custom`, for uplink selection. 0-2147483647 or variable

Returns:

  • (Object)


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

def max_jitter
  @max_jitter
end

#max_latencyObject

For SSR only, when ‘traffic_type`==`custom`, for uplink selection. 0-2147483647 or variable

Returns:

  • (Object)


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

def max_latency
  @max_latency
end

#max_lossObject

For SSR only, when ‘traffic_type`==`custom`, for uplink selection. 0-100 or variable

Returns:

  • (Object)


82
83
84
# File 'lib/mist_api/models/service.rb', line 82

def max_loss
  @max_loss
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#nameString

When the object has been modified for the last time, in epoch

Returns:

  • (String)


90
91
92
# File 'lib/mist_api/models/service.rb', line 90

def name
  @name
end

#org_idUUID | String

When the object has been modified for the last time, in epoch

Returns:

  • (UUID | String)


94
95
96
# File 'lib/mist_api/models/service.rb', line 94

def org_id
  @org_id
end

#service_limit_downInteger

0 means unlimited, value from 0 to 107374182

Returns:

  • (Integer)


98
99
100
# File 'lib/mist_api/models/service.rb', line 98

def service_limit_down
  @service_limit_down
end

#service_limit_upInteger

0 means unlimited, value from 0 to 107374182

Returns:

  • (Integer)


102
103
104
# File 'lib/mist_api/models/service.rb', line 102

def service_limit_up
  @service_limit_up
end

#sle_enabledTrueClass | FalseClass

Whether to enable measure SLE

Returns:

  • (TrueClass | FalseClass)


106
107
108
# File 'lib/mist_api/models/service.rb', line 106

def sle_enabled
  @sle_enabled
end

#specsArray[ServiceSpec]

When ‘type`==`custom`, optional, if it doesn’t exist, http and https is assumed

Returns:



111
112
113
# File 'lib/mist_api/models/service.rb', line 111

def specs
  @specs
end

#ssr_relaxed_tcp_state_enforcementTrueClass | FalseClass

When ‘type`==`custom`, optional, if it doesn’t exist, http and https is assumed

Returns:

  • (TrueClass | FalseClass)


116
117
118
# File 'lib/mist_api/models/service.rb', line 116

def ssr_relaxed_tcp_state_enforcement
  @ssr_relaxed_tcp_state_enforcement
end

#traffic_classServiceTrafficClassEnum

when ‘traffic_type`==`custom`. enum: `best_effort`, `high`, `low`, `medium`



121
122
123
# File 'lib/mist_api/models/service.rb', line 121

def traffic_class
  @traffic_class
end

#traffic_typeString

values from [List Traffic Types]($e/Constants%20Definitions/listTrafficTypes)

Returns:

  • (String)


126
127
128
# File 'lib/mist_api/models/service.rb', line 126

def traffic_type
  @traffic_type
end

#typeServiceTypeEnum

enum: ‘app_categories`, `apps`, `custom`, `urls`

Returns:



130
131
132
# File 'lib/mist_api/models/service.rb', line 130

def type
  @type
end

#urlsArray[String]

When ‘type`==`urls`, no need for spec as URL can encode the ports being used

Returns:

  • (Array[String])


135
136
137
# File 'lib/mist_api/models/service.rb', line 135

def urls
  @urls
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/mist_api/models/service.rb', line 260

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  addresses = hash.key?('addresses') ? hash['addresses'] : SKIP
  app_categories =
    hash.key?('app_categories') ? hash['app_categories'] : SKIP
  app_subcategories =
    hash.key?('app_subcategories') ? hash['app_subcategories'] : SKIP
  apps = hash.key?('apps') ? hash['apps'] : SKIP
  client_limit_down = hash['client_limit_down'] ||= 0
  client_limit_up = hash['client_limit_up'] ||= 0
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  dscp = hash.key?('dscp') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:ServiceDscp), hash['dscp']
  ) : SKIP
  failover_policy =
    hash['failover_policy'] ||= ServiceFailoverPolicyEnum::REVERTIBLE
  hostnames = hash.key?('hostnames') ? hash['hostnames'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  max_jitter = hash.key?('max_jitter') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:ServiceMaxJitter), hash['max_jitter']
  ) : SKIP
  max_latency = hash.key?('max_latency') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:ServiceMaxLatency), hash['max_latency']
  ) : SKIP
  max_loss = hash.key?('max_loss') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:ServiceMaxLoss), hash['max_loss']
  ) : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  service_limit_down = hash['service_limit_down'] ||= 0
  service_limit_up = hash['service_limit_up'] ||= 0
  sle_enabled = hash['sle_enabled'] ||= false
  # Parameter is an array, so we need to iterate through it
  specs = nil
  unless hash['specs'].nil?
    specs = []
    hash['specs'].each do |structure|
      specs << (ServiceSpec.from_hash(structure) if structure)
    end
  end

  specs = SKIP unless hash.key?('specs')
  ssr_relaxed_tcp_state_enforcement =
    hash['ssr_relaxed_tcp_state_enforcement'] ||= false
  traffic_class =
    hash['traffic_class'] ||= ServiceTrafficClassEnum::BEST_EFFORT
  traffic_type = hash['traffic_type'] ||= 'data_best_effort'
  type = hash['type'] ||= ServiceTypeEnum::CUSTOM
  urls = hash.key?('urls') ? hash['urls'] : SKIP

  # 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.
  Service.new(addresses,
              app_categories,
              app_subcategories,
              apps,
              client_limit_down,
              client_limit_up,
              created_time,
              description,
              dscp,
              failover_policy,
              hostnames,
              id,
              max_jitter,
              max_latency,
              max_loss,
              modified_time,
              name,
              org_id,
              service_limit_down,
              service_limit_up,
              sle_enabled,
              specs,
              ssr_relaxed_tcp_state_enforcement,
              traffic_class,
              traffic_type,
              type,
              urls,
              additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/mist_api/models/service.rb', line 138

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['addresses'] = 'addresses'
  @_hash['app_categories'] = 'app_categories'
  @_hash['app_subcategories'] = 'app_subcategories'
  @_hash['apps'] = 'apps'
  @_hash['client_limit_down'] = 'client_limit_down'
  @_hash['client_limit_up'] = 'client_limit_up'
  @_hash['created_time'] = 'created_time'
  @_hash['description'] = 'description'
  @_hash['dscp'] = 'dscp'
  @_hash['failover_policy'] = 'failover_policy'
  @_hash['hostnames'] = 'hostnames'
  @_hash['id'] = 'id'
  @_hash['max_jitter'] = 'max_jitter'
  @_hash['max_latency'] = 'max_latency'
  @_hash['max_loss'] = 'max_loss'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['org_id'] = 'org_id'
  @_hash['service_limit_down'] = 'service_limit_down'
  @_hash['service_limit_up'] = 'service_limit_up'
  @_hash['sle_enabled'] = 'sle_enabled'
  @_hash['specs'] = 'specs'
  @_hash['ssr_relaxed_tcp_state_enforcement'] =
    'ssr_relaxed_tcp_state_enforcement'
  @_hash['traffic_class'] = 'traffic_class'
  @_hash['traffic_type'] = 'traffic_type'
  @_hash['type'] = 'type'
  @_hash['urls'] = 'urls'
  @_hash
end

.nullablesObject

An array for nullable fields



205
206
207
# File 'lib/mist_api/models/service.rb', line 205

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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
# File 'lib/mist_api/models/service.rb', line 172

def self.optionals
  %w[
    addresses
    app_categories
    app_subcategories
    apps
    client_limit_down
    client_limit_up
    created_time
    description
    dscp
    failover_policy
    hostnames
    id
    max_jitter
    max_latency
    max_loss
    modified_time
    name
    org_id
    service_limit_down
    service_limit_up
    sle_enabled
    specs
    ssr_relaxed_tcp_state_enforcement
    traffic_class
    traffic_type
    type
    urls
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Service | Hash)

    value against the validation is performed.



354
355
356
357
358
359
360
# File 'lib/mist_api/models/service.rb', line 354

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/mist_api/models/service.rb', line 379

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} addresses: #{@addresses.inspect}, app_categories:"\
  " #{@app_categories.inspect}, app_subcategories: #{@app_subcategories.inspect}, apps:"\
  " #{@apps.inspect}, client_limit_down: #{@client_limit_down.inspect}, client_limit_up:"\
  " #{@client_limit_up.inspect}, created_time: #{@created_time.inspect}, description:"\
  " #{@description.inspect}, dscp: #{@dscp.inspect}, failover_policy:"\
  " #{@failover_policy.inspect}, hostnames: #{@hostnames.inspect}, id: #{@id.inspect},"\
  " max_jitter: #{@max_jitter.inspect}, max_latency: #{@max_latency.inspect}, max_loss:"\
  " #{@max_loss.inspect}, modified_time: #{@modified_time.inspect}, name: #{@name.inspect},"\
  " org_id: #{@org_id.inspect}, service_limit_down: #{@service_limit_down.inspect},"\
  " service_limit_up: #{@service_limit_up.inspect}, sle_enabled: #{@sle_enabled.inspect},"\
  " specs: #{@specs.inspect}, ssr_relaxed_tcp_state_enforcement:"\
  " #{@ssr_relaxed_tcp_state_enforcement.inspect}, traffic_class: #{@traffic_class.inspect},"\
  " traffic_type: #{@traffic_type.inspect}, type: #{@type.inspect}, urls: #{@urls.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/mist_api/models/service.rb', line 363

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} addresses: #{@addresses}, app_categories: #{@app_categories},"\
  " app_subcategories: #{@app_subcategories}, apps: #{@apps}, client_limit_down:"\
  " #{@client_limit_down}, client_limit_up: #{@client_limit_up}, created_time:"\
  " #{@created_time}, description: #{@description}, dscp: #{@dscp}, failover_policy:"\
  " #{@failover_policy}, hostnames: #{@hostnames}, id: #{@id}, max_jitter: #{@max_jitter},"\
  " max_latency: #{@max_latency}, max_loss: #{@max_loss}, modified_time: #{@modified_time},"\
  " name: #{@name}, org_id: #{@org_id}, service_limit_down: #{@service_limit_down},"\
  " service_limit_up: #{@service_limit_up}, sle_enabled: #{@sle_enabled}, specs: #{@specs},"\
  " ssr_relaxed_tcp_state_enforcement: #{@ssr_relaxed_tcp_state_enforcement}, traffic_class:"\
  " #{@traffic_class}, traffic_type: #{@traffic_type}, type: #{@type}, urls: #{@urls},"\
  " additional_properties: #{@additional_properties}>"
end