Class: MistApi::SwRoutingPolicyTermAction

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

Overview

When used as import policy

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(accept = SKIP, community = SKIP, local_preference = SKIP, prepend_as_path = SKIP) ⇒ SwRoutingPolicyTermAction

Returns a new instance of SwRoutingPolicyTermAction.



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

def initialize(accept = SKIP, community = SKIP, local_preference = SKIP,
               prepend_as_path = SKIP)
  @accept = accept unless accept == SKIP
  @community = community unless community == SKIP
  @local_preference = local_preference unless local_preference == SKIP
  @prepend_as_path = prepend_as_path unless prepend_as_path == SKIP
end

Instance Attribute Details

#acceptTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def accept
  @accept
end

#communityArray[String]

When used as export policy, optional

Returns:

  • (Array[String])


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

def community
  @community
end

#local_preferenceObject

Optional, for an import policy, local_preference can be changed, value in range 1-4294967294. Can be a Variable (e.g. ‘{bgp_as}`)

Returns:

  • (Object)


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

def local_preference
  @local_preference
end

#prepend_as_pathArray[String]

When used as export policy, optional. By default, the local AS will be prepended, to change it. Can be a Variable (e.g. ‘{as_path}`)

Returns:

  • (Array[String])


28
29
30
# File 'lib/mist_api/models/sw_routing_policy_term_action.rb', line 28

def prepend_as_path
  @prepend_as_path
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
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_action.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  accept = hash.key?('accept') ? hash['accept'] : SKIP
  community = hash.key?('community') ? hash['community'] : SKIP
  local_preference = hash.key?('local_preference') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:RoutingPolicyLocalPreference), hash['local_preference']
  ) : SKIP
  prepend_as_path =
    hash.key?('prepend_as_path') ? hash['prepend_as_path'] : SKIP

  # Create object from extracted values.
  SwRoutingPolicyTermAction.new(accept,
                                community,
                                local_preference,
                                prepend_as_path)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accept'] = 'accept'
  @_hash['community'] = 'community'
  @_hash['local_preference'] = 'local_preference'
  @_hash['prepend_as_path'] = 'prepend_as_path'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    accept
    community
    local_preference
    prepend_as_path
  ]
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_action.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
106
# File 'lib/mist_api/models/sw_routing_policy_term_action.rb', line 101

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accept: #{@accept.inspect}, community: #{@community.inspect},"\
  " local_preference: #{@local_preference.inspect}, prepend_as_path:"\
  " #{@prepend_as_path.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_action.rb', line 94

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