Class: MistApi::ServicePolicy

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

Overview

ServicePolicy Model.

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(action = SKIP, antivirus = SKIP, appqoe = SKIP, ewf = SKIP, idp = SKIP, local_routing = SKIP, name = SKIP, path_preference = SKIP, secintel = SKIP, servicepolicy_id = SKIP, services = SKIP, skyatp = SKIP, ssl_proxy = SKIP, syslog = SKIP, tenants = SKIP) ⇒ ServicePolicy

Returns a new instance of ServicePolicy.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/mist_api/models/service_policy.rb', line 122

def initialize(action = SKIP, antivirus = SKIP, appqoe = SKIP, ewf = SKIP,
               idp = SKIP, local_routing = SKIP, name = SKIP,
               path_preference = SKIP, secintel = SKIP,
               servicepolicy_id = SKIP, services = SKIP, skyatp = SKIP,
               ssl_proxy = SKIP, syslog = SKIP, tenants = SKIP)
  @action = action unless action == SKIP
  @antivirus = antivirus unless antivirus == SKIP
  @appqoe = appqoe unless appqoe == SKIP
  @ewf = ewf unless ewf == SKIP
  @idp = idp unless idp == SKIP
  @local_routing = local_routing unless local_routing == SKIP
  @name = name unless name == SKIP
  @path_preference = path_preference unless path_preference == SKIP
  @secintel = secintel unless secintel == SKIP
  @servicepolicy_id = servicepolicy_id unless servicepolicy_id == SKIP
  @services = services unless services == SKIP
  @skyatp = skyatp unless skyatp == SKIP
  @ssl_proxy = ssl_proxy unless ssl_proxy == SKIP
  @syslog = syslog unless syslog == SKIP
  @tenants = tenants unless tenants == SKIP
end

Instance Attribute Details

#actionAllowDenyEnum

enum: ‘allow`, `deny`

Returns:



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

def action
  @action
end

#antivirusServicePolicyAntivirus

For SRX-only



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

def antivirus
  @antivirus
end

#appqoeServicePolicyAppqoe

SRX only

Returns:



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

def appqoe
  @appqoe
end

#ewfArray[ServicePolicyEwfRule]

SRX only

Returns:



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

def ewf
  @ewf
end

#idpIdpConfig

SRX only

Returns:



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

def idp
  @idp
end

#local_routingTrueClass | FalseClass

access within the same VRF

Returns:

  • (TrueClass | FalseClass)


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

def local_routing
  @local_routing
end

#nameString

access within the same VRF

Returns:

  • (String)


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

def name
  @name
end

#path_preferenceString

By default, we derive all paths available and use them. Optionally, you can customize by using ‘path_preference`

Returns:

  • (String)


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

def path_preference
  @path_preference
end

#secintelServicePolicySecintel

SRX only



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

def secintel
  @secintel
end

#servicepolicy_idUUID | String

Used to link servicepolicy defined at org level and overwrite some attributes

Returns:

  • (UUID | String)


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

def servicepolicy_id
  @servicepolicy_id
end

#servicesArray[String]

Used to link servicepolicy defined at org level and overwrite some attributes

Returns:

  • (Array[String])


57
58
59
# File 'lib/mist_api/models/service_policy.rb', line 57

def services
  @services
end

#skyatpServicePolicySkyatp

SRX only

Returns:



61
62
63
# File 'lib/mist_api/models/service_policy.rb', line 61

def skyatp
  @skyatp
end

#ssl_proxyServicePolicySslProxy

For SRX-only



65
66
67
# File 'lib/mist_api/models/service_policy.rb', line 65

def ssl_proxy
  @ssl_proxy
end

#syslogServicePolicySyslog

Required for syslog logging

Returns:



69
70
71
# File 'lib/mist_api/models/service_policy.rb', line 69

def syslog
  @syslog
end

#tenantsArray[String]

Required for syslog logging

Returns:

  • (Array[String])


73
74
75
# File 'lib/mist_api/models/service_policy.rb', line 73

def tenants
  @tenants
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/mist_api/models/service_policy.rb', line 145

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  action = hash.key?('action') ? hash['action'] : SKIP
  antivirus = ServicePolicyAntivirus.from_hash(hash['antivirus']) if hash['antivirus']
  appqoe = ServicePolicyAppqoe.from_hash(hash['appqoe']) if hash['appqoe']
  # Parameter is an array, so we need to iterate through it
  ewf = nil
  unless hash['ewf'].nil?
    ewf = []
    hash['ewf'].each do |structure|
      ewf << (ServicePolicyEwfRule.from_hash(structure) if structure)
    end
  end

  ewf = SKIP unless hash.key?('ewf')
  idp = IdpConfig.from_hash(hash['idp']) if hash['idp']
  local_routing = hash.key?('local_routing') ? hash['local_routing'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  path_preference =
    hash.key?('path_preference') ? hash['path_preference'] : SKIP
  secintel = ServicePolicySecintel.from_hash(hash['secintel']) if hash['secintel']
  servicepolicy_id =
    hash.key?('servicepolicy_id') ? hash['servicepolicy_id'] : SKIP
  services = hash.key?('services') ? hash['services'] : SKIP
  skyatp = ServicePolicySkyatp.from_hash(hash['skyatp']) if hash['skyatp']
  ssl_proxy = ServicePolicySslProxy.from_hash(hash['ssl_proxy']) if hash['ssl_proxy']
  syslog = ServicePolicySyslog.from_hash(hash['syslog']) if hash['syslog']
  tenants = hash.key?('tenants') ? hash['tenants'] : SKIP

  # Create object from extracted values.
  ServicePolicy.new(action,
                    antivirus,
                    appqoe,
                    ewf,
                    idp,
                    local_routing,
                    name,
                    path_preference,
                    secintel,
                    servicepolicy_id,
                    services,
                    skyatp,
                    ssl_proxy,
                    syslog,
                    tenants)
end

.namesObject

A mapping from model property names to API property names.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/mist_api/models/service_policy.rb', line 76

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['action'] = 'action'
  @_hash['antivirus'] = 'antivirus'
  @_hash['appqoe'] = 'appqoe'
  @_hash['ewf'] = 'ewf'
  @_hash['idp'] = 'idp'
  @_hash['local_routing'] = 'local_routing'
  @_hash['name'] = 'name'
  @_hash['path_preference'] = 'path_preference'
  @_hash['secintel'] = 'secintel'
  @_hash['servicepolicy_id'] = 'servicepolicy_id'
  @_hash['services'] = 'services'
  @_hash['skyatp'] = 'skyatp'
  @_hash['ssl_proxy'] = 'ssl_proxy'
  @_hash['syslog'] = 'syslog'
  @_hash['tenants'] = 'tenants'
  @_hash
end

.nullablesObject

An array for nullable fields



118
119
120
# File 'lib/mist_api/models/service_policy.rb', line 118

def self.nullables
  []
end

.optionalsObject

An array for optional fields



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/mist_api/models/service_policy.rb', line 97

def self.optionals
  %w[
    action
    antivirus
    appqoe
    ewf
    idp
    local_routing
    name
    path_preference
    secintel
    servicepolicy_id
    services
    skyatp
    ssl_proxy
    syslog
    tenants
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



205
206
207
208
209
210
211
212
213
214
# File 'lib/mist_api/models/service_policy.rb', line 205

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} action: #{@action.inspect}, antivirus: #{@antivirus.inspect}, appqoe:"\
  " #{@appqoe.inspect}, ewf: #{@ewf.inspect}, idp: #{@idp.inspect}, local_routing:"\
  " #{@local_routing.inspect}, name: #{@name.inspect}, path_preference:"\
  " #{@path_preference.inspect}, secintel: #{@secintel.inspect}, servicepolicy_id:"\
  " #{@servicepolicy_id.inspect}, services: #{@services.inspect}, skyatp: #{@skyatp.inspect},"\
  " ssl_proxy: #{@ssl_proxy.inspect}, syslog: #{@syslog.inspect}, tenants:"\
  " #{@tenants.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



195
196
197
198
199
200
201
202
# File 'lib/mist_api/models/service_policy.rb', line 195

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} action: #{@action}, antivirus: #{@antivirus}, appqoe: #{@appqoe}, ewf:"\
  " #{@ewf}, idp: #{@idp}, local_routing: #{@local_routing}, name: #{@name}, path_preference:"\
  " #{@path_preference}, secintel: #{@secintel}, servicepolicy_id: #{@servicepolicy_id},"\
  " services: #{@services}, skyatp: #{@skyatp}, ssl_proxy: #{@ssl_proxy}, syslog: #{@syslog},"\
  " tenants: #{@tenants}>"
end