Class: SemgrepWebApp::ProtosScanV1ScanPublic
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SemgrepWebApp::ProtosScanV1ScanPublic
- Defined in:
- lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb
Overview
ProtosScanV1ScanPublic Model.
Instance Attribute Summary collapse
-
#branch ⇒ String
The scanned branch.
-
#commit ⇒ String
The commit hash that was scanned.
-
#completed_at ⇒ DateTime
The timestamp when this scan completed (if it has completed).
-
#deployment_id ⇒ String
Unique identifier for the deployment of the scan.
-
#enabled_products ⇒ Array[String]
The products used when running the scan.
-
#exit_code ⇒ String
The exit_code of the scan (see https://semgrep.dev/docs/cli-reference#exit-codes).
-
#findings_counts ⇒ ProtosScanV1ScanFindingsCounts
The exit_code of the scan (see https://semgrep.dev/docs/cli-reference#exit-codes).
-
#id ⇒ String
ID of the scan.
-
#is_full_scan ⇒ TrueClass | FalseClass
Whether the scan was a full scan (true) or a diff scan (false).
-
#repository_id ⇒ String
Unique identifier for the repository of the scan.
-
#started_at ⇒ DateTime
The timestamp when this scan started.
-
#status ⇒ Status7
The current status of the scan | value | description | |-------|---------------| | SCAN_STATUS_RUNNING | The scan is currently running | | SCAN_STATUS_COMPLETED | The scan has completed successfully (0 or 1 exit code) | | SCAN_STATUS_PENDING | The scan is queued and waiting to start | | SCAN_STATUS_CANCELLED | The scan was cancelled before completion | | SCAN_STATUS_ERROR | The scan has exited with a failure (exit code not 0 or 1) | | SCAN_STATUS_NEVER_FINISHED | The scan did not report an error or success after over an hour |.
-
#total_time ⇒ Float
Duration of scan, in seconds.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(branch: SKIP, commit: SKIP, completed_at: SKIP, deployment_id: SKIP, enabled_products: SKIP, exit_code: SKIP, findings_counts: SKIP, id: SKIP, is_full_scan: SKIP, repository_id: SKIP, started_at: SKIP, status: SKIP, total_time: SKIP, additional_properties: nil) ⇒ ProtosScanV1ScanPublic
constructor
A new instance of ProtosScanV1ScanPublic.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_completed_at ⇒ Object
- #to_custom_started_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(branch: SKIP, commit: SKIP, completed_at: SKIP, deployment_id: SKIP, enabled_products: SKIP, exit_code: SKIP, findings_counts: SKIP, id: SKIP, is_full_scan: SKIP, repository_id: SKIP, started_at: SKIP, status: SKIP, total_time: SKIP, additional_properties: nil) ⇒ ProtosScanV1ScanPublic
Returns a new instance of ProtosScanV1ScanPublic.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 121 def initialize(branch: SKIP, commit: SKIP, completed_at: SKIP, deployment_id: SKIP, enabled_products: SKIP, exit_code: SKIP, findings_counts: SKIP, id: SKIP, is_full_scan: SKIP, repository_id: SKIP, started_at: SKIP, status: SKIP, total_time: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @branch = branch unless branch == SKIP @commit = commit unless commit == SKIP @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 @findings_counts = findings_counts unless findings_counts == SKIP @id = id unless id == SKIP @is_full_scan = is_full_scan unless is_full_scan == SKIP @repository_id = repository_id unless repository_id == SKIP @started_at = started_at unless started_at == SKIP @status = status unless status == SKIP @total_time = total_time unless total_time == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#branch ⇒ String
The scanned branch
15 16 17 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 15 def branch @branch end |
#commit ⇒ String
The commit hash that was scanned
19 20 21 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 19 def commit @commit end |
#completed_at ⇒ DateTime
The timestamp when this scan completed (if it has completed).
23 24 25 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 23 def completed_at @completed_at end |
#deployment_id ⇒ String
Unique identifier for the deployment of the scan.
27 28 29 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 27 def deployment_id @deployment_id end |
#enabled_products ⇒ Array[String]
The products used when running the scan.
31 32 33 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 31 def enabled_products @enabled_products end |
#exit_code ⇒ String
The exit_code of the scan (see https://semgrep.dev/docs/cli-reference#exit-codes)
36 37 38 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 36 def exit_code @exit_code end |
#findings_counts ⇒ ProtosScanV1ScanFindingsCounts
The exit_code of the scan (see https://semgrep.dev/docs/cli-reference#exit-codes)
41 42 43 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 41 def findings_counts @findings_counts end |
#id ⇒ String
ID of the scan.
45 46 47 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 45 def id @id end |
#is_full_scan ⇒ TrueClass | FalseClass
Whether the scan was a full scan (true) or a diff scan (false)
49 50 51 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 49 def is_full_scan @is_full_scan end |
#repository_id ⇒ String
Unique identifier for the repository of the scan.
53 54 55 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 53 def repository_id @repository_id end |
#started_at ⇒ DateTime
The timestamp when this scan started.
57 58 59 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 57 def started_at @started_at end |
#status ⇒ Status7
The current status of the scan
| value | description |
|---|---|
| SCAN_STATUS_RUNNING | The scan is currently running |
| SCAN_STATUS_COMPLETED | The scan has completed successfully (0 or 1 exit |
| code) | |
| SCAN_STATUS_PENDING | The scan is queued and waiting to start |
| SCAN_STATUS_CANCELLED | The scan was cancelled before completion |
| SCAN_STATUS_ERROR | The scan has exited with a failure (exit code not 0 |
| or 1) | |
| SCAN_STATUS_NEVER_FINISHED | The scan did not report an error or success |
| after over an hour |
72 73 74 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 72 def status @status end |
#total_time ⇒ Float
Duration of scan, in seconds
76 77 78 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 76 def total_time @total_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 193 194 195 196 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 146 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. branch = hash.key?('branch') ? hash['branch'] : SKIP commit = hash.key?('commit') ? hash['commit'] : SKIP completed_at = if hash.key?('completed_at') (DateTimeHelper.from_rfc3339(hash['completed_at']) if hash['completed_at']) else SKIP end 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 findings_counts = ProtosScanV1ScanFindingsCounts.from_hash(hash['findings_counts']) if hash['findings_counts'] id = hash.key?('id') ? hash['id'] : SKIP is_full_scan = hash.key?('is_full_scan') ? hash['is_full_scan'] : SKIP repository_id = hash.key?('repository_id') ? hash['repository_id'] : SKIP started_at = if hash.key?('started_at') (DateTimeHelper.from_rfc3339(hash['started_at']) if hash['started_at']) else SKIP end status = hash.key?('status') ? hash['status'] : SKIP total_time = hash.key?('total_time') ? hash['total_time'] : 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. ProtosScanV1ScanPublic.new(branch: branch, commit: commit, completed_at: completed_at, deployment_id: deployment_id, enabled_products: enabled_products, exit_code: exit_code, findings_counts: findings_counts, id: id, is_full_scan: is_full_scan, repository_id: repository_id, started_at: started_at, status: status, total_time: total_time, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 79 def self.names @_hash = {} if @_hash.nil? @_hash['branch'] = 'branch' @_hash['commit'] = 'commit' @_hash['completed_at'] = 'completed_at' @_hash['deployment_id'] = 'deployment_id' @_hash['enabled_products'] = 'enabled_products' @_hash['exit_code'] = 'exit_code' @_hash['findings_counts'] = 'findings_counts' @_hash['id'] = 'id' @_hash['is_full_scan'] = 'is_full_scan' @_hash['repository_id'] = 'repository_id' @_hash['started_at'] = 'started_at' @_hash['status'] = 'status' @_hash['total_time'] = 'total_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
117 118 119 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 117 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 98 def self.optionals %w[ branch commit completed_at deployment_id enabled_products exit_code findings_counts id is_full_scan repository_id started_at status total_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 217 def inspect class_name = self.class.name.split('::').last "<#{class_name} branch: #{@branch.inspect}, commit: #{@commit.inspect}, completed_at:"\ " #{@completed_at.inspect}, deployment_id: #{@deployment_id.inspect}, enabled_products:"\ " #{@enabled_products.inspect}, exit_code: #{@exit_code.inspect}, findings_counts:"\ " #{@findings_counts.inspect}, id: #{@id.inspect}, is_full_scan: #{@is_full_scan.inspect},"\ " repository_id: #{@repository_id.inspect}, started_at: #{@started_at.inspect}, status:"\ " #{@status.inspect}, total_time: #{@total_time.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_completed_at ⇒ Object
198 199 200 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 198 def to_custom_completed_at DateTimeHelper.to_rfc3339(completed_at) end |
#to_custom_started_at ⇒ Object
202 203 204 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 202 def to_custom_started_at DateTimeHelper.to_rfc3339(started_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
207 208 209 210 211 212 213 214 |
# File 'lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb', line 207 def to_s class_name = self.class.name.split('::').last "<#{class_name} branch: #{@branch}, commit: #{@commit}, completed_at: #{@completed_at},"\ " deployment_id: #{@deployment_id}, enabled_products: #{@enabled_products}, exit_code:"\ " #{@exit_code}, findings_counts: #{@findings_counts}, id: #{@id}, is_full_scan:"\ " #{@is_full_scan}, repository_id: #{@repository_id}, started_at: #{@started_at}, status:"\ " #{@status}, total_time: #{@total_time}, additional_properties: #{@additional_properties}>" end |