pl.allegro.tech.servicemesh.envoycontrol.services.ServiceInstances.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of envoy-control-services Show documentation
Show all versions of envoy-control-services Show documentation
Production-ready Control Plane for Service Mesh based on Envoy Proxy.
The newest version!
package pl.allegro.tech.servicemesh.envoycontrol.services
data class ServiceInstance(
val id: String,
val tags: Set,
val address: String?,
val port: Int?,
val regular: Boolean = true,
val canary: Boolean = false,
val weight: Int = 1
)
data class ServiceInstances(
val serviceName: String,
val instances: Set
) {
fun withoutEmptyAddressInstances(): ServiceInstances =
if (instances.any { it.address.isNullOrEmpty() }) {
copy(instances = instances.asSequence()
.filter { !it.address.isNullOrEmpty() }
.toSet())
} else this
fun withoutInvalidPortInstances(): ServiceInstances =
if (instances.any { it.port == null }) {
copy(instances = instances.asSequence()
.filter { it.port != null }
.toSet())
} else this
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy