{"id":13651760,"url":"https://github.com/getnelson/helm","last_synced_at":"2025-04-22T22:32:00.110Z","repository":{"id":57732118,"uuid":"162860790","full_name":"getnelson/helm","owner":"getnelson","description":"A native Scala client for interacting with Consul","archived":false,"fork":true,"pushed_at":"2021-09-14T13:58:32.000Z","size":193,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-10T02:34:21.506Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Verizon/helm","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getnelson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-23T03:59:45.000Z","updated_at":"2022-05-02T22:49:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/getnelson/helm","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnelson%2Fhelm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnelson%2Fhelm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnelson%2Fhelm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnelson%2Fhelm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getnelson","download_url":"https://codeload.github.com/getnelson/helm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250334036,"owners_count":21413495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T02:00:52.106Z","updated_at":"2025-04-22T22:31:59.818Z","avatar_url":"https://github.com/getnelson.png","language":"Scala","readme":"# Helm\n\n![Logo](docs/src/img/logo.png)\n\n[![Build Status](https://travis-ci.org/getnelson/helm.svg?branch=master)](https://travis-ci.org/getnelson/helm)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.getnelson.helm/core_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.getnelson.helm/core_2.11)\n[![codecov](https://codecov.io/gh/getnelson/helm/branch/master/graph/badge.svg)](https://codecov.io/gh/getnelson/helm)\n\nA native [Scala](http://scala-lang.org) client for interacting with [Consul](https://www.consul.io/). There is currently one supported client, which uses [http4s](http://http4s.org) to make HTTP calls to Consul. Alternative implementations could be added with relative ease by providing an additional free interpreter for the `ConsulOp` algebra.\n\n## Getting Started\n\nAdd the following to your `build.sbt`:\n\n    libraryDependencies += \"io.getnelson.helm\" %% \"http4s\" % \"x.y.z\"\n\nWhere `x.y.z` is the desired Helm version. Check for the latest release [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.getnelson.helm%22).\n\n### Algebra\n\nConsul operations are specified by the `ConsulOp` algebra.  Two\nexamples are `get` and `set`:\n\n```\nimport ConsulOp.ConsulOpF\n\nval setAlgebra: ConsulOpF[Unit] = ConsulOp.kvSet(key = \"testKey\", value = \"testValue\".getBytes)\n\nval getAlgebra: ConsulOpF[QueryResponse[List[KVGetResult]]] = ConsulOp.kvGet(key = \"testKey\",\n                                                                             recurse = Some(false),\n                                                                             datacenter = None,\n                                                                             separator = None,\n                                                                             index = None,\n                                                                             maxWait = None)\n```\n\nThese are however just descriptions of what operations the program might perform in the future, just creating these operations does not\nactually execute the operations. In order to perform the gets and sets, we need to use the [http4s](http://http4s.org) interpreter.\n\n### The http4s interpreter\n\nFirst we create an interpreter, which requires an http4s client and\na base url for consul:\n\n```\nimport scala.concurrent.ExecutionContext\nimport cats.effect.IO\nimport helm.http4s._\nimport org.http4s.Uri.uri\nimport org.http4s.client.blaze.BlazeClientBuilder\n\nval ec = ExecutionContext.global\nimplicit val contextShift = IO.contextShift(ec)\n// It's better to run everything inside of resource.use() where possible, but this makes for a simpler example\nval client = BlazeClientBuilder[IO](ec).resource.allocated.unsafeRunSync()._1\n\nval baseUrl = uri(\"http://127.0.0.1:8500\")\n\nval interpreter = new Http4sConsulClient(baseUrl, client)\n```\n\nNow we can apply commands to our http4s client to get back IOs\nwhich actually interact with consul.\n\n```\nimport helm._\nimport cats.effect.IO\n\n\nval set: IO[Unit]                             = helm.run(interpreter, setAlgebra)\nval get: IO[QueryResponse[List[KVGetResult]]] = helm.run(interpreter, getAlgebra)\n\n// actually execute the calls\nval setResult: Unit =                             set.unsafeRunSync()\nval getResult: QueryResponse[List[KVGetResult]] = get.unsafeRunSync()\n\n```\n\nTypically, the *Helm* algebra would be a part of a `Coproduct` with other algebras in a larger program, so running the `IO` immediately after `helm.run` is not typical.\n\n## Contributing\n\nContributions are welcome; particularly to expand the algebra with additional operations that are supported by Consul but not yet supported by *Helm*.\n\n","funding_links":[],"categories":["Projects"],"sub_categories":["Programming Language Clients"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetnelson%2Fhelm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetnelson%2Fhelm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetnelson%2Fhelm/lists"}