ZIO K8s

ZIO K8s

  • Overview
  • CRDs
  • Operators
  • Internals
  • API
  • About

›Overview

Overview

  • Contents
  • Getting started
  • Working with resources
  • Generic code
  • Monocle support
  • QuickLens support
  • Test clients

QuickLens support

Quicklens is a library that helps writing code that modifies deeply nested data structures. This fits well some of the Kubernetes resources that can consists of many layers of data structures, including optional fields, lists and maps in the middle.

To enable the Quicklens support of zio-k8s an additional dependency has to be imported:

libraryDependencies += "com.coralogix" %% "zio-k8s-client-quicklens" % "1.4.9"

Then by importing both com.softwaremill.quicklens._ and com.coralogix.zio.k8s.quicklens._, the library can be used as expected:

import com.coralogix.zio.k8s.quicklens._
import com.coralogix.zio.k8s.model.core.v1.{ Container, Pod, PodSpec }
import com.coralogix.zio.k8s.model.pkg.apis.meta.v1.ObjectMeta
import com.softwaremill.quicklens._

val pod = Pod(
    metadata = ObjectMeta(
        name = "test-pod"
    ),
    spec = PodSpec(
        containers = Vector(
            Container(
                name = "test-container-1"
            )
        )
    )
)

val pod2 = pod.modify(_.metadata.each.namespace).setTo("namespace-1")

← Monocle supportTest clients →
ZIO K8s
GitHub
Star
Chat with us on Discord
discord
Additional resources
Scaladoc of zio-k8s
Copyright © 2022 ZIO Maintainers