Method: Awspec::Generator::Spec::AlbListener#generate_rule_actions_specs

Defined in:
lib/awspec/generator/spec/alb_listener.rb

#generate_rule_actions_specs(actions) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/awspec/generator/spec/alb_listener.rb', line 55

def generate_rule_actions_specs(actions)
  actions_line = []
  actions.each do |action|
    action_line = []
    action_line.push("type: '#{action[:type]}'")
    action_line.push("order: #{action[:order]}") unless action[:order].nil?
    action_line.push("target_group_arn: '#{action[:target_group_arn]}'") unless action[:target_group_arn].nil?
    unless action[:redirect_config].nil?
      redirect_config = generate_action_configs_specs(action[:redirect_config])
      action_line.push("redirect_config: {#{redirect_config.join(', ')}}")
    end
    unless action[:fixed_response_config].nil?
      fixed_response_config = generate_action_configs_specs(action[:fixed_response_config])
      action_line.push("fixed_response_config: {#{fixed_response_config.join(', ')}}")
    end
    unless action[:authenticate_oidc_config].nil?
      authenticate_oidc_config = generate_action_configs_specs(action[:authenticate_oidc_config])
      action_line.push("authenticate_oidc_config: {#{authenticate_oidc_config.join(', ')}}")
    end
    actions_line.push("{#{action_line.join(', ')}}")
  end
  actions_line.join(', ')
end