feat(region): add direct field for vpc

This field describes whether the VPC can be connected directly
This commit is contained in:
rainzm
2021-08-26 11:11:00 +08:00
parent 5392e6c9e9
commit 59dc000c0e
3 changed files with 5 additions and 2 deletions
+1 -2
View File
@@ -143,8 +143,7 @@ func (guest *SGuest) sshableTryEach(
if vpc == nil {
continue
}
if vpc.Id == compute_api.DEFAULT_VPC_ID {
// - vpc_id == "default"
if vpc.Id == compute_api.DEFAULT_VPC_ID || vpc.Direct {
if ok := guest.sshableTryDefaultVPC(ctx, tryData, gn); ok {
return nil
}
+3
View File
@@ -86,6 +86,9 @@ type SVpc struct {
// Vpc外网访问模式
ExternalAccessMode string `width:"16" charset:"ascii" nullable:"true" list:"user" update:"user" create:"optional"`
// Can it be connected directly
Direct bool `default:"false" list:"user" update:"user"`
}
func (manager *SVpcManager) GetContextManagers() [][]db.IModelManager {
+1
View File
@@ -88,6 +88,7 @@ func (opts *VpcIdOptions) Params() (jsonutils.JSONObject, error) {
type VpcUpdateOptions struct {
BaseUpdateOptions
ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw"`
Direct bool `help:"Can it be connected directly"`
}
func (opts *VpcUpdateOptions) Params() (jsonutils.JSONObject, error) {