yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/cloudprovider/resources.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package cloudprovider 16 17 import ( 18 "context" 19 "time" 20 21 "yunion.io/x/jsonutils" 22 "yunion.io/x/pkg/errors" 23 "yunion.io/x/pkg/tristate" 24 25 "yunion.io/x/onecloud/pkg/mcclient" 26 "yunion.io/x/onecloud/pkg/util/billing" 27 "yunion.io/x/onecloud/pkg/util/rbacutils" 28 "yunion.io/x/onecloud/pkg/util/samlutils" 29 ) 30 31 type ICloudResource interface { 32 GetId() string 33 GetName() string 34 GetGlobalId() string 35 GetCreatedAt() time.Time 36 37 GetStatus() string 38 39 Refresh() error 40 41 IsEmulated() bool 42 43 GetSysTags() map[string]string 44 GetTags() (map[string]string, error) 45 SetTags(tags map[string]string, replace bool) error 46 } 47 48 type ICloudEnabledResource interface { 49 ICloudResource 50 GetEnabled() bool 51 } 52 53 type IVirtualResource interface { 54 ICloudResource 55 56 GetProjectId() string 57 } 58 59 type IBillingResource interface { 60 GetBillingType() string 61 GetExpiredAt() time.Time 62 SetAutoRenew(bc billing.SBillingCycle) error 63 Renew(bc billing.SBillingCycle) error 64 IsAutoRenew() bool 65 } 66 67 type ICloudI18nResource interface { 68 GetI18n() SModelI18nTable 69 } 70 71 type ICloudRegion interface { 72 ICloudResource 73 ICloudI18nResource 74 75 // GetLatitude() float32 76 // GetLongitude() float32 77 GetGeographicInfo() SGeographicInfo 78 79 GetIZones() ([]ICloudZone, error) 80 GetIVpcs() ([]ICloudVpc, error) 81 GetIEips() ([]ICloudEIP, error) 82 GetIVpcById(id string) (ICloudVpc, error) 83 GetIZoneById(id string) (ICloudZone, error) 84 GetIEipById(id string) (ICloudEIP, error) 85 // Esxi没有zone,需要通过region确认vm是否被删除 86 GetIVMById(id string) (ICloudVM, error) 87 GetIDiskById(id string) (ICloudDisk, error) 88 89 GetISecurityGroupById(secgroupId string) (ICloudSecurityGroup, error) 90 GetISecurityGroupByName(opts *SecurityGroupFilterOptions) (ICloudSecurityGroup, error) 91 CreateISecurityGroup(conf *SecurityGroupCreateInput) (ICloudSecurityGroup, error) 92 93 CreateIVpc(opts *VpcCreateOptions) (ICloudVpc, error) 94 CreateInternetGateway() (ICloudInternetGateway, error) 95 CreateEIP(eip *SEip) (ICloudEIP, error) 96 97 GetISnapshots() ([]ICloudSnapshot, error) 98 GetISnapshotById(snapshotId string) (ICloudSnapshot, error) 99 100 CreateSnapshotPolicy(*SnapshotPolicyInput) (string, error) 101 UpdateSnapshotPolicy(*SnapshotPolicyInput, string) error 102 DeleteSnapshotPolicy(string) error 103 ApplySnapshotPolicyToDisks(snapshotPolicyId string, diskId string) error 104 CancelSnapshotPolicyToDisks(snapshotPolicyId string, diskId string) error 105 GetISnapshotPolicies() ([]ICloudSnapshotPolicy, error) 106 GetISnapshotPolicyById(snapshotPolicyId string) (ICloudSnapshotPolicy, error) 107 108 GetIHosts() ([]ICloudHost, error) 109 GetIHostById(id string) (ICloudHost, error) 110 111 GetIStorages() ([]ICloudStorage, error) 112 GetIStorageById(id string) (ICloudStorage, error) 113 114 GetIStoragecaches() ([]ICloudStoragecache, error) 115 GetIStoragecacheById(id string) (ICloudStoragecache, error) 116 117 GetILoadBalancers() ([]ICloudLoadbalancer, error) 118 GetILoadBalancerAcls() ([]ICloudLoadbalancerAcl, error) 119 GetILoadBalancerCertificates() ([]ICloudLoadbalancerCertificate, error) 120 GetILoadBalancerBackendGroups() ([]ICloudLoadbalancerBackendGroup, error) // for aws only 121 122 GetILoadBalancerById(loadbalancerId string) (ICloudLoadbalancer, error) 123 GetILoadBalancerAclById(aclId string) (ICloudLoadbalancerAcl, error) 124 GetILoadBalancerCertificateById(certId string) (ICloudLoadbalancerCertificate, error) 125 126 CreateILoadBalancer(loadbalancer *SLoadbalancer) (ICloudLoadbalancer, error) 127 CreateILoadBalancerAcl(acl *SLoadbalancerAccessControlList) (ICloudLoadbalancerAcl, error) 128 CreateILoadBalancerCertificate(cert *SLoadbalancerCertificate) (ICloudLoadbalancerCertificate, error) 129 130 GetISkus() ([]ICloudSku, error) 131 CreateISku(opts *SServerSkuCreateOption) (ICloudSku, error) 132 133 GetICloudNatSkus() ([]ICloudNatSku, error) 134 135 GetINetworkInterfaces() ([]ICloudNetworkInterface, error) 136 137 GetIBuckets() ([]ICloudBucket, error) 138 CreateIBucket(name string, storageClassStr string, acl string) error 139 DeleteIBucket(name string) error 140 IBucketExist(name string) (bool, error) 141 GetIBucketById(name string) (ICloudBucket, error) 142 GetIBucketByName(name string) (ICloudBucket, error) 143 144 GetIDBInstances() ([]ICloudDBInstance, error) 145 GetIDBInstanceById(instanceId string) (ICloudDBInstance, error) 146 GetIDBInstanceBackups() ([]ICloudDBInstanceBackup, error) 147 GetIDBInstanceBackupById(backupId string) (ICloudDBInstanceBackup, error) 148 GetIDBInstanceSkus() ([]ICloudDBInstanceSku, error) 149 150 CreateIDBInstance(desc *SManagedDBInstanceCreateConfig) (ICloudDBInstance, error) 151 152 GetIElasticcaches() ([]ICloudElasticcache, error) 153 GetIElasticcacheSkus() ([]ICloudElasticcacheSku, error) 154 GetIElasticcacheById(id string) (ICloudElasticcache, error) 155 CreateIElasticcaches(ec *SCloudElasticCacheInput) (ICloudElasticcache, error) 156 157 GetCloudEnv() string 158 GetProvider() string 159 160 GetICloudEvents(start time.Time, end time.Time, withReadEvent bool) ([]ICloudEvent, error) //获取公有云操作日志接口 161 162 GetCapabilities() []string 163 164 GetICloudQuotas() ([]ICloudQuota, error) 165 166 GetICloudFileSystems() ([]ICloudFileSystem, error) 167 GetICloudFileSystemById(id string) (ICloudFileSystem, error) 168 169 CreateICloudFileSystem(opts *FileSystemCraeteOptions) (ICloudFileSystem, error) 170 171 GetICloudAccessGroups() ([]ICloudAccessGroup, error) 172 CreateICloudAccessGroup(opts *SAccessGroup) (ICloudAccessGroup, error) 173 GetICloudAccessGroupById(id string) (ICloudAccessGroup, error) 174 175 GetICloudWafIPSets() ([]ICloudWafIPSet, error) 176 GetICloudWafRegexSets() ([]ICloudWafRegexSet, error) 177 GetICloudWafInstances() ([]ICloudWafInstance, error) 178 GetICloudWafInstanceById(id string) (ICloudWafInstance, error) 179 CreateICloudWafInstance(opts *WafCreateOptions) (ICloudWafInstance, error) 180 GetICloudWafRuleGroups() ([]ICloudWafRuleGroup, error) 181 182 GetICloudMongoDBs() ([]ICloudMongoDB, error) 183 GetICloudMongoDBById(id string) (ICloudMongoDB, error) 184 185 GetIElasticSearchs() ([]ICloudElasticSearch, error) 186 GetIElasticSearchById(id string) (ICloudElasticSearch, error) 187 188 GetICloudKafkas() ([]ICloudKafka, error) 189 GetICloudKafkaById(id string) (ICloudKafka, error) 190 191 GetICloudApps() ([]ICloudApp, error) 192 GetICloudAppById(id string) (ICloudApp, error) 193 194 GetICloudKubeClusters() ([]ICloudKubeCluster, error) 195 GetICloudKubeClusterById(id string) (ICloudKubeCluster, error) 196 197 GetICloudTablestores() ([]ICloudTablestore, error) 198 199 GetIModelartsPools() ([]ICloudModelartsPool, error) 200 GetIModelartsPoolById(id string) (ICloudModelartsPool, error) 201 CreateIModelartsPool(pool *ModelartsPoolCreateOption) (ICloudModelartsPool, error) 202 GetIModelartsPoolSku() ([]ICloudModelartsPoolSku, error) 203 204 GetIMiscResources() ([]ICloudMiscResource, error) 205 } 206 207 type ICloudZone interface { 208 ICloudResource 209 ICloudI18nResource 210 211 GetIRegion() ICloudRegion 212 213 GetIHosts() ([]ICloudHost, error) 214 GetIHostById(id string) (ICloudHost, error) 215 216 GetIStorages() ([]ICloudStorage, error) 217 GetIStorageById(id string) (ICloudStorage, error) 218 } 219 220 type ICloudImage interface { 221 IVirtualResource 222 223 IOSInfo 224 225 Delete(ctx context.Context) error 226 GetIStoragecache() ICloudStoragecache 227 228 GetSizeByte() int64 229 GetImageType() TImageType 230 GetImageStatus() string 231 232 GetMinOsDiskSizeGb() int 233 GetMinRamSizeMb() int 234 GetImageFormat() string 235 236 GetPublicScope() rbacutils.TRbacScope 237 GetSubImages() []SSubImage 238 } 239 240 type ICloudStoragecache interface { 241 ICloudResource 242 243 // 私有云需要实现 244 GetICloudImages() ([]ICloudImage, error) 245 // 公有云需要实现 246 GetICustomizedCloudImages() ([]ICloudImage, error) 247 GetIImageById(extId string) (ICloudImage, error) 248 249 GetPath() string 250 251 CreateIImage(snapshotId, imageName, osType, imageDesc string) (ICloudImage, error) 252 253 DownloadImage(userCred mcclient.TokenCredential, imageId string, extId string, path string) (jsonutils.JSONObject, error) 254 255 UploadImage(ctx context.Context, userCred mcclient.TokenCredential, image *SImageCreateOption, callback func(float32)) (string, error) 256 } 257 258 type ICloudStorage interface { 259 ICloudResource 260 261 GetIStoragecache() ICloudStoragecache 262 263 GetIZone() ICloudZone 264 GetIDisks() ([]ICloudDisk, error) 265 266 GetStorageType() string 267 GetMediumType() string 268 GetCapacityMB() int64 // MB 269 GetCapacityUsedMB() int64 270 GetStorageConf() jsonutils.JSONObject 271 GetEnabled() bool 272 273 CreateIDisk(conf *DiskCreateConfig) (ICloudDisk, error) 274 275 GetIDiskById(idStr string) (ICloudDisk, error) 276 277 GetMountPoint() string 278 279 IsSysDiskStore() bool 280 281 DisableSync() bool 282 } 283 284 type ICloudHost interface { 285 ICloudResource 286 287 GetIVMs() ([]ICloudVM, error) 288 GetIVMById(id string) (ICloudVM, error) 289 290 GetIWires() ([]ICloudWire, error) 291 GetIStorages() ([]ICloudStorage, error) 292 GetIStorageById(id string) (ICloudStorage, error) 293 294 // GetStatus() string // os status 295 GetEnabled() bool // is enabled 296 GetHostStatus() string // service status 297 GetAccessIp() string // 298 GetAccessMac() string // 299 GetSysInfo() jsonutils.JSONObject 300 GetSN() string 301 GetCpuCount() int 302 GetNodeCount() int8 303 GetCpuDesc() string 304 GetCpuMhz() int 305 GetCpuCmtbound() float32 306 GetCpuArchitecture() string 307 308 GetMemSizeMB() int 309 GetMemCmtbound() float32 310 GetReservedMemoryMb() int 311 GetStorageSizeMB() int 312 GetStorageType() string 313 GetHostType() string 314 315 GetIsMaintenance() bool 316 GetVersion() string 317 318 CreateVM(desc *SManagedVMCreateConfig) (ICloudVM, error) 319 GetIHostNics() ([]ICloudHostNetInterface, error) 320 321 GetSchedtags() ([]string, error) 322 323 GetOvnVersion() string // just for cloudpods host 324 } 325 326 type ICloudVM interface { 327 IBillingResource 328 IVirtualResource 329 330 IOSInfo 331 332 ConvertPublicIpToEip() error 333 334 GetHostname() string 335 GetIHost() ICloudHost 336 GetIHostId() string 337 338 GetIDisks() ([]ICloudDisk, error) 339 GetINics() ([]ICloudNic, error) 340 341 GetIEIP() (ICloudEIP, error) 342 343 GetInternetMaxBandwidthOut() int 344 GetThroughput() int 345 // GetStatus() string 346 // GetRemoteStatus() string 347 348 GetSerialOutput(port int) (string, error) // 目前仅谷歌云windows机器会使用到此接口 349 350 GetVcpuCount() int 351 GetVmemSizeMB() int //MB 352 GetBootOrder() string 353 GetVga() string 354 GetVdi() string 355 356 // GetOSArch() string 357 // GetOsType() TOsType 358 // GetOSName() string 359 // GetBios() string 360 361 GetMachine() string 362 GetInstanceType() string 363 364 GetSecurityGroupIds() ([]string, error) 365 AssignSecurityGroup(secgroupId string) error 366 SetSecurityGroups(secgroupIds []string) error 367 368 GetHypervisor() string 369 370 // GetSecurityGroup() ICloudSecurityGroup 371 372 StartVM(ctx context.Context) error 373 StopVM(ctx context.Context, opts *ServerStopOptions) error 374 DeleteVM(ctx context.Context) error 375 376 UpdateVM(ctx context.Context, name string) error 377 378 UpdateUserData(userData string) error 379 380 RebuildRoot(ctx context.Context, config *SManagedVMRebuildRootConfig) (string, error) 381 382 DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error 383 384 ChangeConfig(ctx context.Context, config *SManagedVMChangeConfig) error 385 386 GetVNCInfo(input *ServerVncInput) (*ServerVncOutput, error) 387 AttachDisk(ctx context.Context, diskId string) error 388 DetachDisk(ctx context.Context, diskId string) error 389 390 CreateDisk(ctx context.Context, opts *GuestDiskCreateOptions) (string, error) 391 392 MigrateVM(hostid string) error 393 LiveMigrateVM(hostid string) error 394 395 GetError() error 396 397 CreateInstanceSnapshot(ctx context.Context, name string, desc string) (ICloudInstanceSnapshot, error) 398 GetInstanceSnapshot(idStr string) (ICloudInstanceSnapshot, error) 399 GetInstanceSnapshots() ([]ICloudInstanceSnapshot, error) 400 ResetToInstanceSnapshot(ctx context.Context, idStr string) error 401 402 SaveImage(opts *SaveImageOptions) (ICloudImage, error) 403 404 AllocatePublicIpAddress() (string, error) 405 } 406 407 type ICloudNic interface { 408 GetId() string 409 GetIP() string 410 GetMAC() string 411 InClassicNetwork() bool 412 GetDriver() string 413 GetINetworkId() string 414 415 // GetSubAddress returns non-primary/secondary/alias ipv4 addresses of 416 // the network interface 417 // 418 // Implement it when any AssignXx ops methods are implemented 419 GetSubAddress() ([]string, error) 420 AssignNAddress(count int) ([]string, error) 421 AssignAddress(ipAddrs []string) error 422 // UnassignAddress should not return error if the network interface is 423 // now not present, or the addresses is not assigned to the network 424 // interface in the first place 425 UnassignAddress(ipAddrs []string) error 426 } 427 428 const ErrAddressCountExceed = errors.Error("ErrAddressCountExceed") 429 430 type DummyICloudNic struct{} 431 432 var _ ICloudNic = DummyICloudNic{} 433 434 func (d DummyICloudNic) GetId() string { panic(errors.ErrNotImplemented) } 435 func (d DummyICloudNic) GetIP() string { panic(errors.ErrNotImplemented) } 436 func (d DummyICloudNic) GetMAC() string { panic(errors.ErrNotImplemented) } 437 func (d DummyICloudNic) InClassicNetwork() bool { panic(errors.ErrNotImplemented) } 438 func (d DummyICloudNic) GetDriver() string { panic(errors.ErrNotImplemented) } 439 func (d DummyICloudNic) GetINetworkId() string { panic(errors.ErrNotImplemented) } 440 func (d DummyICloudNic) GetSubAddress() ([]string, error) { 441 return nil, nil 442 } 443 func (d DummyICloudNic) AssignNAddress(count int) ([]string, error) { 444 return nil, errors.ErrNotImplemented 445 } 446 func (d DummyICloudNic) AssignAddress(ipAddrs []string) error { return errors.ErrNotImplemented } 447 func (d DummyICloudNic) UnassignAddress(ipAddrs []string) error { return errors.ErrNotImplemented } 448 449 type ICloudEIP interface { 450 IBillingResource 451 IVirtualResource 452 453 GetIpAddr() string 454 GetMode() string 455 GetINetworkId() string 456 GetAssociationType() string 457 GetAssociationExternalId() string 458 459 GetBandwidth() int 460 461 GetInternetChargeType() string 462 463 Delete() error 464 465 Associate(conf *AssociateConfig) error 466 Dissociate() error 467 468 ChangeBandwidth(bw int) error 469 } 470 471 type ICloudSecurityGroup interface { 472 IVirtualResource 473 474 GetDescription() string 475 GetRules() ([]SecurityRule, error) 476 GetVpcId() string 477 478 SyncRules(common, inAdds, outAdds, inDels, outDels []SecurityRule) error 479 GetReferences() ([]SecurityGroupReference, error) 480 Delete() error 481 } 482 483 type ICloudRouteTable interface { 484 ICloudResource 485 486 GetAssociations() []RouteTableAssociation 487 GetDescription() string 488 GetRegionId() string 489 GetVpcId() string 490 GetType() RouteTableType 491 GetIRoutes() ([]ICloudRoute, error) 492 493 CreateRoute(route RouteSet) error 494 UpdateRoute(route RouteSet) error 495 RemoveRoute(route RouteSet) error 496 } 497 498 type ICloudRoute interface { 499 ICloudResource 500 GetType() string 501 GetCidr() string 502 GetNextHopType() string 503 GetNextHop() string 504 } 505 506 type ICloudDisk interface { 507 IBillingResource 508 IVirtualResource 509 510 GetIStorage() (ICloudStorage, error) 511 GetIStorageId() string 512 513 // GetStatus() string 514 GetDiskFormat() string 515 GetDiskSizeMB() int // MB 516 GetIsAutoDelete() bool 517 GetTemplateId() string 518 GetDiskType() string 519 GetFsFormat() string 520 GetIsNonPersistent() bool 521 GetIops() int 522 523 GetDriver() string 524 GetCacheMode() string 525 GetMountpoint() string 526 527 GetAccessPath() string 528 529 Delete(ctx context.Context) error 530 531 CreateISnapshot(ctx context.Context, name string, desc string) (ICloudSnapshot, error) 532 GetISnapshots() ([]ICloudSnapshot, error) 533 534 GetExtSnapshotPolicyIds() ([]string, error) 535 536 Resize(ctx context.Context, newSizeMB int64) error 537 Reset(ctx context.Context, snapshotId string) (string, error) 538 539 Rebuild(ctx context.Context) error 540 } 541 542 type ICloudSnapshot interface { 543 IVirtualResource 544 545 GetSizeMb() int32 546 GetDiskId() string 547 GetDiskType() string 548 Delete() error 549 } 550 551 type ICloudInstanceSnapshot interface { 552 IVirtualResource 553 554 GetDescription() string 555 Delete() error 556 } 557 558 type ICloudSnapshotPolicy interface { 559 IVirtualResource 560 561 IsActivated() bool 562 GetRetentionDays() int 563 GetRepeatWeekdays() ([]int, error) 564 GetTimePoints() ([]int, error) 565 } 566 567 type ICloudGlobalVpc interface { 568 ICloudResource 569 570 Delete() error 571 } 572 573 type ICloudIPv6Gateway interface { 574 IVirtualResource 575 576 GetInstanceType() string 577 } 578 579 type ICloudVpc interface { 580 ICloudResource 581 582 GetGlobalVpcId() string 583 IsSupportSetExternalAccess() bool // 是否支持Attach互联网网关. 584 GetExternalAccessMode() string 585 AttachInternetGateway(igwId string) error 586 587 GetRegion() ICloudRegion 588 GetIsDefault() bool 589 GetCidrBlock() string 590 GetIWires() ([]ICloudWire, error) 591 CreateIWire(opts *SWireCreateOptions) (ICloudWire, error) 592 GetISecurityGroups() ([]ICloudSecurityGroup, error) 593 GetIRouteTables() ([]ICloudRouteTable, error) 594 GetIRouteTableById(routeTableId string) (ICloudRouteTable, error) 595 596 Delete() error 597 598 GetIWireById(wireId string) (ICloudWire, error) 599 GetINatGateways() ([]ICloudNatGateway, error) 600 CreateINatGateway(opts *NatGatewayCreateOptions) (ICloudNatGateway, error) 601 602 GetICloudVpcPeeringConnections() ([]ICloudVpcPeeringConnection, error) 603 GetICloudAccepterVpcPeeringConnections() ([]ICloudVpcPeeringConnection, error) 604 GetICloudVpcPeeringConnectionById(id string) (ICloudVpcPeeringConnection, error) 605 CreateICloudVpcPeeringConnection(opts *VpcPeeringConnectionCreateOptions) (ICloudVpcPeeringConnection, error) 606 AcceptICloudVpcPeeringConnection(id string) error 607 608 GetAuthorityOwnerId() string 609 610 ProposeJoinICloudInterVpcNetwork(opts *SVpcJointInterVpcNetworkOption) error 611 612 GetICloudIPv6Gateways() ([]ICloudIPv6Gateway, error) 613 } 614 615 type ICloudInternetGateway interface { 616 ICloudResource 617 } 618 619 type ICloudWire interface { 620 ICloudResource 621 GetIVpc() ICloudVpc 622 GetIZone() ICloudZone 623 GetINetworks() ([]ICloudNetwork, error) 624 GetBandwidth() int 625 626 GetINetworkById(netid string) (ICloudNetwork, error) 627 628 CreateINetwork(opts *SNetworkCreateOptions) (ICloudNetwork, error) 629 } 630 631 type ICloudNetwork interface { 632 IVirtualResource 633 634 GetIWire() ICloudWire 635 // GetStatus() string 636 GetIpStart() string 637 GetIpEnd() string 638 GetIpMask() int8 639 GetGateway() string 640 GetServerType() string 641 //GetIsPublic() bool 642 // 仅私有云有用,公有云无效 643 // 1. scope = none 非共享, network仅会属于一个项目,并且私有 644 // 2. scope = system 系统共享 云账号共享会跟随云账号共享,云账号非共享,会共享到network所在域 645 GetPublicScope() rbacutils.TRbacScope 646 647 Delete() error 648 649 GetAllocTimeoutSeconds() int 650 } 651 652 type ICloudHostNetInterface interface { 653 GetDevice() string 654 GetDriver() string 655 GetMac() string 656 GetIndex() int8 657 IsLinkUp() tristate.TriState 658 GetIpAddr() string 659 GetMtu() int32 660 GetNicType() string 661 GetBridge() string 662 } 663 664 type ICloudLoadbalancer interface { 665 IVirtualResource 666 667 GetAddress() string 668 GetAddressType() string 669 GetNetworkType() string 670 GetNetworkIds() []string 671 GetVpcId() string 672 GetZoneId() string 673 GetZone1Id() string // first slave zone 674 GetLoadbalancerSpec() string 675 GetChargeType() string 676 GetEgressMbps() int 677 678 GetIEIP() (ICloudEIP, error) 679 680 Delete(ctx context.Context) error 681 682 Start() error 683 Stop() error 684 685 GetILoadBalancerListeners() ([]ICloudLoadbalancerListener, error) 686 GetILoadBalancerBackendGroups() ([]ICloudLoadbalancerBackendGroup, error) 687 688 CreateILoadBalancerBackendGroup(group *SLoadbalancerBackendGroup) (ICloudLoadbalancerBackendGroup, error) 689 GetILoadBalancerBackendGroupById(groupId string) (ICloudLoadbalancerBackendGroup, error) 690 691 CreateILoadBalancerListener(ctx context.Context, listener *SLoadbalancerListener) (ICloudLoadbalancerListener, error) 692 GetILoadBalancerListenerById(listenerId string) (ICloudLoadbalancerListener, error) 693 } 694 695 type ICloudLoadbalancerRedirect interface { 696 GetRedirect() string 697 GetRedirectCode() int64 698 GetRedirectScheme() string 699 GetRedirectHost() string 700 GetRedirectPath() string 701 } 702 703 type ICloudloadbalancerHealthCheck interface { 704 GetHealthCheck() string 705 GetHealthCheckType() string 706 GetHealthCheckTimeout() int 707 GetHealthCheckInterval() int 708 GetHealthCheckRise() int 709 GetHealthCheckFail() int 710 711 GetHealthCheckReq() string 712 GetHealthCheckExp() string 713 714 // HTTP && HTTPS 715 GetHealthCheckDomain() string 716 GetHealthCheckURI() string 717 GetHealthCheckCode() string 718 } 719 720 type ICloudLoadbalancerListener interface { 721 IVirtualResource 722 723 GetListenerType() string 724 GetListenerPort() int 725 GetScheduler() string 726 GetAclStatus() string 727 GetAclType() string 728 GetAclId() string 729 730 GetEgressMbps() int 731 GetBackendGroupId() string 732 GetBackendServerPort() int 733 734 GetClientIdleTimeout() int 735 GetBackendConnectTimeout() int 736 737 // HTTP && HTTPS 738 CreateILoadBalancerListenerRule(rule *SLoadbalancerListenerRule) (ICloudLoadbalancerListenerRule, error) 739 GetILoadBalancerListenerRuleById(ruleId string) (ICloudLoadbalancerListenerRule, error) 740 GetILoadbalancerListenerRules() ([]ICloudLoadbalancerListenerRule, error) 741 GetStickySession() string 742 GetStickySessionType() string 743 GetStickySessionCookie() string 744 GetStickySessionCookieTimeout() int 745 XForwardedForEnabled() bool 746 GzipEnabled() bool 747 748 // HTTPS 749 GetCertificateId() string 750 GetTLSCipherPolicy() string 751 HTTP2Enabled() bool 752 753 // http redirect 754 ICloudLoadbalancerRedirect 755 ICloudloadbalancerHealthCheck 756 757 Start() error 758 Stop() error 759 Sync(ctx context.Context, listener *SLoadbalancerListener) error 760 761 Delete(ctx context.Context) error 762 } 763 764 type ICloudLoadbalancerListenerRule interface { 765 IVirtualResource 766 // http redirect 767 ICloudLoadbalancerRedirect 768 769 IsDefault() bool 770 GetDomain() string 771 GetPath() string 772 GetCondition() string 773 GetBackendGroupId() string 774 775 Delete(ctx context.Context) error 776 } 777 778 type ICloudLoadbalancerBackendGroup interface { 779 IVirtualResource 780 781 IsDefault() bool 782 GetType() string 783 GetLoadbalancerId() string 784 GetILoadbalancerBackends() ([]ICloudLoadbalancerBackend, error) 785 GetILoadbalancerBackendById(backendId string) (ICloudLoadbalancerBackend, error) 786 GetProtocolType() string // huawei only .后端云服务器组的后端协议。 787 GetScheduler() string // huawei only 788 GetHealthCheck() (*SLoadbalancerHealthCheck, error) // huawei only 789 GetStickySession() (*SLoadbalancerStickySession, error) // huawei only 790 AddBackendServer(serverId string, weight int, port int) (ICloudLoadbalancerBackend, error) 791 RemoveBackendServer(serverId string, weight int, port int) error 792 793 Delete(ctx context.Context) error 794 Sync(ctx context.Context, group *SLoadbalancerBackendGroup) error 795 } 796 797 type ICloudLoadbalancerBackend interface { 798 IVirtualResource 799 800 GetWeight() int 801 GetPort() int 802 GetBackendType() string 803 GetBackendRole() string 804 GetBackendId() string 805 GetIpAddress() string // backend type is ip 806 SyncConf(ctx context.Context, port, weight int) error 807 } 808 809 type ICloudLoadbalancerCertificate interface { 810 IVirtualResource 811 812 Sync(name, privateKey, publickKey string) error 813 Delete() error 814 815 GetCommonName() string 816 GetSubjectAlternativeNames() string 817 GetFingerprint() string // return value format: <algo>:<fingerprint>,比如sha1:7454a14fdb8ae1ea8b2f72e458a24a76bd23ec19 818 GetExpireTime() time.Time 819 GetPublickKey() string 820 GetPrivateKey() string 821 } 822 823 type ICloudLoadbalancerAcl interface { 824 IVirtualResource 825 826 GetAclListenerID() string // huawei only 827 GetAclEntries() []SLoadbalancerAccessControlListEntry 828 Sync(acl *SLoadbalancerAccessControlList) error 829 Delete() error 830 } 831 832 type ICloudSku interface { 833 ICloudResource 834 835 GetInstanceTypeFamily() string 836 GetInstanceTypeCategory() string 837 838 GetPrepaidStatus() string 839 GetPostpaidStatus() string 840 841 GetCpuArch() string 842 GetCpuCoreCount() int 843 GetMemorySizeMB() int 844 845 GetOsName() string 846 847 GetSysDiskResizable() bool 848 GetSysDiskType() string 849 GetSysDiskMinSizeGB() int 850 GetSysDiskMaxSizeGB() int 851 852 GetAttachedDiskType() string 853 GetAttachedDiskSizeGB() int 854 GetAttachedDiskCount() int 855 856 GetDataDiskTypes() string 857 GetDataDiskMaxCount() int 858 859 GetNicType() string 860 GetNicMaxCount() int 861 862 GetGpuAttachable() bool 863 GetGpuSpec() string 864 GetGpuCount() int 865 GetGpuMaxCount() int 866 867 Delete() error 868 } 869 870 type ICloudProject interface { 871 ICloudResource 872 873 GetDomainId() string 874 GetDomainName() string 875 876 GetAccountId() string 877 } 878 879 type ICloudNatGateway interface { 880 ICloudResource 881 IBillingResource 882 883 // 获取 NAT 规格 884 GetNatSpec() string 885 GetIEips() ([]ICloudEIP, error) 886 GetINatDTable() ([]ICloudNatDEntry, error) 887 GetINatSTable() ([]ICloudNatSEntry, error) 888 889 // ID is the ID of snat entry/rule or dnat entry/rule. 890 GetINatDEntryByID(id string) (ICloudNatDEntry, error) 891 GetINatSEntryByID(id string) (ICloudNatSEntry, error) 892 893 // Read the description of these two structures before using. 894 CreateINatDEntry(rule SNatDRule) (ICloudNatDEntry, error) 895 CreateINatSEntry(rule SNatSRule) (ICloudNatSEntry, error) 896 897 GetINetworkId() string 898 GetBandwidthMb() int 899 GetIpAddr() string 900 901 Delete() error 902 } 903 904 // ICloudNatDEntry describe a DNat rule which transfer externalIp:externalPort to 905 // internalIp:internalPort with IpProtocol(tcp/udp) 906 type ICloudNatDEntry interface { 907 ICloudResource 908 909 GetIpProtocol() string 910 GetExternalIp() string 911 GetExternalPort() int 912 913 GetInternalIp() string 914 GetInternalPort() int 915 916 Delete() error 917 } 918 919 // ICloudNatSEntry describe a SNat rule which transfer internalIp(GetIP()) to externalIp which from sourceCIDR 920 type ICloudNatSEntry interface { 921 ICloudResource 922 923 GetIP() string 924 GetSourceCIDR() string 925 GetNetworkId() string 926 927 Delete() error 928 } 929 930 type ICloudNetworkInterface interface { 931 ICloudResource 932 933 GetMacAddress() string 934 GetAssociateType() string 935 GetAssociateId() string 936 937 GetICloudInterfaceAddresses() ([]ICloudInterfaceAddress, error) 938 } 939 940 type ICloudInterfaceAddress interface { 941 GetGlobalId() string //返回IP即可 942 943 GetINetworkId() string 944 GetIP() string 945 IsPrimary() bool 946 } 947 948 type ICloudDBInstance interface { 949 IVirtualResource 950 IBillingResource 951 952 Reboot() error 953 954 GetMasterInstanceId() string 955 GetSecurityGroupIds() ([]string, error) 956 SetSecurityGroups(ids []string) error 957 GetPort() int 958 GetEngine() string 959 GetEngineVersion() string 960 //实例规格 961 GetInstanceType() string 962 963 GetVcpuCount() int 964 GetVmemSizeMB() int //MB 965 GetDiskSizeGB() int 966 GetDiskSizeUsedMB() int 967 //基础版、高可用? 968 GetCategory() string 969 GetStorageType() string 970 971 GetMaintainTime() string 972 973 GetConnectionStr() string 974 GetInternalConnectionStr() string 975 GetZone1Id() string 976 GetZone2Id() string 977 GetZone3Id() string 978 GetIVpcId() string 979 GetIops() int 980 981 GetDBNetworks() ([]SDBInstanceNetwork, error) 982 GetIDBInstanceParameters() ([]ICloudDBInstanceParameter, error) 983 GetIDBInstanceDatabases() ([]ICloudDBInstanceDatabase, error) 984 GetIDBInstanceAccounts() ([]ICloudDBInstanceAccount, error) 985 GetIDBInstanceBackups() ([]ICloudDBInstanceBackup, error) 986 987 ChangeConfig(ctx context.Context, config *SManagedDBInstanceChangeConfig) error 988 989 OpenPublicConnection() error 990 ClosePublicConnection() error 991 992 CreateDatabase(conf *SDBInstanceDatabaseCreateConfig) error 993 CreateAccount(conf *SDBInstanceAccountCreateConfig) error 994 995 CreateIBackup(conf *SDBInstanceBackupCreateConfig) (string, error) 996 997 RecoveryFromBackup(conf *SDBInstanceRecoveryConfig) error 998 999 Delete() error 1000 } 1001 1002 type ICloudDBInstanceParameter interface { 1003 GetGlobalId() string 1004 GetKey() string 1005 GetValue() string 1006 GetDescription() string 1007 } 1008 1009 type ICloudDBInstanceBackup interface { 1010 IVirtualResource 1011 1012 GetEngine() string 1013 GetEngineVersion() string 1014 GetDBInstanceId() string 1015 GetStartTime() time.Time 1016 GetEndTime() time.Time 1017 GetBackupSizeMb() int 1018 GetDBNames() string 1019 GetBackupMode() string 1020 GetBackupMethod() TBackupMethod 1021 1022 CreateICloudDBInstance(opts *SManagedDBInstanceCreateConfig) (ICloudDBInstance, error) 1023 1024 Delete() error 1025 } 1026 1027 type ICloudDBInstanceDatabase interface { 1028 ICloudResource 1029 1030 GetCharacterSet() string 1031 1032 Delete() error 1033 } 1034 1035 type ICloudDBInstanceAccount interface { 1036 GetName() string 1037 GetStatus() string 1038 GetHost() string 1039 1040 GetIDBInstanceAccountPrivileges() ([]ICloudDBInstanceAccountPrivilege, error) 1041 1042 ResetPassword(password string) error 1043 GrantPrivilege(database, privilege string) error 1044 RevokePrivilege(database string) error 1045 1046 Delete() error 1047 } 1048 1049 type ICloudDBInstanceAccountPrivilege interface { 1050 GetGlobalId() string 1051 1052 GetPrivilege() string 1053 GetDBName() string 1054 } 1055 1056 type ICloudElasticcacheSku interface { 1057 GetName() string 1058 GetGlobalId() string 1059 GetZoneId() string 1060 GetSlaveZoneId() string 1061 GetEngineArch() string 1062 GetLocalCategory() string 1063 GetPrepaidStatus() string 1064 GetPostpaidStatus() string 1065 GetEngine() string 1066 GetEngineVersion() string 1067 GetCpuArch() string 1068 GetStorageType() string 1069 GetMemorySizeMb() int 1070 GetPerformanceType() string 1071 GetNodeType() string 1072 GetDiskSizeGb() int 1073 GetShardNum() int 1074 GetMaxShardNum() int 1075 GetReplicasNum() int 1076 GetMaxReplicasNum() int 1077 GetMaxClients() int 1078 GetMaxConnections() int 1079 GetMaxInBandwidthMb() int 1080 GetMaxMemoryMb() int 1081 GetQps() int 1082 } 1083 1084 type ICloudElasticcache interface { 1085 IVirtualResource 1086 IBillingResource 1087 1088 GetInstanceType() string 1089 GetCapacityMB() int 1090 GetArchType() string 1091 GetNodeType() string 1092 GetEngine() string 1093 GetEngineVersion() string 1094 1095 GetVpcId() string 1096 GetZoneId() string 1097 GetNetworkType() string 1098 GetNetworkId() string 1099 GetBandwidth() int 1100 GetConnections() int 1101 1102 GetPrivateDNS() string 1103 GetPrivateIpAddr() string 1104 GetPrivateConnectPort() int 1105 GetPublicDNS() string 1106 GetPublicIpAddr() string 1107 GetPublicConnectPort() int 1108 1109 GetMaintainStartTime() string 1110 GetMaintainEndTime() string 1111 1112 GetAuthMode() string 1113 GetSecurityGroupIds() ([]string, error) 1114 1115 GetICloudElasticcacheAccounts() ([]ICloudElasticcacheAccount, error) 1116 GetICloudElasticcacheAcls() ([]ICloudElasticcacheAcl, error) 1117 GetICloudElasticcacheBackups() ([]ICloudElasticcacheBackup, error) 1118 GetICloudElasticcacheParameters() ([]ICloudElasticcacheParameter, error) 1119 1120 GetICloudElasticcacheAccount(accountId string) (ICloudElasticcacheAccount, error) 1121 GetICloudElasticcacheAcl(aclId string) (ICloudElasticcacheAcl, error) 1122 GetICloudElasticcacheBackup(backupId string) (ICloudElasticcacheBackup, error) 1123 1124 Restart() error 1125 Delete() error 1126 ChangeInstanceSpec(spec string) error 1127 SetMaintainTime(maintainStartTime, maintainEndTime string) error 1128 AllocatePublicConnection(port int) (string, error) // return url & error info 1129 ReleasePublicConnection() error 1130 1131 CreateAccount(account SCloudElasticCacheAccountInput) (ICloudElasticcacheAccount, error) 1132 CreateAcl(aclName, securityIps string) (ICloudElasticcacheAcl, error) 1133 CreateBackup(desc string) (ICloudElasticcacheBackup, error) 1134 FlushInstance(input SCloudElasticCacheFlushInstanceInput) error 1135 UpdateAuthMode(noPasswordAccess bool, password string) error 1136 UpdateInstanceParameters(config jsonutils.JSONObject) error 1137 UpdateBackupPolicy(config SCloudElasticCacheBackupPolicyUpdateInput) error 1138 1139 UpdateSecurityGroups(secgroupIds []string) error 1140 } 1141 1142 type ICloudElasticcacheAccount interface { 1143 ICloudResource 1144 1145 GetAccountType() string 1146 GetAccountPrivilege() string 1147 1148 Delete() error 1149 ResetPassword(input SCloudElasticCacheAccountResetPasswordInput) error 1150 UpdateAccount(input SCloudElasticCacheAccountUpdateInput) error 1151 } 1152 1153 type ICloudElasticcacheAcl interface { 1154 ICloudResource 1155 1156 GetIpList() string 1157 1158 Delete() error 1159 UpdateAcl(securityIps string) error 1160 } 1161 1162 type ICloudElasticcacheBackup interface { 1163 ICloudResource 1164 1165 GetBackupSizeMb() int 1166 GetBackupType() string 1167 GetBackupMode() string 1168 GetDownloadURL() string 1169 1170 GetStartTime() time.Time 1171 GetEndTime() time.Time 1172 1173 Delete() error 1174 RestoreInstance(instanceId string) error 1175 } 1176 1177 type ICloudElasticcacheParameter interface { 1178 ICloudResource 1179 1180 GetParameterKey() string 1181 GetParameterValue() string 1182 GetParameterValueRange() string 1183 GetDescription() string 1184 GetModifiable() bool 1185 GetForceRestart() bool 1186 } 1187 1188 type ICloudEvent interface { 1189 GetName() string 1190 GetService() string 1191 GetAction() string 1192 GetResourceType() string 1193 GetRequestId() string 1194 GetRequest() jsonutils.JSONObject 1195 GetAccount() string 1196 IsSuccess() bool 1197 1198 GetCreatedAt() time.Time 1199 } 1200 1201 type ICloudQuota interface { 1202 GetGlobalId() string 1203 GetDesc() string 1204 GetQuotaType() string 1205 GetMaxQuotaCount() int 1206 GetCurrentQuotaUsedCount() int 1207 } 1208 1209 // 公有云子账号 1210 type IClouduser interface { 1211 GetGlobalId() string 1212 GetName() string 1213 1214 GetEmailAddr() string 1215 GetInviteUrl() string 1216 1217 GetICloudgroups() ([]ICloudgroup, error) 1218 1219 GetISystemCloudpolicies() ([]ICloudpolicy, error) 1220 GetICustomCloudpolicies() ([]ICloudpolicy, error) 1221 1222 AttachSystemPolicy(policyName string) error 1223 DetachSystemPolicy(policyName string) error 1224 1225 AttachCustomPolicy(policyName string) error 1226 DetachCustomPolicy(policyName string) error 1227 1228 Delete() error 1229 1230 ResetPassword(password string) error 1231 IsConsoleLogin() bool 1232 1233 CreateAccessKey(name string) (*SAccessKey, error) 1234 DeleteAccessKey(accessKey string) error 1235 GetAccessKeys() ([]SAccessKey, error) 1236 } 1237 1238 // 公有云子账号权限 1239 type ICloudpolicy interface { 1240 GetGlobalId() string 1241 GetName() string 1242 GetDescription() string 1243 1244 GetDocument() (*jsonutils.JSONDict, error) 1245 UpdateDocument(*jsonutils.JSONDict) error 1246 1247 Delete() error 1248 } 1249 1250 // 公有云用户组 1251 type ICloudgroup interface { 1252 GetGlobalId() string 1253 GetName() string 1254 GetDescription() string 1255 GetISystemCloudpolicies() ([]ICloudpolicy, error) 1256 GetICustomCloudpolicies() ([]ICloudpolicy, error) 1257 GetICloudusers() ([]IClouduser, error) 1258 1259 AddUser(name string) error 1260 RemoveUser(name string) error 1261 1262 AttachSystemPolicy(policyName string) error 1263 DetachSystemPolicy(policyName string) error 1264 1265 AttachCustomPolicy(policyName string) error 1266 DetachCustomPolicy(policyName string) error 1267 1268 Delete() error 1269 } 1270 1271 type ICloudDnsZone interface { 1272 ICloudResource 1273 1274 GetZoneType() TDnsZoneType 1275 GetOptions() *jsonutils.JSONDict 1276 1277 GetICloudVpcIds() ([]string, error) 1278 AddVpc(*SPrivateZoneVpc) error 1279 RemoveVpc(*SPrivateZoneVpc) error 1280 1281 GetIDnsRecordSets() ([]ICloudDnsRecordSet, error) 1282 SyncDnsRecordSets(common, add, del, update []DnsRecordSet) error 1283 1284 Delete() error 1285 1286 GetDnsProductType() TDnsProductType 1287 } 1288 1289 type ICloudDnsRecordSet interface { 1290 GetGlobalId() string 1291 1292 GetDnsName() string 1293 GetStatus() string 1294 GetEnabled() bool 1295 GetDnsType() TDnsType 1296 GetDnsValue() string 1297 GetTTL() int64 1298 GetMxPriority() int64 1299 1300 GetPolicyType() TDnsPolicyType 1301 GetPolicyValue() TDnsPolicyValue 1302 GetPolicyOptions() *jsonutils.JSONDict 1303 } 1304 1305 type ICloudVpcPeeringConnection interface { 1306 ICloudResource 1307 1308 GetPeerVpcId() string 1309 GetPeerAccountId() string 1310 GetEnabled() bool 1311 Delete() error 1312 } 1313 1314 type ICloudSAMLProvider interface { 1315 ICloudResource 1316 1317 GetMetadataDocument() (*samlutils.EntityDescriptor, error) 1318 UpdateMetadata(samlutils.EntityDescriptor) error 1319 1320 GetAuthUrl() string 1321 Delete() error 1322 } 1323 1324 type ICloudrole interface { 1325 GetGlobalId() string 1326 GetName() string 1327 1328 GetDocument() *jsonutils.JSONDict 1329 GetSAMLProvider() string 1330 1331 GetICloudpolicies() ([]ICloudpolicy, error) 1332 AttachPolicy(id string) error 1333 DetachPolicy(id string) error 1334 1335 Delete() error 1336 } 1337 1338 type ICloudInterVpcNetwork interface { 1339 ICloudResource 1340 GetAuthorityOwnerId() string 1341 GetICloudVpcIds() ([]string, error) 1342 AttachVpc(opts *SInterVpcNetworkAttachVpcOption) error 1343 DetachVpc(opts *SInterVpcNetworkDetachVpcOption) error 1344 Delete() error 1345 GetIRoutes() ([]ICloudInterVpcNetworkRoute, error) 1346 EnableRouteEntry(routeId string) error 1347 DisableRouteEntry(routeId string) error 1348 } 1349 1350 type ICloudInterVpcNetworkRoute interface { 1351 ICloudResource 1352 GetInstanceId() string 1353 GetInstanceType() string 1354 GetInstanceRegionId() string 1355 1356 GetEnabled() bool 1357 GetCidr() string 1358 } 1359 1360 type ICloudFileSystem interface { 1361 ICloudResource 1362 IBillingResource 1363 1364 GetFileSystemType() string 1365 GetStorageType() string 1366 GetProtocol() string 1367 GetCapacityGb() int64 1368 GetUsedCapacityGb() int64 1369 GetMountTargetCountLimit() int 1370 1371 GetZoneId() string 1372 1373 GetMountTargets() ([]ICloudMountTarget, error) 1374 CreateMountTarget(opts *SMountTargetCreateOptions) (ICloudMountTarget, error) 1375 1376 Delete() error 1377 } 1378 1379 type ICloudMountTarget interface { 1380 GetGlobalId() string 1381 GetName() string 1382 GetAccessGroupId() string 1383 GetDomainName() string 1384 GetNetworkType() string 1385 GetVpcId() string 1386 GetNetworkId() string 1387 GetStatus() string 1388 1389 Delete() error 1390 } 1391 1392 type ICloudAccessGroup interface { 1393 GetGlobalId() string 1394 GetName() string 1395 GetDesc() string 1396 IsDefault() bool 1397 GetMaxPriority() int 1398 GetMinPriority() int 1399 GetSupporedUserAccessTypes() []TUserAccessType 1400 GetNetworkType() string 1401 GetFileSystemType() string 1402 GetMountTargetCount() int 1403 1404 GetRules() ([]AccessGroupRule, error) 1405 SyncRules(common, added, removed AccessGroupRuleSet) error 1406 1407 Delete() error 1408 } 1409 1410 type ICloudWafIPSet interface { 1411 GetName() string 1412 GetDesc() string 1413 GetType() TWafType 1414 GetGlobalId() string 1415 GetAddresses() WafAddresses 1416 1417 Delete() error 1418 } 1419 1420 type ICloudWafRegexSet interface { 1421 GetName() string 1422 GetDesc() string 1423 GetType() TWafType 1424 GetGlobalId() string 1425 GetRegexPatterns() WafRegexPatterns 1426 1427 Delete() error 1428 } 1429 1430 type ICloudWafInstance interface { 1431 ICloudEnabledResource 1432 1433 GetWafType() TWafType 1434 GetDefaultAction() *DefaultAction 1435 GetRules() ([]ICloudWafRule, error) 1436 AddRule(opts *SWafRule) (ICloudWafRule, error) 1437 1438 // 绑定的资源列表 1439 GetCloudResources() ([]SCloudResource, error) 1440 1441 Delete() error 1442 } 1443 1444 type ICloudWafRuleGroup interface { 1445 GetName() string 1446 GetDesc() string 1447 GetGlobalId() string 1448 GetWafType() TWafType 1449 GetRules() ([]ICloudWafRule, error) 1450 } 1451 1452 type ICloudWafRule interface { 1453 GetName() string 1454 GetDesc() string 1455 GetGlobalId() string 1456 GetPriority() int 1457 GetAction() *DefaultAction 1458 GetStatementCondition() TWafStatementCondition 1459 GetStatements() ([]SWafStatement, error) 1460 1461 Update(opts *SWafRule) error 1462 Delete() error 1463 } 1464 1465 type ICloudMongoDB interface { 1466 IVirtualResource 1467 IBillingResource 1468 1469 GetVpcId() string 1470 GetNetworkId() string 1471 GetIpAddr() string 1472 GetVcpuCount() int 1473 GetVmemSizeMb() int 1474 GetDiskSizeMb() int 1475 GetZoneId() string 1476 GetReplicationNum() int 1477 GetCategory() string 1478 GetEngine() string 1479 GetEngineVersion() string 1480 GetInstanceType() string 1481 GetMaintainTime() string 1482 GetPort() int 1483 GetIops() int 1484 1485 GetMaxConnections() int 1486 1487 GetNetworkAddress() string 1488 1489 GetIBackups() ([]SMongoDBBackup, error) 1490 1491 Delete() error 1492 } 1493 1494 type ICloudElasticSearch interface { 1495 IVirtualResource 1496 IBillingResource 1497 1498 GetVersion() string 1499 GetStorageType() string 1500 GetDiskSizeGb() int 1501 GetCategory() string 1502 1503 GetInstanceType() string 1504 GetVcpuCount() int 1505 GetVmemSizeGb() int 1506 1507 GetVpcId() string 1508 GetNetworkId() string 1509 GetZoneId() string 1510 IsMultiAz() bool 1511 1512 GetAccessInfo() (*ElasticSearchAccessInfo, error) 1513 1514 Delete() error 1515 } 1516 1517 type ICloudKafka interface { 1518 IVirtualResource 1519 IBillingResource 1520 1521 GetNetworkId() string 1522 GetVpcId() string 1523 GetZoneId() string 1524 GetInstanceType() string 1525 1526 GetVersion() string 1527 GetDiskSizeGb() int 1528 GetStorageType() string 1529 GetBandwidthMb() int 1530 GetEndpoint() string 1531 GetMsgRetentionMinute() int 1532 1533 IsMultiAz() bool 1534 1535 GetTopics() ([]SKafkaTopic, error) 1536 1537 Delete() error 1538 } 1539 1540 type ICloudApp interface { 1541 IVirtualResource 1542 GetEnvironments() ([]ICloudAppEnvironment, error) 1543 GetTechStack() string 1544 GetType() string 1545 GetKind() string 1546 GetOsType() TOsType 1547 } 1548 1549 type ICloudAppEnvironment interface { 1550 IVirtualResource 1551 GetInstanceType() (string, error) 1552 GetInstanceNumber() (int, error) 1553 } 1554 1555 type ICloudDBInstanceSku interface { 1556 GetName() string 1557 GetGlobalId() string 1558 GetStatus() string 1559 GetEngine() string 1560 GetEngineVersion() string 1561 GetStorageType() string 1562 GetDiskSizeStep() int 1563 GetMaxDiskSizeGb() int 1564 GetMinDiskSizeGb() int 1565 GetIOPS() int 1566 GetTPS() int 1567 GetQPS() int 1568 GetMaxConnections() int 1569 GetVcpuCount() int 1570 GetVmemSizeMb() int 1571 GetCategory() string 1572 GetZone1Id() string 1573 GetZone2Id() string 1574 GetZone3Id() string 1575 GetZoneId() string 1576 } 1577 1578 type ICloudNatSku interface { 1579 GetName() string 1580 GetDesc() string 1581 GetGlobalId() string 1582 GetPrepaidStatus() string 1583 GetPostpaidStatus() string 1584 } 1585 1586 type ICloudCDNDomain interface { 1587 ICloudEnabledResource 1588 1589 GetArea() string 1590 GetServiceType() string 1591 GetCname() string 1592 GetOrigins() *SCdnOrigins 1593 1594 Delete() error 1595 } 1596 1597 type ICloudKubeCluster interface { 1598 ICloudEnabledResource 1599 1600 GetKubeConfig(private bool, expireMinutes int) (*SKubeconfig, error) 1601 1602 GetIKubeNodePools() ([]ICloudKubeNodePool, error) 1603 GetIKubeNodes() ([]ICloudKubeNode, error) 1604 1605 Delete(isRetain bool) error 1606 } 1607 1608 type ICloudKubeNode interface { 1609 ICloudResource 1610 1611 GetINodePoolId() string 1612 } 1613 1614 type ICloudKubeNodePool interface { 1615 ICloudResource 1616 } 1617 1618 type ICloudTablestore interface { 1619 IVirtualResource 1620 } 1621 1622 type ICloudMiscResource interface { 1623 IVirtualResource 1624 1625 GetResourceType() string 1626 1627 GetConfig() jsonutils.JSONObject 1628 }