generated from edgexfoundry-holding/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Migrate Camera Management example to V3 (#214)
* feat: Migrate Camera Management example to V3 closes #194 Signed-off-by: Leonard Goodell <leonard.goodell@intel.com> Signed-off-by: Anthony Casagrande <anthony.j.casagrande@intel.com> Signed-off-by: preethi-satishcandra <preethi.satishchandra@intel.com> Co-authored-by: Anthony Casagrande <anthony.j.casagrande@intel.com> Co-authored-by: preethi-satishcandra <preethi.satishchandra@intel.com>
- Loading branch information
1 parent
c7fd6a8
commit 11045f6
Showing
17 changed files
with
294 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
application-services/custom/camera-management/appcamera/credentials.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
// | ||
// Copyright (C) 2022 Intel Corporation | ||
// Copyright (C) 2022-2023 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package appcamera | ||
|
||
import ( | ||
"github.com/edgexfoundry/go-mod-bootstrap/v2/config" | ||
"github.com/edgexfoundry/go-mod-core-contracts/v2/errors" | ||
"github.com/edgexfoundry/go-mod-bootstrap/v3/bootstrap/secret" | ||
"github.com/edgexfoundry/go-mod-bootstrap/v3/config" | ||
"github.com/edgexfoundry/go-mod-core-contracts/v3/errors" | ||
) | ||
|
||
const ( | ||
CameraCredentials = "CameraCredentials" | ||
UsernameKey = "username" | ||
PasswordKey = "password" | ||
rtspAuth = "rtspAuth" | ||
onvifAuth = "onvifAuth" | ||
) | ||
|
||
// tryGetCredentials will attempt one time to get the camera credentials from the | ||
// secret provider and return them, otherwise return an error. | ||
func (app *CameraManagementApp) tryGetCredentials() (config.Credentials, errors.EdgeX) { | ||
secretData, err := app.service.GetSecret(CameraCredentials, UsernameKey, PasswordKey) | ||
func (app *CameraManagementApp) tryGetCredentials(secretName string) (config.Credentials, errors.EdgeX) { | ||
secretData, err := app.service.SecretProvider().GetSecret(secretName, secret.UsernameKey, secret.PasswordKey) | ||
if err != nil { | ||
return config.Credentials{}, errors.NewCommonEdgeXWrapper(err) | ||
} | ||
return config.Credentials{ | ||
Username: secretData[UsernameKey], | ||
Password: secretData[PasswordKey], | ||
Username: secretData[secret.UsernameKey], | ||
Password: secretData[secret.PasswordKey], | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.