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_NAMESPACE_SPLITTER =

String to split for resource namespacing

['.', '/']

Constants inherited from SparkleFormation::Resources

RESOURCE_TYPE_TR

Class Method Summary collapse

Methods inherited from SparkleFormation::Resources

base_key, load, lookup, register, registry, registry_key, resource, resource_type_splitter

Methods included from Utils::AnimalStrings

#camel, #snake

Class Method Details

.included(_klass) ⇒ Object

Auto load data when included



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

def included(_klass)
  load!
end

.load!TrueClass

Load the builtin AWS resources

Returns:

  • (TrueClass)


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

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:



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

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