Class: SparkleFormation::Resources::Azure

Inherits:
SparkleFormation::Resources show all
Extended by:
Bogo::Memoization
Defined in:
lib/sparkle_formation/resources/azure.rb

Overview

Azure specific resources collection

Constant Summary collapse

RESOURCE_TYPE_TR =

Characters to be removed from supplied key on matching

"/._"
RESOURCE_TYPE_NAMESPACE_SPLITTER =

String to split for resource namespacing

[".", "/"]

Class Method Summary collapse

Class Method Details

.included(_klass) ⇒ Object

Auto load data when included



35
36
37
# File 'lib/sparkle_formation/resources/azure.rb', line 35

def included(_klass)
  load!
end

.load!TrueClass

Load the builtin AWS resources

Returns:

  • (TrueClass)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sparkle_formation/resources/azure.rb', line 22

def load!
  memoize(:azure_resources, :global) do
    load(
      File.join(
        File.dirname(__FILE__),
        "azure_resources.json"
      )
    )
    true
  end
end

.resource_customizer(struct, lookup_key) ⇒ SparkleStruct

Automatically add api version information and location if required by resource and not provided

Parameters:

Returns:



45
46
47
48
49
50
51
52
53
54
# File 'lib/sparkle_formation/resources/azure.rb', line 45

def resource_customizer(struct, lookup_key)
  info = registry[lookup_key]
  if info[:required].include?("apiVersion") && struct.api_version.nil?
    struct.api_version info[:api_version]
  end
  if info[:required].include?("location") && struct.location.nil?
    struct.location struct.resource_group!.location
  end
  struct
end