Skip to content

cdancy/gradle-etcd-rest-plugin

Repository files navigation

Build Status

gradle-etcd-rest-plugin

alt tag

Gradle plugin for interacting with Etcd's REST API.

Setup

buildscript() {
 	repositories {
 		jcenter()
 	}
 	dependencies {
 		classpath group: 'com.cdancy', name: 'gradle-etcd-rest-plugin', version: '0.0.3', changing: true
 	}
 }

 apply plugin: 'gradle-etcd-rest-plugin'

Documentation

groovydocs can be found via github pages here

Tasks

Name Description
Version Get the version of etcd
Health Get the health of the cluster
Metrics Get the metrics of the cluster
Leader Get the current leader of cluster
Self Get the self instance of cluster
Store Get the store (statistics) for cluster
List List of members in cluster
SetKey Set key in cluster
GetKey Get key in cluster
DeleteKey Delete key in cluster

Extension

The etcdRest extension is provided to define the url and credentials for connecting to an Etcd instance. Using the extension, and subsequently exposing this potentially private information, is required only if one does NOT want to use the various means of setting the aforementioned properties noted in the Credentials section below.

 etcdRest {
 	url { "http://127.0.0.1:2379" } // Optional and defaults to http://127.0.0.1:2379
 	credentials { "admin:password" } // Optional and defaults to null
 }

On Url and Credentials

Because this plugin builds on top of etcd-rest library one can supply the url and credentials in any form this library accepts. Furthermore, etcd-rest allows the url and credentials to be optionally supplied through properties or environment variables. This gives great flexibility in the way the user wants to define and/or hide their url or credentials assuming one does not want to use the etcdRest extension.

Examples

The functional tests provide many examples that you can use in your own code.

Components

  • etcd-rest - java library used to interact with etcd program

Testing

Running functional tests against an existing etcd program can be done like so:

./gradlew functionalTest -PetcdUrl=http://127.0.0.1:2379

Running functional tests with docker can be done like so:

./gradlew functionalTest -PbootstrapDocker=true

Contributing

If you're looking for a new feature, or are interested in contributing, we'd love to review your PR. If you don't have a new feature in mind, and are more interested in just hacking on the project, feel free to reach out for suggestions.

Additional Resources

About

Gradle plugin for interacting with Etcd's REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages