Certs - Implementation of SDK and CLI#9
Conversation
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
| RetrieveCertDownloadToken(serialNumber string) (string, errors.SDKError) | ||
|
|
||
| OCSP(serialNumber string) (Cert, int, errors.SDKError) |
There was a problem hiding this comment.
Add godoc comments with an explanation of what these methods do.
| type mgSDK struct { | ||
| certsURL string | ||
| HostURL string | ||
|
|
||
| msgContentType ContentType | ||
| client *http.Client | ||
| curlFlag bool | ||
| } | ||
|
|
||
| type Config struct { | ||
| CertsURL string | ||
| HostURL string | ||
|
|
||
| MsgContentType ContentType | ||
| TLSVerification bool | ||
| CurlFlag bool | ||
| } | ||
|
|
||
| func NewSDK(conf Config) SDK { | ||
| return &mgSDK{ | ||
| certsURL: conf.CertsURL, | ||
| HostURL: conf.HostURL, | ||
|
|
||
| msgContentType: conf.MsgContentType, | ||
| client: &http.Client{ | ||
| Transport: &http.Transport{ | ||
| TLSClientConfig: &tls.Config{ | ||
| InsecureSkipVerify: !conf.TLSVerification, | ||
| }, | ||
| }, | ||
| }, | ||
| curlFlag: conf.CurlFlag, | ||
| } | ||
| } |
There was a problem hiding this comment.
Move this to the top. Swap the order of Config and mgSDK (i.e. declare exported struct first).
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
| AM_DOCKER_IMAGE_NAME_PREFIX ?= absmach | ||
| BUILD_DIR = build | ||
| SERVICES = certs | ||
| SERVICES = certs cli |
There was a problem hiding this comment.
Remove this argument, we have only certs service here.
| } | ||
| req := issueCertReq{ | ||
| entityID: chi.URLParam(r, "entityID"), | ||
| entityID: chi.URLParam(r, "entityID"), |
There was a problem hiding this comment.
Extract string literal to constant.
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
dborovcanin
left a comment
There was a problem hiding this comment.
make dockers fails.
It should also be singular - make docker. There is no need for modularity here, simplify Makefile and Dockerfile and completely remove $SVC argument.
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
| SERVICES = certs | ||
| DOCKERS = $(addprefix docker_,$(SERVICES)) | ||
| DOCKERS_DEV = $(addprefix docker_dev_,$(SERVICES)) | ||
| SERVICE = certs |
There was a problem hiding this comment.
@nyagamunene There was a misunderstanding, please revert the changes you made to Makefile and Dockerfile. I did not want to remove options to configure Go build flags (while some such as CGO_ENABLED could stay fixed) or build time and version. Let's remove the SERVICE param from Makefile since we have only one service.
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
dborovcanin
left a comment
There was a problem hiding this comment.
Let' keep SDK flat since we have only one SDK implementation for the time being: move pkg/sdk/go to pkg/sdk.
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| AM_DOCKER_IMAGE_NAME_PREFIX ?= absmach | ||
| AM_DOCKER_IMAGE_NAME_PREFIX ?= ghcr.io/absmach/certs |
There was a problem hiding this comment.
The prefix is only ghcr.io/absmach.
| ifdef pv | ||
| # Remove unused volumes | ||
| docker volume ls -f name=$(MF_DOCKER_IMAGE_NAME_PREFIX) -f dangling=true -q | xargs -r docker volume rm | ||
| docker volume ls -f name=$(AM_DOCKER_IMAGE_NAME_PREFIX) -f dangling=true -q | xargs -r docker volume rm |
There was a problem hiding this comment.
It looks like we do not use pv. Remove everything unused.
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
What type of PR is this?
This is a feature because it adds the following functionality: It add a SDK for software development.
What does this do?
It adds SDK for the API endpoints.
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
Yes
Did you document any new/modified features?
No.
Notes