Skip to content
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

Merged
merged 10 commits into from
Nov 28, 2024
Merged

CERT-22 - Add CSR feature #53

merged 10 commits into from
Nov 28, 2024

Conversation

nyagamunene
Copy link
Contributor

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

@dborovcanin
Copy link
Contributor

@nyagamunene What's the status with this one?

@nyagamunene
Copy link
Contributor Author

@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]>
@nyagamunene nyagamunene marked this pull request as ready for review November 27, 2024 23:50
Signed-off-by: nyagamunene <[email protected]>
}
}

func retrieveCSREndpoint(svc certs.Service) endpoint.Endpoint {
Copy link
Contributor

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.

EncodeResponse,
opts...,
), "").ServeHTTP)
r.Get("/list", otelhttp.NewHandler(kithttp.NewServer(
Copy link
Contributor

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.

@@ -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) {
Copy link
Contributor

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)
Copy link
Contributor

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

certs.go Outdated
Comment on lines 243 to 247
// 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, swap the order.

{
Id: "csr_1",
Up: []string{
`CREATE TABLE IF NOT EXISTS csr (
Copy link
Contributor

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
Comment on lines 294 to 304
// 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)
Copy link
Contributor

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]>
@dborovcanin dborovcanin merged commit f2b8a9a into absmach:main Nov 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Feature: Add CSR feature
2 participants