Class: AWSCDK::PolicyViolatingResource

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

Overview

Resource violating a specific rule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locations:, construct_path: nil, resource_logical_id: nil, template_path: nil) ⇒ PolicyViolatingResource

Returns a new instance of PolicyViolatingResource.

Parameters:

  • locations (Array<String>)

    The locations in the CloudFormation template that pose the violations.

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

    The construct path of the violating construct.

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

    The logical ID of the resource in the CloudFormation template.

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

    The path to the CloudFormation template that contains this resource.



11
12
13
14
15
16
17
18
19
20
# File 'policy_violating_resource.rb', line 11

def initialize(locations:, construct_path: nil, resource_logical_id: nil, template_path: nil)
  @locations = locations
  Jsii::Type.check_type(@locations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "locations")
  @construct_path = construct_path
  Jsii::Type.check_type(@construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath") unless @construct_path.nil?
  @resource_logical_id = resource_logical_id
  Jsii::Type.check_type(@resource_logical_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceLogicalId") unless @resource_logical_id.nil?
  @template_path = template_path
  Jsii::Type.check_type(@template_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "templatePath") unless @template_path.nil?
end

Instance Attribute Details

#construct_pathString? (readonly)

Note:

Default: - construct path is derived from the resource logical ID

The construct path of the violating construct.

Use this for violations that originate from constructs rather than CloudFormation resources (e.g. annotations added via Annotations.of() or Validations.of()). When provided, the report will use this path directly instead of deriving it from the resource logical ID. Mutually exclusive with resource_logical_id.

Returns:

  • (String, nil)


39
40
41
# File 'policy_violating_resource.rb', line 39

def construct_path
  @construct_path
end

#locationsArray<String> (readonly)

The locations in the CloudFormation template that pose the violations.

TODO: Define whether this is from the root of the template, or from the resource itself. Not sure this is well-defined at the moment.

Returns:

  • (Array<String>)


28
29
30
# File 'policy_violating_resource.rb', line 28

def locations
  @locations
end

#resource_logical_idString? (readonly)

Note:

Default: - no resource logical ID

The logical ID of the resource in the CloudFormation template.

Required for plugin-sourced violations that operate on CloudFormation templates. Mutually exclusive with construct_path.

Returns:

  • (String, nil)


47
48
49
# File 'policy_violating_resource.rb', line 47

def resource_logical_id
  @resource_logical_id
end

#template_pathString? (readonly)

Note:

Default: - no template path

The path to the CloudFormation template that contains this resource.

Returns:

  • (String, nil)


52
53
54
# File 'policy_violating_resource.rb', line 52

def template_path
  @template_path
end

Class Method Details

.jsii_propertiesObject



54
55
56
57
58
59
60
61
# File 'policy_violating_resource.rb', line 54

def self.jsii_properties
  {
    :locations => "locations",
    :construct_path => "constructPath",
    :resource_logical_id => "resourceLogicalId",
    :template_path => "templatePath",
  }
end

Instance Method Details

#to_jsiiObject



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

def to_jsii
  result = {}
  result.merge!({
    "locations" => @locations,
    "constructPath" => @construct_path,
    "resourceLogicalId" => @resource_logical_id,
    "templatePath" => @template_path,
  })
  result.compact
end