Class: AWSCDK::PolicyViolation
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::PolicyViolation
- Defined in:
- policy_violation.rb
Overview
Violation produced by the validation plugin.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
The description of the violation.
-
#fix ⇒ String?
readonly
How to fix the violation.
-
#rule_metadata ⇒ Hash{String => String}?
readonly
Additional metadata to include with the rule results.
-
#rule_name ⇒ String
readonly
The name of the rule.
-
#severity ⇒ String?
readonly
The severity of the violation, only used for reporting purposes.
-
#violating_resources ⇒ Array<AWSCDK::PolicyViolatingResource>
readonly
The resources violating this rule.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(description:, rule_name:, violating_resources:, fix: nil, rule_metadata: nil, severity: nil) ⇒ PolicyViolation
constructor
A new instance of PolicyViolation.
- #to_jsii ⇒ Object
Constructor Details
#initialize(description:, rule_name:, violating_resources:, fix: nil, rule_metadata: nil, severity: nil) ⇒ PolicyViolation
Returns a new instance of PolicyViolation.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'policy_violation.rb', line 13 def initialize(description:, rule_name:, violating_resources:, fix: nil, rule_metadata: nil, severity: 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") @violating_resources = violating_resources.is_a?(Array) ? violating_resources.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::PolicyViolatingResource.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : violating_resources Jsii::Type.check_type(@violating_resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLlBvbGljeVZpb2xhdGluZ1Jlc291cmNlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "violatingResources") @fix = fix Jsii::Type.check_type(@fix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "fix") unless @fix.nil? @rule_metadata = Jsii::Type.check_type(@rule_metadata, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "ruleMetadata") unless @rule_metadata.nil? @severity = severity Jsii::Type.check_type(@severity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "severity") unless @severity.nil? end |
Instance Attribute Details
#description ⇒ String (readonly)
The description of the violation.
31 32 33 |
# File 'policy_violation.rb', line 31 def description @description end |
#fix ⇒ String? (readonly)
Default: - no fix is provided
How to fix the violation.
44 45 46 |
# File 'policy_violation.rb', line 44 def fix @fix end |
#rule_metadata ⇒ Hash{String => String}? (readonly)
Default: - no rule metadata
Additional metadata to include with the rule results.
This can be used to provide additional information that is plugin specific. The data provided here will be rendered as is.
52 53 54 |
# File 'policy_violation.rb', line 52 def @rule_metadata end |
#rule_name ⇒ String (readonly)
The name of the rule.
35 36 37 |
# File 'policy_violation.rb', line 35 def rule_name @rule_name end |
#severity ⇒ String? (readonly)
Default: - no severity
The severity of the violation, only used for reporting purposes.
This is useful for helping the user discriminate between warnings, errors, information, etc.
60 61 62 |
# File 'policy_violation.rb', line 60 def severity @severity end |
#violating_resources ⇒ Array<AWSCDK::PolicyViolatingResource> (readonly)
The resources violating this rule.
39 40 41 |
# File 'policy_violation.rb', line 39 def violating_resources @violating_resources end |
Class Method Details
.jsii_properties ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'policy_violation.rb', line 62 def self.jsii_properties { :description => "description", :rule_name => "ruleName", :violating_resources => "violatingResources", :fix => "fix", :rule_metadata => "ruleMetadata", :severity => "severity", } end |
Instance Method Details
#to_jsii ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'policy_violation.rb', line 73 def to_jsii result = {} result.merge!({ "description" => @description, "ruleName" => @rule_name, "violatingResources" => @violating_resources, "fix" => @fix, "ruleMetadata" => @rule_metadata, "severity" => @severity, }) result.compact end |