Class: Igniter::Lang::DiagnosticPayload
- Inherits:
-
Object
- Object
- Igniter::Lang::DiagnosticPayload
- Defined in:
- lib/igniter/lang/diagnostic_payload.rb
Constant Summary collapse
- SEMANTICS =
{ report_only: true, runtime_enforced: false, package_adapter_authorized: false, real_data_export_authorized: false, readiness_enforced: false, ledger_core: false }.freeze
- DEFAULT_REDACTION_POLICY =
{ raw_ref_export: false, hash_source_refs: true, redacted_ref_kinds: [] }.freeze
- STATUSES =
%i[ok warning blocked unknown].freeze
- DECISIONS =
%i[trusted provisional blocked unknown].freeze
- RAW_REF_KEYS =
%i[raw_ref raw_refs raw_source_ref raw_source_refs].freeze
- RAW_REF_PREFIX =
"raw:"
Instance Attribute Summary collapse
-
#decision ⇒ Object
readonly
Returns the value of attribute decision.
-
#diagnostic_id ⇒ Object
readonly
Returns the value of attribute diagnostic_id.
-
#evidence_links ⇒ Object
readonly
Returns the value of attribute evidence_links.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#redaction_policy ⇒ Object
readonly
Returns the value of attribute redaction_policy.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(diagnostic_id:, profile:, status:, decision:, payload: {}, evidence_links: {}, redaction_policy: {}, metadata: {}) ⇒ DiagnosticPayload
constructor
A new instance of DiagnosticPayload.
- #report_only? ⇒ Boolean
- #runtime_enforced? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(diagnostic_id:, profile:, status:, decision:, payload: {}, evidence_links: {}, redaction_policy: {}, metadata: {}) ⇒ DiagnosticPayload
Returns a new instance of DiagnosticPayload.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 35 def initialize( diagnostic_id:, profile:, status:, decision:, payload: {}, evidence_links: {}, redaction_policy: {}, metadata: {} ) @diagnostic_id = require_value(:diagnostic_id, diagnostic_id) @profile = require_value(:profile, profile) @status = normalize_status(status) @decision = normalize_decision(decision) @payload = deep_freeze(normalize_hash(payload, :payload)) @evidence_links = deep_freeze(normalize_hash(evidence_links, :evidence_links)) @redaction_policy = deep_freeze(normalize_redaction_policy(redaction_policy)) @metadata = deep_freeze(normalize_hash(, :metadata)) reject_raw_refs! freeze end |
Instance Attribute Details
#decision ⇒ Object (readonly)
Returns the value of attribute decision.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def decision @decision end |
#diagnostic_id ⇒ Object (readonly)
Returns the value of attribute diagnostic_id.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def diagnostic_id @diagnostic_id end |
#evidence_links ⇒ Object (readonly)
Returns the value of attribute evidence_links.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def evidence_links @evidence_links end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def @metadata end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def payload @payload end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def profile @profile end |
#redaction_policy ⇒ Object (readonly)
Returns the value of attribute redaction_policy.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def redaction_policy @redaction_policy end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
26 27 28 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 26 def status @status end |
Instance Method Details
#report_only? ⇒ Boolean
57 58 59 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 57 def report_only? true end |
#runtime_enforced? ⇒ Boolean
61 62 63 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 61 def runtime_enforced? false end |
#to_h ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/igniter/lang/diagnostic_payload.rb', line 65 def to_h { diagnostic_id: diagnostic_id, profile: profile, status: status, decision: decision, payload: payload, evidence_links: evidence_links, redaction_policy: redaction_policy, semantics: SEMANTICS, metadata: } end |