-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from kthcloud/dev
add zone support, rework auth model and bug fixes
- Loading branch information
Showing
76 changed files
with
1,535 additions
and
904 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
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,7 @@ | ||
package body | ||
|
||
type ZoneRead struct { | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Type string `json:"type"` | ||
} |
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,5 @@ | ||
package query | ||
|
||
type ZoneList struct { | ||
Type *string `form:"type" binding:"omitempty,oneof=deployment vm"` | ||
} |
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,6 @@ | ||
package uri | ||
|
||
type ZoneGet struct { | ||
Name string `uri:"name" binding:"required,rfc1035,min=1,max=30"` | ||
Type string `uri:"type" binding:"required,oneof=deployment vm"` | ||
} |
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,45 @@ | ||
package enviroment | ||
|
||
import roleModel "go-deploy/models/sys/enviroment/role" | ||
|
||
func (e *Environment) GetRole(roleName string) *roleModel.Role { | ||
for _, role := range e.Roles { | ||
if role.Name == roleName { | ||
return &role | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (e *Environment) GetRolesByIamGroups(iamGroups []string) []roleModel.Role { | ||
var roles []roleModel.Role | ||
|
||
for _, role := range e.Roles { | ||
for _, iamGroup := range iamGroups { | ||
if role.IamGroup == iamGroup { | ||
roles = append(roles, role) | ||
} | ||
} | ||
} | ||
|
||
return roles | ||
} | ||
|
||
func (d *Deployment) GetZone(name string) *DeploymentZone { | ||
for _, zone := range d.Zones { | ||
if zone.Name == name { | ||
return &zone | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (v *VM) GetZone(name string) *VmZone { | ||
for _, zone := range v.Zones { | ||
if zone.Name == name { | ||
return &zone | ||
} | ||
} | ||
return nil | ||
} |
Oops, something went wrong.