Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 14-Oct-2021 | - | ||||
LICENSE | H A D | 14-Oct-2021 | 15.6 KiB | 355 | 256 | |
README.md | H A D | 14-Oct-2021 | 1.3 KiB | 68 | 49 | |
acl.go | H A D | 14-Oct-2021 | 38.4 KiB | 1,411 | 1,050 | |
agent.go | H A D | 14-Oct-2021 | 39.5 KiB | 1,212 | 819 | |
api.go | H A D | 14-Oct-2021 | 31.3 KiB | 1,110 | 699 | |
catalog.go | H A D | 14-Oct-2021 | 8.7 KiB | 338 | 274 | |
config_entry.go | H A D | 14-Oct-2021 | 15.5 KiB | 500 | 321 | |
config_entry_cluster.go | H A D | 14-Oct-2021 | 1.1 KiB | 54 | 41 | |
config_entry_discoverychain.go | H A D | 14-Oct-2021 | 10.1 KiB | 290 | 208 | |
config_entry_gateways.go | H A D | 14-Oct-2021 | 6.1 KiB | 191 | 77 | |
config_entry_intentions.go | H A D | 14-Oct-2021 | 2.1 KiB | 81 | 62 | |
connect.go | H A D | 14-Oct-2021 | 299 | 13 | 7 | |
connect_ca.go | H A D | 14-Oct-2021 | 5.3 KiB | 189 | 113 | |
connect_intention.go | H A D | 14-Oct-2021 | 12.1 KiB | 415 | 263 | |
coordinate.go | H A D | 14-Oct-2021 | 2.7 KiB | 107 | 80 | |
debug.go | H A D | 14-Oct-2021 | 3.1 KiB | 123 | 78 | |
discovery_chain.go | H A D | 14-Oct-2021 | 5.7 KiB | 233 | 146 | |
event.go | H A D | 14-Oct-2021 | 2.7 KiB | 106 | 82 | |
go.mod | H A D | 14-Oct-2021 | 424 | 17 | 13 | |
go.sum | H A D | 14-Oct-2021 | 11.2 KiB | 121 | 120 | |
health.go | H A D | 14-Oct-2021 | 10.4 KiB | 377 | 299 | |
kv.go | H A D | 14-Oct-2021 | 8.1 KiB | 292 | 208 | |
lock.go | H A D | 14-Oct-2021 | 11.1 KiB | 409 | 269 | |
namespace.go | H A D | 14-Oct-2021 | 4.4 KiB | 160 | 110 | |
operator.go | H A D | 14-Oct-2021 | 241 | 12 | 7 | |
operator_area.go | H A D | 14-Oct-2021 | 5.4 KiB | 195 | 115 | |
operator_autopilot.go | H A D | 14-Oct-2021 | 12 KiB | 379 | 232 | |
operator_keyring.go | H A D | 14-Oct-2021 | 2.3 KiB | 93 | 66 | |
operator_license.go | H A D | 14-Oct-2021 | 3.1 KiB | 120 | 76 | |
operator_raft.go | H A D | 14-Oct-2021 | 2.5 KiB | 90 | 49 | |
operator_segment.go | H A D | 14-Oct-2021 | 289 | 12 | 9 | |
prepared_query.go | H A D | 14-Oct-2021 | 7.3 KiB | 224 | 103 | |
raw.go | H A D | 14-Oct-2021 | 749 | 25 | 13 | |
semaphore.go | H A D | 14-Oct-2021 | 14.3 KiB | 531 | 358 | |
session.go | H A D | 14-Oct-2021 | 5.9 KiB | 244 | 188 | |
snapshot.go | H A D | 14-Oct-2021 | 1.3 KiB | 49 | 33 | |
status.go | H A D | 14-Oct-2021 | 1.2 KiB | 62 | 45 | |
txn.go | H A D | 14-Oct-2021 | 6.5 KiB | 245 | 138 |
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