Class: AWSCDK::RegionInfo::Fact

Inherits:
Jsii::Object
  • Object
show all
Defined in:
region_info/fact.rb

Overview

A database of regional information.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Fact

Returns a new instance of Fact.

Raises:

  • (NoMethodError)


8
9
10
# File 'region_info/fact.rb', line 8

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

Class Method Details

.defined_factsArray<Array<String>>

Return all pairs of (region, factName) that are defined.

Returns:

  • (Array<Array<String>>)


20
21
22
# File 'region_info/fact.rb', line 20

def self.defined_facts()
  Jsii::Kernel.instance.call_static("aws-cdk-lib.region_info.Fact", "definedFacts", [])
end

.find(region, name) ⇒ String?

Retrieves a fact from this Fact database.

Parameters:

  • region (String)

    the name of the region (e.g: us-east-1).

  • name (String)

    the name of the fact being looked up (see the FactName class for details).

Returns:

  • (String, nil)

    the fact value if it is known, and undefined otherwise.



29
30
31
32
33
# File 'region_info/fact.rb', line 29

def self.find(region, name)
  Jsii::Type.check_type(region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region")
  Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.region_info.Fact", "find", [region, name])
end

.jsii_overridable_methodsObject



12
13
14
15
# File 'region_info/fact.rb', line 12

def self.jsii_overridable_methods
  {
  }
end

.namesArray<String>

Returns the list of names of registered facts.

All facts will be present in at least one region.

Returns:

  • (Array<String>)


78
79
80
# File 'region_info/fact.rb', line 78

def self.names()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.region_info.Fact", "names")
end

.regionsArray<String>

Returns:

  • (Array<String>)


83
84
85
# File 'region_info/fact.rb', line 83

def self.regions()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.region_info.Fact", "regions")
end

.register(fact, allow_replacing = nil) ⇒ void

This method returns an undefined value.

Registers a new fact in this Fact database.

Parameters:

  • fact (AWSCDK::RegionInfo::IFact)

    the new fact to be registered.

  • allow_replacing (Boolean, nil) (defaults to: nil)

    whether new facts can replace existing facts or not.



40
41
42
43
44
# File 'region_info/fact.rb', line 40

def self.register(fact, allow_replacing = nil)
  Jsii::Type.check_type(fact, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5yZWdpb25faW5mby5JRmFjdCJ9")), "fact")
  Jsii::Type.check_type(allow_replacing, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowReplacing") unless allow_replacing.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.region_info.Fact", "register", [fact, allow_replacing])
end

.require_fact(region, name) ⇒ String

Retrieve a fact from the Fact database.

(retrieval will fail if the specified region or fact name does not exist.)

Parameters:

  • region (String)

    the name of the region (e.g: us-east-1).

  • name (String)

    the name of the fact being looked up (see the FactName class for details).

Returns:

  • (String)


54
55
56
57
58
# File 'region_info/fact.rb', line 54

def self.require_fact(region, name)
  Jsii::Type.check_type(region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region")
  Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.region_info.Fact", "requireFact", [region, name])
end

.unregister(region, name, value = nil) ⇒ void

This method returns an undefined value.

Removes a fact from the database.

Parameters:

  • region (String)

    the region for which the fact is to be removed.

  • name (String)

    the name of the fact to remove.

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

    the value that should be removed (removal will fail if the value is specified, but does not match the current stored value).



66
67
68
69
70
71
# File 'region_info/fact.rb', line 66

def self.unregister(region, name, value = nil)
  Jsii::Type.check_type(region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region")
  Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "value") unless value.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.region_info.Fact", "unregister", [region, name, value])
end