Class: AWSCDK::PolicyViolationBeta1 Deprecated

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
policy_violation_beta1.rb

Overview

Deprecated.

Use PolicyViolation instead.

Violation produced by the validation plugin.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description:, rule_name:, violating_resources:, fix: nil, rule_metadata: nil, severity: nil) ⇒ PolicyViolationBeta1

Returns a new instance of PolicyViolationBeta1.

Parameters:

  • description (String)

    The description of the violation.

  • rule_name (String)

    The name of the rule.

  • violating_resources (Array<AWSCDK::PolicyViolatingResourceBeta1>)

    The resources violating this rule.

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

    How to fix the violation.

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

    Additional metadata to include with the rule results.

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

    The severity of the violation, only used for reporting purposes.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'policy_violation_beta1.rb', line 15

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::PolicyViolatingResourceBeta1.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : violating_resources
  Jsii::Type.check_type(@violating_resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLlBvbGljeVZpb2xhdGluZ1Jlc291cmNlQmV0YTEifSwia2luZCI6ImFycmF5In19")), "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

#descriptionString (readonly)

The description of the violation.

Returns:

  • (String)


33
34
35
# File 'policy_violation_beta1.rb', line 33

def description
  @description
end

#fixString? (readonly)

Note:

Default: - no fix is provided

How to fix the violation.

Returns:

  • (String, nil)


46
47
48
# File 'policy_violation_beta1.rb', line 46

def fix
  @fix
end

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

Note:

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.

Returns:

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


54
55
56
# File 'policy_violation_beta1.rb', line 54

def 
  @rule_metadata
end

#rule_nameString (readonly)

The name of the rule.

Returns:

  • (String)


37
38
39
# File 'policy_violation_beta1.rb', line 37

def rule_name
  @rule_name
end

#severityString? (readonly)

Note:

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.

Returns:

  • (String, nil)


62
63
64
# File 'policy_violation_beta1.rb', line 62

def severity
  @severity
end

#violating_resourcesArray<AWSCDK::PolicyViolatingResourceBeta1> (readonly)

The resources violating this rule.



41
42
43
# File 'policy_violation_beta1.rb', line 41

def violating_resources
  @violating_resources
end

Class Method Details

.jsii_propertiesObject



64
65
66
67
68
69
70
71
72
73
# File 'policy_violation_beta1.rb', line 64

def self.jsii_properties
  {
    :description => "description",
    :rule_name => "ruleName",
    :violating_resources => "violatingResources",
    :fix => "fix",
    :rule_metadata => "ruleMetadata",
    :severity => "severity",
  }
end

Instance Method Details

#to_jsiiObject



75
76
77
78
79
80
81
82
83
84
85
86
# File 'policy_violation_beta1.rb', line 75

def to_jsii
  result = {}
  result.merge!({
    "description" => @description,
    "ruleName" => @rule_name,
    "violatingResources" => @violating_resources,
    "fix" => @fix,
    "ruleMetadata" => @rule_metadata,
    "severity" => @severity,
  })
  result.compact
end