MCPcopy Create free account
hub / github.com/cloudfoundry/credhub-cli / ExampleCredHub_Request

Function ExampleCredHub_Request

credhub/example_test.go:71–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71func ExampleCredHub_Request() {
72 _ = func() {
73 ch, _ := credhub.New("https://example.com")
74
75 // Get encryption key usage
76 response, err := ch.Request("GET", "/api/v1/key-usage", nil, nil, true)
77 if err != nil {
78 panic("couldn't get key usage")
79 }
80
81 var keyUsage map[string]int
82 decoder := json.NewDecoder(response.Body)
83 err = decoder.Decode(&keyUsage)
84 if err != nil {
85 panic("couldn't parse response")
86 }
87
88 fmt.Println("Active Key: ", keyUsage["active_key"])
89 // Sample Output:
90 // Active Key: 1231231
91 }
92}
93
94func Example() {
95 _ = func() {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
RequestMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…