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

NOISSUE - Add new endpoint to retrieve configuration to be used as a template. #1242

Merged
merged 5 commits into from
Sep 29, 2020

Conversation

mteodor
Copy link
Contributor

@mteodor mteodor commented Sep 25, 2020

What does this do?

Adds new endpoint that will retrieve current provision template configuration as JSON.
It can be used in UI to populate configuration in a same way as provision service does

@mteodor mteodor requested a review from a team as a code owner September 25, 2020 16:40
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
return "", errors.Wrap(ErrUnauthorized, err)
}
return ps.conf.Bootstrap.Content, nil

Copy link
Contributor

Choose a reason for hiding this comment

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

Rm this blank line

defer func(begin time.Time) {
message := fmt.Sprintf("Method mapping for token: %s took %s to complete", token, time.Since(begin))
if err != nil {
lm.logger.Warn(fmt.Sprintf("%s with error: %s.", message, err))
Copy link
Contributor

Choose a reason for hiding this comment

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

remove last .

lm.logger.Warn(fmt.Sprintf("%s with error: %s.", message, err))
return
}
lm.logger.Info(fmt.Sprintf("%s without errors.", message))
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Comment on lines 77 to 78


Copy link
Contributor

Choose a reason for hiding this comment

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

why this blank lines?

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
manuio
manuio previously approved these changes Sep 25, 2020
Copy link
Contributor

@manuio manuio left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2020

Codecov Report

Merging #1242 into master will decrease coverage by 0.20%.
The diff coverage is 6.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1242      +/-   ##
==========================================
- Coverage   68.03%   67.82%   -0.21%     
==========================================
  Files         108      108              
  Lines        7136     7161      +25     
==========================================
+ Hits         4855     4857       +2     
- Misses       1850     1873      +23     
  Partials      431      431              
Impacted Files Coverage Δ
provision/api/endpoint.go 0.00% <0.00%> (ø)
provision/api/logging.go 0.00% <0.00%> (ø)
provision/api/transport.go 0.00% <0.00%> (ø)
provision/api/requests.go 50.00% <66.66%> (-50.00%) ⬇️
things/service.go 77.68% <0.00%> (+1.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ea26c5...d5249e0. Read the comment docs.

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
manuio
manuio previously approved these changes Sep 28, 2020
Copy link
Contributor

@manuio manuio left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -81,6 +84,14 @@ func New(cfg Config, sdk SDK.SDK, logger logger.Logger) Service {
}
}

// Mapping retrieves current configuration
func (ps *provisionService) Mapping(token string) (interface{}, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can at least return map[string]interface instead of interface{}. It's of little use, but better than interface{}.

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@dborovcanin dborovcanin merged commit 9ed5f83 into absmach:master Sep 29, 2020
manuio pushed a commit that referenced this pull request Oct 12, 2020
…template. (#1242)

* add provision service

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix code style

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix test for provision

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* extra line

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* return map[string]interface instead of interface

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@mteodor mteodor deleted the provision-get branch January 11, 2021 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants