-
Notifications
You must be signed in to change notification settings - Fork 0
/
end_entity.go
47 lines (37 loc) · 1009 Bytes
/
end_entity.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ejbca
import (
"encoding/json"
"log"
)
func (c *RESTClient) EndEntitySearch(criteria *EndEntitySearch) (*EndEntitySearchResponse, error) {
log.Printf("[INFO] Searching EJBCA for end entities with criteria %x", criteria)
requestConfig := &request{
Method: "POST",
Endpoint: "v1/endentity/search",
Payload: criteria,
}
resp, err := c.sendRESTRequest(requestConfig)
if err != nil {
return nil, err
}
jsonResp := &EndEntitySearchResponse{}
err = json.NewDecoder(resp.Body).Decode(&jsonResp)
return jsonResp, nil
}
func (c *RESTClient) GetV1EndEntityStatus() (*V1EndEntityStatus, error) {
log.Println("[INFO] Getting EJBCA V1 End Entity Endpoint Status")
requestConfig := &request{
Method: "GET",
Endpoint: "v1/endentity/status",
}
resp, err := c.sendRESTRequest(requestConfig)
if err != nil {
return nil, err
}
jsonResp := &V1EndEntityStatus{}
err = json.NewDecoder(resp.Body).Decode(&jsonResp)
if err != nil {
return nil, err
}
return jsonResp, nil
}