-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: add controller to as-controller-board-status #43
feat: add controller to as-controller-board-status #43
Conversation
closes: issue intel-retail#40 Signed-off-by: Valina Li <valina.li@intel.com>
|
||
func (c *Controller) AddAllRoutes() error { | ||
// Add the "status" REST API route | ||
err := c.service.AddRoute("/status", c.GetStatus, "GET", "OPTIONS") |
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.
http.MethodGet, http.MethodOptions for constants
@@ -6,7 +6,7 @@ package functions | |||
import ( | |||
"time" | |||
|
|||
"github.com/edgexfoundry/app-functions-sdk-go/v2/pkg/interfaces" | |||
clientInterfaces "github.com/edgexfoundry/go-mod-core-contracts/v2/clients/interfaces" |
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.
go convention is to only alias when you have a name conflict, which isn't the case here
as-controller-board-status/main.go
Outdated
SubscriptionClient: subscriptionClient, | ||
} | ||
|
||
// Subscribe to the EdgeX notification service |
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.
Remove command since this is obvious from the code.
Signed-off-by: Valina Li <valina.li@intel.com>
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.
please resolve my concerns thanks
// RESTPost is a const used for REST commands using the specified method. | ||
RESTPost = "POST" | ||
RESTPost = http.MethodPost | ||
// RESTPut is a const used for REST commands using the specified method. | ||
RESTPut = "PUT" | ||
RESTPut = http.MethodPut | ||
// RESTGet is a const used for REST commands using the specified method. | ||
RESTGet = "GET" | ||
RESTGet = http.MethodGet |
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.
Just remove these constants and use the ones from http.
in place of them
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.
all my issues addressed - thanks
Signed-off-by: Valina Li <valina.li@intel.com>
utilities.WriteJSONHTTPResponse(writer, req, http.StatusOK, controllerBoardStatusJSON, false) | ||
}) | ||
// for testing purpose | ||
func (boardStatus *CheckBoardStatus) SetControllerBoardStatus(controllerBoardStatusInput ControllerBoardStatus) { |
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.
Actually Set is not needed for testing since as @jim-wang-intel pointed out the tests have direct access to controllerBoardStatusInput
. This can be cleaned up in the next PR.
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.
LGTM
closes: issue #40
Signed-off-by: Valina Li valina.li@intel.com