mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
refact(region): resource tags
This commit is contained in:
@@ -127,6 +127,12 @@ func (disk *SDisk) GetMetadata() *jsonutils.JSONDict {
|
||||
return data
|
||||
}
|
||||
|
||||
func (disk *SDisk) GetSysTags() map[string]string {
|
||||
data := map[string]string{}
|
||||
data["hypervisor"] = api.HYPERVISOR_OPENSTACK
|
||||
return data
|
||||
}
|
||||
|
||||
func (region *SRegion) GetDisks() ([]SDisk, error) {
|
||||
disks := []SDisk{}
|
||||
resource := "/volumes/detail"
|
||||
|
||||
@@ -157,10 +157,6 @@ func (eip *SEipAddress) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (eip *SEipAddress) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (eip *SEipAddress) GetIpAddr() string {
|
||||
return eip.FloatingIPAddress
|
||||
}
|
||||
|
||||
@@ -164,10 +164,6 @@ func (flavor *SFlavor) Delete() error {
|
||||
return flavor.region.DeleteFlavor(flavor.Id)
|
||||
}
|
||||
|
||||
func (flavor *SFlavor) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (flavor *SFlavor) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -131,10 +131,6 @@ func (region *SRegion) GetImages(name string, status string, imageId string) ([]
|
||||
return images, nil
|
||||
}
|
||||
|
||||
func (image *SImage) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (image *SImage) GetId() string {
|
||||
return image.Id
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SLoadbalancerPoolCreateParams struct {
|
||||
@@ -67,6 +68,7 @@ type SSessionPersistence struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerPool struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
members []SLoadbalancerMember
|
||||
healthmonitor *SLoadbalancerHealthmonitor
|
||||
@@ -255,10 +257,6 @@ func (pool *SLoadbalancerPool) GetType() string {
|
||||
return api.LB_BACKENDGROUP_TYPE_NORMAL
|
||||
}
|
||||
|
||||
func (pool *SLoadbalancerPool) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pool *SLoadbalancerPool) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type AclEntrys struct {
|
||||
@@ -35,6 +36,7 @@ type AclEntry struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerAcl struct {
|
||||
multicloud.SResourceBase
|
||||
listener *SLoadbalancerListener
|
||||
}
|
||||
|
||||
@@ -58,10 +60,6 @@ func (acl *SLoadbalancerAcl) GetStatus() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (acl *SLoadbalancerAcl) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (acl *SLoadbalancerAcl) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SLoadbalancerL7PolicyCreateParams struct {
|
||||
@@ -39,6 +40,7 @@ type SLoadbalancerL7PolicyCreateParams struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerL7Policy struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
l7rules []SLoadbalancerL7Rule
|
||||
ListenerID string `json:"listener_id"`
|
||||
@@ -164,6 +166,3 @@ func (L7policy *SLoadbalancerL7Policy) Refresh() error {
|
||||
func (L7policy *SLoadbalancerL7Policy) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
func (L7policy *SLoadbalancerL7Policy) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SLoadbalancerL7RuleCreateParams struct {
|
||||
@@ -36,6 +37,7 @@ type SLoadbalancerL7RuleCreateParams struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerL7Rule struct {
|
||||
multicloud.SResourceBase
|
||||
policy *SLoadbalancerL7Policy
|
||||
CreatedAt string `json:"created_at"`
|
||||
CompareType string `json:"compare_type"`
|
||||
@@ -151,10 +153,6 @@ func (l7r *SLoadbalancerL7Rule) GetStatus() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (l7r *SLoadbalancerL7Rule) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SLoadbalancerL7Rule) IsDefault() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SLoadbalancerListenerCreateParams struct {
|
||||
@@ -83,6 +84,7 @@ type SInsertHeaders struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerListener struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
l7policies []SLoadbalancerL7Policy
|
||||
pools []SLoadbalancerPool
|
||||
@@ -151,10 +153,6 @@ func (listener *SLoadbalancerListener) GetStatus() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (listener *SLoadbalancerListener) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (listener *SLoadbalancerListener) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SLoadbalancerMemberCreateParams struct {
|
||||
@@ -40,6 +41,7 @@ type SLoadbalancerMemberCreateParams struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerMember struct {
|
||||
multicloud.SResourceBase
|
||||
poolID string
|
||||
region *SRegion
|
||||
MonitorPort int `json:"monitor_port"`
|
||||
@@ -89,10 +91,6 @@ func (member *SLoadbalancerMember) GetStatus() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (member *SLoadbalancerMember) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (member *SLoadbalancerMember) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -162,10 +162,6 @@ func (lb *SLoadbalancer) GetStatus() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (lb *SLoadbalancer) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (lb *SLoadbalancer) GetAddress() string {
|
||||
return lb.VipAddress
|
||||
}
|
||||
@@ -492,6 +488,6 @@ func (lb *SLoadbalancer) GetProjectId() string {
|
||||
return lb.ProjectID
|
||||
}
|
||||
|
||||
func (self *SLoadbalancer) SetMetadata(tags map[string]string, replace bool) error {
|
||||
func (self *SLoadbalancer) SetTags(tags map[string]string, replace bool) error {
|
||||
return cloudprovider.ErrNotSupported
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SLoadbalancerHealthmonitorCreateParams struct {
|
||||
@@ -57,6 +58,7 @@ type SLoadbalancerHealthmonitorUpdateParams struct {
|
||||
}
|
||||
|
||||
type SLoadbalancerHealthmonitor struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
ProjectID string `json:"project_id"`
|
||||
Name string `json:"name"`
|
||||
@@ -221,6 +223,3 @@ func (healthmonitor *SLoadbalancerHealthmonitor) Refresh() error {
|
||||
func (healthmonitor *SLoadbalancerHealthmonitor) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
func (healthmonitor *SLoadbalancerHealthmonitor) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
"yunion.io/x/onecloud/pkg/util/rbacutils"
|
||||
)
|
||||
|
||||
@@ -91,6 +92,7 @@ type SNextLink struct {
|
||||
}
|
||||
|
||||
type SNetwork struct {
|
||||
multicloud.SResourceBase
|
||||
wire *SWire
|
||||
|
||||
Name string
|
||||
@@ -117,10 +119,6 @@ type SNetwork struct {
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (network *SNetwork) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (network *SNetwork) GetId() string {
|
||||
return network.Id
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
@@ -35,10 +33,6 @@ type SNovaDisk struct {
|
||||
instanceId string
|
||||
}
|
||||
|
||||
func (disk *SNovaDisk) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (disk *SNovaDisk) GetId() string {
|
||||
return disk.instanceId
|
||||
}
|
||||
|
||||
@@ -21,17 +21,15 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SNovaStorage struct {
|
||||
multicloud.SResourceBase
|
||||
host *SHypervisor
|
||||
zone *SZone
|
||||
}
|
||||
|
||||
func (storage *SNovaStorage) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (storage *SNovaStorage) GetId() string {
|
||||
return fmt.Sprintf("%s-%s-%s", storage.zone.GetGlobalId(), storage.host.GetId(), storage.GetName())
|
||||
}
|
||||
|
||||
@@ -18,16 +18,17 @@ import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
)
|
||||
|
||||
type SProject struct {
|
||||
multicloud.SResourceBase
|
||||
client *SOpenStackClient
|
||||
Description string
|
||||
Enabled bool
|
||||
@@ -43,10 +44,6 @@ func (p *SProject) GetGlobalId() string {
|
||||
return p.GetId()
|
||||
}
|
||||
|
||||
func (p *SProject) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *SProject) GetName() string {
|
||||
return p.Name
|
||||
}
|
||||
|
||||
@@ -59,10 +59,6 @@ func (region *SRegion) GetClient() *SOpenStackClient {
|
||||
return region.client
|
||||
}
|
||||
|
||||
func (region *SRegion) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (region *SRegion) GetId() string {
|
||||
return region.Name
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
package openstack
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SRouteEntry struct {
|
||||
multicloud.SResourceBase
|
||||
Destination string `json:"destination"`
|
||||
Nexthop string `json:"nexthop"`
|
||||
}
|
||||
@@ -48,10 +48,6 @@ func (route *SRouteEntry) IsEmulated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (route *SRouteEntry) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (route *SRouteEntry) GetType() string {
|
||||
return api.ROUTE_ENTRY_TYPE_CUSTOM
|
||||
}
|
||||
@@ -69,6 +65,7 @@ func (route *SRouteEntry) GetNextHop() string {
|
||||
}
|
||||
|
||||
type SRouteTable struct {
|
||||
multicloud.SResourceBase
|
||||
vpc *SVpc
|
||||
entries []SRouteEntry
|
||||
router *SRouter
|
||||
@@ -90,10 +87,6 @@ func (self *SRouteTable) GetName() string {
|
||||
return self.router.Name
|
||||
}
|
||||
|
||||
func (self *SRouteTable) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SRouteTable) GetRegionId() string {
|
||||
return self.vpc.region.GetId()
|
||||
}
|
||||
|
||||
@@ -117,10 +117,6 @@ func (region *SRegion) GetSecurityGroups(projectId, name string) ([]SSecurityGro
|
||||
return secgroups, nil
|
||||
}
|
||||
|
||||
func (secgroup *SSecurityGroup) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (secgroup *SSecurityGroup) GetVpcId() string {
|
||||
return "normal"
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -38,6 +39,7 @@ const (
|
||||
)
|
||||
|
||||
type SSnapshot struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
|
||||
Id string
|
||||
@@ -143,10 +145,6 @@ func (region *SRegion) GetISnapshots() ([]cloudprovider.ICloudSnapshot, error) {
|
||||
return isnapshots, nil
|
||||
}
|
||||
|
||||
func (snapshot *SSnapshot) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (snapshot *SSnapshot) GetSizeMb() int32 {
|
||||
return snapshot.Size * 1024
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -37,16 +38,13 @@ type SExtraSpecs struct {
|
||||
}
|
||||
|
||||
type SStorage struct {
|
||||
multicloud.SResourceBase
|
||||
zone *SZone
|
||||
Name string
|
||||
ExtraSpecs SExtraSpecs
|
||||
ID string
|
||||
}
|
||||
|
||||
func (storage *SStorage) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (storage *SStorage) GetId() string {
|
||||
return storage.ID
|
||||
}
|
||||
|
||||
@@ -29,17 +29,15 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
"yunion.io/x/onecloud/pkg/util/qemuimg"
|
||||
)
|
||||
|
||||
type SStoragecache struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
}
|
||||
|
||||
func (cache *SStoragecache) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cache *SStoragecache) GetId() string {
|
||||
return fmt.Sprintf("%s-%s", cache.region.client.cpcfg.Id, cache.region.GetId())
|
||||
}
|
||||
|
||||
@@ -17,21 +17,18 @@ package openstack
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SWire struct {
|
||||
multicloud.SResourceBase
|
||||
zone *SZone
|
||||
vpc *SVpc
|
||||
}
|
||||
|
||||
func (wire *SWire) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (wire *SWire) GetId() string {
|
||||
return fmt.Sprintf("%s-%s", wire.vpc.GetId(), wire.zone.GetId())
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud"
|
||||
)
|
||||
|
||||
type ZoneState struct {
|
||||
@@ -37,6 +38,7 @@ type HostState struct {
|
||||
}
|
||||
|
||||
type SZone struct {
|
||||
multicloud.SResourceBase
|
||||
region *SRegion
|
||||
|
||||
ZoneName string
|
||||
@@ -47,10 +49,6 @@ type SZone struct {
|
||||
hosts []SHypervisor
|
||||
}
|
||||
|
||||
func (zone *SZone) GetMetadata() *jsonutils.JSONDict {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (zone *SZone) GetId() string {
|
||||
return zone.ZoneName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user