Skip to content

Commit

Permalink
Merge pull request #148 from Juniper/feat/125-apstra-4.2-lock-status
Browse files Browse the repository at this point in the history
Add new lock_status value for Apstra 4.2
  • Loading branch information
chrismarget-j authored Oct 26, 2023
2 parents 5d733c0 + 256ae75 commit 93cefaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apstra/two_stage_l3_clos_lock_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ type lockStatus string

const (
LockStatusUnlocked = LockStatus(iota)
LockStatusLocked
LockStatusLockedByRestrictedUser
LockStatusLockedByAdmin
LockStatusLockedByDeletedUser
LockStatusUnknown = "unknown lock status %s"

lockStatusUnlocked = lockStatus("unlocked")
lockStatusLocked = lockStatus("locked")
lockStatusLockedByRestrictedUser = lockStatus("locked_by_restricted_user")
lockStatusLockedByAdmin = lockStatus("locked_by_admin")
lockStatusLockedByDeletedUser = lockStatus("locked_by_deleted_user")
Expand All @@ -31,6 +33,8 @@ func (o LockStatus) String() string {
switch o {
case LockStatusUnlocked:
return string(lockStatusUnlocked)
case LockStatusLocked:
return string(lockStatusLocked)
case LockStatusLockedByRestrictedUser:
return string(lockStatusLockedByRestrictedUser)
case LockStatusLockedByAdmin:
Expand All @@ -50,6 +54,8 @@ func (o lockStatus) parse() (int, error) {
switch o {
case lockStatusUnlocked:
return int(LockStatusUnlocked), nil
case lockStatusLocked:
return int(LockStatusLocked), nil
case lockStatusLockedByRestrictedUser:
return int(LockStatusLockedByRestrictedUser), nil
case lockStatusLockedByAdmin:
Expand Down
1 change: 1 addition & 0 deletions apstra/two_stage_l3_clos_lock_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestLockStatusStrings(t *testing.T) {
stringType apiIotaString
}
testData := []stringTestData{
{stringVal: "locked", intType: LockStatusLocked, stringType: lockStatusLocked},
{stringVal: "unlocked", intType: LockStatusUnlocked, stringType: lockStatusUnlocked},
{stringVal: "locked_by_restricted_user", intType: LockStatusLockedByRestrictedUser, stringType: lockStatusLockedByRestrictedUser},
{stringVal: "locked_by_admin", intType: LockStatusLockedByAdmin, stringType: lockStatusLockedByAdmin},
Expand Down

0 comments on commit 93cefaf

Please sign in to comment.