Skip to content

Commit

Permalink
fix checkstyles
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferdudas97 committed Dec 27, 2024
1 parent f644070 commit 5c55e8e
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ data class ProxySettings(
)
}


fun Value.toPathNormalization(snapshotProperties: SnapshotProperties): PathNormalizationPolicy {
return PathNormalizationPolicy(
normalizationEnabled = this.field("enabled")?.boolValue ?: snapshotProperties.pathNormalization.enabled,
Expand All @@ -82,6 +81,7 @@ fun Value.toPathNormalization(snapshotProperties: SnapshotProperties): PathNorma
?: snapshotProperties.pathNormalization.pathWithEscapedSlashesAction
)
}

fun getPathNormalization(proto: Value?, snapshotProperties: SnapshotProperties): PathNormalizationPolicy {
val defaultNormalizationConfig = PathNormalizationPolicy(
snapshotProperties.pathNormalization.enabled,
Expand Down Expand Up @@ -366,7 +366,7 @@ fun Value?.toIncoming(properties: SnapshotProperties): Incoming {
rateLimitEndpoints = rateLimitEndpointsField.orEmpty().map(Value::toIncomingRateLimitEndpoint),
// if there is no endpoint field defined in metadata, we allow for all traffic
permissionsEnabled = endpointsField != null,
pathNormalizationPolicy = this?.field("path_normalization")?.toPathNormalization(properties),
pathNormalizationPolicy = this?.field("path_normalization")?.toPathNormalization(properties),
healthCheck = this?.field("healthCheck").toHealthCheck(),
roles = this?.field("roles")?.list().orEmpty().map { Role(it) },
timeoutPolicy = this?.field("timeoutPolicy").toIncomingTimeoutPolicy(),
Expand Down Expand Up @@ -412,7 +412,8 @@ fun Value.toIncomingEndpoint(properties: SnapshotProperties): IncomingEndpoint {

if (isMoreThanOnePropertyDefined(paths, path, pathPrefix, pathRegex)) {
throw NodeMetadataValidationException(
"Precisely one of 'paths', 'path', 'pathPrefix' or 'pathRegex' field is allowed")
"Precisely one of 'paths', 'path', 'pathPrefix' or 'pathRegex' field is allowed"
)
}

val methods = this.field("methods")?.list().orEmpty().map { it.stringValue }.toSet()
Expand All @@ -422,9 +423,13 @@ fun Value.toIncomingEndpoint(properties: SnapshotProperties): IncomingEndpoint {

return when {
paths.isNotEmpty() -> IncomingEndpoint(
paths, "", PathMatchingType.PATH, methods, clients, unlistedClientsPolicy, oauth)
paths, "", PathMatchingType.PATH, methods, clients, unlistedClientsPolicy, oauth
)

path != null -> IncomingEndpoint(
paths, path, PathMatchingType.PATH, methods, clients, unlistedClientsPolicy, oauth)
paths, path, PathMatchingType.PATH, methods, clients, unlistedClientsPolicy, oauth
)

pathPrefix != null -> IncomingEndpoint(
paths, pathPrefix, PathMatchingType.PATH_PREFIX, methods, clients, unlistedClientsPolicy, oauth
)
Expand All @@ -434,7 +439,8 @@ fun Value.toIncomingEndpoint(properties: SnapshotProperties): IncomingEndpoint {
)

else -> throw NodeMetadataValidationException(
"One of 'paths', 'path', 'pathPrefix' or 'pathRegex' field is required")
"One of 'paths', 'path', 'pathPrefix' or 'pathRegex' field is required"
)
}
}

Expand Down

0 comments on commit 5c55e8e

Please sign in to comment.