Class: Chronos::Core::DeployNormalizer
- Inherits:
-
Object
- Object
- Chronos::Core::DeployNormalizer
- Defined in:
- lib/chronos/core/deploy_normalizer.rb
Overview
Normalizes explicit deployment metadata into the versioned deploy payload.
Instance Method Summary collapse
- #call(attributes = {}) ⇒ Object
-
#initialize(config, options = {}) ⇒ DeployNormalizer
constructor
A new instance of DeployNormalizer.
Constructor Details
#initialize(config, options = {}) ⇒ DeployNormalizer
Returns a new instance of DeployNormalizer.
19 20 21 22 |
# File 'lib/chronos/core/deploy_normalizer.rb', line 19 def initialize(config, = {}) @config = config @id_generator = [:id_generator] || proc { SecureRandom.uuid } end |
Instance Method Details
#call(attributes = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/chronos/core/deploy_normalizer.rb', line 24 def call(attributes = {}) values = string_hash(attributes) payload = { "deploy_id" => deploy_id(values["deploy_id"] || @config.deploy_id), "environment" => bounded(values["environment"] || @config.environment, 128), "revision" => bounded(values["revision"] || @config.revision, 128), "version" => bounded(values["version"] || @config.app_version, 128), "repository" => repository(values["repository"]), "actor" => bounded(values["actor"], 128), "service" => bounded(values["service"] || @config.service_name, 128), "region" => bounded(values["region"] || @config.region, 128), "instance" => bounded(values["instance"] || @config.instance_id, 128) } validate!(payload) payload end |