Class: AWSCDK::FeatureFlags

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

Overview

Features that are implemented behind a flag in order to preserve backwards compatibility for existing apps.

The list of flags are available in the aws-cdk-lib/cx-api module.

The state of the flag for this application is stored as a CDK context variable.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FeatureFlags

Returns a new instance of FeatureFlags.

Raises:

  • (NoMethodError)


13
14
15
# File 'feature_flags.rb', line 13

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

Class Method Details

.jsii_overridable_methodsObject



17
18
19
20
21
# File 'feature_flags.rb', line 17

def self.jsii_overridable_methods
  {
    :is_enabled => { kind: :method, name: "isEnabled", is_optional: false },
  }
end

.of(scope) ⇒ AWSCDK::FeatureFlags

Inspect feature flags on the construct node's context.

Parameters:

  • scope (Constructs::IConstruct)

Returns:

  • (AWSCDK::FeatureFlags)


27
28
29
30
# File 'feature_flags.rb', line 27

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

Instance Method Details

#is_enabled(feature_flag) ⇒ Boolean?

Check whether a feature flag is enabled.

If configured, the flag is present in the construct node context. Falls back to the defaults defined in the cx-api module.

Parameters:

  • feature_flag (String)

Returns:

  • (Boolean, nil)


40
41
42
43
# File 'feature_flags.rb', line 40

def is_enabled(feature_flag)
  Jsii::Type.check_type(feature_flag, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "featureFlag")
  jsii_call_method("isEnabled", [feature_flag])
end