mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): validate cloudaccount saml auth params
This commit is contained in:
@@ -37,7 +37,7 @@ func init() {
|
||||
cmd.CreateWithKeyworkd("create-aws", &options.SAWSCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-openstack", &options.SOpenStackCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-huawei", &options.SHuaweiCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-ucloud", &options.SHuaweiCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-ucloud", &options.SUcloudCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-zstack", &options.SZStackCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-s3", &options.SS3CloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyworkd("create-ceph", &options.SCephCloudAccountCreateOptions{})
|
||||
|
||||
@@ -319,6 +319,8 @@ type CloudaccountUpdateInput struct {
|
||||
// 带删除的options key
|
||||
RemoveOptions []string `json:"remove_options"`
|
||||
|
||||
SAMLAuth *bool `json:"saml_auth"`
|
||||
|
||||
proxyapi.ProxySettingResourceInput
|
||||
}
|
||||
|
||||
|
||||
@@ -304,6 +304,14 @@ func (self *SCloudaccount) ValidateUpdateData(
|
||||
input.Options = optionsJson
|
||||
}
|
||||
|
||||
factory, err := self.GetProviderFactory()
|
||||
if err != nil {
|
||||
return input, httperrors.NewGeneralError(errors.Wrapf(err, "GetProviderFactory"))
|
||||
}
|
||||
if input.SAMLAuth != nil && *input.SAMLAuth && !factory.IsSupportSAMLAuth() {
|
||||
return input, httperrors.NewNotSupportedError("%s not support saml auth", self.Provider)
|
||||
}
|
||||
|
||||
if len(input.ProxySettingId) > 0 {
|
||||
var proxySetting *proxy.SProxySetting
|
||||
proxySetting, input.ProxySettingResourceInput, err = proxy.ValidateProxySettingResourceInput(userCred, input.ProxySettingResourceInput)
|
||||
|
||||
@@ -108,6 +108,8 @@ type SCloudAccountCreateBaseOptions struct {
|
||||
|
||||
Disabled *bool `help:"create cloud account with disabled status"`
|
||||
|
||||
SamlAuth string `help:"Enable or disable saml auth" choices:"true|false"`
|
||||
|
||||
ProxySetting string `help:"proxy setting id or name" json:"proxy_setting"`
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ func (factory *SAwsProviderFactory) IsSystemCloudpolicyUnified() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (factory *SAwsProviderFactory) IsSupportSAMLAuth() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SAwsProviderFactory) GetSupportedDnsZoneTypes() []cloudprovider.TDnsZoneType {
|
||||
return []cloudprovider.TDnsZoneType{
|
||||
cloudprovider.PublicZone,
|
||||
|
||||
@@ -80,6 +80,10 @@ func (factory *SHuaweiProviderFactory) IsSupportModifyRouteTable() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (factory *SHuaweiProviderFactory) IsSupportSAMLAuth() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SHuaweiProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, userCred mcclient.TokenCredential, input cloudprovider.SCloudaccountCredential) (cloudprovider.SCloudaccount, error) {
|
||||
output := cloudprovider.SCloudaccount{}
|
||||
if len(input.AccessKeyId) == 0 {
|
||||
|
||||
@@ -62,6 +62,10 @@ func (self *SQcloudProviderFactory) IsSupportCreateCloudgroup() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SQcloudProviderFactory) IsSupportSAMLAuth() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SQcloudProviderFactory) IsSupportCrossCloudEnvVpcPeering() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user