resources

package
v0.8.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMPUTE_INSTANCE      = "Compute Instance"
	STORAGE               = "Storage"
	NETWORK_LOAD_BALANCER = "Network Load Balancer"
)

Variables

View Source
var PrepareImageInfoList []*irs.ImageInfo

Functions

func CloneDiskInfo added in v0.6.7

func CloneDiskInfo(srcInfo irs.DiskInfo) irs.DiskInfo

func CloneDiskInfoList added in v0.6.7

func CloneDiskInfoList(srcInfoList []*irs.DiskInfo) []*irs.DiskInfo

func CloneHealthCheckerInfo added in v0.5.11

func CloneHealthCheckerInfo(srcInfo irs.HealthCheckerInfo) irs.HealthCheckerInfo

func CloneKeyPairInfo added in v0.4.11

func CloneKeyPairInfo(srcInfo irs.KeyPairInfo) irs.KeyPairInfo

func CloneKeyPairInfoList added in v0.4.11

func CloneKeyPairInfoList(srcInfoList []*irs.KeyPairInfo) []*irs.KeyPairInfo

func CloneListenerInfo added in v0.5.11

func CloneListenerInfo(srcInfo irs.ListenerInfo) irs.ListenerInfo

func CloneMyImageInfo added in v0.6.12

func CloneMyImageInfo(srcInfo irs.MyImageInfo) irs.MyImageInfo

func CloneMyImageInfoList added in v0.6.12

func CloneMyImageInfoList(srcInfoList []*irs.MyImageInfo) []*irs.MyImageInfo

func CloneNLBInfo added in v0.5.10

func CloneNLBInfo(srcInfo irs.NLBInfo) irs.NLBInfo

func CloneNLBInfoList added in v0.5.10

func CloneNLBInfoList(srcInfoList []*irs.NLBInfo) []*irs.NLBInfo

func CloneSecurityInfo added in v0.3.3

func CloneSecurityInfo(srcInfo irs.SecurityInfo) irs.SecurityInfo

func CloneSecurityInfoList added in v0.3.3

func CloneSecurityInfoList(srcInfoList []*irs.SecurityInfo) []*irs.SecurityInfo

func CloneSubnetInfo added in v0.4.11

func CloneSubnetInfo(srcInfo irs.SubnetInfo) irs.SubnetInfo

func CloneSubnetInfoList added in v0.4.11

func CloneSubnetInfoList(srcInfoList []irs.SubnetInfo) []irs.SubnetInfo

func CloneVMGroupInfo added in v0.5.11

func CloneVMGroupInfo(srcInfo irs.VMGroupInfo) irs.VMGroupInfo

func CloneVMInfo added in v0.4.11

func CloneVMInfo(srcInfo irs.VMInfo) irs.VMInfo

func CloneVMInfoList added in v0.4.11

func CloneVMInfoList(srcInfoList []*irs.VMInfo) []*irs.VMInfo

func CloneVMStatusInfo added in v0.4.11

func CloneVMStatusInfo(srcInfo irs.VMStatusInfo) irs.VMStatusInfo

func CloneVMStatusInfoList added in v0.4.11

func CloneVMStatusInfoList(srcInfoList []*irs.VMStatusInfo) []*irs.VMStatusInfo

func CloneVMs added in v0.5.11

func CloneVMs(srcInfo *[]irs.IID) *[]irs.IID

func CloneVPCInfo added in v0.4.11

func CloneVPCInfo(srcInfo irs.VPCInfo) irs.VPCInfo

func CloneVPCInfoList added in v0.4.11

func CloneVPCInfoList(srcInfoList []*irs.VPCInfo) []*irs.VPCInfo

func GetGlobalViewTemplate added in v0.8.1

func GetGlobalViewTemplate(productFamily string) (irs.CloudPriceData, error)

func PrepareRegionZone added in v0.7.6

func PrepareRegionZone(mockName string)

Be called before using the User function. Called in MockDriver

func PrepareVMImage added in v0.2.8

func PrepareVMImage(mockName string)

Be called before using the User function. Called in MockDriver

func PrepareVMSpec added in v0.2.8

func PrepareVMSpec(mockName string)

Be called before using the User function. Called in MockDriver

Types

type InstanceData added in v0.8.1

type InstanceData struct {
	Category     string       `json:"category"`
	InstanceName string       `json:"instanceName"`
	InstanceInfo InstanceInfo `json:"instanceInfo"`
	PricingList  PricingList  `json:"pricingList"`
}

==================================================== ------- vm instance struct for price info

type InstanceInfo added in v0.8.1

type InstanceInfo struct {
	RegionName            string `json:"regionName"`
	InstanceType          string `json:"instanceType"`
	Vcpu                  string `json:"vcpu"`
	Clock                 string `json:"clock"`
	Memory                string `json:"memory"`
	Storage               string `json:"storage"`
	ProcessorArchitecture string `json:"processorArchitecture"`
	Os                    string `json:"os"`
	ProcessorFeatures     string `json:"processorFeatures"`
}

type MockAnyCallHandler added in v0.6.9

type MockAnyCallHandler struct {
	MockName string
}

func (*MockAnyCallHandler) AnyCall added in v0.6.9

func (anyCallHandler *MockAnyCallHandler) AnyCall(callInfo irs.AnyCallInfo) (irs.AnyCallInfo, error)

*******************************************************

// call example
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d \
'{
        "ConnectionName" : "mock-config01",
        "ReqInfo" : {
                "FID" : "countAll",
                "IKeyValueList" : [{"Key":"rsType", "Value":"vpc"}]
        }
}' | json_pp

*******************************************************

type MockDiskHandler added in v0.6.7

type MockDiskHandler struct {
	MockName string
}

func (*MockDiskHandler) AttachDisk added in v0.6.7

func (diskHandler *MockDiskHandler) AttachDisk(diskIID irs.IID, ownerVM irs.IID) (irs.DiskInfo, error)

func (*MockDiskHandler) ChangeDiskSize added in v0.6.7

func (diskHandler *MockDiskHandler) ChangeDiskSize(iid irs.IID, size string) (bool, error)

func (*MockDiskHandler) CreateDisk added in v0.6.7

func (diskHandler *MockDiskHandler) CreateDisk(diskReqInfo irs.DiskInfo) (irs.DiskInfo, error)

(1) create diskInfo object (2) insert diskInfo into global Map

func (*MockDiskHandler) DeleteDisk added in v0.6.7

func (diskHandler *MockDiskHandler) DeleteDisk(iid irs.IID) (bool, error)

func (*MockDiskHandler) DetachDisk added in v0.6.7

func (diskHandler *MockDiskHandler) DetachDisk(diskIID irs.IID, ownerVM irs.IID) (bool, error)

func (*MockDiskHandler) GetDisk added in v0.6.7

func (diskHandler *MockDiskHandler) GetDisk(iid irs.IID) (irs.DiskInfo, error)

func (*MockDiskHandler) ListDisk added in v0.6.7

func (diskHandler *MockDiskHandler) ListDisk() ([]*irs.DiskInfo, error)

type MockImageHandler

type MockImageHandler struct {
	MockName string
}

func (*MockImageHandler) CheckWindowsImage added in v0.6.15

func (imageHandler *MockImageHandler) CheckWindowsImage(imageIID irs.IID) (bool, error)

func (*MockImageHandler) CreateImage

func (imageHandler *MockImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error)

(1) create imageInfo object (2) insert ImageInfo into global Map

func (*MockImageHandler) DeleteImage

func (imageHandler *MockImageHandler) DeleteImage(imageIID irs.IID) (bool, error)

func (*MockImageHandler) GetImage

func (imageHandler *MockImageHandler) GetImage(imageIID irs.IID) (irs.ImageInfo, error)

func (*MockImageHandler) ListImage

func (imageHandler *MockImageHandler) ListImage() ([]*irs.ImageInfo, error)

type MockKeyPairHandler

type MockKeyPairHandler struct {
	MockName string
}

func (*MockKeyPairHandler) CreateKey

func (keyPairHandler *MockKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error)

(1) create keyPairInfo object (2) insert keyPairInfo into global Map

func (*MockKeyPairHandler) DeleteKey

func (keyPairHandler *MockKeyPairHandler) DeleteKey(iid irs.IID) (bool, error)

func (*MockKeyPairHandler) GetKey

func (keyPairHandler *MockKeyPairHandler) GetKey(iid irs.IID) (irs.KeyPairInfo, error)

func (*MockKeyPairHandler) ListKey

func (keyPairHandler *MockKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, error)

type MockMyImageHandler added in v0.6.12

type MockMyImageHandler struct {
	MockName string
}

func (*MockMyImageHandler) CheckWindowsImage added in v0.6.15

func (myImageHandler *MockMyImageHandler) CheckWindowsImage(iid irs.IID) (bool, error)

func (*MockMyImageHandler) DeleteMyImage added in v0.6.12

func (myImageHandler *MockMyImageHandler) DeleteMyImage(iid irs.IID) (bool, error)

func (*MockMyImageHandler) GetMyImage added in v0.6.12

func (myImageHandler *MockMyImageHandler) GetMyImage(iid irs.IID) (irs.MyImageInfo, error)

func (*MockMyImageHandler) ListMyImage added in v0.6.12

func (myImageHandler *MockMyImageHandler) ListMyImage() ([]*irs.MyImageInfo, error)

func (*MockMyImageHandler) SnapshotVM added in v0.6.12

func (myImageHandler *MockMyImageHandler) SnapshotVM(myImageReqInfo irs.MyImageInfo) (irs.MyImageInfo, error)

(1) create myImageInfo object (2) insert myImageInfo into global Map

type MockNLBHandler added in v0.5.10

type MockNLBHandler struct {
	MockName string
}

func (*MockNLBHandler) AddVMs added in v0.5.10

func (nlbHandler *MockNLBHandler) AddVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (irs.VMGroupInfo, error)

func (*MockNLBHandler) ChangeHealthCheckerInfo added in v0.5.10

func (nlbHandler *MockNLBHandler) ChangeHealthCheckerInfo(nlbIID irs.IID, healthChecker irs.HealthCheckerInfo) (irs.HealthCheckerInfo, error)

func (*MockNLBHandler) ChangeListener added in v0.5.10

func (nlbHandler *MockNLBHandler) ChangeListener(nlbIID irs.IID, listener irs.ListenerInfo) (irs.ListenerInfo, error)

------ Frontend Control

func (*MockNLBHandler) ChangeVMGroupInfo added in v0.5.10

func (nlbHandler *MockNLBHandler) ChangeVMGroupInfo(nlbIID irs.IID, vmGroup irs.VMGroupInfo) (irs.VMGroupInfo, error)

------ Backend Control

func (*MockNLBHandler) CreateNLB added in v0.5.10

func (nlbHandler *MockNLBHandler) CreateNLB(nlbInfo irs.NLBInfo) (irs.NLBInfo, error)

func (*MockNLBHandler) DeleteNLB added in v0.5.10

func (nlbHandler *MockNLBHandler) DeleteNLB(iid irs.IID) (bool, error)

func (*MockNLBHandler) GetNLB added in v0.5.10

func (nlbHandler *MockNLBHandler) GetNLB(iid irs.IID) (irs.NLBInfo, error)

func (*MockNLBHandler) GetVMGroupHealthInfo added in v0.5.10

func (nlbHandler *MockNLBHandler) GetVMGroupHealthInfo(nlbIID irs.IID) (irs.HealthInfo, error)

func (*MockNLBHandler) ListNLB added in v0.5.10

func (nlbHandler *MockNLBHandler) ListNLB() ([]*irs.NLBInfo, error)

func (*MockNLBHandler) RemoveVMs added in v0.5.10

func (nlbHandler *MockNLBHandler) RemoveVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (bool, error)

type MockPriceInfoHandler added in v0.8.1

type MockPriceInfoHandler struct {
	Region   idrv.RegionInfo
	MockName string
}

func (*MockPriceInfoHandler) GetPriceInfo added in v0.8.1

func (handler *MockPriceInfoHandler) GetPriceInfo(productFamily string, regionName string, filterList []irs.KeyValue) (string, error)

1. Get the Mock's price info from product price info files

  • by getMockPriceInfo()

2. transform csp price info to Spider price info(Global view) with filter processing

  • by transformPriceInfo() -> transformToProductInfo() -> checkFilters() -> transformToPriceInfo() -> checkFilters() -> make cloudPrice.PriceList info -> make global json for result string

3. return Spider price info

func (*MockPriceInfoHandler) ListProductFamily added in v0.8.1

func (handler *MockPriceInfoHandler) ListProductFamily(regionName string) ([]string, error)

type MockRegionZoneHandler added in v0.7.6

type MockRegionZoneHandler struct {
	Region   idrv.RegionInfo
	MockName string
}

func (*MockRegionZoneHandler) GetRegionZone added in v0.7.6

func (handler *MockRegionZoneHandler) GetRegionZone(Name string) (irs.RegionZoneInfo, error)

func (*MockRegionZoneHandler) ListOrgRegion added in v0.7.6

func (handler *MockRegionZoneHandler) ListOrgRegion() (string, error)

ListOrgRegion implements resources.RegionZoneHandler.

func (*MockRegionZoneHandler) ListOrgZone added in v0.7.6

func (handler *MockRegionZoneHandler) ListOrgZone() (string, error)

ListOrgZone implements resources.RegionZoneHandler.

func (*MockRegionZoneHandler) ListRegionZone added in v0.7.6

func (handler *MockRegionZoneHandler) ListRegionZone() ([]*irs.RegionZoneInfo, error)

type MockSecurityHandler

type MockSecurityHandler struct {
	MockName string
}

func (*MockSecurityHandler) AddRules added in v0.5.4

func (securityHandler *MockSecurityHandler) AddRules(sgIID irs.IID, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)

func (*MockSecurityHandler) CreateSecurity

func (securityHandler *MockSecurityHandler) CreateSecurity(securityReqInfo irs.SecurityReqInfo) (irs.SecurityInfo, error)

(1) create securityInfo object (2) insert securityInfo into global Map

func (*MockSecurityHandler) DeleteSecurity

func (securityHandler *MockSecurityHandler) DeleteSecurity(iid irs.IID) (bool, error)

func (*MockSecurityHandler) GetSecurity

func (securityHandler *MockSecurityHandler) GetSecurity(iid irs.IID) (irs.SecurityInfo, error)

func (*MockSecurityHandler) ListSecurity

func (securityHandler *MockSecurityHandler) ListSecurity() ([]*irs.SecurityInfo, error)

func (*MockSecurityHandler) RemoveRules added in v0.5.4

func (securityHandler *MockSecurityHandler) RemoveRules(sgIID irs.IID, securityRules *[]irs.SecurityRuleInfo) (bool, error)

type MockVMHandler added in v0.2.8

type MockVMHandler struct {
	Region   idrv.RegionInfo
	MockName string
}

func (*MockVMHandler) GetVM added in v0.2.8

func (vmHandler *MockVMHandler) GetVM(iid irs.IID) (irs.VMInfo, error)

func (*MockVMHandler) GetVMStatus added in v0.2.8

func (vmHandler *MockVMHandler) GetVMStatus(iid irs.IID) (irs.VMStatus, error)

func (*MockVMHandler) ListVM added in v0.2.8

func (vmHandler *MockVMHandler) ListVM() ([]*irs.VMInfo, error)

func (*MockVMHandler) ListVMStatus added in v0.2.8

func (vmHandler *MockVMHandler) ListVMStatus() ([]*irs.VMStatusInfo, error)

func (*MockVMHandler) RebootVM added in v0.2.8

func (vmHandler *MockVMHandler) RebootVM(iid irs.IID) (irs.VMStatus, error)

func (*MockVMHandler) ResumeVM added in v0.2.8

func (vmHandler *MockVMHandler) ResumeVM(iid irs.IID) (irs.VMStatus, error)

func (*MockVMHandler) StartVM added in v0.2.8

func (vmHandler *MockVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, error)

func (*MockVMHandler) SuspendVM added in v0.2.8

func (vmHandler *MockVMHandler) SuspendVM(iid irs.IID) (irs.VMStatus, error)

func (*MockVMHandler) TerminateVM added in v0.2.8

func (vmHandler *MockVMHandler) TerminateVM(iid irs.IID) (irs.VMStatus, error)

type MockVMSpecHandler

type MockVMSpecHandler struct {
	MockName string
}

func (*MockVMSpecHandler) GetOrgVMSpec

func (vmSpecHandler *MockVMSpecHandler) GetOrgVMSpec(Name string) (string, error)

func (*MockVMSpecHandler) GetVMSpec

func (vmSpecHandler *MockVMSpecHandler) GetVMSpec(Name string) (irs.VMSpecInfo, error)

func (*MockVMSpecHandler) ListOrgVMSpec

func (vmSpecHandler *MockVMSpecHandler) ListOrgVMSpec() (string, error)

func (*MockVMSpecHandler) ListVMSpec

func (vmSpecHandler *MockVMSpecHandler) ListVMSpec() ([]*irs.VMSpecInfo, error)

type MockVPCHandler

type MockVPCHandler struct {
	MockName string
}

func (*MockVPCHandler) AddSubnet

func (vpcHandler *MockVPCHandler) AddSubnet(iid irs.IID, subnetInfo irs.SubnetInfo) (irs.VPCInfo, error)

func (*MockVPCHandler) CreateVPC

func (vpcHandler *MockVPCHandler) CreateVPC(vpcReqInfo irs.VPCReqInfo) (irs.VPCInfo, error)

(1) create vpcInfo object (2) insert vpcInfo into global Map

func (*MockVPCHandler) DeleteVPC

func (vpcHandler *MockVPCHandler) DeleteVPC(iid irs.IID) (bool, error)

func (*MockVPCHandler) GetVPC

func (vpcHandler *MockVPCHandler) GetVPC(iid irs.IID) (irs.VPCInfo, error)

func (*MockVPCHandler) ListVPC

func (vpcHandler *MockVPCHandler) ListVPC() ([]*irs.VPCInfo, error)

func (*MockVPCHandler) RemoveSubnet

func (vpcHandler *MockVPCHandler) RemoveSubnet(iid irs.IID, subnetIID irs.IID) (bool, error)

type NLBData added in v0.8.1

type NLBData struct {
	Category    string      `json:"category"`
	NLBName     string      `json:"nlbName"`
	NLBInfo     NLBInfo     `json:"nlbInfo"`
	PricingList PricingList `json:"pricingList"`
}

------- load balancer struct for price info

type NLBInfo added in v0.8.1

type NLBInfo struct {
	RegionName string `json:"regionName"`
}

type PayAsYouGo added in v0.8.1

type PayAsYouGo struct {
	PricingId string `json:"priceId"`
	Unit      string `json:"unit"`
	Currency  string `json:"currency"`
	Price     string `json:"price"`
}

type PricingList added in v0.8.1

type PricingList struct {
	PayAsYouGo PayAsYouGo   `json:"payAsYouGo"`
	SavingPlan []SavingPlan `json:"savingPlan"`
}

------- common struct for price info

type SavingPlan added in v0.8.1

type SavingPlan struct {
	PricingId string `json:"priceId"`
	Term      string `json:"term"`
	Unit      string `json:"unit"`
	Currency  string `json:"currency"`
	Price     string `json:"price"`
}

type StorageData added in v0.8.1

type StorageData struct {
	Category    string      `json:"category"`
	StorageName string      `json:"storageName"`
	StorageInfo StorageInfo `json:"storageInfo"`
	PricingList PricingList `json:"pricingList"`
}

------- storage struct for price info

type StorageInfo added in v0.8.1

type StorageInfo struct {
	RegionName  string `json:"regionName"`
	StorageType string `json:"storageType"`
	MaxVolume   string `json:"maxVolume"`
	MaxIOPS     string `json:"maxIOPS"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL