Skip to content

Commit a8522f5

Browse files
author
李锐
committed
feat(bingocloud):improve bingocloud driver
1 parent 3a7171b commit a8522f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+785
-218
lines changed

cmd/bingocli/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,11 @@ func newClient(options *BaseOptions) (*bingocloud.SRegion, error) {
9696
options.Endpoint,
9797
options.AccessKey,
9898
options.SecretKey,
99-
).Debug(options.Debug).
100-
CloudproviderConfig(
101-
cloudprovider.ProviderConfig{
102-
ProxyFunc: proxyFunc,
103-
},
104-
),
99+
).Debug(options.Debug).SetCloudproviderConfig(
100+
cloudprovider.ProviderConfig{
101+
ProxyFunc: proxyFunc,
102+
},
103+
),
105104
)
106105
if err != nil {
107106
return nil, err

pkg/cloudprovider/cloudprovider.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ type ProviderConfig struct {
174174

175175
AliyunResourceGroupIds []string
176176

177+
ManagerProviderConfig *ProviderConfig
178+
177179
UpdatePermission func(service, permission string)
178180
}
179181

pkg/cloudprovider/disk.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ type DiskCreateConfig struct {
1919
SizeGb int
2020
Desc string
2121
ProjectId string
22+
ZoneId string
2223
}

pkg/cloudprovider/resources.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ type ICloudRegion interface {
8686
GetISecurityGroupById(secgroupId string) (ICloudSecurityGroup, error)
8787
GetISecurityGroupByName(opts *SecurityGroupFilterOptions) (ICloudSecurityGroup, error)
8888
CreateISecurityGroup(conf *SecurityGroupCreateInput) (ICloudSecurityGroup, error)
89+
GetISecurityGroups() ([]ICloudSecurityGroup, error)
8990

9091
CreateIVpc(opts *VpcCreateOptions) (ICloudVpc, error)
9192
CreateInternetGateway() (ICloudInternetGateway, error)
@@ -607,6 +608,7 @@ type ICloudVpc interface {
607608
ProposeJoinICloudInterVpcNetwork(opts *SVpcJointInterVpcNetworkOption) error
608609

609610
GetICloudIPv6Gateways() ([]ICloudIPv6Gateway, error)
611+
IsPublic() bool
610612
}
611613

612614
type ICloudInternetGateway interface {

pkg/cloudprovider/subaccount.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ import (
2222
)
2323

2424
type SSubAccount struct {
25+
Id string // ID
2526
// 若Account不为空,可不传
2627
Name string
2728
// 描述信息
2829
Desc string
2930
// 输入必填,若为空,需要指定子账号名称
3031
Account string
32+
Secret string // 子账号SK
3133
HealthStatus string // 云端服务健康状态。例如欠费、项目冻结都属于不健康状态。
34+
IsSubAccount bool // 是否子账号
3235
DefaultProjectId string // 默认云订阅项目Id
3336
}
3437

pkg/multicloud/aliyun/region.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ func (self *SRegion) GetOssClient() (*oss.Client, error) {
125125
return self.ossClient, nil
126126
}
127127

128+
func (self *SRegion) GetISecurityGroups() ([]cloudprovider.ICloudSecurityGroup, error) {
129+
return nil, nil
130+
}
131+
128132
func (self *SRegion) ecsRequest(apiName string, params map[string]string) (jsonutils.JSONObject, error) {
129133
client, err := self.getSdkClient()
130134
if err != nil {
@@ -297,7 +301,7 @@ func (self *SRegion) _lbRequest(client *sdk.Client, apiName string, domain strin
297301
return jsonRequest(client, domain, ALIYUN_API_VERSION_LB, apiName, params, self.client.debug)
298302
}
299303

300-
/////////////////////////////////////////////////////////////////////////////
304+
// ///////////////////////////////////////////////////////////////////////////
301305
func (self *SRegion) GetId() string {
302306
return self.RegionId
303307
}

pkg/multicloud/aliyun/vpc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func (self *SVpc) IsEmulated() bool {
8484
return false
8585
}
8686

87+
func (self *SVpc) IsPublic() bool {
88+
return false
89+
}
90+
8791
func (self *SVpc) GetIsDefault() bool {
8892
return self.IsDefault
8993
}

pkg/multicloud/apsara/region.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ func (self *SRegion) tagRequest(serviceType string, action string, params map[st
149149
}
150150
}
151151

152+
func (self *SRegion) GetISecurityGroups() ([]cloudprovider.ICloudSecurityGroup, error) {
153+
return nil, nil
154+
}
155+
152156
func (self *SRegion) lbRequest(apiName string, params map[string]string) (jsonutils.JSONObject, error) {
153157
client, err := self.getSdkClient()
154158
if err != nil {
@@ -158,7 +162,7 @@ func (self *SRegion) lbRequest(apiName string, params map[string]string) (jsonut
158162
return self.productRequest(client, APSARA_PRODUCT_SLB, domain, APSARA_API_VERSION_LB, apiName, params, self.client.debug)
159163
}
160164

161-
/////////////////////////////////////////////////////////////////////////////
165+
// ///////////////////////////////////////////////////////////////////////////
162166
func (self *SRegion) GetId() string {
163167
return self.RegionId
164168
}

pkg/multicloud/apsara/vpc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ func (self *SVpc) IsEmulated() bool {
8585
return false
8686
}
8787

88+
func (self *SVpc) IsPublic() bool {
89+
return false
90+
}
91+
8892
func (self *SVpc) GetIsDefault() bool {
8993
return self.IsDefault
9094
}

pkg/multicloud/aws/region.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func (self *SAwsClient) monitorRequest(regionId, apiName string, params map[stri
270270
return self.request(regionId, CLOUDWATCH_SERVICE_NAME, CLOUDWATCH_SERVICE_ID, "2010-08-01", apiName, params, retval, true)
271271
}
272272

273-
/////////////////////////////////////////////////////////////////////////////
273+
// ///////////////////////////////////////////////////////////////////////////
274274
func (self *SRegion) fetchZones() error {
275275
ec2Client, err := self.getEc2Client()
276276
if err != nil {
@@ -416,6 +416,10 @@ func (self *SRegion) GetIZones() ([]cloudprovider.ICloudZone, error) {
416416
return self.izones, nil
417417
}
418418

419+
func (self *SRegion) GetISecurityGroups() ([]cloudprovider.ICloudSecurityGroup, error) {
420+
return nil, nil
421+
}
422+
419423
func (self *SRegion) GetIVpcs() ([]cloudprovider.ICloudVpc, error) {
420424
if self.ivpcs == nil {
421425
err := self.fetchInfrastructure()

0 commit comments

Comments
 (0)