diff --git a/config.yaml b/config.yaml index aaaf87f..496055f 100644 --- a/config.yaml +++ b/config.yaml @@ -183,6 +183,7 @@ Project: - ProjectInvite - ProjectInviteAccept - ProjectInviteDelete + - ProjectKmsGetCA - ProjectList - ProjectPrivatelinkAvailabilityList - ProjectTagsList diff --git a/handler/project/project.go b/handler/project/project.go index 20554d9..6b218de 100644 --- a/handler/project/project.go +++ b/handler/project/project.go @@ -60,6 +60,11 @@ type Handler interface { // https://api.aiven.io/doc/#tag/Project/operation/ProjectInviteDelete ProjectInviteDelete(ctx context.Context, project string, invitedEmail string) error + // ProjectKmsGetCA retrieve project CA certificate + // GET /project/{project}/kms/ca + // https://api.aiven.io/doc/#tag/Project_Key_Management/operation/ProjectKmsGetCA + ProjectKmsGetCA(ctx context.Context, project string) (string, error) + // ProjectList list projects // GET /project // https://api.aiven.io/doc/#tag/Project/operation/ProjectList @@ -224,6 +229,19 @@ func (h *ProjectHandler) ProjectInviteDelete(ctx context.Context, project string _, err := h.doer.Do(ctx, "ProjectInviteDelete", "DELETE", path, nil) return err } +func (h *ProjectHandler) ProjectKmsGetCA(ctx context.Context, project string) (string, error) { + path := fmt.Sprintf("/project/%s/kms/ca", project) + b, err := h.doer.Do(ctx, "ProjectKmsGetCA", "GET", path, nil) + if err != nil { + return "", err + } + out := new(projectKmsGetCaOut) + err = json.Unmarshal(b, out) + if err != nil { + return "", err + } + return out.Certificate, nil +} func (h *ProjectHandler) ProjectList(ctx context.Context) (*ProjectListOut, error) { path := fmt.Sprintf("/project") b, err := h.doer.Do(ctx, "ProjectList", "GET", path, nil) @@ -648,6 +666,9 @@ type projectGetOut struct { type projectInviteAcceptOut struct { InviteDetails ProjectInviteAcceptOut `json:"invite_details"` } +type projectKmsGetCaOut struct { + Certificate string `json:"certificate"` +} type projectPrivatelinkAvailabilityListOut struct { PrivatelinkAvailability []PrivatelinkAvailabilityOut `json:"privatelink_availability"` }