apimatic-semgrep-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +205 -0
- data/bin/console +15 -0
- data/lib/semgrep_web_app/api_helper.rb +10 -0
- data/lib/semgrep_web_app/apis/base_api.rb +67 -0
- data/lib/semgrep_web_app/apis/deployments_service_api.rb +29 -0
- data/lib/semgrep_web_app/apis/findings_service_api.rb +107 -0
- data/lib/semgrep_web_app/apis/misc_service_api.rb +47 -0
- data/lib/semgrep_web_app/apis/policies_service_api.rb +97 -0
- data/lib/semgrep_web_app/apis/projects_service_api.rb +238 -0
- data/lib/semgrep_web_app/apis/scans_service_api.rb +65 -0
- data/lib/semgrep_web_app/apis/secrets_service_api.rb +55 -0
- data/lib/semgrep_web_app/apis/supply_chain_service_api.rb +154 -0
- data/lib/semgrep_web_app/apis/ticketing_service_api.rb +144 -0
- data/lib/semgrep_web_app/apis/triage_service_api.rb +43 -0
- data/lib/semgrep_web_app/client.rb +136 -0
- data/lib/semgrep_web_app/configuration.rb +178 -0
- data/lib/semgrep_web_app/exceptions/api_exception.rb +21 -0
- data/lib/semgrep_web_app/http/api_response.rb +19 -0
- data/lib/semgrep_web_app/http/auth/semgrep_admin_jwt.rb +53 -0
- data/lib/semgrep_web_app/http/auth/semgrep_jwt.rb +53 -0
- data/lib/semgrep_web_app/http/auth/semgrep_web_token.rb +53 -0
- data/lib/semgrep_web_app/http/http_call_back.rb +10 -0
- data/lib/semgrep_web_app/http/http_method_enum.rb +10 -0
- data/lib/semgrep_web_app/http/http_request.rb +10 -0
- data/lib/semgrep_web_app/http/http_response.rb +10 -0
- data/lib/semgrep_web_app/http/proxy_settings.rb +22 -0
- data/lib/semgrep_web_app/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/semgrep_web_app/logging/sdk_logger.rb +17 -0
- data/lib/semgrep_web_app/models/add_project_tags_request.rb +96 -0
- data/lib/semgrep_web_app/models/add_project_tags_response.rb +73 -0
- data/lib/semgrep_web_app/models/ai_powered_scan_finding.rb +426 -0
- data/lib/semgrep_web_app/models/ai_sast_findings.rb +85 -0
- data/lib/semgrep_web_app/models/api_v1_deployments_findings_response.rb +87 -0
- data/lib/semgrep_web_app/models/assistant.rb +127 -0
- data/lib/semgrep_web_app/models/autofix.rb +98 -0
- data/lib/semgrep_web_app/models/autotriage.rb +98 -0
- data/lib/semgrep_web_app/models/autotriage_verdict.rb +36 -0
- data/lib/semgrep_web_app/models/autotriage_verdict2.rb +38 -0
- data/lib/semgrep_web_app/models/base_model.rb +110 -0
- data/lib/semgrep_web_app/models/bulk_triage_request.rb +393 -0
- data/lib/semgrep_web_app/models/bulk_triage_response.rb +83 -0
- data/lib/semgrep_web_app/models/click_to_fix_failure.rb +95 -0
- data/lib/semgrep_web_app/models/click_to_fix_pr.rb +95 -0
- data/lib/semgrep_web_app/models/click_to_fix_pr_state.rb +38 -0
- data/lib/semgrep_web_app/models/component.rb +95 -0
- data/lib/semgrep_web_app/models/confidence.rb +42 -0
- data/lib/semgrep_web_app/models/confidence1.rb +40 -0
- data/lib/semgrep_web_app/models/confidence2.rb +40 -0
- data/lib/semgrep_web_app/models/confidence3.rb +40 -0
- data/lib/semgrep_web_app/models/confidence7.rb +41 -0
- data/lib/semgrep_web_app/models/confidence8.rb +42 -0
- data/lib/semgrep_web_app/models/create_sbom_export_request.rb +176 -0
- data/lib/semgrep_web_app/models/create_sbom_export_response.rb +74 -0
- data/lib/semgrep_web_app/models/create_ticket_request.rb +393 -0
- data/lib/semgrep_web_app/models/cyclonedx_version.rb +48 -0
- data/lib/semgrep_web_app/models/delete_project_response.rb +74 -0
- data/lib/semgrep_web_app/models/delete_project_tags_response.rb +73 -0
- data/lib/semgrep_web_app/models/deployment.rb +102 -0
- data/lib/semgrep_web_app/models/ecosystem.rb +91 -0
- data/lib/semgrep_web_app/models/ecosystem1.rb +92 -0
- data/lib/semgrep_web_app/models/ecosystem2.rb +76 -0
- data/lib/semgrep_web_app/models/endpoint_reference.rb +72 -0
- data/lib/semgrep_web_app/models/epss_probability.rb +45 -0
- data/lib/semgrep_web_app/models/epss_score.rb +95 -0
- data/lib/semgrep_web_app/models/exposures.rb +50 -0
- data/lib/semgrep_web_app/models/exposures2.rb +51 -0
- data/lib/semgrep_web_app/models/external_ticket.rb +116 -0
- data/lib/semgrep_web_app/models/finding_location.rb +126 -0
- data/lib/semgrep_web_app/models/finding_repository.rb +95 -0
- data/lib/semgrep_web_app/models/finding_rule.rb +158 -0
- data/lib/semgrep_web_app/models/fix_recommendation.rb +95 -0
- data/lib/semgrep_web_app/models/float_range.rb +85 -0
- data/lib/semgrep_web_app/models/format.rb +27 -0
- data/lib/semgrep_web_app/models/found_dependency.rb +128 -0
- data/lib/semgrep_web_app/models/get_project_response.rb +73 -0
- data/lib/semgrep_web_app/models/get_sbom_export_response.rb +100 -0
- data/lib/semgrep_web_app/models/guidance.rb +98 -0
- data/lib/semgrep_web_app/models/issue_type.rb +40 -0
- data/lib/semgrep_web_app/models/issue_type1.rb +40 -0
- data/lib/semgrep_web_app/models/issue_type2.rb +42 -0
- data/lib/semgrep_web_app/models/license_policy_settings.rb +42 -0
- data/lib/semgrep_web_app/models/link_ticket_request.rb +93 -0
- data/lib/semgrep_web_app/models/list_dependencies_request.rb +108 -0
- data/lib/semgrep_web_app/models/list_dependencies_response.rb +102 -0
- data/lib/semgrep_web_app/models/list_findings_response.rb +100 -0
- data/lib/semgrep_web_app/models/list_lockfiles_for_dependencies_request.rb +118 -0
- data/lib/semgrep_web_app/models/list_lockfiles_for_dependencies_response.rb +103 -0
- data/lib/semgrep_web_app/models/list_project.rb +145 -0
- data/lib/semgrep_web_app/models/list_projects_response.rb +82 -0
- data/lib/semgrep_web_app/models/list_repositories_for_dependencies_request.rb +107 -0
- data/lib/semgrep_web_app/models/list_repositories_for_dependencies_response.rb +103 -0
- data/lib/semgrep_web_app/models/managed_scan_config.rb +85 -0
- data/lib/semgrep_web_app/models/metadata_component_type.rb +101 -0
- data/lib/semgrep_web_app/models/mode.rb +48 -0
- data/lib/semgrep_web_app/models/new_triage_reason.rb +48 -0
- data/lib/semgrep_web_app/models/new_triage_state.rb +48 -0
- data/lib/semgrep_web_app/models/policy.rb +118 -0
- data/lib/semgrep_web_app/models/policy_mode.rb +48 -0
- data/lib/semgrep_web_app/models/policy_mode1.rb +40 -0
- data/lib/semgrep_web_app/models/policy_mode3.rb +51 -0
- data/lib/semgrep_web_app/models/policy_reference.rb +105 -0
- data/lib/semgrep_web_app/models/product_type.rb +38 -0
- data/lib/semgrep_web_app/models/products.rb +46 -0
- data/lib/semgrep_web_app/models/project.rb +157 -0
- data/lib/semgrep_web_app/models/protos_ai_v1_autotriage.rb +154 -0
- data/lib/semgrep_web_app/models/protos_ai_v1_autotriage_feedback.rb +98 -0
- data/lib/semgrep_web_app/models/protos_common_v1_review_comment.rb +90 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response.rb +123 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response_ticket_creation_failed.rb +85 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response_ticket_creation_skipped.rb +85 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_create_ticket_response_ticket_creation_success.rb +106 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_delete_ticket_response.rb +76 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_diff_scan.rb +75 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_full_scan.rb +75 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_get_bootstrap_sms_vpc_response.rb +130 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response.rb +168 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_get_scan_response_scan_meta.rb +256 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_link_ticket_response.rb +119 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_list_deployments_response.rb +85 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_list_policies_response.rb +84 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_list_policy_rules_response.rb +104 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_list_secrets_path_response.rb +104 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_search_scans_response.rb +94 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_unlink_ticket_response.rb +77 -0
- data/lib/semgrep_web_app/models/protos_openapi_v1_update_policy_response.rb +88 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_code_location.rb +144 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_dependency.rb +87 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_dependency_filter.rb +199 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_found_dependency.rb +174 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_lockfile_dependency_summary.rb +87 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_package_filter.rb +124 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_repository_dependency_summary.rb +111 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_sbom_format_version.rb +109 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_sbom_metadata_contact.rb +95 -0
- data/lib/semgrep_web_app/models/protos_sca_v1_sbom_metadata_supplier.rb +95 -0
- data/lib/semgrep_web_app/models/protos_scan_v1_scan_findings_counts.rb +105 -0
- data/lib/semgrep_web_app/models/protos_scan_v1_scan_public.rb +228 -0
- data/lib/semgrep_web_app/models/protos_secrets_v1_historical_info.rb +116 -0
- data/lib/semgrep_web_app/models/protos_secrets_v1_secrets_finding.rb +320 -0
- data/lib/semgrep_web_app/models/protos_secrets_v1_secrets_finding_repository.rb +121 -0
- data/lib/semgrep_web_app/models/protos_ticketing_v1_external_ticket.rb +106 -0
- data/lib/semgrep_web_app/models/rating.rb +38 -0
- data/lib/semgrep_web_app/models/reachability.rb +48 -0
- data/lib/semgrep_web_app/models/repository_visibility.rb +40 -0
- data/lib/semgrep_web_app/models/review_comment.rb +100 -0
- data/lib/semgrep_web_app/models/risk.rb +40 -0
- data/lib/semgrep_web_app/models/rule.rb +292 -0
- data/lib/semgrep_web_app/models/rule_explanation.rb +98 -0
- data/lib/semgrep_web_app/models/sast_finding.rb +426 -0
- data/lib/semgrep_web_app/models/sast_findings.rb +84 -0
- data/lib/semgrep_web_app/models/sbom_output_format.rb +37 -0
- data/lib/semgrep_web_app/models/sca_finding.rb +458 -0
- data/lib/semgrep_web_app/models/sca_findings.rb +85 -0
- data/lib/semgrep_web_app/models/scm_type.rb +70 -0
- data/lib/semgrep_web_app/models/search_scans_request.rb +202 -0
- data/lib/semgrep_web_app/models/severities.rb +44 -0
- data/lib/semgrep_web_app/models/severities2.rb +45 -0
- data/lib/semgrep_web_app/models/severity.rb +46 -0
- data/lib/semgrep_web_app/models/severity1.rb +45 -0
- data/lib/semgrep_web_app/models/severity4.rb +46 -0
- data/lib/semgrep_web_app/models/severity5.rb +48 -0
- data/lib/semgrep_web_app/models/source.rb +42 -0
- data/lib/semgrep_web_app/models/state.rb +42 -0
- data/lib/semgrep_web_app/models/status.rb +55 -0
- data/lib/semgrep_web_app/models/status1.rb +52 -0
- data/lib/semgrep_web_app/models/status3.rb +44 -0
- data/lib/semgrep_web_app/models/status6.rb +55 -0
- data/lib/semgrep_web_app/models/status7.rb +59 -0
- data/lib/semgrep_web_app/models/status8.rb +61 -0
- data/lib/semgrep_web_app/models/status9.rb +55 -0
- data/lib/semgrep_web_app/models/statuses.rb +63 -0
- data/lib/semgrep_web_app/models/toggle_project_managed_scan_request.rb +108 -0
- data/lib/semgrep_web_app/models/toggle_project_managed_scan_response.rb +73 -0
- data/lib/semgrep_web_app/models/transitivities.rb +40 -0
- data/lib/semgrep_web_app/models/transitivities2.rb +42 -0
- data/lib/semgrep_web_app/models/transitivity.rb +41 -0
- data/lib/semgrep_web_app/models/transitivity1.rb +42 -0
- data/lib/semgrep_web_app/models/transitivity2.rb +40 -0
- data/lib/semgrep_web_app/models/triage_reason.rb +48 -0
- data/lib/semgrep_web_app/models/triage_reasons.rb +48 -0
- data/lib/semgrep_web_app/models/triage_reasons2.rb +50 -0
- data/lib/semgrep_web_app/models/triage_state.rb +54 -0
- data/lib/semgrep_web_app/models/unlink_ticket_request.rb +83 -0
- data/lib/semgrep_web_app/models/update_policy_request.rb +113 -0
- data/lib/semgrep_web_app/models/update_project_request.rb +121 -0
- data/lib/semgrep_web_app/models/update_project_response.rb +73 -0
- data/lib/semgrep_web_app/models/usage.rb +99 -0
- data/lib/semgrep_web_app/models/validation_state.rb +45 -0
- data/lib/semgrep_web_app/models/validation_state2.rb +47 -0
- data/lib/semgrep_web_app/models/validation_state3.rb +48 -0
- data/lib/semgrep_web_app/models/verdict.rb +41 -0
- data/lib/semgrep_web_app/models/verdict1.rb +38 -0
- data/lib/semgrep_web_app/models/visibility.rb +42 -0
- data/lib/semgrep_web_app/utilities/date_time_helper.rb +11 -0
- data/lib/semgrep_web_app/utilities/file_wrapper.rb +28 -0
- data/lib/semgrep_web_app/utilities/union_type_lookup.rb +34 -0
- data/lib/semgrep_web_app.rb +245 -0
- metadata +283 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
# semgrep_web_app
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SemgrepWebApp
|
|
7
|
+
# A Supply Chain finding that Semgrep has identified in your organization
|
|
8
|
+
class ScaFinding < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The categories of the finding as classified by the associated rule
|
|
13
|
+
# metadata
|
|
14
|
+
# @return [Array[String]]
|
|
15
|
+
attr_accessor :categories
|
|
16
|
+
|
|
17
|
+
# Confidence of the finding, derived from the rule that triggered it
|
|
18
|
+
# @return [Confidence1]
|
|
19
|
+
attr_accessor :confidence
|
|
20
|
+
|
|
21
|
+
# The timestamp when this finding was created
|
|
22
|
+
# @return [String]
|
|
23
|
+
attr_accessor :created_at
|
|
24
|
+
|
|
25
|
+
# The score assigned by FIRST.org's Exploitation Probability Scoring System
|
|
26
|
+
# @return [EpssScore]
|
|
27
|
+
attr_accessor :epss_score
|
|
28
|
+
|
|
29
|
+
# External ticket associated with finding
|
|
30
|
+
# @return [ExternalTicket]
|
|
31
|
+
attr_accessor :external_ticket
|
|
32
|
+
|
|
33
|
+
# Unique ID of the Semgrep scan that first identified this finding
|
|
34
|
+
# @return [Integer]
|
|
35
|
+
attr_accessor :first_seen_scan_id
|
|
36
|
+
|
|
37
|
+
# Recommendations for fixing the vulnerability
|
|
38
|
+
# @return [Array[FixRecommendation]]
|
|
39
|
+
attr_accessor :fix_recommendations
|
|
40
|
+
|
|
41
|
+
# Information about the vulnerable package that was found in the codebase
|
|
42
|
+
# @return [FoundDependency]
|
|
43
|
+
attr_accessor :found_dependency
|
|
44
|
+
|
|
45
|
+
# Unique ID of this finding
|
|
46
|
+
# @return [Integer]
|
|
47
|
+
attr_accessor :id
|
|
48
|
+
|
|
49
|
+
# True if the finding is from a malicious dependency
|
|
50
|
+
# @return [TrueClass | FalseClass]
|
|
51
|
+
attr_accessor :is_malicious
|
|
52
|
+
|
|
53
|
+
# The source URL including file and line number
|
|
54
|
+
# @return [String]
|
|
55
|
+
attr_accessor :line_of_code_url
|
|
56
|
+
|
|
57
|
+
# Location of the record in a file, as reported by Semgrep. If null, then
|
|
58
|
+
# the information does not exist or lacks integrity (older or broken scans)
|
|
59
|
+
# @return [FindingLocation]
|
|
60
|
+
attr_accessor :location
|
|
61
|
+
|
|
62
|
+
# ID calculated based on a finding's file path, rule identifier and pattern,
|
|
63
|
+
# and index
|
|
64
|
+
# @return [String]
|
|
65
|
+
attr_accessor :match_based_id
|
|
66
|
+
|
|
67
|
+
# Indicates whether the vulnerable code is reachable
|
|
68
|
+
# @return [Reachability]
|
|
69
|
+
attr_accessor :reachability
|
|
70
|
+
|
|
71
|
+
# Description of the condition under which the vulnerability becomes
|
|
72
|
+
# reachable. Applies to conditionally reachable findings
|
|
73
|
+
# @return [String]
|
|
74
|
+
attr_accessor :reachable_condition
|
|
75
|
+
|
|
76
|
+
# External reference to the source of this finding (e.g. PR)
|
|
77
|
+
# @return [String]
|
|
78
|
+
attr_accessor :ref
|
|
79
|
+
|
|
80
|
+
# The timestamp when this finding was detected by Semgrep (the first time,
|
|
81
|
+
# or when reintroduced)
|
|
82
|
+
# @return [String]
|
|
83
|
+
attr_accessor :relevant_since
|
|
84
|
+
|
|
85
|
+
# Which repository this finding was identified in
|
|
86
|
+
# @return [FindingRepository]
|
|
87
|
+
attr_accessor :repository
|
|
88
|
+
|
|
89
|
+
# List of external review comment information associated with a finding
|
|
90
|
+
# @return [Array[ReviewComment]]
|
|
91
|
+
attr_accessor :review_comments
|
|
92
|
+
|
|
93
|
+
# Rule that applies to this finding
|
|
94
|
+
# @return [FindingRule]
|
|
95
|
+
attr_accessor :rule
|
|
96
|
+
|
|
97
|
+
# Deprecated in favor of rule.message. Rule message at the time of finding
|
|
98
|
+
# identification. Older findings may not have a value for this field
|
|
99
|
+
# @return [String]
|
|
100
|
+
attr_accessor :rule_message
|
|
101
|
+
|
|
102
|
+
# Deprecated in favor of rule.name
|
|
103
|
+
# @return [String]
|
|
104
|
+
attr_accessor :rule_name
|
|
105
|
+
|
|
106
|
+
# Severity of the finding, derived from the rule that triggered it. Low is
|
|
107
|
+
# equivalent to INFO, Medium to WARNING, and High to ERROR
|
|
108
|
+
# @return [Severity1]
|
|
109
|
+
attr_accessor :severity
|
|
110
|
+
|
|
111
|
+
# The finding's resolution state. Managed only by changes detected at scan
|
|
112
|
+
# time, the `state` is combined with `triage_state` to ultimately determine
|
|
113
|
+
# a final `status` which is exposed in the UI and API
|
|
114
|
+
# @return [State]
|
|
115
|
+
attr_accessor :state
|
|
116
|
+
|
|
117
|
+
# When this issue's `state` (resolution state) was last updated, as distinct
|
|
118
|
+
# from when the issue was triaged (`triaged_at`)
|
|
119
|
+
# @return [String]
|
|
120
|
+
attr_accessor :state_updated_at
|
|
121
|
+
|
|
122
|
+
# The finding's status as exposed in the UI. Status is a derived property
|
|
123
|
+
# combining information from the finding `state` and `triage_state`. The
|
|
124
|
+
# `triage_state` can be used to override the scan state if the finding is
|
|
125
|
+
# still detected
|
|
126
|
+
# @return [Status]
|
|
127
|
+
attr_accessor :status
|
|
128
|
+
|
|
129
|
+
# ID calculated based on a finding's file path, rule identifier and matched
|
|
130
|
+
# code, and index. Prefer `match_based_id`
|
|
131
|
+
# @return [String]
|
|
132
|
+
attr_accessor :syntactic_id
|
|
133
|
+
|
|
134
|
+
# The detailed comment provided during triage
|
|
135
|
+
# @return [String]
|
|
136
|
+
attr_accessor :triage_comment
|
|
137
|
+
|
|
138
|
+
# Reason provided when this issue was triaged
|
|
139
|
+
# @return [TriageReason]
|
|
140
|
+
attr_accessor :triage_reason
|
|
141
|
+
|
|
142
|
+
# The finding's triage state. Note: "reviewing" and "fixing" are only in
|
|
143
|
+
# private beta. Set by the user and used along with state to generate the
|
|
144
|
+
# final "status" viewable in the UI
|
|
145
|
+
# @return [TriageState]
|
|
146
|
+
attr_accessor :triage_state
|
|
147
|
+
|
|
148
|
+
# When the finding was triaged
|
|
149
|
+
# @return [String]
|
|
150
|
+
attr_accessor :triaged_at
|
|
151
|
+
|
|
152
|
+
# Usage of the vulnerable package in the codebase. Applies to reachable
|
|
153
|
+
# findings
|
|
154
|
+
# @return [Usage]
|
|
155
|
+
attr_accessor :usage
|
|
156
|
+
|
|
157
|
+
# Identifier of the vulnerability in the vulnerability database
|
|
158
|
+
# @return [String]
|
|
159
|
+
attr_accessor :vulnerability_identifier
|
|
160
|
+
|
|
161
|
+
# A mapping from model property names to API property names.
|
|
162
|
+
def self.names
|
|
163
|
+
@_hash = {} if @_hash.nil?
|
|
164
|
+
@_hash['categories'] = 'categories'
|
|
165
|
+
@_hash['confidence'] = 'confidence'
|
|
166
|
+
@_hash['created_at'] = 'created_at'
|
|
167
|
+
@_hash['epss_score'] = 'epss_score'
|
|
168
|
+
@_hash['external_ticket'] = 'external_ticket'
|
|
169
|
+
@_hash['first_seen_scan_id'] = 'first_seen_scan_id'
|
|
170
|
+
@_hash['fix_recommendations'] = 'fix_recommendations'
|
|
171
|
+
@_hash['found_dependency'] = 'found_dependency'
|
|
172
|
+
@_hash['id'] = 'id'
|
|
173
|
+
@_hash['is_malicious'] = 'is_malicious'
|
|
174
|
+
@_hash['line_of_code_url'] = 'line_of_code_url'
|
|
175
|
+
@_hash['location'] = 'location'
|
|
176
|
+
@_hash['match_based_id'] = 'match_based_id'
|
|
177
|
+
@_hash['reachability'] = 'reachability'
|
|
178
|
+
@_hash['reachable_condition'] = 'reachable_condition'
|
|
179
|
+
@_hash['ref'] = 'ref'
|
|
180
|
+
@_hash['relevant_since'] = 'relevant_since'
|
|
181
|
+
@_hash['repository'] = 'repository'
|
|
182
|
+
@_hash['review_comments'] = 'review_comments'
|
|
183
|
+
@_hash['rule'] = 'rule'
|
|
184
|
+
@_hash['rule_message'] = 'rule_message'
|
|
185
|
+
@_hash['rule_name'] = 'rule_name'
|
|
186
|
+
@_hash['severity'] = 'severity'
|
|
187
|
+
@_hash['state'] = 'state'
|
|
188
|
+
@_hash['state_updated_at'] = 'state_updated_at'
|
|
189
|
+
@_hash['status'] = 'status'
|
|
190
|
+
@_hash['syntactic_id'] = 'syntactic_id'
|
|
191
|
+
@_hash['triage_comment'] = 'triage_comment'
|
|
192
|
+
@_hash['triage_reason'] = 'triage_reason'
|
|
193
|
+
@_hash['triage_state'] = 'triage_state'
|
|
194
|
+
@_hash['triaged_at'] = 'triaged_at'
|
|
195
|
+
@_hash['usage'] = 'usage'
|
|
196
|
+
@_hash['vulnerability_identifier'] = 'vulnerability_identifier'
|
|
197
|
+
@_hash
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# An array for optional fields
|
|
201
|
+
def self.optionals
|
|
202
|
+
%w[
|
|
203
|
+
categories
|
|
204
|
+
confidence
|
|
205
|
+
created_at
|
|
206
|
+
epss_score
|
|
207
|
+
external_ticket
|
|
208
|
+
first_seen_scan_id
|
|
209
|
+
fix_recommendations
|
|
210
|
+
found_dependency
|
|
211
|
+
id
|
|
212
|
+
is_malicious
|
|
213
|
+
line_of_code_url
|
|
214
|
+
location
|
|
215
|
+
match_based_id
|
|
216
|
+
reachability
|
|
217
|
+
reachable_condition
|
|
218
|
+
ref
|
|
219
|
+
relevant_since
|
|
220
|
+
repository
|
|
221
|
+
review_comments
|
|
222
|
+
rule
|
|
223
|
+
rule_message
|
|
224
|
+
rule_name
|
|
225
|
+
severity
|
|
226
|
+
state
|
|
227
|
+
state_updated_at
|
|
228
|
+
status
|
|
229
|
+
syntactic_id
|
|
230
|
+
triage_comment
|
|
231
|
+
triage_reason
|
|
232
|
+
triage_state
|
|
233
|
+
triaged_at
|
|
234
|
+
usage
|
|
235
|
+
vulnerability_identifier
|
|
236
|
+
]
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# An array for nullable fields
|
|
240
|
+
def self.nullables
|
|
241
|
+
[]
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def initialize(categories: SKIP, confidence: SKIP, created_at: SKIP,
|
|
245
|
+
epss_score: SKIP, external_ticket: SKIP,
|
|
246
|
+
first_seen_scan_id: SKIP, fix_recommendations: SKIP,
|
|
247
|
+
found_dependency: SKIP, id: SKIP, is_malicious: SKIP,
|
|
248
|
+
line_of_code_url: SKIP, location: SKIP, match_based_id: SKIP,
|
|
249
|
+
reachability: SKIP, reachable_condition: SKIP, ref: SKIP,
|
|
250
|
+
relevant_since: SKIP, repository: SKIP,
|
|
251
|
+
review_comments: SKIP, rule: SKIP, rule_message: SKIP,
|
|
252
|
+
rule_name: SKIP, severity: SKIP, state: SKIP,
|
|
253
|
+
state_updated_at: SKIP, status: SKIP, syntactic_id: SKIP,
|
|
254
|
+
triage_comment: SKIP, triage_reason: SKIP,
|
|
255
|
+
triage_state: SKIP, triaged_at: SKIP, usage: SKIP,
|
|
256
|
+
vulnerability_identifier: SKIP, additional_properties: nil)
|
|
257
|
+
# Add additional model properties to the instance
|
|
258
|
+
additional_properties = {} if additional_properties.nil?
|
|
259
|
+
|
|
260
|
+
@categories = categories unless categories == SKIP
|
|
261
|
+
@confidence = confidence unless confidence == SKIP
|
|
262
|
+
@created_at = created_at unless created_at == SKIP
|
|
263
|
+
@epss_score = epss_score unless epss_score == SKIP
|
|
264
|
+
@external_ticket = external_ticket unless external_ticket == SKIP
|
|
265
|
+
@first_seen_scan_id = first_seen_scan_id unless first_seen_scan_id == SKIP
|
|
266
|
+
@fix_recommendations = fix_recommendations unless fix_recommendations == SKIP
|
|
267
|
+
@found_dependency = found_dependency unless found_dependency == SKIP
|
|
268
|
+
@id = id unless id == SKIP
|
|
269
|
+
@is_malicious = is_malicious unless is_malicious == SKIP
|
|
270
|
+
@line_of_code_url = line_of_code_url unless line_of_code_url == SKIP
|
|
271
|
+
@location = location unless location == SKIP
|
|
272
|
+
@match_based_id = match_based_id unless match_based_id == SKIP
|
|
273
|
+
@reachability = reachability unless reachability == SKIP
|
|
274
|
+
@reachable_condition = reachable_condition unless reachable_condition == SKIP
|
|
275
|
+
@ref = ref unless ref == SKIP
|
|
276
|
+
@relevant_since = relevant_since unless relevant_since == SKIP
|
|
277
|
+
@repository = repository unless repository == SKIP
|
|
278
|
+
@review_comments = review_comments unless review_comments == SKIP
|
|
279
|
+
@rule = rule unless rule == SKIP
|
|
280
|
+
@rule_message = rule_message unless rule_message == SKIP
|
|
281
|
+
@rule_name = rule_name unless rule_name == SKIP
|
|
282
|
+
@severity = severity unless severity == SKIP
|
|
283
|
+
@state = state unless state == SKIP
|
|
284
|
+
@state_updated_at = state_updated_at unless state_updated_at == SKIP
|
|
285
|
+
@status = status unless status == SKIP
|
|
286
|
+
@syntactic_id = syntactic_id unless syntactic_id == SKIP
|
|
287
|
+
@triage_comment = triage_comment unless triage_comment == SKIP
|
|
288
|
+
@triage_reason = triage_reason unless triage_reason == SKIP
|
|
289
|
+
@triage_state = triage_state unless triage_state == SKIP
|
|
290
|
+
@triaged_at = triaged_at unless triaged_at == SKIP
|
|
291
|
+
@usage = usage unless usage == SKIP
|
|
292
|
+
@vulnerability_identifier = vulnerability_identifier unless vulnerability_identifier == SKIP
|
|
293
|
+
@additional_properties = additional_properties
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Creates an instance of the object from a hash.
|
|
297
|
+
def self.from_hash(hash)
|
|
298
|
+
return nil unless hash
|
|
299
|
+
|
|
300
|
+
# Extract variables from the hash.
|
|
301
|
+
categories = hash.key?('categories') ? hash['categories'] : SKIP
|
|
302
|
+
confidence = hash.key?('confidence') ? hash['confidence'] : SKIP
|
|
303
|
+
created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
|
|
304
|
+
epss_score = EpssScore.from_hash(hash['epss_score']) if hash['epss_score']
|
|
305
|
+
external_ticket = ExternalTicket.from_hash(hash['external_ticket']) if
|
|
306
|
+
hash['external_ticket']
|
|
307
|
+
first_seen_scan_id =
|
|
308
|
+
hash.key?('first_seen_scan_id') ? hash['first_seen_scan_id'] : SKIP
|
|
309
|
+
# Parameter is an array, so we need to iterate through it
|
|
310
|
+
fix_recommendations = nil
|
|
311
|
+
unless hash['fix_recommendations'].nil?
|
|
312
|
+
fix_recommendations = []
|
|
313
|
+
hash['fix_recommendations'].each do |structure|
|
|
314
|
+
fix_recommendations << (FixRecommendation.from_hash(structure) if structure)
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
fix_recommendations = SKIP unless hash.key?('fix_recommendations')
|
|
319
|
+
found_dependency = FoundDependency.from_hash(hash['found_dependency']) if
|
|
320
|
+
hash['found_dependency']
|
|
321
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
322
|
+
is_malicious = hash.key?('is_malicious') ? hash['is_malicious'] : SKIP
|
|
323
|
+
line_of_code_url =
|
|
324
|
+
hash.key?('line_of_code_url') ? hash['line_of_code_url'] : SKIP
|
|
325
|
+
location = FindingLocation.from_hash(hash['location']) if hash['location']
|
|
326
|
+
match_based_id =
|
|
327
|
+
hash.key?('match_based_id') ? hash['match_based_id'] : SKIP
|
|
328
|
+
reachability = hash.key?('reachability') ? hash['reachability'] : SKIP
|
|
329
|
+
reachable_condition =
|
|
330
|
+
hash.key?('reachable_condition') ? hash['reachable_condition'] : SKIP
|
|
331
|
+
ref = hash.key?('ref') ? hash['ref'] : SKIP
|
|
332
|
+
relevant_since =
|
|
333
|
+
hash.key?('relevant_since') ? hash['relevant_since'] : SKIP
|
|
334
|
+
repository = FindingRepository.from_hash(hash['repository']) if hash['repository']
|
|
335
|
+
# Parameter is an array, so we need to iterate through it
|
|
336
|
+
review_comments = nil
|
|
337
|
+
unless hash['review_comments'].nil?
|
|
338
|
+
review_comments = []
|
|
339
|
+
hash['review_comments'].each do |structure|
|
|
340
|
+
review_comments << (ReviewComment.from_hash(structure) if structure)
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
review_comments = SKIP unless hash.key?('review_comments')
|
|
345
|
+
rule = FindingRule.from_hash(hash['rule']) if hash['rule']
|
|
346
|
+
rule_message = hash.key?('rule_message') ? hash['rule_message'] : SKIP
|
|
347
|
+
rule_name = hash.key?('rule_name') ? hash['rule_name'] : SKIP
|
|
348
|
+
severity = hash.key?('severity') ? hash['severity'] : SKIP
|
|
349
|
+
state = hash.key?('state') ? hash['state'] : SKIP
|
|
350
|
+
state_updated_at =
|
|
351
|
+
hash.key?('state_updated_at') ? hash['state_updated_at'] : SKIP
|
|
352
|
+
status = hash.key?('status') ? hash['status'] : SKIP
|
|
353
|
+
syntactic_id = hash.key?('syntactic_id') ? hash['syntactic_id'] : SKIP
|
|
354
|
+
triage_comment =
|
|
355
|
+
hash.key?('triage_comment') ? hash['triage_comment'] : SKIP
|
|
356
|
+
triage_reason = hash.key?('triage_reason') ? hash['triage_reason'] : SKIP
|
|
357
|
+
triage_state = hash.key?('triage_state') ? hash['triage_state'] : SKIP
|
|
358
|
+
triaged_at = hash.key?('triaged_at') ? hash['triaged_at'] : SKIP
|
|
359
|
+
usage = Usage.from_hash(hash['usage']) if hash['usage']
|
|
360
|
+
vulnerability_identifier =
|
|
361
|
+
hash.key?('vulnerability_identifier') ? hash['vulnerability_identifier'] : SKIP
|
|
362
|
+
|
|
363
|
+
# Create a new hash for additional properties, removing known properties.
|
|
364
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
365
|
+
|
|
366
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
367
|
+
new_hash, proc { |value| value }
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
# Create object from extracted values.
|
|
371
|
+
ScaFinding.new(categories: categories,
|
|
372
|
+
confidence: confidence,
|
|
373
|
+
created_at: created_at,
|
|
374
|
+
epss_score: epss_score,
|
|
375
|
+
external_ticket: external_ticket,
|
|
376
|
+
first_seen_scan_id: first_seen_scan_id,
|
|
377
|
+
fix_recommendations: fix_recommendations,
|
|
378
|
+
found_dependency: found_dependency,
|
|
379
|
+
id: id,
|
|
380
|
+
is_malicious: is_malicious,
|
|
381
|
+
line_of_code_url: line_of_code_url,
|
|
382
|
+
location: location,
|
|
383
|
+
match_based_id: match_based_id,
|
|
384
|
+
reachability: reachability,
|
|
385
|
+
reachable_condition: reachable_condition,
|
|
386
|
+
ref: ref,
|
|
387
|
+
relevant_since: relevant_since,
|
|
388
|
+
repository: repository,
|
|
389
|
+
review_comments: review_comments,
|
|
390
|
+
rule: rule,
|
|
391
|
+
rule_message: rule_message,
|
|
392
|
+
rule_name: rule_name,
|
|
393
|
+
severity: severity,
|
|
394
|
+
state: state,
|
|
395
|
+
state_updated_at: state_updated_at,
|
|
396
|
+
status: status,
|
|
397
|
+
syntactic_id: syntactic_id,
|
|
398
|
+
triage_comment: triage_comment,
|
|
399
|
+
triage_reason: triage_reason,
|
|
400
|
+
triage_state: triage_state,
|
|
401
|
+
triaged_at: triaged_at,
|
|
402
|
+
usage: usage,
|
|
403
|
+
vulnerability_identifier: vulnerability_identifier,
|
|
404
|
+
additional_properties: additional_properties)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
# Validates an instance of the object from a given value.
|
|
408
|
+
# @param [ScaFinding | Hash] The value against the validation is performed.
|
|
409
|
+
def self.validate(value)
|
|
410
|
+
return true if value.instance_of? self
|
|
411
|
+
|
|
412
|
+
return false unless value.instance_of? Hash
|
|
413
|
+
|
|
414
|
+
true
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
# Provides a human-readable string representation of the object.
|
|
418
|
+
def to_s
|
|
419
|
+
class_name = self.class.name.split('::').last
|
|
420
|
+
"<#{class_name} categories: #{@categories}, confidence: #{@confidence}, created_at:"\
|
|
421
|
+
" #{@created_at}, epss_score: #{@epss_score}, external_ticket: #{@external_ticket},"\
|
|
422
|
+
" first_seen_scan_id: #{@first_seen_scan_id}, fix_recommendations: #{@fix_recommendations},"\
|
|
423
|
+
" found_dependency: #{@found_dependency}, id: #{@id}, is_malicious: #{@is_malicious},"\
|
|
424
|
+
" line_of_code_url: #{@line_of_code_url}, location: #{@location}, match_based_id:"\
|
|
425
|
+
" #{@match_based_id}, reachability: #{@reachability}, reachable_condition:"\
|
|
426
|
+
" #{@reachable_condition}, ref: #{@ref}, relevant_since: #{@relevant_since}, repository:"\
|
|
427
|
+
" #{@repository}, review_comments: #{@review_comments}, rule: #{@rule}, rule_message:"\
|
|
428
|
+
" #{@rule_message}, rule_name: #{@rule_name}, severity: #{@severity}, state: #{@state},"\
|
|
429
|
+
" state_updated_at: #{@state_updated_at}, status: #{@status}, syntactic_id:"\
|
|
430
|
+
" #{@syntactic_id}, triage_comment: #{@triage_comment}, triage_reason: #{@triage_reason},"\
|
|
431
|
+
" triage_state: #{@triage_state}, triaged_at: #{@triaged_at}, usage: #{@usage},"\
|
|
432
|
+
" vulnerability_identifier: #{@vulnerability_identifier}, additional_properties:"\
|
|
433
|
+
" #{@additional_properties}>"
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
437
|
+
def inspect
|
|
438
|
+
class_name = self.class.name.split('::').last
|
|
439
|
+
"<#{class_name} categories: #{@categories.inspect}, confidence: #{@confidence.inspect},"\
|
|
440
|
+
" created_at: #{@created_at.inspect}, epss_score: #{@epss_score.inspect}, external_ticket:"\
|
|
441
|
+
" #{@external_ticket.inspect}, first_seen_scan_id: #{@first_seen_scan_id.inspect},"\
|
|
442
|
+
" fix_recommendations: #{@fix_recommendations.inspect}, found_dependency:"\
|
|
443
|
+
" #{@found_dependency.inspect}, id: #{@id.inspect}, is_malicious: #{@is_malicious.inspect},"\
|
|
444
|
+
" line_of_code_url: #{@line_of_code_url.inspect}, location: #{@location.inspect},"\
|
|
445
|
+
" match_based_id: #{@match_based_id.inspect}, reachability: #{@reachability.inspect},"\
|
|
446
|
+
" reachable_condition: #{@reachable_condition.inspect}, ref: #{@ref.inspect},"\
|
|
447
|
+
" relevant_since: #{@relevant_since.inspect}, repository: #{@repository.inspect},"\
|
|
448
|
+
" review_comments: #{@review_comments.inspect}, rule: #{@rule.inspect}, rule_message:"\
|
|
449
|
+
" #{@rule_message.inspect}, rule_name: #{@rule_name.inspect}, severity:"\
|
|
450
|
+
" #{@severity.inspect}, state: #{@state.inspect}, state_updated_at:"\
|
|
451
|
+
" #{@state_updated_at.inspect}, status: #{@status.inspect}, syntactic_id:"\
|
|
452
|
+
" #{@syntactic_id.inspect}, triage_comment: #{@triage_comment.inspect}, triage_reason:"\
|
|
453
|
+
" #{@triage_reason.inspect}, triage_state: #{@triage_state.inspect}, triaged_at:"\
|
|
454
|
+
" #{@triaged_at.inspect}, usage: #{@usage.inspect}, vulnerability_identifier:"\
|
|
455
|
+
" #{@vulnerability_identifier.inspect}, additional_properties: #{@additional_properties}>"
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# semgrep_web_app
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SemgrepWebApp
|
|
7
|
+
# A list of Supply Chain findings that Semgrep has identified in your
|
|
8
|
+
# organization
|
|
9
|
+
class ScaFindings < BaseModel
|
|
10
|
+
SKIP = Object.new
|
|
11
|
+
private_constant :SKIP
|
|
12
|
+
|
|
13
|
+
# A list of Supply Chain findings.
|
|
14
|
+
# @return [Array[ScaFinding]]
|
|
15
|
+
attr_accessor :findings
|
|
16
|
+
|
|
17
|
+
# A mapping from model property names to API property names.
|
|
18
|
+
def self.names
|
|
19
|
+
@_hash = {} if @_hash.nil?
|
|
20
|
+
@_hash['findings'] = 'findings'
|
|
21
|
+
@_hash
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# An array for optional fields
|
|
25
|
+
def self.optionals
|
|
26
|
+
%w[
|
|
27
|
+
findings
|
|
28
|
+
]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# An array for nullable fields
|
|
32
|
+
def self.nullables
|
|
33
|
+
[]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(findings: SKIP, additional_properties: nil)
|
|
37
|
+
# Add additional model properties to the instance
|
|
38
|
+
additional_properties = {} if additional_properties.nil?
|
|
39
|
+
|
|
40
|
+
@findings = findings unless findings == SKIP
|
|
41
|
+
@additional_properties = additional_properties
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Creates an instance of the object from a hash.
|
|
45
|
+
def self.from_hash(hash)
|
|
46
|
+
return nil unless hash
|
|
47
|
+
|
|
48
|
+
# Extract variables from the hash.
|
|
49
|
+
# Parameter is an array, so we need to iterate through it
|
|
50
|
+
findings = nil
|
|
51
|
+
unless hash['findings'].nil?
|
|
52
|
+
findings = []
|
|
53
|
+
hash['findings'].each do |structure|
|
|
54
|
+
findings << (ScaFinding.from_hash(structure) if structure)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
findings = SKIP unless hash.key?('findings')
|
|
59
|
+
|
|
60
|
+
# Create a new hash for additional properties, removing known properties.
|
|
61
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
62
|
+
|
|
63
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
64
|
+
new_hash, proc { |value| value }
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Create object from extracted values.
|
|
68
|
+
ScaFindings.new(findings: findings,
|
|
69
|
+
additional_properties: additional_properties)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Provides a human-readable string representation of the object.
|
|
73
|
+
def to_s
|
|
74
|
+
class_name = self.class.name.split('::').last
|
|
75
|
+
"<#{class_name} findings: #{@findings}, additional_properties: #{@additional_properties}>"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
79
|
+
def inspect
|
|
80
|
+
class_name = self.class.name.split('::').last
|
|
81
|
+
"<#{class_name} findings: #{@findings.inspect}, additional_properties:"\
|
|
82
|
+
" #{@additional_properties}>"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# semgrep_web_app
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SemgrepWebApp
|
|
7
|
+
# Provider for the finding (e.g. GitHub, GitLab, GHE, etc). | value |
|
|
8
|
+
# description | |-------|---------------| | SCM_TYPE_GITHUB | GitHub Cloud | |
|
|
9
|
+
# SCM_TYPE_GITHUB_ENTERPRISE | GitHub Enterprise | | SCM_TYPE_GITLAB | GitLab
|
|
10
|
+
# Cloud | | SCM_TYPE_GITLAB_SELFMANAGED | GitLab Self-Managed | |
|
|
11
|
+
# SCM_TYPE_BITBUCKET | Bitbucket Cloud | | SCM_TYPE_BITBUCKET_DATACENTER |
|
|
12
|
+
# Bitbucket Data Center | | SCM_TYPE_AZURE_DEVOPS | Azure DevOps | |
|
|
13
|
+
# SCM_TYPE_UNKNOWN | | | SCM_TYPE_HARNESS | Harness |
|
|
14
|
+
class ScmType
|
|
15
|
+
SCM_TYPE = [
|
|
16
|
+
# TODO: Write general description for SCM_TYPE_GITHUB
|
|
17
|
+
SCM_TYPE_GITHUB = 'SCM_TYPE_GITHUB'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for SCM_TYPE_GITHUB_ENTERPRISE
|
|
20
|
+
SCM_TYPE_GITHUB_ENTERPRISE = 'SCM_TYPE_GITHUB_ENTERPRISE'.freeze,
|
|
21
|
+
|
|
22
|
+
# TODO: Write general description for SCM_TYPE_GITLAB
|
|
23
|
+
SCM_TYPE_GITLAB = 'SCM_TYPE_GITLAB'.freeze,
|
|
24
|
+
|
|
25
|
+
# TODO: Write general description for SCM_TYPE_GITLAB_SELFMANAGED
|
|
26
|
+
SCM_TYPE_GITLAB_SELFMANAGED = 'SCM_TYPE_GITLAB_SELFMANAGED'.freeze,
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for SCM_TYPE_BITBUCKET
|
|
29
|
+
SCM_TYPE_BITBUCKET = 'SCM_TYPE_BITBUCKET'.freeze,
|
|
30
|
+
|
|
31
|
+
# TODO: Write general description for SCM_TYPE_BITBUCKET_DATACENTER
|
|
32
|
+
SCM_TYPE_BITBUCKET_DATACENTER = 'SCM_TYPE_BITBUCKET_DATACENTER'.freeze,
|
|
33
|
+
|
|
34
|
+
# TODO: Write general description for SCM_TYPE_AZURE_DEVOPS
|
|
35
|
+
SCM_TYPE_AZURE_DEVOPS = 'SCM_TYPE_AZURE_DEVOPS'.freeze,
|
|
36
|
+
|
|
37
|
+
# TODO: Write general description for SCM_TYPE_UNKNOWN
|
|
38
|
+
SCM_TYPE_UNKNOWN = 'SCM_TYPE_UNKNOWN'.freeze,
|
|
39
|
+
|
|
40
|
+
# TODO: Write general description for SCM_TYPE_HARNESS
|
|
41
|
+
SCM_TYPE_HARNESS = 'SCM_TYPE_HARNESS'.freeze
|
|
42
|
+
].freeze
|
|
43
|
+
|
|
44
|
+
def self.validate(value)
|
|
45
|
+
return false if value.nil?
|
|
46
|
+
|
|
47
|
+
SCM_TYPE.include?(value)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.from_value(value, default_value = SCM_TYPE_GITHUB)
|
|
51
|
+
return default_value if value.nil?
|
|
52
|
+
|
|
53
|
+
str = value.to_s.strip
|
|
54
|
+
|
|
55
|
+
case str.downcase
|
|
56
|
+
when 'scm_type_github' then SCM_TYPE_GITHUB
|
|
57
|
+
when 'scm_type_github_enterprise' then SCM_TYPE_GITHUB_ENTERPRISE
|
|
58
|
+
when 'scm_type_gitlab' then SCM_TYPE_GITLAB
|
|
59
|
+
when 'scm_type_gitlab_selfmanaged' then SCM_TYPE_GITLAB_SELFMANAGED
|
|
60
|
+
when 'scm_type_bitbucket' then SCM_TYPE_BITBUCKET
|
|
61
|
+
when 'scm_type_bitbucket_datacenter' then SCM_TYPE_BITBUCKET_DATACENTER
|
|
62
|
+
when 'scm_type_azure_devops' then SCM_TYPE_AZURE_DEVOPS
|
|
63
|
+
when 'scm_type_unknown' then SCM_TYPE_UNKNOWN
|
|
64
|
+
when 'scm_type_harness' then SCM_TYPE_HARNESS
|
|
65
|
+
else
|
|
66
|
+
default_value
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|