Class: MistApi::ProtectReCustom

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

Overview

Custom acls

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(port_range = '0', protocol = ProtectReCustomProtocolEnum::ANY, subnets = SKIP) ⇒ ProtectReCustom

Returns a new instance of ProtectReCustom.



47
48
49
50
51
52
# File 'lib/mist_api/models/protect_re_custom.rb', line 47

def initialize(port_range = '0',
               protocol = ProtectReCustomProtocolEnum::ANY, subnets = SKIP)
  @port_range = port_range unless port_range == SKIP
  @protocol = protocol unless protocol == SKIP
  @subnets = subnets unless subnets == SKIP
end

Instance Attribute Details

#port_rangeString

Matched dst port, “0” means any

Returns:

  • (String)


14
15
16
# File 'lib/mist_api/models/protect_re_custom.rb', line 14

def port_range
  @port_range
end

#protocolProtectReCustomProtocolEnum

enum: ‘any`, `icmp`, `tcp`, `udp`



18
19
20
# File 'lib/mist_api/models/protect_re_custom.rb', line 18

def protocol
  @protocol
end

#subnetsArray[String]

enum: ‘any`, `icmp`, `tcp`, `udp`

Returns:

  • (Array[String])


22
23
24
# File 'lib/mist_api/models/protect_re_custom.rb', line 22

def subnets
  @subnets
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/mist_api/models/protect_re_custom.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  port_range = hash['port_range'] ||= '0'
  protocol = hash['protocol'] ||= ProtectReCustomProtocolEnum::ANY
  subnets = hash.key?('subnets') ? hash['subnets'] : SKIP

  # Create object from extracted values.
  ProtectReCustom.new(port_range,
                      protocol,
                      subnets)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/mist_api/models/protect_re_custom.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['port_range'] = 'port_range'
  @_hash['protocol'] = 'protocol'
  @_hash['subnets'] = 'subnets'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/mist_api/models/protect_re_custom.rb', line 34

def self.optionals
  %w[
    port_range
    protocol
    subnets
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (ProtectReCustom | Hash)

    value against the validation is performed.



71
72
73
74
75
76
77
# File 'lib/mist_api/models/protect_re_custom.rb', line 71

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.



86
87
88
89
90
# File 'lib/mist_api/models/protect_re_custom.rb', line 86

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} port_range: #{@port_range.inspect}, protocol: #{@protocol.inspect},"\
  " subnets: #{@subnets.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} port_range: #{@port_range}, protocol: #{@protocol}, subnets: #{@subnets}>"
end