Class: Orchparty::Kubernetes::ApplicationBuilder
- Defined in:
- lib/orchparty/dsl_parser_kubernetes.rb
Instance Method Summary collapse
- #_build ⇒ Object
- #all(&block) ⇒ Object
- #apply(name, &block) ⇒ Object
- #chart(name, &block) ⇒ Object
- #helm(name, &block) ⇒ Object
-
#initialize(name) ⇒ ApplicationBuilder
constructor
A new instance of ApplicationBuilder.
- #label(&block) ⇒ Object
- #mix(name) ⇒ Object
- #mixin(name, &block) ⇒ Object
- #secret_generic(name, &block) ⇒ Object
- #service(name, &block) ⇒ Object
- #template(path) ⇒ Object
- #variables(&block) ⇒ Object
- #volumes(&block) ⇒ Object
- #wait(&block) ⇒ Object
Methods inherited from Builder
Constructor Details
#initialize(name) ⇒ ApplicationBuilder
Returns a new instance of ApplicationBuilder.
131 132 133 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 131 def initialize(name) @application = AST.application(name:) end |
Instance Method Details
#_build ⇒ Object
230 231 232 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 230 def _build @application end |
#all(&block) ⇒ Object
144 145 146 147 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 144 def all(&block) @application.all = AllBuilder.build(block) self end |
#apply(name, &block) ⇒ Object
174 175 176 177 178 179 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 174 def apply(name, &block) result = ServiceBuilder.build(name, 'apply', block) @application.services[name] = result @application._service_order << name self end |
#chart(name, &block) ⇒ Object
196 197 198 199 200 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 196 def chart(name, &block) @application.services[name] = ChartBuilder.build(name, @application, 'chart', block) @application._service_order << name self end |
#helm(name, &block) ⇒ Object
159 160 161 162 163 164 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 159 def helm(name, &block) result = ServiceBuilder.build(name, 'helm', block) @application.services[name] = result @application._service_order << name self end |
#label(&block) ⇒ Object
166 167 168 169 170 171 172 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 166 def label(&block) name = SecureRandom.hex result = ServiceWithoutNameBuilder.build('label', block) @application.services[name] = result @application._service_order << name self end |
#mix(name) ⇒ Object
135 136 137 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 135 def mix(name) @application._mix << name end |
#mixin(name, &block) ⇒ Object
139 140 141 142 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 139 def mixin(name, &block) @application._mixins[name] = ApplicationMixinBuilder.build(block) self end |
#secret_generic(name, &block) ⇒ Object
181 182 183 184 185 186 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 181 def secret_generic(name, &block) result = ServiceBuilder.build(name, 'secret_generic', block) @application.services[name] = result @application._service_order << name self end |
#service(name, &block) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 213 def service(name, &block) chart_name = @application.name unless @application.services[chart_name] @application.services[chart_name] = AST.chart(name: chart_name, _type: 'chart') @application._service_order << chart_name end chart = @application.services[chart_name] result = ServiceBuilder.build(name, 'chart-service', block) name = "chart-#{chart.name}-#{name}" @application.services[name] = result @application._service_order << name chart._services << name self end |
#template(path) ⇒ Object
202 203 204 205 206 207 208 209 210 211 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 202 def template(path) chart_name = @application.name unless @application.services[chart_name] @application.services[chart_name] = AST.chart(name: chart_name, _type: 'chart') @application._service_order << chart_name end chart = @application.services[chart_name] chart.template = path self end |
#variables(&block) ⇒ Object
149 150 151 152 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 149 def variables(&block) @application._variables = VariableBuilder.build(block) self end |
#volumes(&block) ⇒ Object
154 155 156 157 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 154 def volumes(&block) @application.volumes = HashBuilder.build(block) self end |
#wait(&block) ⇒ Object
188 189 190 191 192 193 194 |
# File 'lib/orchparty/dsl_parser_kubernetes.rb', line 188 def wait(&block) name = SecureRandom.hex result = ServiceBuilder.build(name, 'wait', block) @application.services[name] = result @application._service_order << name self end |