class MU::Cloud::CloudFormation::Collection

A Cloud Watch alarm as configured in {MU::Config::BasketofKittens::collections}

Attributes

cfm_name[R]
cfm_template[R]
cloud_id[R]
config[R]
mu_name[R]

Public Class Methods

cleanup(*args) click to toggle source

Placeholder. This is a NOOP for CloudFormation, which doesn't build resources directly.

# File modules/mu/providers/cloudformation/collection.rb, line 94
def self.cleanup(*args)
  MU.log "cleanup() not implemented for CloudFormation layer", MU::DEBUG
  nil
end
find(*args) click to toggle source

Placeholder. This is a NOOP for CloudFormation, which doesn't build resources directly.

# File modules/mu/providers/cloudformation/collection.rb, line 88
def self.find(*args)
  MU.log "find() not implemented for CloudFormation layer", MU::DEBUG
  nil
end
isGlobal?() click to toggle source

Does this resource type exist as a global (cloud-wide) artifact, or is it localized to a region/zone? @return [Boolean]

# File modules/mu/providers/cloudformation/collection.rb, line 117
def self.isGlobal?
  MU::Cloud.resourceClass("AWS", "Collection").isGlobal?
end
new(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil) click to toggle source

@param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member. @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::collections}

# File modules/mu/providers/cloudformation/collection.rb, line 31
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
  @deploy = mommacat
  @config = kitten_cfg
  @cloud_id ||= cloud_id
  if !mu_name.nil?
    @mu_name = mu_name
  elsif @config['scrub_mu_isms']
    @mu_name = @config['name']
  else
    @mu_name ||= @deploy.getResourceName(@config["name"])
  end
end
schema(config) click to toggle source

Cloud-specific configuration properties. @param config [MU::Config]: The calling MU::Config object @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource

# File modules/mu/providers/cloudformation/collection.rb, line 102
def self.schema(config)
  MU::Cloud.resourceClass("AWS", "Collection").schema(config)
end
validateConfig(server, configurator) click to toggle source

Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated. @param server [Hash]: The resource to process and validate @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member @return [Boolean]: True if validation succeeded, False otherwise

# File modules/mu/providers/cloudformation/collection.rb, line 110
def self.validateConfig(server, configurator)
  MU::Cloud.resourceClass("AWS", "Collection").validateConfig(server, configurator)
end

Public Instance Methods

create() click to toggle source

Populate @cfm_template with a resource description for this alarm in CloudFormation language.

# File modules/mu/providers/cloudformation/collection.rb, line 46
def create
  @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase(self.class.cfg_name, self, tags: @config['tags'], scrub_mu_isms: @config['scrub_mu_isms'])
  if @config["template_url"].nil?
    raise MuError, "You must specify template_url when creating a Collection and targeting CloudFormation (note: the template_file parameter is not supported when nesting CloudFormation templates)."
  end
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "TemplateURL", @config["template_url"])
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "TimeoutInMinutes", @config["timeout"])
  if @config['cfm_deps']
    MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "TimeoutInMinutes", @config["timeout"])
  end
  # XXX Should do this for any resource that can depend on a VPC
  @config['dependencies'].each { |dep|
    if dep['type'] == "vpc"
      subnets = @dependencies["vpc"][dep['name']].cloudobj.subnets
      subnets.each { |subnet|
        MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DependsOn", subnet.cfm_name)
      }
    end
  }

  parameters = Hash.new
  if !@config["parameters"].nil?
    @config["parameters"].each { |parameter|
      # Dumb old-school static string parameters. Nobody should use
      # these. Modern Mu parameters are vastly superior.
      parameters[parameter["parameter_key"]] = parameter["parameter_value"]
    }
  end
  if !@config["pass_deploy_key_as"].nil?
    parameters[@config["pass_deploy_key_as"]] = keypairname
  end

  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "Parameters", parameters)
end
notify() click to toggle source

Return the metadata for this CacheCluster @return [Hash]

# File modules/mu/providers/cloudformation/collection.rb, line 83
def notify
  {}
end