forked from aiven/aiven-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathca.go
31 lines (25 loc) · 750 Bytes
/
ca.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
// Copyright (c) 2017 jelmersnoeck
// Copyright (c) 2018 Aiven, Helsinki, Finland. https://aiven.io/
package aiven
type (
// CAHandler is the client which interacts with the Projects CA endpoint
// on Aiven.
CAHandler struct {
client *Client
}
// ProjectCAResponse is the response from Aiven for project CA Certificate.
ProjectCAResponse struct {
APIResponse
CACertificate string `json:"certificate"`
}
)
// Get retrieves the specified Project CA Certificate.
func (h *CAHandler) Get(project string) (string, error) {
bts, err := h.client.doGetRequest(buildPath("project", project, "kms", "ca"), nil)
if err != nil {
return "", err
}
var r ProjectCAResponse
errR := checkAPIResponse(bts, &r)
return r.CACertificate, errR
}