Skip to content

Commit 19c72ec

Browse files
authored
Access to encryption keys export capability (#10)
* exposes exportKeys oas capability * help message * graal json field added Co-authored-by: Bart van Deenen <bartvandeenen@streammachine.io>
1 parent 5b6dffe commit 19c72ec

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

src/main/kotlin/io/streammachine/api/cli/commands/Exporters.kt

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package io.streammachine.api.cli.commands
33
import com.github.ajalt.clikt.core.CliktCommand
44
import com.github.ajalt.clikt.core.subcommands
55
import com.github.ajalt.clikt.parameters.arguments.argument
6+
import com.github.ajalt.clikt.parameters.options.flag
67
import com.github.ajalt.clikt.parameters.options.option
78
import com.github.ajalt.clikt.parameters.options.required
89
import com.github.ajalt.clikt.parameters.types.choice
@@ -55,9 +56,14 @@ open class ExportersGet : CliktCommand(
5556
"--exporter-name",
5657
help = "Name of the exporter that is linked to this stream."
5758
).required()
59+
internal val exportKeys by option(
60+
"-k",
61+
"--export-keys",
62+
help = "Export the encryption keys"
63+
).flag()
5864

5965
override fun run() {
60-
"/v1/exporters/$streamName/$exporterName"
66+
"/v1/exporters/$streamName/$exporterName?exportKeys=$exportKeys"
6167
.httpGet()
6268
.printResponse()
6369
}
@@ -73,9 +79,14 @@ open class ExportersDelete : CliktCommand(
7379
"--exporter-name",
7480
help = "Name of the exporter that is linked to this stream."
7581
).required()
82+
internal val exportKeys by option(
83+
"-k",
84+
"--export-keys",
85+
help = "Export the encryption keys"
86+
).flag()
7687

7788
override fun run() {
78-
"/v1/exporters/$streamName/$exporterName"
89+
"/v1/exporters/$streamName/$exporterName?exportKeys=$exportKeys"
7990
.httpDelete()
8091
.printResponse()
8192
}
@@ -122,6 +133,13 @@ open class ExportersCreate : CliktCommand(
122133
help = "Optional path prefix. Every object that is exported to the configured sink will have this path prepended to the resource destination."
123134
)
124135

136+
internal val exportKeys by option(
137+
"-k",
138+
"--export-keys",
139+
help = "Export the encryption keys"
140+
).flag()
141+
142+
125143
override fun run() {
126144
"/v1/exporters/$streamName"
127145
.httpPut()
@@ -133,9 +151,10 @@ open class ExportersCreate : CliktCommand(
133151
intervalSecs,
134152
ExporterType.BATCH,
135153
pathPrefix,
136-
null
154+
null,
155+
exportKeys
137156
)
138157
)
139158
.printResponse()
140159
}
141-
}
160+
}

src/main/kotlin/io/streammachine/api/cli/commands/Outputs.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ class OutputStreamExportersCreate : StreamExportersCreate() {
158158
intervalSecs,
159159
ExporterType.BATCH,
160160
pathPrefix,
161-
null
161+
null,
162+
false
162163
)
163164
)
164165
.printResponse()
@@ -177,4 +178,4 @@ class OutputStreamExportersDelete : StreamExportersDelete() {
177178
.httpDelete()
178179
.printResponse()
179180
}
180-
}
181+
}

src/main/kotlin/io/streammachine/api/cli/commands/Streams.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package io.streammachine.api.cli.commands
33
import com.github.ajalt.clikt.core.CliktCommand
44
import com.github.ajalt.clikt.core.subcommands
55
import com.github.ajalt.clikt.parameters.arguments.argument
6+
import com.github.ajalt.clikt.parameters.options.flag
67
import com.github.ajalt.clikt.parameters.options.multiple
78
import com.github.ajalt.clikt.parameters.options.option
89
import com.github.ajalt.clikt.parameters.options.required
@@ -156,6 +157,10 @@ open class StreamExportersCreate : CliktCommand(
156157
"--path-prefix",
157158
help = "Optional path prefix. Every object that is exported to the configured sink will have this path prepended to the resource destination."
158159
)
160+
internal val exportKeys by option(
161+
"-k",
162+
"--export-keys"
163+
).flag()
159164

160165
override fun run() {
161166
"/v1/streams/$streamName/exporters"
@@ -168,7 +173,8 @@ open class StreamExportersCreate : CliktCommand(
168173
intervalSecs,
169174
ExporterType.BATCH,
170175
pathPrefix,
171-
null
176+
null,
177+
exportKeys
172178
)
173179
)
174180
.printResponse()
@@ -186,9 +192,14 @@ open class StreamExportersDelete : CliktCommand(
186192
help = "Name of the stream that is linked to this exporter."
187193
).required()
188194

195+
internal val exportKeys by option(
196+
"-k",
197+
"--export-keys"
198+
).flag()
199+
189200
override fun run() {
190-
"/v1/streams/$streamName/exporters/$name"
201+
"/v1/streams/$streamName/exporters/$name?exportKeys=$exportKeys"
191202
.httpDelete()
192203
.printResponse()
193204
}
194-
}
205+
}

src/main/kotlin/io/streammachine/api/cli/common/Domain.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ data class ExporterCreateRequest(
3838
val intervalSecs: Int,
3939
val type: ExporterType = ExporterType.BATCH,
4040
val pathPrefix: String?,
41-
val extraConfig: String?
41+
val extraConfig: String?,
42+
val exportKeys: Boolean
4243
)
4344

4445
enum class ExporterType {
@@ -57,5 +58,4 @@ enum class SinkType {
5758
data class ConsentLevelMappingCreateRequest(
5859
val id: Int,
5960
val name: String
60-
)
61-
61+
)

src/main/resources/reflection.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@
184184
{
185185
"name": "extraConfig",
186186
"allowWrite": true
187+
},
188+
{
189+
"name": "exportKeys",
190+
"allowWrite": true
187191
}
188192
]
189193
},
@@ -301,4 +305,4 @@
301305
}
302306
]
303307
}
304-
]
308+
]

0 commit comments

Comments
 (0)