Class: SemgrepWebApp::ProtosOpenapiV1GetScanResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb

Overview

ProtosOpenapiV1GetScanResponse 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(completed_at: SKIP, deployment_id: SKIP, enabled_products: SKIP, exit_code: SKIP, has_logs: SKIP, id: SKIP, meta: SKIP, repository_id: SKIP, started_at: SKIP, stats: SKIP, additional_properties: nil) ⇒ ProtosOpenapiV1GetScanResponse

Returns a new instance of ProtosOpenapiV1GetScanResponse.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 90

def initialize(completed_at: SKIP, deployment_id: SKIP,
               enabled_products: SKIP, exit_code: SKIP, has_logs: SKIP,
               id: SKIP, meta: SKIP, repository_id: SKIP, started_at: SKIP,
               stats: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @completed_at = completed_at unless completed_at == SKIP
  @deployment_id = deployment_id unless deployment_id == SKIP
  @enabled_products = enabled_products unless enabled_products == SKIP
  @exit_code = exit_code unless exit_code == SKIP
  @has_logs = has_logs unless has_logs == SKIP
  @id = id unless id == SKIP
  @meta = meta unless meta == SKIP
  @repository_id = repository_id unless repository_id == SKIP
  @started_at = started_at unless started_at == SKIP
  @stats = stats unless stats == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#completed_atString

imestamp of when the scan started.

Returns:

  • (String)


14
15
16
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 14

def completed_at
  @completed_at
end

#deployment_idInteger

The unique ID of the deployment associated with the scanned repository.

Returns:

  • (Integer)


18
19
20
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 18

def deployment_id
  @deployment_id
end

#enabled_productsArray[String]

The products used when running the scan.

Returns:

  • (Array[String])


22
23
24
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 22

def enabled_products
  @enabled_products
end

#exit_codeInteger

The products used when running the scan.

Returns:

  • (Integer)


26
27
28
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 26

def exit_code
  @exit_code
end

#has_logsTrueClass | FalseClass

The products used when running the scan.

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 30

def has_logs
  @has_logs
end

#idInteger

The unique ID representing this scan.

Returns:

  • (Integer)


34
35
36
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 34

def id
  @id
end

#metaProtosOpenapiV1GetScanResponseScanMeta

The unique ID representing this scan.



38
39
40
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 38

def meta
  @meta
end

#repository_idInteger

The unique ID of the repository that was scanned.

Returns:

  • (Integer)


42
43
44
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 42

def repository_id
  @repository_id
end

#started_atString

when the scan was started

Returns:

  • (String)


46
47
48
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 46

def started_at
  @started_at
end

#statsObject

Miscellaneous statistics about the scan, like number of findings found and scan duration.

Returns:

  • (Object)


51
52
53
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 51

def stats
  @stats
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 111

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  completed_at = hash.key?('completed_at') ? hash['completed_at'] : SKIP
  deployment_id = hash.key?('deployment_id') ? hash['deployment_id'] : SKIP
  enabled_products =
    hash.key?('enabled_products') ? hash['enabled_products'] : SKIP
  exit_code = hash.key?('exit_code') ? hash['exit_code'] : SKIP
  has_logs = hash.key?('has_logs') ? hash['has_logs'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  meta = ProtosOpenapiV1GetScanResponseScanMeta.from_hash(hash['meta']) if hash['meta']
  repository_id = hash.key?('repository_id') ? hash['repository_id'] : SKIP
  started_at = hash.key?('started_at') ? hash['started_at'] : SKIP
  stats = hash.key?('stats') ? hash['stats'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ProtosOpenapiV1GetScanResponse.new(completed_at: completed_at,
                                     deployment_id: deployment_id,
                                     enabled_products: enabled_products,
                                     exit_code: exit_code,
                                     has_logs: has_logs,
                                     id: id,
                                     meta: meta,
                                     repository_id: repository_id,
                                     started_at: started_at,
                                     stats: stats,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['completed_at'] = 'completed_at'
  @_hash['deployment_id'] = 'deployment_id'
  @_hash['enabled_products'] = 'enabled_products'
  @_hash['exit_code'] = 'exit_code'
  @_hash['has_logs'] = 'has_logs'
  @_hash['id'] = 'id'
  @_hash['meta'] = 'meta'
  @_hash['repository_id'] = 'repository_id'
  @_hash['started_at'] = 'started_at'
  @_hash['stats'] = 'stats'
  @_hash
end

.nullablesObject

An array for nullable fields



86
87
88
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 86

def self.nullables
  []
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 70

def self.optionals
  %w[
    completed_at
    deployment_id
    enabled_products
    exit_code
    has_logs
    id
    meta
    repository_id
    started_at
    stats
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
164
165
166
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 158

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} completed_at: #{@completed_at.inspect}, deployment_id:"\
  " #{@deployment_id.inspect}, enabled_products: #{@enabled_products.inspect}, exit_code:"\
  " #{@exit_code.inspect}, has_logs: #{@has_logs.inspect}, id: #{@id.inspect}, meta:"\
  " #{@meta.inspect}, repository_id: #{@repository_id.inspect}, started_at:"\
  " #{@started_at.inspect}, stats: #{@stats.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



149
150
151
152
153
154
155
# File 'lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb', line 149

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} completed_at: #{@completed_at}, deployment_id: #{@deployment_id},"\
  " enabled_products: #{@enabled_products}, exit_code: #{@exit_code}, has_logs: #{@has_logs},"\
  " id: #{@id}, meta: #{@meta}, repository_id: #{@repository_id}, started_at: #{@started_at},"\
  " stats: #{@stats}, additional_properties: #{@additional_properties}>"
end