Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 28-Jan-2019 | - | ||||
README.md | H A D | 28-Jan-2019 | 1.3 KiB | 68 | 49 | |
acl.go | H A D | 28-Jan-2019 | 15.1 KiB | 589 | 441 | |
acl_test.go | H A D | 28-Jan-2019 | 16.7 KiB | 727 | 575 | |
agent.go | H A D | 28-Jan-2019 | 29.1 KiB | 967 | 684 | |
agent_test.go | H A D | 28-Jan-2019 | 33.5 KiB | 1,492 | 1,242 | |
api.go | H A D | 28-Jan-2019 | 24.9 KiB | 900 | 572 | |
api_test.go | H A D | 28-Jan-2019 | 15.5 KiB | 645 | 549 | |
catalog.go | H A D | 28-Jan-2019 | 6 KiB | 245 | 200 | |
catalog_test.go | H A D | 28-Jan-2019 | 20.9 KiB | 931 | 742 | |
connect.go | H A D | 28-Jan-2019 | 299 | 13 | 7 | |
connect_ca.go | H A D | 28-Jan-2019 | 4.5 KiB | 175 | 111 | |
connect_ca_test.go | H A D | 28-Jan-2019 | 2.3 KiB | 96 | 70 | |
connect_intention.go | H A D | 28-Jan-2019 | 8.7 KiB | 303 | 190 | |
connect_intention_test.go | H A D | 28-Jan-2019 | 3.8 KiB | 188 | 141 | |
coordinate.go | H A D | 28-Jan-2019 | 2.6 KiB | 107 | 80 | |
coordinate_test.go | H A D | 28-Jan-2019 | 2.2 KiB | 107 | 83 | |
debug.go | H A D | 28-Jan-2019 | 2.7 KiB | 107 | 66 | |
debug_test.go | H A D | 28-Jan-2019 | 1.4 KiB | 84 | 65 | |
event.go | H A D | 28-Jan-2019 | 2.6 KiB | 105 | 81 | |
event_test.go | H A D | 28-Jan-2019 | 798 | 51 | 39 | |
health.go | H A D | 28-Jan-2019 | 9 KiB | 331 | 261 | |
health_test.go | H A D | 28-Jan-2019 | 9.9 KiB | 482 | 432 | |
kv.go | H A D | 28-Jan-2019 | 7.8 KiB | 287 | 206 | |
kv_test.go | H A D | 28-Jan-2019 | 11.6 KiB | 575 | 463 | |
lock.go | H A D | 28-Jan-2019 | 10.5 KiB | 387 | 252 | |
lock_test.go | H A D | 28-Jan-2019 | 11.9 KiB | 583 | 439 | |
operator.go | H A D | 28-Jan-2019 | 241 | 12 | 7 | |
operator_area.go | H A D | 28-Jan-2019 | 5.4 KiB | 195 | 115 | |
operator_autopilot.go | H A D | 28-Jan-2019 | 6.5 KiB | 220 | 127 | |
operator_autopilot_test.go | H A D | 28-Jan-2019 | 2.3 KiB | 108 | 91 | |
operator_keyring.go | H A D | 28-Jan-2019 | 2.2 KiB | 90 | 65 | |
operator_keyring_test.go | H A D | 28-Jan-2019 | 1.6 KiB | 74 | 60 | |
operator_raft.go | H A D | 28-Jan-2019 | 2.5 KiB | 90 | 49 | |
operator_raft_test.go | H A D | 28-Jan-2019 | 817 | 39 | 31 | |
operator_segment.go | H A D | 28-Jan-2019 | 289 | 12 | 9 | |
prepared_query.go | H A D | 28-Jan-2019 | 6.9 KiB | 213 | 100 | |
prepared_query_test.go | H A D | 28-Jan-2019 | 4.1 KiB | 181 | 147 | |
raw.go | H A D | 28-Jan-2019 | 749 | 25 | 13 | |
semaphore.go | H A D | 28-Jan-2019 | 13.8 KiB | 515 | 347 | |
semaphore_test.go | H A D | 28-Jan-2019 | 11.2 KiB | 532 | 405 | |
session.go | H A D | 28-Jan-2019 | 5.4 KiB | 225 | 175 | |
session_test.go | H A D | 28-Jan-2019 | 7.9 KiB | 436 | 337 | |
snapshot.go | H A D | 28-Jan-2019 | 1.2 KiB | 48 | 32 | |
snapshot_test.go | H A D | 28-Jan-2019 | 3.3 KiB | 135 | 100 | |
status.go | H A D | 28-Jan-2019 | 932 | 44 | 33 | |
status_test.go | H A D | 28-Jan-2019 | 587 | 40 | 32 | |
txn.go | H A D | 28-Jan-2019 | 6.2 KiB | 231 | 129 | |
txn_test.go | H A D | 28-Jan-2019 | 7 KiB | 291 | 267 |
README.md
1Consul API client 2================= 3 4This package provides the `api` package which attempts to 5provide programmatic access to the full Consul API. 6 7Currently, all of the Consul APIs included in version 0.6.0 are supported. 8 9Documentation 10============= 11 12The full documentation is available on [Godoc](https://godoc.org/github.com/hashicorp/consul/api) 13 14Usage 15===== 16 17Below is an example of using the Consul client: 18 19```go 20package main 21 22import "github.com/hashicorp/consul/api" 23import "fmt" 24 25func main() { 26 // Get a new client 27 client, err := api.NewClient(api.DefaultConfig()) 28 if err != nil { 29 panic(err) 30 } 31 32 // Get a handle to the KV API 33 kv := client.KV() 34 35 // PUT a new KV pair 36 p := &api.KVPair{Key: "REDIS_MAXCLIENTS", Value: []byte("1000")} 37 _, err = kv.Put(p, nil) 38 if err != nil { 39 panic(err) 40 } 41 42 // Lookup the pair 43 pair, _, err := kv.Get("REDIS_MAXCLIENTS", nil) 44 if err != nil { 45 panic(err) 46 } 47 fmt.Printf("KV: %v %s\n", pair.Key, pair.Value) 48} 49``` 50 51To run this example, start a Consul server: 52 53```bash 54consul agent -dev 55``` 56 57Copy the code above into a file such as `main.go`. 58 59Install and run. You'll see a key (`REDIS_MAXCLIENTS`) and value (`1000`) printed. 60 61```bash 62$ go get 63$ go run main.go 64KV: REDIS_MAXCLIENTS 1000 65``` 66 67After running the code, you can also view the values in the Consul UI on your local machine at http://localhost:8500/ui/dc1/kv 68