c659fdb8b42fe7b939dba362a2cface3725f50c7
[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 retries(retries: Int) = retries(retries.asJsonPrimitive())
163
164     fun retries(retries: JsonNode) = property(KafkaBasicAuthMessageProducerProperties::retries, retries)
165
166     fun enableIdempotence(enableIdempotence: Boolean) = enableIdempotence(enableIdempotence.asJsonPrimitive())
167
168     fun enableIdempotence(enableIdempotence: JsonNode) =
169         property(KafkaBasicAuthMessageProducerProperties::enableIdempotence, enableIdempotence)
170 }
171
172 open class KafkaSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder() {
173     fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
174
175     fun truststore(truststore: JsonNode) =
176             property(KafkaSslAuthMessageProducerProperties::truststore, truststore)
177
178     fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
179
180     fun truststorePassword(truststorePassword: JsonNode) =
181             property(KafkaSslAuthMessageProducerProperties::truststorePassword, truststorePassword)
182
183     fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
184
185     fun truststoreType(truststoreType: JsonNode) =
186             property(KafkaSslAuthMessageProducerProperties::truststoreType, truststoreType)
187
188     fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
189
190     fun keystore(keystore: JsonNode) =
191             property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
192
193     fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
194
195     fun keystorePassword(keystorePassword: JsonNode) =
196             property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
197
198     fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
199
200     fun keystoreType(keystoreType: JsonNode) =
201             property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
202
203     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
204             sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
205
206     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
207             property(KafkaSslAuthMessageProducerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
208 }
209
210 class KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaSslAuthMessageProducerPropertiesAssignmentBuilder() {
211     fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
212
213     fun saslMechanism(saslMechanism: JsonNode) =
214             property(KafkaScramSslAuthMessageProducerProperties::saslMechanism, saslMechanism)
215
216     fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
217
218     fun scramUsername(scramUsername: JsonNode) =
219             property(KafkaScramSslAuthMessageProducerProperties::scramUsername, scramUsername)
220
221     fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
222
223     fun scramPassword(scramPassword: JsonNode) =
224             property(KafkaScramSslAuthMessageProducerProperties::scramPassword, scramPassword)
225 }
226
227 /** Relationships Templates DSL for Message Consumer */
228 fun TopologyTemplateBuilder.relationshipTemplateMessageConsumer(
229     name: String,
230     description: String,
231     block: MessageConsumerRelationshipTemplateBuilder.() -> Unit
232 ) {
233     if (relationshipTemplates == null) relationshipTemplates = hashMapOf()
234     val relationshipTemplate =
235         MessageConsumerRelationshipTemplateBuilder(name, description).apply(block).build()
236     relationshipTemplates!![relationshipTemplate.id!!] = relationshipTemplate
237 }
238
239 class MessageConsumerRelationshipTemplateBuilder(name: String, description: String) :
240     RelationshipTemplateBuilder(
241         name,
242         BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_CONSUMER, description
243     ) {
244
245     fun kafkaBasicAuth(block: KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
246         property(
247             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
248             BluePrintTypes.kafkaBasicAuthMessageConsumerProperties(block)
249         )
250     }
251
252     fun kafkaSslAuth(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
253         property(
254                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
255                 BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block)
256         )
257     }
258
259     fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
260         property(
261                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
262                 BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block)
263         )
264     }
265
266     fun kafkaStreamsBasicAuth(block: KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
267         property(
268             BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
269             BluePrintTypes.kafkaStreamsBasicAuthConsumerProperties(block)
270         )
271     }
272
273     fun kafkaStreamsSslAuth(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
274         property(
275                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
276                 BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block)
277         )
278     }
279
280     fun kafkaStreamsScramSslAuth(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
281         property(
282                 BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
283                 BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block)
284         )
285     }
286 }
287
288 fun BluePrintTypes.kafkaBasicAuthMessageConsumerProperties(block: KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
289     val assignments = KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
290     assignments[KafkaBasicAuthMessageConsumerProperties::type.name] =
291         MessageLibConstants.TYPE_KAFKA_BASIC_AUTH.asJsonPrimitive()
292     return assignments.asJsonType()
293 }
294
295 fun BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
296     val assignments = KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
297     assignments[KafkaSslAuthMessageConsumerProperties::type.name] =
298             MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
299     return assignments.asJsonType()
300 }
301
302 fun BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
303     val assignments = KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
304     assignments[KafkaScramSslAuthMessageConsumerProperties::type.name] =
305             MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
306     return assignments.asJsonType()
307 }
308
309 fun BluePrintTypes.kafkaStreamsBasicAuthConsumerProperties(block: KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
310     val assignments = KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
311     assignments[KafkaStreamsBasicAuthConsumerProperties::type.name] =
312         MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH.asJsonPrimitive()
313     return assignments.asJsonType()
314 }
315
316 fun BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
317     val assignments = KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
318     assignments[KafkaStreamsSslAuthConsumerProperties::type.name] =
319             MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH.asJsonPrimitive()
320     return assignments.asJsonType()
321 }
322
323 fun BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
324     val assignments = KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
325     assignments[KafkaStreamsScramSslAuthConsumerProperties::type.name] =
326             MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH.asJsonPrimitive()
327     return assignments.asJsonType()
328 }
329
330 open class MessageConsumerPropertiesAssignmentBuilder : PropertiesAssignmentBuilder()
331
332 /** KafkaBasicAuthMessageConsumerProperties assignment builder */
333 open class KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder : MessageConsumerPropertiesAssignmentBuilder() {
334
335     fun bootstrapServers(bootstrapServers: String) = bootstrapServers(bootstrapServers.asJsonPrimitive())
336
337     fun bootstrapServers(bootstrapServers: JsonNode) =
338         property(KafkaBasicAuthMessageConsumerProperties::bootstrapServers, bootstrapServers)
339
340     fun groupId(groupId: String) = groupId(groupId.asJsonPrimitive())
341
342     fun groupId(groupId: JsonNode) =
343         property(KafkaBasicAuthMessageConsumerProperties::groupId, groupId)
344
345     fun clientId(clientId: String) = clientId(clientId.asJsonPrimitive())
346
347     fun clientId(clientId: JsonNode) =
348         property(KafkaBasicAuthMessageConsumerProperties::clientId, clientId)
349
350     fun topic(topic: String) = topic(topic.asJsonPrimitive())
351
352     fun topic(topic: JsonNode) =
353         property(KafkaBasicAuthMessageConsumerProperties::topic, topic)
354
355     fun autoCommit(autoCommit: Boolean) = autoCommit(autoCommit.asJsonPrimitive())
356
357     fun autoCommit(autoCommit: JsonNode) =
358         property(KafkaBasicAuthMessageConsumerProperties::autoCommit, autoCommit)
359
360     fun autoOffsetReset(autoOffsetReset: String) = autoOffsetReset(autoOffsetReset.asJsonPrimitive())
361
362     fun autoOffsetReset(autoOffsetReset: JsonNode) =
363         property(KafkaBasicAuthMessageConsumerProperties::autoOffsetReset, autoOffsetReset)
364
365     fun pollMillSec(pollMillSec: Int) = pollMillSec(pollMillSec.asJsonPrimitive())
366
367     fun pollMillSec(pollMillSec: JsonNode) =
368         property(KafkaBasicAuthMessageConsumerProperties::pollMillSec, pollMillSec)
369
370     fun pollRecords(pollRecords: Int) = pollRecords(pollRecords.asJsonPrimitive())
371
372     fun pollRecords(pollRecords: JsonNode) =
373         property(KafkaBasicAuthMessageConsumerProperties::pollRecords, pollRecords)
374 }
375
376 open class KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder() {
377     fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
378
379     fun truststore(truststore: JsonNode) =
380             property(KafkaSslAuthMessageConsumerProperties::truststore, truststore)
381
382     fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
383
384     fun truststorePassword(truststorePassword: JsonNode) =
385             property(KafkaSslAuthMessageConsumerProperties::truststorePassword, truststorePassword)
386
387     fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
388
389     fun truststoreType(truststoreType: JsonNode) =
390             property(KafkaSslAuthMessageConsumerProperties::truststoreType, truststoreType)
391
392     fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
393
394     fun keystore(keystore: JsonNode) =
395             property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
396
397     fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
398
399     fun keystorePassword(keystorePassword: JsonNode) =
400             property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
401
402     fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
403
404     fun keystoreType(keystoreType: JsonNode) =
405             property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
406
407     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
408             sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
409
410     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
411             property(KafkaSslAuthMessageConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
412 }
413
414 class KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder() {
415     fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
416
417     fun saslMechanism(saslMechanism: JsonNode) =
418             property(KafkaScramSslAuthMessageConsumerProperties::saslMechanism, saslMechanism)
419
420     fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
421
422     fun scramUsername(scramUsername: JsonNode) =
423             property(KafkaScramSslAuthMessageConsumerProperties::scramUsername, scramUsername)
424
425     fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
426
427     fun scramPassword(scramPassword: JsonNode) =
428             property(KafkaScramSslAuthMessageConsumerProperties::scramPassword, scramPassword)
429 }
430
431 /** KafkaStreamsConsumerProperties assignment builder */
432 open class KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder : MessageConsumerPropertiesAssignmentBuilder() {
433
434     fun bootstrapServers(bootstrapServers: String) = bootstrapServers(bootstrapServers.asJsonPrimitive())
435
436     fun bootstrapServers(bootstrapServers: JsonNode) =
437         property(KafkaStreamsBasicAuthConsumerProperties::bootstrapServers, bootstrapServers)
438
439     fun applicationId(applicationId: String) = bootstrapServers(applicationId.asJsonPrimitive())
440
441     fun applicationId(applicationId: JsonNode) =
442         property(KafkaStreamsBasicAuthConsumerProperties::applicationId, applicationId)
443
444     fun topic(topic: String) = topic(topic.asJsonPrimitive())
445
446     fun topic(topic: JsonNode) =
447         property(KafkaStreamsBasicAuthConsumerProperties::topic, topic)
448
449     fun autoOffsetReset(autoOffsetReset: String) = autoOffsetReset(autoOffsetReset.asJsonPrimitive())
450
451     fun autoOffsetReset(autoOffsetReset: JsonNode) =
452         property(KafkaStreamsBasicAuthConsumerProperties::autoOffsetReset, autoOffsetReset)
453
454     fun processingGuarantee(processingGuarantee: String) = processingGuarantee(processingGuarantee.asJsonPrimitive())
455
456     fun processingGuarantee(processingGuarantee: JsonNode) =
457         property(KafkaStreamsBasicAuthConsumerProperties::processingGuarantee, processingGuarantee)
458 }
459
460 open class KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder() {
461     fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
462
463     fun truststore(truststore: JsonNode) =
464             property(KafkaStreamsSslAuthConsumerProperties::truststore, truststore)
465
466     fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
467
468     fun truststorePassword(truststorePassword: JsonNode) =
469             property(KafkaStreamsSslAuthConsumerProperties::truststorePassword, truststorePassword)
470
471     fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
472
473     fun truststoreType(truststoreType: JsonNode) =
474             property(KafkaStreamsSslAuthConsumerProperties::truststoreType, truststoreType)
475
476     fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
477
478     fun keystore(keystore: JsonNode) =
479             property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
480
481     fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
482
483     fun keystorePassword(keystorePassword: JsonNode) =
484             property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
485
486     fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
487
488     fun keystoreType(keystoreType: JsonNode) =
489             property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
490
491     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
492             sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
493
494     fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
495             property(KafkaStreamsSslAuthConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
496 }
497
498 class KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder() {
499     fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
500
501     fun saslMechanism(saslMechanism: JsonNode) =
502             property(KafkaStreamsScramSslAuthConsumerProperties::saslMechanism, saslMechanism)
503
504     fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
505
506     fun scramUsername(scramUsername: JsonNode) =
507             property(KafkaStreamsScramSslAuthConsumerProperties::scramUsername, scramUsername)
508
509     fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
510
511     fun scramPassword(scramPassword: JsonNode) =
512             property(KafkaStreamsScramSslAuthConsumerProperties::scramPassword, scramPassword)
513 }