Class: AWSCDK::Aspects

Inherits:
Jsii::Object
  • Object
show all
Defined in:
aspects.rb

Overview

Aspects can be applied to CDK tree scopes and can operate on the tree before synthesis.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Aspects

Returns a new instance of Aspects.

Raises:

  • (NoMethodError)


8
9
10
# File 'aspects.rb', line 8

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.Aspects does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.jsii_overridable_methodsObject



12
13
14
15
16
17
18
# File 'aspects.rb', line 12

def self.jsii_overridable_methods
  {
    :all => { kind: :property, name: "all", is_optional: false },
    :applied => { kind: :property, name: "applied", is_optional: false },
    :add => { kind: :method, name: "add", is_optional: false },
  }
end

.of(scope) ⇒ AWSCDK::Aspects

Returns the Aspects object associated with a construct scope.

Parameters:

  • scope (Constructs::IConstruct)

    The scope for which these aspects will apply.

Returns:

  • (AWSCDK::Aspects)


24
25
26
27
# File 'aspects.rb', line 24

def self.of(scope)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "scope")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Aspects", "of", [scope])
end

Instance Method Details

#add(aspect, options = nil) ⇒ void

This method returns an undefined value.

Adds an aspect to apply this scope before synthesis.

Parameters:



50
51
52
53
54
55
# File 'aspects.rb', line 50

def add(aspect, options = nil)
  Jsii::Type.check_type(aspect, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JQXNwZWN0In0=")), "aspect")
  options = options.is_a?(Hash) ? ::AWSCDK::AspectOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bc3BlY3RPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("add", [aspect, options])
end

#allArray<AWSCDK::IAspect>

The list of aspects which were directly applied on this scope.

Returns:



32
33
34
# File 'aspects.rb', line 32

def all()
  jsii_get_property("all")
end

#appliedArray<AWSCDK::AspectApplication>

The list of aspects with priority which were directly applied on this scope.

Also returns inherited Aspects of this node.

Returns:



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

def applied()
  jsii_get_property("applied")
end