Class: MistApi::GwRoutingPolicyTermAction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/gw_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, add_community = SKIP, add_target_vrfs = SKIP, community = SKIP, exclude_as_path = SKIP, exclude_community = SKIP, export_communities = SKIP, local_preference = SKIP, prepend_as_path = SKIP) ⇒ GwRoutingPolicyTermAction

Returns a new instance of GwRoutingPolicyTermAction.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 85

def initialize(accept = SKIP, add_community = SKIP, add_target_vrfs = SKIP,
               community = SKIP, exclude_as_path = SKIP,
               exclude_community = SKIP, export_communities = SKIP,
               local_preference = SKIP, prepend_as_path = SKIP)
  @accept = accept unless accept == SKIP
  @add_community = add_community unless add_community == SKIP
  @add_target_vrfs = add_target_vrfs unless add_target_vrfs == SKIP
  @community = community unless community == SKIP
  @exclude_as_path = exclude_as_path unless exclude_as_path == SKIP
  @exclude_community = exclude_community unless exclude_community == SKIP
  @export_communities = export_communities unless export_communities == 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/gw_routing_policy_term_action.rb', line 14

def accept
  @accept
end

#add_communityArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def add_community
  @add_community
end

#add_target_vrfsArray[String]

For SSR, hub decides how VRF routes are leaked on spoke

Returns:

  • (Array[String])


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

def add_target_vrfs
  @add_target_vrfs
end

#communityArray[String]

When used as export policy, optional

Returns:

  • (Array[String])


26
27
28
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 26

def community
  @community
end

#exclude_as_pathArray[String]

When used as export policy, optional. To exclude certain AS

Returns:

  • (Array[String])


30
31
32
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 30

def exclude_as_path
  @exclude_as_path
end

#exclude_communityArray[String]

When used as export policy, optional. To exclude certain AS

Returns:

  • (Array[String])


34
35
36
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 34

def exclude_community
  @exclude_community
end

#export_communitiesArray[String]

When used as export policy, optional

Returns:

  • (Array[String])


38
39
40
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 38

def export_communities
  @export_communities
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)


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

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])


48
49
50
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 48

def prepend_as_path
  @prepend_as_path
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  accept = hash.key?('accept') ? hash['accept'] : SKIP
  add_community = hash.key?('add_community') ? hash['add_community'] : SKIP
  add_target_vrfs =
    hash.key?('add_target_vrfs') ? hash['add_target_vrfs'] : SKIP
  community = hash.key?('community') ? hash['community'] : SKIP
  exclude_as_path =
    hash.key?('exclude_as_path') ? hash['exclude_as_path'] : SKIP
  exclude_community =
    hash.key?('exclude_community') ? hash['exclude_community'] : SKIP
  export_communities =
    hash.key?('export_communities') ? hash['export_communities'] : 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.
  GwRoutingPolicyTermAction.new(accept,
                                add_community,
                                add_target_vrfs,
                                community,
                                exclude_as_path,
                                exclude_community,
                                export_communities,
                                local_preference,
                                prepend_as_path)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 51

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    accept
    add_community
    add_target_vrfs
    community
    exclude_as_path
    exclude_community
    export_communities
    local_preference
    prepend_as_path
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



136
137
138
139
140
141
142
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 136

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.



154
155
156
157
158
159
160
161
162
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 154

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accept: #{@accept.inspect}, add_community: #{@add_community.inspect},"\
  " add_target_vrfs: #{@add_target_vrfs.inspect}, community: #{@community.inspect},"\
  " exclude_as_path: #{@exclude_as_path.inspect}, exclude_community:"\
  " #{@exclude_community.inspect}, export_communities: #{@export_communities.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.



145
146
147
148
149
150
151
# File 'lib/mist_api/models/gw_routing_policy_term_action.rb', line 145

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