X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Fmodules%2Fcommons%2Frest-lib%2Fsrc%2Fmain%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Frest%2FRestClientPropertiesDSL.kt;fp=ms%2Fblueprintsprocessor%2Fmodules%2Fcommons%2Frest-lib%2Fsrc%2Fmain%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Frest%2FRestClientPropertiesDSL.kt;h=b1692d93a4bcbb749647c69623edb46f1bcfa358;hb=204ae9b5b21c48054d0d02761ef80b647c7e0473;hp=45b9e38275d1caccba6d52ee8e63b6ac31ce18d2;hpb=c7bd99a9bf07e3023ab510dfe84fc2acbe74299b;p=ccsdk%2Fcds.git diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt index 45b9e3827..b1692d93a 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt @@ -77,6 +77,10 @@ open class RestClientRelationshipTemplateBuilder(name: String, description: Stri property(BlueprintConstants.PROPERTY_CONNECTION_CONFIG, BlueprintTypes.tokenAuthRestClientProperties(block)) } + fun sslBasicAuth(block: SSLBasicAuthRestClientPropertiesBuilder.() -> Unit) { + property(BlueprintConstants.PROPERTY_CONNECTION_CONFIG, BlueprintTypes.sslBasicAuthRestClientProperties(block)) + } + fun sslAuth(block: SslAuthRestClientPropertiesAssignmentBuilder.() -> Unit) { property(BlueprintConstants.PROPERTY_CONNECTION_CONFIG, BlueprintTypes.sslRestClientProperties(block)) } @@ -94,6 +98,12 @@ fun BlueprintTypes.tokenAuthRestClientProperties(block: TokenAuthRestClientPrope return assignments.asJsonType() } +fun BlueprintTypes.sslBasicAuthRestClientProperties(block: SSLBasicAuthRestClientPropertiesBuilder.() -> Unit): JsonNode { + val assignments = SSLBasicAuthRestClientPropertiesBuilder().apply(block).build() + assignments[RestClientProperties::type.name] = RestLibConstants.TYPE_SSL_BASIC_AUTH.asJsonPrimitive() + return assignments.asJsonType() +} + fun BlueprintTypes.sslRestClientProperties(block: SslAuthRestClientPropertiesAssignmentBuilder.() -> Unit): JsonNode { val assignments = SslAuthRestClientPropertiesAssignmentBuilder().apply(block).build() assignments[RestClientProperties::type.name] = RestLibConstants.TYPE_SSL_NO_AUTH.asJsonPrimitive() @@ -182,10 +192,32 @@ open class SslAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAs open fun sslKeyPassword(sslKeyPassword: JsonNode) { property(SSLRestClientProperties::sslKeyPassword, sslKeyPassword) } + + open fun sslTrustIgnoreHostname(sslTrustIgnoreHostname: String) { + sslTrustIgnoreHostname(sslTrustIgnoreHostname.asJsonPrimitive()) + } + + open fun sslTrustIgnoreHostname(sslTrustIgnoreHostname: JsonNode) { + property(SSLRestClientProperties::sslTrustIgnoreHostname, sslTrustIgnoreHostname) + } } open class SSLBasicAuthRestClientPropertiesBuilder : SslAuthRestClientPropertiesAssignmentBuilder() { - // TODO() + open fun password(password: String) { + password(password.asJsonPrimitive()) + } + + open fun password(password: JsonNode) { + property(SSLBasicAuthRestClientProperties::password, password) + } + + open fun username(username: String) { + username(username.asJsonPrimitive()) + } + + open fun username(username: JsonNode) { + property(SSLBasicAuthRestClientProperties::username, username) + } } open class SSLTokenAuthRestClientPropertiesBuilder : SslAuthRestClientPropertiesAssignmentBuilder() {