Class: AWSCDK::CloudAssemblySchema::SuppressedViolationJson

Inherits:
PolicyViolationJson
  • Object
show all
Defined in:
cloud_assembly_schema/suppressed_violation_json.rb

Overview

A violation that was acknowledged/suppressed and excluded from the active violation set.

Examples:

require 'aws-cdk-cloud-assembly-schema'

suppressed = {
    rule_name: "no-public-access",
    description: "S3 bucket should not allow public access",
    severity: "warning",
    violating_constructs: [{construct_path: "MyStack/MyBucket"}],
    acknowledged_id: "my-plugin::no-public-access",
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description:, rule_name:, severity:, violating_constructs:, custom_severity: nil, rule_metadata: nil, suggested_fix: nil, acknowledged_id:, acknowledged_at: nil, acknowledged_stack_trace: nil, reason: nil) ⇒ SuppressedViolationJson

Returns a new instance of SuppressedViolationJson.

Parameters:

  • description (String)

    A description of the violation.

  • rule_name (String)

    The name of the rule that was violated.

  • severity (String)

    The severity of the violation.

  • violating_constructs (Array<AWSCDK::CloudAssemblySchema::ViolatingConstructJson>)

    Constructs that violated the rule.

  • custom_severity (String, nil) (defaults to: nil)

    If the plugin wants to report using a non-standard severity, put it here.

  • rule_metadata (Hash{String => String}, nil) (defaults to: nil)

    Additional rule-specific metadata.

  • suggested_fix (String, nil) (defaults to: nil)

    How to fix the violation.

  • acknowledged_id (String)

    The acknowledgement ID that caused this violation to be suppressed.

  • acknowledged_at (String, nil) (defaults to: nil)

    The construct path where the acknowledgement was declared.

  • acknowledged_stack_trace (String, nil) (defaults to: nil)

    Stack trace showing where the acknowledgement was declared.

  • reason (String, nil) (defaults to: nil)

    The reason given for the acknowledgement, if provided.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 30

def initialize(description:, rule_name:, severity:, violating_constructs:, custom_severity: nil, rule_metadata: nil, suggested_fix: nil, acknowledged_id:, acknowledged_at: nil, acknowledged_stack_trace: nil, reason: nil)
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description")
  @rule_name = rule_name
  Jsii::Type.check_type(@rule_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ruleName")
  @severity = severity
  Jsii::Type.check_type(@severity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "severity")
  @violating_constructs = violating_constructs.is_a?(Array) ? violating_constructs.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::ViolatingConstructJson.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : violating_constructs
  Jsii::Type.check_type(@violating_constructs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmNsb3VkX2Fzc2VtYmx5X3NjaGVtYS5WaW9sYXRpbmdDb25zdHJ1Y3RKc29uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "violatingConstructs")
  @custom_severity = custom_severity
  Jsii::Type.check_type(@custom_severity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "customSeverity") unless @custom_severity.nil?
  @rule_metadata = 
  Jsii::Type.check_type(@rule_metadata, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "ruleMetadata") unless @rule_metadata.nil?
  @suggested_fix = suggested_fix
  Jsii::Type.check_type(@suggested_fix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "suggestedFix") unless @suggested_fix.nil?
  @acknowledged_id = acknowledged_id
  Jsii::Type.check_type(@acknowledged_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "acknowledgedId")
  @acknowledged_at = acknowledged_at
  Jsii::Type.check_type(@acknowledged_at, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "acknowledgedAt") unless @acknowledged_at.nil?
  @acknowledged_stack_trace = acknowledged_stack_trace
  Jsii::Type.check_type(@acknowledged_stack_trace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "acknowledgedStackTrace") unless @acknowledged_stack_trace.nil?
  @reason = reason
  Jsii::Type.check_type(@reason, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "reason") unless @reason.nil?
end

Instance Attribute Details

#acknowledged_atString? (readonly)

Note:

Default: - unknown

The construct path where the acknowledgement was declared.

Returns:

  • (String, nil)


95
96
97
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 95

def acknowledged_at
  @acknowledged_at
end

#acknowledged_idString (readonly)

The acknowledgement ID that caused this violation to be suppressed.

Format: <plugin-name>::<rule-name> (spaces replaced with hyphens).

Returns:

  • (String)


90
91
92
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 90

def acknowledged_id
  @acknowledged_id
end

#acknowledged_stack_traceString? (readonly)

Note:

Default: - no stack trace

Stack trace showing where the acknowledgement was declared.

A \n-delimited string of stack frames.

Returns:

  • (String, nil)


102
103
104
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 102

def acknowledged_stack_trace
  @acknowledged_stack_trace
end

#custom_severityString? (readonly)

If the plugin wants to report using a non-standard severity, put it here.

Returns:

  • (String, nil)


74
75
76
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 74

def custom_severity
  @custom_severity
end

#descriptionString (readonly)

A description of the violation.

Returns:

  • (String)


58
59
60
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 58

def description
  @description
end

#reasonString? (readonly)

Note:

Default: - no reason given

The reason given for the acknowledgement, if provided.

Returns:

  • (String, nil)


107
108
109
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 107

def reason
  @reason
end

#rule_metadataHash{String => String}? (readonly)

Note:

Default: - no metadata

Additional rule-specific metadata.

Returns:

  • (Hash{String => String}, nil)


79
80
81
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 79

def 
  @rule_metadata
end

#rule_nameString (readonly)

The name of the rule that was violated.

Returns:

  • (String)


62
63
64
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 62

def rule_name
  @rule_name
end

#severityString (readonly)

The severity of the violation.

Returns:

  • (String)


66
67
68
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 66

def severity
  @severity
end

#suggested_fixString? (readonly)

Note:

Default: - no fix provided

How to fix the violation.

Returns:

  • (String, nil)


84
85
86
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 84

def suggested_fix
  @suggested_fix
end

#violating_constructsArray<AWSCDK::CloudAssemblySchema::ViolatingConstructJson> (readonly)

Constructs that violated the rule.



70
71
72
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 70

def violating_constructs
  @violating_constructs
end

Class Method Details

.jsii_propertiesObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 109

def self.jsii_properties
  {
    :description => "description",
    :rule_name => "ruleName",
    :severity => "severity",
    :violating_constructs => "violatingConstructs",
    :custom_severity => "customSeverity",
    :rule_metadata => "ruleMetadata",
    :suggested_fix => "suggestedFix",
    :acknowledged_id => "acknowledgedId",
    :acknowledged_at => "acknowledgedAt",
    :acknowledged_stack_trace => "acknowledgedStackTrace",
    :reason => "reason",
  }
end

Instance Method Details

#to_jsiiObject



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'cloud_assembly_schema/suppressed_violation_json.rb', line 125

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "description" => @description,
    "ruleName" => @rule_name,
    "severity" => @severity,
    "violatingConstructs" => @violating_constructs,
    "customSeverity" => @custom_severity,
    "ruleMetadata" => @rule_metadata,
    "suggestedFix" => @suggested_fix,
    "acknowledgedId" => @acknowledged_id,
    "acknowledgedAt" => @acknowledged_at,
    "acknowledgedStackTrace" => @acknowledged_stack_trace,
    "reason" => @reason,
  })
  result.compact
end