Class: MistApi::SwRoutingPolicyTermMatching

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

Overview

zero or more criteria/filter can be specified to match the term, all criteria have to be met

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(as_path = SKIP, community = SKIP, prefix = SKIP, protocol = SKIP) ⇒ SwRoutingPolicyTermMatching

Returns a new instance of SwRoutingPolicyTermMatching.



56
57
58
59
60
61
62
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 56

def initialize(as_path = SKIP, community = SKIP, prefix = SKIP,
               protocol = SKIP)
  @as_path = as_path unless as_path == SKIP
  @community = community unless community == SKIP
  @prefix = prefix unless prefix == SKIP
  @protocol = protocol unless protocol == SKIP
end

Instance Attribute Details

#as_pathArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


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

def as_path
  @as_path
end

#communityArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def community
  @community
end

#prefixArray[String]

zero or more criteria/filter can be specified to match the term, all criteria have to be met

Returns:

  • (Array[String])


24
25
26
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 24

def prefix
  @prefix
end

#protocolArray[SwRoutingPolicyTermMatchingProtocolEnum]

zero or more criteria/filter can be specified to match the term, all criteria have to be met



29
30
31
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 29

def protocol
  @protocol
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  as_path = hash.key?('as_path') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:BgpAs4), hash['as_path']
  ) : SKIP
  community = hash.key?('community') ? hash['community'] : SKIP
  prefix = hash.key?('prefix') ? hash['prefix'] : SKIP
  protocol = hash.key?('protocol') ? hash['protocol'] : SKIP

  # Create object from extracted values.
  SwRoutingPolicyTermMatching.new(as_path,
                                  community,
                                  prefix,
                                  protocol)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['as_path'] = 'as_path'
  @_hash['community'] = 'community'
  @_hash['prefix'] = 'prefix'
  @_hash['protocol'] = 'protocol'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
49
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 42

def self.optionals
  %w[
    as_path
    community
    prefix
    protocol
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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

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.



101
102
103
104
105
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 101

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

#to_sObject

Provides a human-readable string representation of the object.



94
95
96
97
98
# File 'lib/mist_api/models/sw_routing_policy_term_matching.rb', line 94

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