mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-25 10:16:12 +08:00
24 lines
517 B
Go
24 lines
517 B
Go
package models
|
|
|
|
import "yunion.io/x/onecloud/pkg/httperrors"
|
|
|
|
type IGetVpc interface {
|
|
GetName() string
|
|
GetVpc() (*SVpc, error)
|
|
}
|
|
|
|
func ValidateAssociateEip(obj IGetVpc) error {
|
|
vpc, err := obj.GetVpc()
|
|
if err != nil {
|
|
return httperrors.NewGeneralError(err)
|
|
}
|
|
|
|
if vpc != nil {
|
|
if !vpc.IsSupportAssociateEip() {
|
|
return httperrors.NewNotSupportedError("resource %s in vpc %s external access mode %s is not support accociate eip", obj.GetName(), vpc.GetName(), vpc.ExternalAccessMode)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|