MCPcopy Create free account
hub / github.com/cloudflare/cfssl / Info

Method Info

api/client/client.go:255–280  ·  view source on GitHub ↗

Info sends an info request to the remote CFSSL server, receiving a response or an error in response. It takes the serialized JSON request to send.

(jsonData []byte)

Source from the content-addressed store, hash-verified

253// response or an error in response.
254// It takes the serialized JSON request to send.
255func (srv *server) Info(jsonData []byte) (*info.Resp, error) {
256 res, err := srv.getResultMap(jsonData, "info")
257 if err != nil {
258 return nil, err
259 }
260
261 info := new(info.Resp)
262
263 if val, ok := res["certificate"]; ok {
264 info.Certificate = val.(string)
265 }
266 var usages []interface{}
267 if val, ok := res["usages"]; ok && val != nil {
268 usages = val.([]interface{})
269 }
270 if val, ok := res["expiry"]; ok && val != nil {
271 info.ExpiryString = val.(string)
272 }
273
274 info.Usage = make([]string, len(usages))
275 for i, s := range usages {
276 info.Usage[i] = s.(string)
277 }
278
279 return info, nil
280}
281
282func (srv *server) getResultMap(jsonData []byte, target string) (result map[string]interface{}, err error) {
283 url := srv.getURL(target)

Callers

nothing calls this directly

Calls 1

getResultMapMethod · 0.95

Tested by

no test coverage detected