Skip to content

Commit 239cb91

Browse files
authored
Merge pull request #53 from sourceplusplus/dev
v0.4.7
2 parents 95b8271 + 1c4b18b commit 239cb91

File tree

6 files changed

+60
-6
lines changed

6 files changed

+60
-6
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
kotlin.code.style=official
22

3-
projectVersion=0.4.6
3+
projectVersion=0.4.7
44

55
kotlinVersion=1.6.10
66
vertxVersion=4.2.6

src/commonMain/kotlin/spp.protocol/artifact/metrics/MetricType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ enum class MetricType {
6161
return (values().find { it.name == name }
6262
?: when (name) {
6363
"endpoint_cpm" -> Throughput_Average
64-
"endpoint_avg" -> ResponseTime_Average
64+
"endpoint_avg", "endpoint_resp_time" -> ResponseTime_Average
6565
"endpoint_sla" -> ServiceLevelAgreement_Average
6666
"endpoint_percentile" -> ResponseTime_99Percentile
6767
else -> throw UnsupportedOperationException(name)

src/commonMain/kotlin/spp.protocol/platform/auth/DataRedaction.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,17 @@ package spp.protocol.platform.auth
1919

2020
data class DataRedaction(
2121
val id: String,
22-
val redactionPattern: String
23-
)
22+
val type: RedactionType,
23+
val lookup: String,
24+
val replacement: String
25+
) {
26+
override fun equals(other: Any?): Boolean {
27+
if (this === other) return true
28+
if (other == null || this::class != other::class) return false
29+
other as DataRedaction
30+
if (id != other.id) return false
31+
return true
32+
}
33+
34+
override fun hashCode(): Int = id.hashCode()
35+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Source++, the open-source live coding platform.
3+
* Copyright (C) 2022 CodeBrig, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published
7+
* by the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
package spp.protocol.platform.auth
19+
20+
/**
21+
* The type of redaction lookup to perform.
22+
*/
23+
enum class RedactionType {
24+
IDENTIFIER_MATCH,
25+
VALUE_REGEX
26+
}

src/commonMain/kotlin/spp.protocol/platform/auth/RolePermission.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ enum class RolePermission(val manager: Boolean, val commandType: CommandType) {
4545
//instrument access
4646
GET_ACCESS_PERMISSIONS(true, LIVE_SERVICE),
4747
GET_DATA_REDACTIONS(true, LIVE_SERVICE),
48-
ADD_DATA_REDACTION(true, LIVE_SERVICE),
49-
REMOVE_DATA_REDACTION(true, LIVE_SERVICE),
48+
UPDATE_DATA_REDACTION(true, LIVE_SERVICE),
5049
ADD_ACCESS_PERMISSION(true, LIVE_SERVICE),
5150
REMOVE_ACCESS_PERMISSION(true, LIVE_SERVICE),
5251

src/jvmMain/kotlin/spp/protocol/marshall/ProtocolMarshaller.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import spp.protocol.instrument.event.LiveBreakpointHit
3838
import spp.protocol.instrument.event.LiveInstrumentRemoved
3939
import spp.protocol.instrument.event.LiveLogHit
4040
import spp.protocol.instrument.variable.LiveVariable
41+
import spp.protocol.platform.auth.DataRedaction
42+
import spp.protocol.platform.auth.RedactionType
4143
import spp.protocol.platform.developer.SelfInfo
4244
import spp.protocol.platform.general.Service
4345
import spp.protocol.platform.status.ActiveInstance
@@ -407,4 +409,19 @@ object ProtocolMarshaller {
407409
value.getJsonArray("arguments").list.map { it.toString() }
408410
)
409411
}
412+
413+
@JvmStatic
414+
fun serializeDataRedaction(value: DataRedaction): JsonObject {
415+
return JsonObject(Json.encode(value))
416+
}
417+
418+
@JvmStatic
419+
fun deserializeDataRedaction(value: JsonObject): DataRedaction {
420+
return DataRedaction(
421+
value.getString("id"),
422+
RedactionType.valueOf(value.getString("type")),
423+
value.getString("lookup"),
424+
value.getString("replacement")
425+
)
426+
}
410427
}

0 commit comments

Comments
 (0)