Class: CtdDocumentation::Policy

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ctd_documentation/models/policy.rb

Overview

Policy Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(resource_id = SKIP, id = SKIP, site_id = SKIP, action = SKIP, active = SKIP, approved_user_id = SKIP, approved_username = SKIP, categories = SKIP, categories_access = SKIP, cloud_reputation = SKIP, created_user_id = SKIP, created_username = SKIP, description = SKIP, full_match = SKIP, hit_count = SKIP, port_ranges = SKIP, ports = SKIP, protocols = SKIP, valid = SKIP, state = SKIP, usage_percentage = SKIP, modified_user_id = SKIP, modified_username = SKIP, last_modified = SKIP, timestamp = SKIP, last_user_modified = SKIP, state_modified = SKIP, virtual_zones = SKIP) ⇒ Policy

Returns a new instance of Policy.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/ctd_documentation/models/policy.rb', line 197

def initialize(resource_id = SKIP,
               id = SKIP,
               site_id = SKIP,
               action = SKIP,
               active = SKIP,
               approved_user_id = SKIP,
               approved_username = SKIP,
               categories = SKIP,
               categories_access = SKIP,
               cloud_reputation = SKIP,
               created_user_id = SKIP,
               created_username = SKIP,
               description = SKIP,
               full_match = SKIP,
               hit_count = SKIP,
               port_ranges = SKIP,
               ports = SKIP,
               protocols = SKIP,
               valid = SKIP,
               state = SKIP,
               usage_percentage = SKIP,
               modified_user_id = SKIP,
               modified_username = SKIP,
               last_modified = SKIP,
               timestamp = SKIP,
               last_user_modified = SKIP,
               state_modified = SKIP,
               virtual_zones = SKIP)
  @resource_id = resource_id unless resource_id == SKIP
  @id = id unless id == SKIP
  @site_id = site_id unless site_id == SKIP
  @action = action unless action == SKIP
  @active = active unless active == SKIP
  @approved_user_id = approved_user_id unless approved_user_id == SKIP
  @approved_username = approved_username unless approved_username == SKIP
  @categories = categories unless categories == SKIP
  @categories_access = categories_access unless categories_access == SKIP
  @cloud_reputation = cloud_reputation unless cloud_reputation == SKIP
  @created_user_id = created_user_id unless created_user_id == SKIP
  @created_username = created_username unless created_username == SKIP
  @description = description unless description == SKIP
  @full_match = full_match unless full_match == SKIP
  @hit_count = hit_count unless hit_count == SKIP
  @port_ranges = port_ranges unless port_ranges == SKIP
  @ports = ports unless ports == SKIP
  @protocols = protocols unless protocols == SKIP
  @valid = valid unless valid == SKIP
  @state = state unless state == SKIP
  @usage_percentage = usage_percentage unless usage_percentage == SKIP
  @modified_user_id = modified_user_id unless modified_user_id == SKIP
  @modified_username = modified_username unless modified_username == SKIP
  @last_modified = last_modified unless last_modified == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @last_user_modified = last_user_modified unless last_user_modified == SKIP
  @state_modified = state_modified unless state_modified == SKIP
  @virtual_zones = virtual_zones unless virtual_zones == SKIP
end

Instance Attribute Details

#actionInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/ctd_documentation/models/policy.rb', line 26

def action
  @action
end

#activeTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


30
31
32
# File 'lib/ctd_documentation/models/policy.rb', line 30

def active
  @active
end

#approved_user_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/ctd_documentation/models/policy.rb', line 34

def approved_user_id
  @approved_user_id
end

#approved_usernameString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/ctd_documentation/models/policy.rb', line 38

def approved_username
  @approved_username
end

#categoriesList of Integer

TODO: Write general description for this method

Returns:

  • (List of Integer)


42
43
44
# File 'lib/ctd_documentation/models/policy.rb', line 42

def categories
  @categories
end

#categories_accessList of Integer

TODO: Write general description for this method

Returns:

  • (List of Integer)


46
47
48
# File 'lib/ctd_documentation/models/policy.rb', line 46

def categories_access
  @categories_access
end

#cloud_reputationInteger

TODO: Write general description for this method

Returns:

  • (Integer)


50
51
52
# File 'lib/ctd_documentation/models/policy.rb', line 50

def cloud_reputation
  @cloud_reputation
end

#created_user_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


54
55
56
# File 'lib/ctd_documentation/models/policy.rb', line 54

def created_user_id
  @created_user_id
end

#created_usernameString

TODO: Write general description for this method

Returns:

  • (String)


58
59
60
# File 'lib/ctd_documentation/models/policy.rb', line 58

def created_username
  @created_username
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/ctd_documentation/models/policy.rb', line 62

def description
  @description
end

#full_matchTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


66
67
68
# File 'lib/ctd_documentation/models/policy.rb', line 66

def full_match
  @full_match
end

#hit_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


70
71
72
# File 'lib/ctd_documentation/models/policy.rb', line 70

def hit_count
  @hit_count
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/ctd_documentation/models/policy.rb', line 18

def id
  @id
end

#last_modifiedString

TODO: Write general description for this method

Returns:

  • (String)


106
107
108
# File 'lib/ctd_documentation/models/policy.rb', line 106

def last_modified
  @last_modified
end

#last_user_modifiedString

TODO: Write general description for this method

Returns:

  • (String)


114
115
116
# File 'lib/ctd_documentation/models/policy.rb', line 114

def last_user_modified
  @last_user_modified
end

#modified_user_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


98
99
100
# File 'lib/ctd_documentation/models/policy.rb', line 98

def modified_user_id
  @modified_user_id
end

#modified_usernameString

TODO: Write general description for this method

Returns:

  • (String)


102
103
104
# File 'lib/ctd_documentation/models/policy.rb', line 102

def modified_username
  @modified_username
end

#port_rangesList of String

TODO: Write general description for this method

Returns:

  • (List of String)


74
75
76
# File 'lib/ctd_documentation/models/policy.rb', line 74

def port_ranges
  @port_ranges
end

#portsList of String

TODO: Write general description for this method

Returns:

  • (List of String)


78
79
80
# File 'lib/ctd_documentation/models/policy.rb', line 78

def ports
  @ports
end

#protocolsList of String

TODO: Write general description for this method

Returns:

  • (List of String)


82
83
84
# File 'lib/ctd_documentation/models/policy.rb', line 82

def protocols
  @protocols
end

#resource_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/ctd_documentation/models/policy.rb', line 14

def resource_id
  @resource_id
end

#site_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/ctd_documentation/models/policy.rb', line 22

def site_id
  @site_id
end

#stateInteger

TODO: Write general description for this method

Returns:

  • (Integer)


90
91
92
# File 'lib/ctd_documentation/models/policy.rb', line 90

def state
  @state
end

#state_modifiedString

TODO: Write general description for this method

Returns:

  • (String)


118
119
120
# File 'lib/ctd_documentation/models/policy.rb', line 118

def state_modified
  @state_modified
end

#timestampString

TODO: Write general description for this method

Returns:

  • (String)


110
111
112
# File 'lib/ctd_documentation/models/policy.rb', line 110

def timestamp
  @timestamp
end

#usage_percentageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


94
95
96
# File 'lib/ctd_documentation/models/policy.rb', line 94

def usage_percentage
  @usage_percentage
end

#validTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


86
87
88
# File 'lib/ctd_documentation/models/policy.rb', line 86

def valid
  @valid
end

#virtual_zonesVirtualZones

TODO: Write general description for this method

Returns:



122
123
124
# File 'lib/ctd_documentation/models/policy.rb', line 122

def virtual_zones
  @virtual_zones
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/ctd_documentation/models/policy.rb', line 256

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  action = hash.key?('action') ? hash['action'] : SKIP
  active = hash.key?('active') ? hash['active'] : SKIP
  approved_user_id =
    hash.key?('approved_user_id') ? hash['approved_user_id'] : SKIP
  approved_username =
    hash.key?('approved_username') ? hash['approved_username'] : SKIP
  categories = hash.key?('categories') ? hash['categories'] : SKIP
  categories_access =
    hash.key?('categories_access') ? hash['categories_access'] : SKIP
  cloud_reputation =
    hash.key?('cloud_reputation') ? hash['cloud_reputation'] : SKIP
  created_user_id =
    hash.key?('created_user_id') ? hash['created_user_id'] : SKIP
  created_username =
    hash.key?('created_username') ? hash['created_username'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  full_match = hash.key?('full_match') ? hash['full_match'] : SKIP
  hit_count = hash.key?('hit_count') ? hash['hit_count'] : SKIP
  port_ranges = hash.key?('port_ranges') ? hash['port_ranges'] : SKIP
  ports = hash.key?('ports') ? hash['ports'] : SKIP
  protocols = hash.key?('protocols') ? hash['protocols'] : SKIP
  valid = hash.key?('valid') ? hash['valid'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  usage_percentage =
    hash.key?('usage_percentage') ? hash['usage_percentage'] : SKIP
  modified_user_id =
    hash.key?('modified_user_id') ? hash['modified_user_id'] : SKIP
  modified_username =
    hash.key?('modified_username') ? hash['modified_username'] : SKIP
  last_modified = hash.key?('last_modified') ? hash['last_modified'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  last_user_modified =
    hash.key?('last_user_modified') ? hash['last_user_modified'] : SKIP
  state_modified =
    hash.key?('state_modified') ? hash['state_modified'] : SKIP
  virtual_zones = VirtualZones.from_hash(hash['virtual_zones']) if hash['virtual_zones']

  # Create object from extracted values.
  Policy.new(resource_id,
             id,
             site_id,
             action,
             active,
             approved_user_id,
             approved_username,
             categories,
             categories_access,
             cloud_reputation,
             created_user_id,
             created_username,
             description,
             full_match,
             hit_count,
             port_ranges,
             ports,
             protocols,
             valid,
             state,
             usage_percentage,
             modified_user_id,
             modified_username,
             last_modified,
             timestamp,
             last_user_modified,
             state_modified,
             virtual_zones)
end

.namesObject

A mapping from model property names to API property names.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/ctd_documentation/models/policy.rb', line 125

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['resource_id'] = 'resource_id'
  @_hash['id'] = 'id'
  @_hash['site_id'] = 'site_id'
  @_hash['action'] = 'action'
  @_hash['active'] = 'active'
  @_hash['approved_user_id'] = 'approved_user_id'
  @_hash['approved_username'] = 'approved_username'
  @_hash['categories'] = 'categories'
  @_hash['categories_access'] = 'categories_access'
  @_hash['cloud_reputation'] = 'cloud_reputation'
  @_hash['created_user_id'] = 'created_user_id'
  @_hash['created_username'] = 'created_username'
  @_hash['description'] = 'description'
  @_hash['full_match'] = 'full_match'
  @_hash['hit_count'] = 'hit_count'
  @_hash['port_ranges'] = 'port_ranges'
  @_hash['ports'] = 'ports'
  @_hash['protocols'] = 'protocols'
  @_hash['valid'] = 'valid'
  @_hash['state'] = 'state'
  @_hash['usage_percentage'] = 'usage_percentage'
  @_hash['modified_user_id'] = 'modified_user_id'
  @_hash['modified_username'] = 'modified_username'
  @_hash['last_modified'] = 'last_modified'
  @_hash['timestamp'] = 'timestamp'
  @_hash['last_user_modified'] = 'last_user_modified'
  @_hash['state_modified'] = 'state_modified'
  @_hash['virtual_zones'] = 'virtual_zones'
  @_hash
end

.nullablesObject

An array for nullable fields



193
194
195
# File 'lib/ctd_documentation/models/policy.rb', line 193

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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
# File 'lib/ctd_documentation/models/policy.rb', line 159

def self.optionals
  %w[
    resource_id
    id
    site_id
    action
    active
    approved_user_id
    approved_username
    categories
    categories_access
    cloud_reputation
    created_user_id
    created_username
    description
    full_match
    hit_count
    port_ranges
    ports
    protocols
    valid
    state
    usage_percentage
    modified_user_id
    modified_username
    last_modified
    timestamp
    last_user_modified
    state_modified
    virtual_zones
  ]
end