-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LH68644- Feat: implement updating of asa device location (#12)
* fix: implement updating of asa device location * refactor: abstract literals into constants * refactor: update location via usual update method * style: remove commented code * refactor: change if prefixed function to is
- Loading branch information
Christopher Dickson
authored
Jul 27, 2023
1 parent
f711eea
commit 2ac82aa
Showing
7 changed files
with
190 additions
and
54 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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package model | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
type LarType string | ||
|
||
const ( | ||
LarTypeCloudDeviceGateway LarType = "CDG" | ||
LarTypeSecureDeviceConnector LarType = "SDC" | ||
) | ||
|
||
func ParseLarType(input string) (LarType, error) { | ||
switch strings.ToUpper(input) { | ||
case string(LarTypeCloudDeviceGateway): | ||
return LarTypeCloudDeviceGateway, nil | ||
|
||
case string(LarTypeSecureDeviceConnector): | ||
return LarTypeSecureDeviceConnector, nil | ||
|
||
default: | ||
return "", fmt.Errorf("'%s' is not a valid lar type", input) | ||
|
||
} | ||
} | ||
|
||
func MustParseLarType(input string) LarType { | ||
larType, err := ParseLarType(input) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return larType | ||
} |
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