Class: Jets::Cfn::Builder::Parent
- Inherits:
-
Object
- Object
- Jets::Cfn::Builder::Parent
show all
- Includes:
- AwsServices, Interface, Stagger
- Defined in:
- lib/jets/cfn/builder/parent.rb,
lib/jets/cfn/builder/parent/stagger.rb
Defined Under Namespace
Modules: Stagger
Instance Method Summary
collapse
Methods included from Stagger
#add_stagger, #stagger_batch_size, #stagger_enabled
#apigateway, #aws_lambda, #aws_options, #cfn, #dynamodb, #logs, #s3, #s3_resource, #sns, #sqs, #sts
#lookup, #stack_exists?, #stack_in_progress?
included
Methods included from Interface
#add_description, #add_output, #add_outputs, #add_parameter, #add_parameters, #add_resource, #add_resources, #add_template_resource, #build, #build?, #template, #text, #write
#camelize
Constructor Details
#initialize(options = {}) ⇒ Parent
Returns a new instance of Parent.
7
8
9
10
|
# File 'lib/jets/cfn/builder/parent.rb', line 7
def initialize(options={})
@options = options
@template = ActiveSupport::HashWithIndifferentAccess.new(Resources: {})
end
|
Instance Method Details
#add_api_deployment ⇒ Object
133
134
135
136
|
# File 'lib/jets/cfn/builder/parent.rb', line 133
def add_api_deployment
resource = Jets::Cfn::Resource::Nested::Api::Deployment.new(@options)
add_child_resources(resource)
end
|
#add_api_gateway ⇒ Object
112
113
114
115
|
# File 'lib/jets/cfn/builder/parent.rb', line 112
def add_api_gateway
resource = Jets::Cfn::Resource::Nested::Api::Gateway.new(@options)
add_child_resources(resource)
end
|
#add_api_mapping ⇒ Object
#add_api_methods ⇒ Object
125
126
127
128
129
130
131
|
# File 'lib/jets/cfn/builder/parent.rb', line 125
def add_api_methods
pages = Api::Pages::Methods.pages
pages.each do |page|
resource = Jets::Cfn::Resource::Nested::Api::Methods.new(@options.merge(page_number: page.number))
add_child_resources(resource)
end
end
|
#add_api_resources ⇒ Object
117
118
119
120
121
122
123
|
# File 'lib/jets/cfn/builder/parent.rb', line 117
def add_api_resources
pages = Api::Pages::Resources.pages
pages.each do |page|
resource = Jets::Cfn::Resource::Nested::Api::Resources.new(@options.merge(page_number: page.number))
add_child_resources(resource)
end
end
|
#add_app_class_stack(path) ⇒ Object
96
97
98
99
100
|
# File 'lib/jets/cfn/builder/parent.rb', line 96
def add_app_class_stack(path)
resource = Jets::Cfn::Resource::Nested::AppClass.new(@options.merge(path: path))
add_stagger(resource)
add_child_resources(resource)
end
|
#add_authorizer_resources(path) ⇒ Object
102
103
104
105
|
# File 'lib/jets/cfn/builder/parent.rb', line 102
def add_authorizer_resources(path)
resource = Jets::Cfn::Resource::Nested::Authorizer.new(@options.merge(path: path))
add_child_resources(resource)
end
|
#add_child_resources(resource) ⇒ Object
144
145
146
147
|
# File 'lib/jets/cfn/builder/parent.rb', line 144
def add_child_resources(resource)
add_resource(resource)
add_outputs(resource.outputs)
end
|
#add_one_lambda_controller ⇒ Object
79
80
81
82
|
# File 'lib/jets/cfn/builder/parent.rb', line 79
def add_one_lambda_controller
resource = Jets::Cfn::Resource::Nested::OneController.new(@options)
add_child_resources(resource)
end
|
#add_shared_resources(path) ⇒ Object
107
108
109
110
|
# File 'lib/jets/cfn/builder/parent.rb', line 107
def add_shared_resources(path)
resource = Jets::Cfn::Resource::Nested::Shared.new(@options.merge(path: path))
add_child_resources(resource) if resource.resources?
end
|
#build_child_resources ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/jets/cfn/builder/parent.rb', line 53
def build_child_resources
return unless full?
add_one_lambda_controller if Jets.one_lambda_for_all_controllers? && Jets.config.mode != "job"
for_each_path(:app) do |path|
add_app_class_stack(path)
end
for_each_path(:shared) do |path|
add_shared_resources(path)
end
return if Jets::Router.no_routes?
for_each_path(:authorizers) do |path|
add_authorizer_resources(path)
end
add_api_gateway
add_api_resources
add_api_methods
add_api_deployment
add_api_mapping
end
|
#build_minimal_resources ⇒ Object
#compose ⇒ Object
13
14
15
16
|
# File 'lib/jets/cfn/builder/parent.rb', line 13
def compose
build_minimal_resources
build_child_resources
end
|
#for_each_path(type) ⇒ Object
#Jets.build_root/templates/shared-resources.yml
88
89
90
91
92
93
94
|
# File 'lib/jets/cfn/builder/parent.rb', line 88
def for_each_path(type)
expression = "#{Jets::Names.templates_folder}/#{type}-*"
Dir.glob(expression).each do |path|
next unless File.file?(path)
yield(path)
end
end
|
#full? ⇒ Boolean
75
76
77
|
# File 'lib/jets/cfn/builder/parent.rb', line 75
def full?
@options[:stack_type] == :full
end
|