e9bc5d8addd38c8d2f4da75248ba159a612c5ef7
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2018-2019 AT&T Intellectual Property.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.cds.blueprintsprocessor.message
18
19 import com.fasterxml.jackson.databind.JsonNode
20 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
21 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
22 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
23 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
24 import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
25 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
26 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.RelationshipTemplateBuilder
27 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.ServiceTemplateBuilder
28 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.TopologyTemplateBuilder
29 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.relationshipType
30
31 /** Relationships Types DSL for Message Producer */
32 fun ServiceTemplateBuilder.relationshipTypeConnectsToMessageProducer() {
33     val relationshipType = BluePrintTypes.relationshipTypeConnectsToMessageProducer()
34     if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf()
35     this.relationshipTypes!![relationshipType.id!!] = relationshipType
36 }
37
38 fun BluePrintTypes.relationshipTypeConnectsToMessageProducer(): RelationshipType {
39     return relationshipType(
40         id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER,
41         version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
42         derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
43         description = "Relationship connects to through message producer."
44     ) {
45         property(
46             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
47             BluePrintConstants.DATA_TYPE_MAP,
48             true,
49             "Connection Config details."
50         )
51         validTargetTypes(arrayListOf(BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT))
52     }
53 }
54
55 fun ServiceTemplateBuilder.relationshipTypeConnectsToMessageConsumer() {
56     val relationshipType = BluePrintTypes.relationshipTypeConnectsToMessageConsumer()
57     if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf()
58     this.relationshipTypes!![relationshipType.id!!] = relationshipType
59 }
60
61 fun BluePrintTypes.relationshipTypeConnectsToMessageConsumer(): RelationshipType {
62     return relationshipType(
63         id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_CONSUMER,
64         version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
65         derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
66         description = "Relationship type connects to message consumer."
67     ) {
68         property(
69             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
70             BluePrintConstants.DATA_TYPE_MAP,
71             true,
72             "Connection Config details."
73         )
74         validTargetTypes(arrayListOf(BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT))
75     }
76 }
77
78 /** Relationships Templates DSL for Message Producer */
79 fun TopologyTemplateBuilder.relationshipTemplateMessageProducer(
80     name: String,
81     description: String,
82     block: MessageProducerRelationshipTemplateBuilder.() -> Unit
83 ) {
84     if (relationshipTemplates == null) relationshipTemplates = hashMapOf()
85     val relationshipTemplate =
86         MessageProducerRelationshipTemplateBuilder(name, description).apply(block).build()
87     relationshipTemplates!![relationshipTemplate.id!!] = relationshipTemplate
88 }
89
90 class MessageProducerRelationshipTemplateBuilder(name: String, description: String) :
91     RelationshipTemplateBuilder(
92         name,
93         BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER, description
94     ) {
95
96     fun kafkaBasicAuth(block: KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
97         property(
98             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
99             BluePrintTypes.kafkaBasicAuthMessageProducerProperties(block)
100         )
101     }
102
103     fun kafkaSslAuth(block: KafkaSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
104         property(
105                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
106                 BluePrintTypes.kafkaSslAuthMessageProducerProperties(block)
107         )
108     }
109
110     fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
111         property(
112                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
113                 BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block)
114         )
115     }
116 }
117
118 fun BluePrintTypes.kafkaBasicAuthMessageProducerProperties(block: KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
119     val assignments = KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
120     assignments[KafkaBasicAuthMessageProducerProperties::type.name] =
121         MessageLibConstants.TYPE_KAFKA_BASIC_AUTH.asJsonPrimitive()
122     return assignments.asJsonType()
123 }
124
125 fun BluePrintTypes.kafkaSslAuthMessageProducerProperties(block: KafkaSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
126     val assignments = KafkaSslAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
127     assignments[KafkaSslAuthMessageProducerProperties::type.name] =
128             MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
129     return assignments.asJsonType()
130 }
131
132 fun BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block: KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
133     val assignments = KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
134     assignments[KafkaScramSslAuthMessageProducerProperties::type.name] =
135             MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
136     return assignments.asJsonType()
137 }
138
139 open class MessageProducerPropertiesAssignmentBuilder : PropertiesAssignmentBuilder()
140
141 open class KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder : MessageProducerPropertiesAssignmentBuilder() {
142
143     fun bootstrapServers(bootstrapServers: String) = bootstrapServers(bootstrapServers.asJsonPrimitive())
144
145     fun bootstrapServers(bootstrapServers: JsonNode) =
146         property(KafkaBasicAuthMessageProducerProperties::bootstrapServers, bootstrapServers)
147
148     fun topic(topic: String) = topic(topic.asJsonPrimitive())
149
150     fun topic(topic: JsonNode) =
151         property(KafkaBasicAuthMessageProducerProperties::topic, topic)
152
153     fun clientId(clientId: String) = bootstrapServers(clientId.asJsonPrimitive())
154
155     fun clientId(clientId: JsonNode) =
156         property(KafkaBasicAuthMessageProducerProperties::clientId, clientId)
157
158     fun acks(acks: String) = acks(acks.asJsonPrimitive())
159
160     fun acks(acks: JsonNode) = property(KafkaBasicAuthMessageProducerProperties::acks, acks)
161
162     fun maxBlockMs(maxBlockMs: Int) = maxBlockMs(maxBlockMs.asJsonPrimitive())
163
164     fun maxBlockMs(maxBlockMs: JsonNode) = property(KafkaBasicAuthMessageProducerProperties::maxBlockMs, maxBlockMs)
165
166     fun reconnectBackOffMs(reconnectBackOffMs: Int) = reconnectBackOffMs(reconnectBackOffMs.asJsonPrimitive())
167
168     fun reconnectBackOffMs(reconnectBackOffMs: JsonNode) = property(KafkaBasicAuthMessageProducerProperties::reconnectBackOffMs, reconnectBackOffMs)
169
170     fun enableIdempotence(enableIdempotence: Boolean) = enableIdempotence(enableIdempotence.asJsonPrimitive())
171
172     fun enableIdempotence(enableIdempotence: JsonNode) =
173         property(KafkaBasicAuthMessageProducerProperties::enableIdempotence, enableIdempotence)
174 }
175
176 open class KafkaSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder() {
177     fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
178
179     fun truststore(truststore: JsonNode) =
180             property(KafkaSslAuthMessageProducerProperties::truststore, truststore)
181
182     fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
183
184     fun truststorePassword(truststorePassword: JsonNode) =
185             property(KafkaSslAuthMessageProducerProperties::truststorePassword, truststorePassword)
186
187     fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
188
189     fun truststoreType(truststoreType: JsonNode) =
190             property(KafkaSslAuthMessageProducerProperties::truststoreType, truststoreType)
191
192     fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
193
194     fun keystore(keystore: JsonNode) =
195             property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
196
197     fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
198
199     fun keystorePassword(keystorePassword: JsonNode) =
200             property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
201
202     fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
203
204     fun keystoreType(keystoreType: JsonNode) =
205             property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
206
207     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
208             sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
209
210     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
211             property(KafkaSslAuthMessageProducerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
212 }
213
214 class KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaSslAuthMessageProducerPropertiesAssignmentBuilder() {
215     fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
216
217     fun saslMechanism(saslMechanism: JsonNode) =
218             property(KafkaScramSslAuthMessageProducerProperties::saslMechanism, saslMechanism)
219
220     fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
221
222     fun scramUsername(scramUsername: JsonNode) =
223             property(KafkaScramSslAuthMessageProducerProperties::scramUsername, scramUsername)
224
225     fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
226
227     fun scramPassword(scramPassword: JsonNode) =
228             property(KafkaScramSslAuthMessageProducerProperties::scramPassword, scramPassword)
229 }
230
231 /** Relationships Templates DSL for Message Consumer */
232 fun TopologyTemplateBuilder.relationshipTemplateMessageConsumer(
233     name: String,
234     description: String,
235     block: MessageConsumerRelationshipTemplateBuilder.() -> Unit
236 ) {
237     if (relationshipTemplates == null) relationshipTemplates = hashMapOf()
238     val relationshipTemplate =
239         MessageConsumerRelationshipTemplateBuilder(name, description).apply(block).build()
240     relationshipTemplates!![relationshipTemplate.id!!] = relationshipTemplate
241 }
242
243 class MessageConsumerRelationshipTemplateBuilder(name: String, description: String) :
244     RelationshipTemplateBuilder(
245         name,
246         BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_CONSUMER, description
247     ) {
248
249     fun kafkaBasicAuth(block: KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
250         property(
251             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
252             BluePrintTypes.kafkaBasicAuthMessageConsumerProperties(block)
253         )
254     }
255
256     fun kafkaSslAuth(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
257         property(
258                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
259                 BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block)
260         )
261     }
262
263     fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
264         property(
265                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
266                 BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block)
267         )
268     }
269
270     fun kafkaStreamsBasicAuth(block: KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
271         property(
272             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
273             BluePrintTypes.kafkaStreamsBasicAuthConsumerProperties(block)
274         )
275     }
276
277     fun kafkaStreamsSslAuth(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
278         property(
279                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
280                 BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block)
281         )
282     }
283
284     fun kafkaStreamsScramSslAuth(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
285         property(
286                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
287                 BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block)
288         )
289     }
290 }
291
292 fun BluePrintTypes.kafkaBasicAuthMessageConsumerProperties(block: KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
293     val assignments = KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
294     assignments[KafkaBasicAuthMessageConsumerProperties::type.name] =
295         MessageLibConstants.TYPE_KAFKA_BASIC_AUTH.asJsonPrimitive()
296     return assignments.asJsonType()
297 }
298
299 fun BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
300     val assignments = KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
301     assignments[KafkaSslAuthMessageConsumerProperties::type.name] =
302             MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
303     return assignments.asJsonType()
304 }
305
306 fun BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
307     val assignments = KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
308     assignments[KafkaScramSslAuthMessageConsumerProperties::type.name] =
309             MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
310     return assignments.asJsonType()
311 }
312
313 fun BluePrintTypes.kafkaStreamsBasicAuthConsumerProperties(block: KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
314     val assignments = KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
315     assignments[KafkaStreamsBasicAuthConsumerProperties::type.name] =
316         MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH.asJsonPrimitive()
317     return assignments.asJsonType()
318 }
319
320 fun BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
321     val assignments = KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
322     assignments[KafkaStreamsSslAuthConsumerProperties::type.name] =
323             MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH.asJsonPrimitive()
324     return assignments.asJsonType()
325 }
326
327 fun BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
328     val assignments = KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
329     assignments[KafkaStreamsScramSslAuthConsumerProperties::type.name] =
330             MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH.asJsonPrimitive()
331     return assignments.asJsonType()
332 }
333
334 open class MessageConsumerPropertiesAssignmentBuilder : PropertiesAssignmentBuilder()
335
336 /** KafkaBasicAuthMessageConsumerProperties assignment builder */
337 open class KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder : MessageConsumerPropertiesAssignmentBuilder() {
338
339     fun bootstrapServers(bootstrapServers: String) = bootstrapServers(bootstrapServers.asJsonPrimitive())
340
341     fun bootstrapServers(bootstrapServers: JsonNode) =
342         property(KafkaBasicAuthMessageConsumerProperties::bootstrapServers, bootstrapServers)
343
344     fun groupId(groupId: String) = groupId(groupId.asJsonPrimitive())
345
346     fun groupId(groupId: JsonNode) =
347         property(KafkaBasicAuthMessageConsumerProperties::groupId, groupId)
348
349     fun clientId(clientId: String) = clientId(clientId.asJsonPrimitive())
350
351     fun clientId(clientId: JsonNode) =
352         property(KafkaBasicAuthMessageConsumerProperties::clientId, clientId)
353
354     fun topic(topic: String) = topic(topic.asJsonPrimitive())
355
356     fun topic(topic: JsonNode) =
357         property(KafkaBasicAuthMessageConsumerProperties::topic, topic)
358
359     fun autoCommit(autoCommit: Boolean) = autoCommit(autoCommit.asJsonPrimitive())
360
361     fun autoCommit(autoCommit: JsonNode) =
362         property(KafkaBasicAuthMessageConsumerProperties::autoCommit, autoCommit)
363
364     fun autoOffsetReset(autoOffsetReset: String) = autoOffsetReset(autoOffsetReset.asJsonPrimitive())
365
366     fun autoOffsetReset(autoOffsetReset: JsonNode) =
367         property(KafkaBasicAuthMessageConsumerProperties::autoOffsetReset, autoOffsetReset)
368
369     fun pollMillSec(pollMillSec: Int) = pollMillSec(pollMillSec.asJsonPrimitive())
370
371     fun pollMillSec(pollMillSec: JsonNode) =
372         property(KafkaBasicAuthMessageConsumerProperties::pollMillSec, pollMillSec)
373
374     fun pollRecords(pollRecords: Int) = pollRecords(pollRecords.asJsonPrimitive())
375
376     fun pollRecords(pollRecords: JsonNode) =
377         property(KafkaBasicAuthMessageConsumerProperties::pollRecords, pollRecords)
378 }
379
380 open class KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder() {
381     fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
382
383     fun truststore(truststore: JsonNode) =
384             property(KafkaSslAuthMessageConsumerProperties::truststore, truststore)
385
386     fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
387
388     fun truststorePassword(truststorePassword: JsonNode) =
389             property(KafkaSslAuthMessageConsumerProperties::truststorePassword, truststorePassword)
390
391     fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
392
393     fun truststoreType(truststoreType: JsonNode) =
394             property(KafkaSslAuthMessageConsumerProperties::truststoreType, truststoreType)
395
396     fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
397
398     fun keystore(keystore: JsonNode) =
399             property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
400
401     fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
402
403     fun keystorePassword(keystorePassword: JsonNode) =
404             property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
405
406     fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
407
408     fun keystoreType(keystoreType: JsonNode) =
409             property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
410
411     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
412             sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
413
414     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
415             property(KafkaSslAuthMessageConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
416 }
417
418 class KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder() {
419     fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
420
421     fun saslMechanism(saslMechanism: JsonNode) =
422             property(KafkaScramSslAuthMessageConsumerProperties::saslMechanism, saslMechanism)
423
424     fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
425
426     fun scramUsername(scramUsername: JsonNode) =
427             property(KafkaScramSslAuthMessageConsumerProperties::scramUsername, scramUsername)
428
429     fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
430
431     fun scramPassword(scramPassword: JsonNode) =
432             property(KafkaScramSslAuthMessageConsumerProperties::scramPassword, scramPassword)
433 }
434
435 /** KafkaStreamsConsumerProperties assignment builder */
436 open class KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder : MessageConsumerPropertiesAssignmentBuilder() {
437
438     fun bootstrapServers(bootstrapServers: String) = bootstrapServers(bootstrapServers.asJsonPrimitive())
439
440     fun bootstrapServers(bootstrapServers: JsonNode) =
441         property(KafkaStreamsBasicAuthConsumerProperties::bootstrapServers, bootstrapServers)
442
443     fun applicationId(applicationId: String) = bootstrapServers(applicationId.asJsonPrimitive())
444
445     fun applicationId(applicationId: JsonNode) =
446         property(KafkaStreamsBasicAuthConsumerProperties::applicationId, applicationId)
447
448     fun topic(topic: String) = topic(topic.asJsonPrimitive())
449
450     fun topic(topic: JsonNode) =
451         property(KafkaStreamsBasicAuthConsumerProperties::topic, topic)
452
453     fun autoOffsetReset(autoOffsetReset: String) = autoOffsetReset(autoOffsetReset.asJsonPrimitive())
454
455     fun autoOffsetReset(autoOffsetReset: JsonNode) =
456         property(KafkaStreamsBasicAuthConsumerProperties::autoOffsetReset, autoOffsetReset)
457
458     fun processingGuarantee(processingGuarantee: String) = processingGuarantee(processingGuarantee.asJsonPrimitive())
459
460     fun processingGuarantee(processingGuarantee: JsonNode) =
461         property(KafkaStreamsBasicAuthConsumerProperties::processingGuarantee, processingGuarantee)
462 }
463
464 open class KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder() {
465     fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
466
467     fun truststore(truststore: JsonNode) =
468             property(KafkaStreamsSslAuthConsumerProperties::truststore, truststore)
469
470     fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
471
472     fun truststorePassword(truststorePassword: JsonNode) =
473             property(KafkaStreamsSslAuthConsumerProperties::truststorePassword, truststorePassword)
474
475     fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
476
477     fun truststoreType(truststoreType: JsonNode) =
478             property(KafkaStreamsSslAuthConsumerProperties::truststoreType, truststoreType)
479
480     fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
481
482     fun keystore(keystore: JsonNode) =
483             property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
484
485     fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
486
487     fun keystorePassword(keystorePassword: JsonNode) =
488             property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
489
490     fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
491
492     fun keystoreType(keystoreType: JsonNode) =
493             property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
494
495     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
496             sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
497
498     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
499             property(KafkaStreamsSslAuthConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
500 }
501
502 class KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder() {
503     fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
504
505     fun saslMechanism(saslMechanism: JsonNode) =
506             property(KafkaStreamsScramSslAuthConsumerProperties::saslMechanism, saslMechanism)
507
508     fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
509
510     fun scramUsername(scramUsername: JsonNode) =
511             property(KafkaStreamsScramSslAuthConsumerProperties::scramUsername, scramUsername)
512
513     fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
514
515     fun scramPassword(scramPassword: JsonNode) =
516             property(KafkaStreamsScramSslAuthConsumerProperties::scramPassword, scramPassword)
517 }