Skip to content

Commit

Permalink
added v2 endpoint support for all endpoints (#225)
Browse files Browse the repository at this point in the history
* added v2 endpoint support for all endpoints

* prep for release
  • Loading branch information
kristinapathak committed Apr 13, 2022
1 parent 5efaa8f commit fbad170
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v0.6.4]
- Updated spec file and rpkg version macro to be able to choose when the 'v' is included in the version. [#199](https://github.com/xmidt-org/talaria/pull/199)
- Updated WRPHandler_Test to correspond with a bug fix in WRP-Go. [#206](https://github.com/xmidt-org/talaria/pull/206)
- Added /v2 support for service endpoints. [#225](https://github.com/xmidt-org/talaria/pull/225)

## [v0.6.3]
- Removed v1 webpa-common dependency that was accidentally added in v0.6.2. [#197](https://github.com/xmidt-org/talaria/pull/197)
Expand Down Expand Up @@ -133,7 +136,8 @@ Switching to new build process
## [v0.1.1] Tue Mar 28 2017 Weston Schmidt - 0.1.1
- initial creation

[Unreleased]: https://github.com/xmidt-org/talaria/compare/v0.6.3...HEAD
[Unreleased]: https://github.com/xmidt-org/talaria/compare/v0.6.4...HEAD
[v0.6.4]: https://github.com/xmidt-org/talaria/compare/v0.6.3...v0.6.4
[v0.6.3]: https://github.com/xmidt-org/talaria/compare/v0.6.2...v0.6.3
[v0.6.2]: https://github.com/xmidt-org/talaria/compare/v0.6.1...v0.6.2
[v0.6.1]: https://github.com/xmidt-org/talaria/compare/v0.6.0...v0.6.1
Expand Down
8 changes: 4 additions & 4 deletions primaryHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func NewPrimaryHandler(logger log.Logger, manager device.Manager, v *viper.Viper
controlConstructor alice.Constructor, metricsRegistry xmetrics.Registry, r *mux.Router) (http.Handler, error) {
var (
inboundTimeout = getInboundTimeout(v)
apiHandler = r.PathPrefix(fmt.Sprintf("%s/%s", baseURI, version)).Subrouter()
apiHandler = r.PathPrefix(fmt.Sprintf("%s/{version:%s|%s}", baseURI, v2, version)).Subrouter()

authConstructor = NoOpConstructor
authEnforcer = NoOpConstructor
Expand Down Expand Up @@ -242,12 +242,12 @@ func NewPrimaryHandler(logger log.Logger, manager device.Manager, v *viper.Viper
xtimeout.NewConstructor(xtimeout.Options{
Timeout: inboundTimeout,
})).
Extend(authChain).
Extend(versionCompatibleAuth).
Then(wrphttp.NewHTTPHandler(wrpRouterHandler)),
).Methods("POST", "PATCH")

apiHandler.Handle("/devices",
authChain.Then(&device.ListHandler{
versionCompatibleAuth.Then(&device.ListHandler{
Logger: logger,
Registry: manager,
})).Methods("GET")
Expand Down Expand Up @@ -304,7 +304,7 @@ func NewPrimaryHandler(logger log.Logger, manager device.Manager, v *viper.Viper
"/device/{deviceID}/stat",
alice.New(
device.UseID.FromPath("deviceID")).
Extend(authChain).
Extend(versionCompatibleAuth).
Then(&device.StatHandler{
Logger: logger,
Registry: manager,
Expand Down

0 comments on commit fbad170

Please sign in to comment.