-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CERT-22 - Add CSR feature #53
Conversation
@nyagamunene What's the status with this one? |
There is still some issues with tests which am currently addressing. |
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
api/http/endpoint.go
Outdated
} | ||
} | ||
|
||
func retrieveCSREndpoint(svc certs.Service) endpoint.Endpoint { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch the order of retrieve and list endpoints.
api/http/transport.go
Outdated
EncodeResponse, | ||
opts..., | ||
), "").ServeHTTP) | ||
r.Get("/list", otelhttp.NewHandler(kithttp.NewServer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need for /list
, an empty route will work.
api/http/transport.go
Outdated
@@ -137,6 +141,32 @@ func MakeHandler(svc certs.Service, logger *slog.Logger, instanceID string) http | |||
encodeCADownloadResponse, | |||
opts..., | |||
), "download_ca").ServeHTTP) | |||
r.Route("/csr", func(r chi.Router) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use plural, csrs
.
api/metrics.go
Outdated
|
||
func (mm *metricsMiddleware) SignCSR(ctx context.Context, csrID string, approve bool) error { | ||
defer func(begin time.Time) { | ||
mm.counter.With("method", "process_csr").Add(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mm.counter.With("method", "sign_csr").Add(1)
api/metrics.go
Outdated
func (mm *metricsMiddleware) SignCSR(ctx context.Context, csrID string, approve bool) error { | ||
defer func(begin time.Time) { | ||
mm.counter.With("method", "process_csr").Add(1) | ||
mm.latency.With("method", "process_csr").Observe(time.Since(begin).Seconds()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
certs.go
Outdated
// ListCSRs returns a list of CSRs based on filter criteria | ||
ListCSRs(ctx context.Context, pm PageMetadata) (CSRPage, error) | ||
|
||
// RetrieveCSR retrieves a specific CSR by ID | ||
RetrieveCSR(ctx context.Context, csrID string) (CSR, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, swap the order.
postgres/csr/init.go
Outdated
{ | ||
Id: "csr_1", | ||
Up: []string{ | ||
`CREATE TABLE IF NOT EXISTS csr ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-check if this is aligned properly.
sdk/sdk.go
Outdated
// ListCSRs returns a list of CSRs based on filter criteria | ||
// | ||
// response, _ := sdk.ListCSRs(sdk.PageMetadata{EntityID: "entity_id", Status: "pending"}) | ||
// fmt.Println(response) | ||
ListCSRs(pm PageMetadata) (CSRPage, errors.SDKError) | ||
|
||
// RetrieveCSR retrieves a specific CSR by ID | ||
// | ||
// response, _ := sdk.RetrieveCSR("csr_id") | ||
// fmt.Println(response) | ||
RetrieveCSR(csrID string) (CSR, errors.SDKError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same order remark.
Signed-off-by: nyagamunene <[email protected]>
Signed-off-by: nyagamunene <[email protected]>
What type of PR is this?
What does this do?
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
Yes.
Did you document any new/modified features?
Yes
Notes