Class: Wrapbox::Configuration
- Inherits:
-
Struct
- Object
- Struct
- Wrapbox::Configuration
- Defined in:
- lib/wrapbox/configuration.rb
Constant Summary collapse
- AVAILABLE_RUNNERS =
%i(docker ecs)
Instance Attribute Summary collapse
-
#additional_container_definitions ⇒ Object
Returns the value of attribute additional_container_definitions.
-
#capacity_provider_strategy ⇒ Object
Returns the value of attribute capacity_provider_strategy.
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#container_definition ⇒ Object
Returns the value of attribute container_definition.
-
#container_definitions ⇒ Object
Returns the value of attribute container_definitions.
-
#cpu ⇒ Object
Returns the value of attribute cpu.
-
#enable_ecs_managed_tags ⇒ Object
Returns the value of attribute enable_ecs_managed_tags.
-
#enable_execute_command ⇒ Object
Returns the value of attribute enable_execute_command.
-
#execution_role_arn ⇒ Object
Returns the value of attribute execution_role_arn.
-
#keep_container ⇒ Object
Returns the value of attribute keep_container.
-
#launch_instances ⇒ Object
Returns the value of attribute launch_instances.
-
#launch_type ⇒ Object
Returns the value of attribute launch_type.
-
#log_fetcher ⇒ Object
Returns the value of attribute log_fetcher.
-
#memory ⇒ Object
Returns the value of attribute memory.
-
#name ⇒ Object
Returns the value of attribute name.
-
#network_configuration ⇒ Object
Returns the value of attribute network_configuration.
-
#network_mode ⇒ Object
Returns the value of attribute network_mode.
-
#placement_constraints ⇒ Object
Returns the value of attribute placement_constraints.
-
#placement_strategy ⇒ Object
Returns the value of attribute placement_strategy.
-
#propagate_tags ⇒ Object
Returns the value of attribute propagate_tags.
-
#region ⇒ Object
Returns the value of attribute region.
-
#requires_compatibilities ⇒ Object
Returns the value of attribute requires_compatibilities.
-
#retry ⇒ Object
Returns the value of attribute retry.
-
#retry_interval ⇒ Object
Returns the value of attribute retry_interval.
-
#retry_interval_multiplier ⇒ Object
Returns the value of attribute retry_interval_multiplier.
-
#revision ⇒ Object
Returns the value of attribute revision.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#task_definition ⇒ Object
Returns the value of attribute task_definition.
-
#task_definition_name ⇒ Object
Returns the value of attribute task_definition_name.
-
#task_role_arn ⇒ Object
Returns the value of attribute task_role_arn.
-
#volumes ⇒ Object
Returns the value of attribute volumes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Configuration
constructor
A new instance of Configuration.
- #run(class_name, method_name, args, runner: nil, **options) ⇒ Object
- #run_cmd(*cmd, runner: nil, **options) ⇒ Object
- #runner_class(overrided_runner = nil) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Configuration
Returns a new instance of Configuration.
79 80 81 |
# File 'lib/wrapbox/configuration.rb', line 79 def initialize(*args) super end |
Instance Attribute Details
#additional_container_definitions ⇒ Object
Returns the value of attribute additional_container_definitions
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def additional_container_definitions @additional_container_definitions end |
#capacity_provider_strategy ⇒ Object
Returns the value of attribute capacity_provider_strategy
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def capacity_provider_strategy @capacity_provider_strategy end |
#cluster ⇒ Object
Returns the value of attribute cluster
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def cluster @cluster end |
#container_definition ⇒ Object
Returns the value of attribute container_definition
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def container_definition @container_definition end |
#container_definitions ⇒ Object
Returns the value of attribute container_definitions
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def container_definitions @container_definitions end |
#cpu ⇒ Object
Returns the value of attribute cpu
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def cpu @cpu end |
#enable_ecs_managed_tags ⇒ Object
Returns the value of attribute enable_ecs_managed_tags
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def @enable_ecs_managed_tags end |
#enable_execute_command ⇒ Object
Returns the value of attribute enable_execute_command
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def enable_execute_command @enable_execute_command end |
#execution_role_arn ⇒ Object
Returns the value of attribute execution_role_arn
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def execution_role_arn @execution_role_arn end |
#keep_container ⇒ Object
Returns the value of attribute keep_container
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def keep_container @keep_container end |
#launch_instances ⇒ Object
Returns the value of attribute launch_instances
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def launch_instances @launch_instances end |
#launch_type ⇒ Object
Returns the value of attribute launch_type
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def launch_type @launch_type end |
#log_fetcher ⇒ Object
Returns the value of attribute log_fetcher
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def log_fetcher @log_fetcher end |
#memory ⇒ Object
Returns the value of attribute memory
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def memory @memory end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def name @name end |
#network_configuration ⇒ Object
Returns the value of attribute network_configuration
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def network_configuration @network_configuration end |
#network_mode ⇒ Object
Returns the value of attribute network_mode
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def network_mode @network_mode end |
#placement_constraints ⇒ Object
Returns the value of attribute placement_constraints
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def placement_constraints @placement_constraints end |
#placement_strategy ⇒ Object
Returns the value of attribute placement_strategy
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def placement_strategy @placement_strategy end |
#propagate_tags ⇒ Object
Returns the value of attribute propagate_tags
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def @propagate_tags end |
#region ⇒ Object
Returns the value of attribute region
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def region @region end |
#requires_compatibilities ⇒ Object
Returns the value of attribute requires_compatibilities
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def requires_compatibilities @requires_compatibilities end |
#retry ⇒ Object
Returns the value of attribute retry
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def retry @retry end |
#retry_interval ⇒ Object
Returns the value of attribute retry_interval
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def retry_interval @retry_interval end |
#retry_interval_multiplier ⇒ Object
Returns the value of attribute retry_interval_multiplier
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def retry_interval_multiplier @retry_interval_multiplier end |
#revision ⇒ Object
Returns the value of attribute revision
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def revision @revision end |
#runner ⇒ Object
Returns the value of attribute runner
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def runner @runner end |
#tags ⇒ Object
Returns the value of attribute tags
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def @tags end |
#task_definition ⇒ Object
Returns the value of attribute task_definition
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def task_definition @task_definition end |
#task_definition_name ⇒ Object
Returns the value of attribute task_definition_name
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def task_definition_name @task_definition_name end |
#task_role_arn ⇒ Object
Returns the value of attribute task_role_arn
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def task_role_arn @task_role_arn end |
#volumes ⇒ Object
Returns the value of attribute volumes
6 7 8 |
# File 'lib/wrapbox/configuration.rb', line 6 def volumes @volumes end |
Class Method Details
.load_config(config) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/wrapbox/configuration.rb', line 40 def self.load_config(config) new( config["name"], config["task_definition_name"], config["revision"], config["runner"] ? config["runner"].to_sym : :docker, config["cluster"], config["region"], config["retry"] || 0, config["retry_interval"] || 1, config["retry_interval_multiplier"] || 2, config["container_definition"]&.deep_symbolize_keys, config["container_definitions"]&.map(&:deep_symbolize_keys) || [], config["volumes"]&.map(&:deep_symbolize_keys) || [], config["placement_constraints"]&.map(&:deep_symbolize_keys) || [], config["placement_strategy"]&.map(&:deep_symbolize_keys) || [], config["capacity_provider_strategy"]&.map(&:deep_symbolize_keys) || [], config["launch_type"], config["requires_compatibilities"] || ["EC2"], config["task_definition"]&.deep_symbolize_keys, config["additional_container_definitions"]&.map(&:deep_symbolize_keys) || [], config["network_mode"], config["network_configuration"]&.deep_symbolize_keys, config["cpu"]&.to_s, config["memory"]&.to_s, config["task_role_arn"], config["execution_role_arn"], config["keep_container"], config["log_fetcher"]&.deep_symbolize_keys, config["tags"], config["enable_ecs_managed_tags"], config["propagate_tags"], config["launch_instances"]&.deep_symbolize_keys, config["enable_execute_command"] ) end |
Instance Method Details
#run(class_name, method_name, args, runner: nil, **options) ⇒ Object
90 91 92 93 94 |
# File 'lib/wrapbox/configuration.rb', line 90 def run(class_name, method_name, args, runner: nil, **) klass = runner_class(runner) , parameters = klass.() klass.new(to_h.merge()).run(class_name, method_name, args, **parameters) end |
#run_cmd(*cmd, runner: nil, **options) ⇒ Object
96 97 98 99 100 |
# File 'lib/wrapbox/configuration.rb', line 96 def run_cmd(*cmd, runner: nil, **) klass = runner_class(runner) , parameters = klass.() klass.new(to_h.merge()).run_cmd(*cmd, **parameters) end |
#runner_class(overrided_runner = nil) ⇒ Object
83 84 85 86 87 88 |
# File 'lib/wrapbox/configuration.rb', line 83 def runner_class(overrided_runner = nil) r = overrided_runner || runner raise "#{r} is unsupported runner" unless AVAILABLE_RUNNERS.include?(r.to_sym) require "wrapbox/runner/#{r}" Wrapbox::Runner.const_get(r.to_s.camelcase) end |