vmock

package
v0.0.0-...-a1c3796 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZoneID             = "cn-hangzhou-a"
	RegionID           = "cn-hangzhou"
	InstanceIP         = "192.0.168.68"
	InstanceType       = "ecs.c6.xlarge"
	NodePoolID         = "np-123456"
	InstanceChargeType = "PostPaid"
)
View Source
const (
	NLBDNSName = "nlb-id.cn-hangzhou.nlb.aliyuncs.com"
	ExistNLBID = "nlb-exist-id"
)
View Source
const (
	LoadBalancerIP = "47.168.0.1"
	ExistLBID      = "lb-exist-id"
	ExistVGroupID  = "rsp-reuse-id"
)

Variables

This section is empty.

Functions

func NewMockCloud

func NewMockCloud(auth *base.ClientMgr) prvd.Provider

func NewMockMetaData

func NewMockMetaData(vpcID string) prvd.IMetaData

Types

type MockALB

type MockALB struct {
	// contains filtered or unexported fields
}

func NewMockALB

func NewMockALB(
	auth *base.ClientMgr,
) *MockALB

func (MockALB) CreateALB

func (MockALB) CreateALBListener

func (p MockALB) CreateALBListener(ctx context.Context, resLS *albmodel.Listener) (albmodel.ListenerStatus, error)

ALB Listener

func (MockALB) CreateALBListenerRule

func (p MockALB) CreateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule) (albmodel.ListenerRuleStatus, error)

ALB Listener Rule

func (MockALB) CreateALBListenerRules

func (p MockALB) CreateALBListenerRules(ctx context.Context, resLR []*albmodel.ListenerRule) (map[int]albmodel.ListenerRuleStatus, error)

func (MockALB) CreateALBServerGroup

func (p MockALB) CreateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, trackingProvider tracking.TrackingProvider) (albmodel.ServerGroupStatus, error)

ALB ServerGroup

func (MockALB) DeleteALB

func (p MockALB) DeleteALB(ctx context.Context, lbID string) error

func (MockALB) DeleteALBListener

func (p MockALB) DeleteALBListener(ctx context.Context, lsID string) error

func (MockALB) DeleteALBListenerRule

func (p MockALB) DeleteALBListenerRule(ctx context.Context, sdkLRId string) error

func (MockALB) DeleteALBListenerRules

func (p MockALB) DeleteALBListenerRules(ctx context.Context, sdkLRIds []string) error

func (MockALB) DeleteALBServerGroup

func (p MockALB) DeleteALBServerGroup(ctx context.Context, serverGroupID string) error

func (MockALB) DeregisterALBServers

func (p MockALB) DeregisterALBServers(ctx context.Context, serverGroupID string, sdkServers []albsdk.BackendServer) error

func (MockALB) DescribeALBZones

func (p MockALB) DescribeALBZones(request *albsdk.DescribeZonesRequest) (response *albsdk.DescribeZonesResponse, err error)

func (MockALB) ListALBListenerRules

func (p MockALB) ListALBListenerRules(ctx context.Context, lsID string) ([]albsdk.Rule, error)

func (MockALB) ListALBListeners

func (p MockALB) ListALBListeners(ctx context.Context, lbID string) ([]albsdk.Listener, error)

func (MockALB) ListALBServerGroupsWithTags

func (p MockALB) ListALBServerGroupsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.ServerGroupWithTags, error)

ALB Tags

func (MockALB) ListALBServers

func (p MockALB) ListALBServers(ctx context.Context, serverGroupID string) ([]albsdk.BackendServer, error)

func (MockALB) ListALBsWithTags

func (p MockALB) ListALBsWithTags(ctx context.Context, tagFilters map[string]string) ([]albmodel.AlbLoadBalancerWithTags, error)

func (MockALB) RegisterALBServers

func (p MockALB) RegisterALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem) error

ALB Server

func (MockALB) ReplaceALBServers

func (p MockALB) ReplaceALBServers(ctx context.Context, serverGroupID string, resServers []albmodel.BackendItem, sdkServers []albsdk.BackendServer) error

func (MockALB) ReuseALB

func (p MockALB) ReuseALB(ctx context.Context, resLB *albmodel.AlbLoadBalancer, lbID string, trackingProvider tracking.TrackingProvider) (albmodel.LoadBalancerStatus, error)

func (MockALB) TagALBResources

func (p MockALB) TagALBResources(request *albsdk.TagResourcesRequest) (response *albsdk.TagResourcesResponse, err error)

func (MockALB) UpdateALB

func (MockALB) UpdateALBListener

func (p MockALB) UpdateALBListener(ctx context.Context, resLS *albmodel.Listener, sdkLB *albsdk.Listener) (albmodel.ListenerStatus, error)

func (MockALB) UpdateALBListenerRule

func (p MockALB) UpdateALBListenerRule(ctx context.Context, resLR *albmodel.ListenerRule, sdkLR *albsdk.Rule) (albmodel.ListenerRuleStatus, error)

func (MockALB) UpdateALBListenerRules

func (p MockALB) UpdateALBListenerRules(ctx context.Context, matches []albmodel.ResAndSDKListenerRulePair) error

func (MockALB) UpdateALBServerGroup

func (p MockALB) UpdateALBServerGroup(ctx context.Context, resSGP *albmodel.ServerGroup, sdkSGP albmodel.ServerGroupWithTags) (albmodel.ServerGroupStatus, error)

type MockCAS

type MockCAS struct {
	// contains filtered or unexported fields
}

func NewMockCAS

func NewMockCAS(
	auth *base.ClientMgr,
) *MockCAS

func (MockCAS) DescribeSSLCertificateList

func (c MockCAS) DescribeSSLCertificateList(ctx context.Context) ([]model.CertificateInfo, error)

func (MockCAS) DescribeSSLCertificatePublicKeyDetail

func (c MockCAS) DescribeSSLCertificatePublicKeyDetail(ctx context.Context, certId string) (*model.CertificateInfo, error)

type MockCLB

type MockCLB struct {
	// contains filtered or unexported fields
}

func NewMockCLB

func NewMockCLB(
	auth *base.ClientMgr,
) *MockCLB

func (*MockCLB) AddVServerGroupBackendServers

func (m *MockCLB) AddVServerGroupBackendServers(ctx context.Context, vGroupId string, backends string) error

func (*MockCLB) CreateLoadBalancer

func (m *MockCLB) CreateLoadBalancer(ctx context.Context, mdl *model.LoadBalancer, clientToken string) error

func (*MockCLB) CreateLoadBalancerHTTPListener

func (m *MockCLB) CreateLoadBalancerHTTPListener(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) CreateLoadBalancerHTTPSListener

func (m *MockCLB) CreateLoadBalancerHTTPSListener(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) CreateLoadBalancerTCPListener

func (m *MockCLB) CreateLoadBalancerTCPListener(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) CreateLoadBalancerUDPListener

func (m *MockCLB) CreateLoadBalancerUDPListener(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) CreateVServerGroup

func (m *MockCLB) CreateVServerGroup(ctx context.Context, vg *model.VServerGroup, lbId string) error

func (*MockCLB) DeleteLoadBalancer

func (m *MockCLB) DeleteLoadBalancer(ctx context.Context, mdl *model.LoadBalancer) error

func (*MockCLB) DeleteLoadBalancerListener

func (m *MockCLB) DeleteLoadBalancerListener(ctx context.Context, lbId string, port int, proto string) error

func (*MockCLB) DeleteVServerGroup

func (m *MockCLB) DeleteVServerGroup(ctx context.Context, vGroupId string) error

func (*MockCLB) DescribeLoadBalancer

func (m *MockCLB) DescribeLoadBalancer(ctx context.Context, mdl *model.LoadBalancer) error

func (*MockCLB) DescribeLoadBalancerListeners

func (m *MockCLB) DescribeLoadBalancerListeners(ctx context.Context, lbId string) ([]model.ListenerAttribute, error)

Listener

func (*MockCLB) DescribeServerCertificateById

func (m *MockCLB) DescribeServerCertificateById(ctx context.Context, serverCertificateId string) (*model.CertAttribute, error)

func (*MockCLB) DescribeVServerGroupAttribute

func (m *MockCLB) DescribeVServerGroupAttribute(ctx context.Context, vGroupId string) (model.VServerGroup, error)

func (*MockCLB) DescribeVServerGroups

func (m *MockCLB) DescribeVServerGroups(ctx context.Context, lbId string) ([]model.VServerGroup, error)

VServerGroup

func (*MockCLB) FindLoadBalancer

func (m *MockCLB) FindLoadBalancer(ctx context.Context, mdl *model.LoadBalancer) error

func (*MockCLB) ListCLBTagResources

func (m *MockCLB) ListCLBTagResources(ctx context.Context, lbId string) ([]tag.Tag, error)

func (*MockCLB) ModifyLoadBalancerInstanceChargeType

func (m *MockCLB) ModifyLoadBalancerInstanceChargeType(ctx context.Context, lbId string, instanceChargeType string, spec string) error

func (*MockCLB) ModifyLoadBalancerInstanceSpec

func (m *MockCLB) ModifyLoadBalancerInstanceSpec(ctx context.Context, lbId string, spec string) error

func (*MockCLB) ModifyLoadBalancerInternetSpec

func (m *MockCLB) ModifyLoadBalancerInternetSpec(ctx context.Context, lbId string, chargeType string, bandwidth int) error

func (*MockCLB) ModifyVServerGroupBackendServers

func (m *MockCLB) ModifyVServerGroupBackendServers(ctx context.Context, vGroupId string, old string, new string) error

func (*MockCLB) RemoveVServerGroupBackendServers

func (m *MockCLB) RemoveVServerGroupBackendServers(ctx context.Context, vGroupId string, backends string) error

func (*MockCLB) SetLoadBalancerDeleteProtection

func (m *MockCLB) SetLoadBalancerDeleteProtection(ctx context.Context, lbId string, flag string) error

func (*MockCLB) SetLoadBalancerHTTPListenerAttribute

func (m *MockCLB) SetLoadBalancerHTTPListenerAttribute(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) SetLoadBalancerHTTPSListenerAttribute

func (m *MockCLB) SetLoadBalancerHTTPSListenerAttribute(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) SetLoadBalancerModificationProtection

func (m *MockCLB) SetLoadBalancerModificationProtection(ctx context.Context, lbId string, flag string) error

func (*MockCLB) SetLoadBalancerName

func (m *MockCLB) SetLoadBalancerName(ctx context.Context, lbId string, name string) error

func (*MockCLB) SetLoadBalancerTCPListenerAttribute

func (m *MockCLB) SetLoadBalancerTCPListenerAttribute(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) SetLoadBalancerUDPListenerAttribute

func (m *MockCLB) SetLoadBalancerUDPListenerAttribute(ctx context.Context, lbId string, listener model.ListenerAttribute) error

func (*MockCLB) SetVServerGroupAttribute

func (m *MockCLB) SetVServerGroupAttribute(ctx context.Context, vGroupId string, backends string) error

func (*MockCLB) StartLoadBalancerListener

func (m *MockCLB) StartLoadBalancerListener(ctx context.Context, lbId string, port int, proto string) error

func (*MockCLB) StopLoadBalancerListener

func (m *MockCLB) StopLoadBalancerListener(ctx context.Context, lbId string, port int, proto string) error

func (*MockCLB) TagCLBResource

func (m *MockCLB) TagCLBResource(ctx context.Context, resourceId string, tags []tag.Tag) error

func (*MockCLB) UntagResources

func (m *MockCLB) UntagResources(ctx context.Context, lbId string, tagKey *[]string) error

type MockCloud

type MockCloud struct {
	*MockECS
	*MockPVTZ
	*MockVPC
	*MockCLB
	*MockALB
	*MockCAS
	*MockSLS
	*MockNLB
	prvd.IMetaData
}

MockCloud for unit test

type MockECS

type MockECS struct {
	// contains filtered or unexported fields
}

func NewMockECS

func NewMockECS(
	auth *base.ClientMgr,
) *MockECS

func (*MockECS) DescribeNetworkInterfaces

func (d *MockECS) DescribeNetworkInterfaces(vpcId string, ips []string, ipVersionType model.AddressIPVersionType) (map[string]string, error)

func (*MockECS) GetInstancesByIP

func (d *MockECS) GetInstancesByIP(ctx context.Context, ips []string) (*prvd.NodeAttribute, error)

func (*MockECS) ListInstances

func (d *MockECS) ListInstances(ctx context.Context, ids []string) (map[string]*prvd.NodeAttribute, error)

type MockMetaData

type MockMetaData struct {
	// contains filtered or unexported fields
}

func (*MockMetaData) ClusterID

func (m *MockMetaData) ClusterID() string

func (*MockMetaData) DNSNameServers

func (m *MockMetaData) DNSNameServers() ([]string, error)

func (*MockMetaData) EIPv4

func (m *MockMetaData) EIPv4() (string, error)

func (*MockMetaData) HostName

func (m *MockMetaData) HostName() (string, error)

func (*MockMetaData) ImageID

func (m *MockMetaData) ImageID() (string, error)

func (*MockMetaData) InstanceID

func (m *MockMetaData) InstanceID() (string, error)

func (*MockMetaData) Mac

func (m *MockMetaData) Mac() (string, error)

func (*MockMetaData) NTPConfigServers

func (m *MockMetaData) NTPConfigServers() ([]string, error)

func (*MockMetaData) NetworkType

func (m *MockMetaData) NetworkType() (string, error)

func (*MockMetaData) OwnerAccountID

func (m *MockMetaData) OwnerAccountID() (string, error)

func (*MockMetaData) PrivateIPv4

func (m *MockMetaData) PrivateIPv4() (string, error)

func (*MockMetaData) RamRoleToken

func (m *MockMetaData) RamRoleToken(role string) (prvd.RoleAuth, error)

func (*MockMetaData) Region

func (m *MockMetaData) Region() (string, error)

func (*MockMetaData) RoleName

func (m *MockMetaData) RoleName() (string, error)

func (*MockMetaData) SerialNumber

func (m *MockMetaData) SerialNumber() (string, error)

func (*MockMetaData) SourceAddress

func (m *MockMetaData) SourceAddress() (string, error)

func (*MockMetaData) VpcCIDRBlock

func (m *MockMetaData) VpcCIDRBlock() (string, error)

func (*MockMetaData) VpcID

func (m *MockMetaData) VpcID() (string, error)

func (*MockMetaData) VswitchCIDRBlock

func (m *MockMetaData) VswitchCIDRBlock() (string, error)

func (*MockMetaData) VswitchID

func (m *MockMetaData) VswitchID() (string, error)

func (*MockMetaData) Zone

func (m *MockMetaData) Zone() (string, error)

type MockNLB

type MockNLB struct {
	// contains filtered or unexported fields
}

func NewMockNLB

func NewMockNLB(
	auth *base.ClientMgr,
) *MockNLB

func (MockNLB) AddNLBServers

func (m MockNLB) AddNLBServers(ctx context.Context, sgId string, backends []nlbmodel.ServerGroupServer) error

func (MockNLB) AttachCommonBandwidthPackageToLoadBalancer

func (m MockNLB) AttachCommonBandwidthPackageToLoadBalancer(ctx context.Context, lbId string, bandwidthPackageId string) error

func (MockNLB) CreateNLB

func (m MockNLB) CreateNLB(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

func (MockNLB) CreateNLBListener

func (m MockNLB) CreateNLBListener(ctx context.Context, lbId string, lis *nlbmodel.ListenerAttribute) error

func (MockNLB) CreateNLBServerGroup

func (m MockNLB) CreateNLBServerGroup(ctx context.Context, sg *nlbmodel.ServerGroup) error

func (MockNLB) DeleteNLB

func (m MockNLB) DeleteNLB(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

func (MockNLB) DeleteNLBListener

func (m MockNLB) DeleteNLBListener(ctx context.Context, listenerId string) error

func (MockNLB) DeleteNLBServerGroup

func (m MockNLB) DeleteNLBServerGroup(ctx context.Context, sgId string) error

func (MockNLB) DescribeNLB

func (m MockNLB) DescribeNLB(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

func (MockNLB) DetachCommonBandwidthPackageFromLoadBalancer

func (m MockNLB) DetachCommonBandwidthPackageFromLoadBalancer(ctx context.Context, lbId string, bandwidthPackageId string) error

func (MockNLB) FindNLB

func (MockNLB) GetNLBServerGroup

func (m MockNLB) GetNLBServerGroup(ctx context.Context, sgId string) (*nlbmodel.ServerGroup, error)

func (MockNLB) ListNLBListeners

func (m MockNLB) ListNLBListeners(ctx context.Context, lbId string) ([]*nlbmodel.ListenerAttribute, error)

func (MockNLB) ListNLBServerGroups

func (m MockNLB) ListNLBServerGroups(ctx context.Context, tags []tag.Tag) ([]*nlbmodel.ServerGroup, error)

func (MockNLB) ListNLBTagResources

func (m MockNLB) ListNLBTagResources(ctx context.Context, lbId string) ([]tag.Tag, error)

func (MockNLB) RemoveNLBServers

func (m MockNLB) RemoveNLBServers(ctx context.Context, sgId string, backends []nlbmodel.ServerGroupServer) error

func (MockNLB) StartNLBListener

func (m MockNLB) StartNLBListener(ctx context.Context, listenerId string) error

func (MockNLB) TagNLBResource

func (m MockNLB) TagNLBResource(ctx context.Context, resourceId string, resourceType nlbmodel.TagResourceType, tags []tag.Tag) error

func (MockNLB) UntagNLBResources

func (m MockNLB) UntagNLBResources(ctx context.Context, resourceId string, resourceType nlbmodel.TagResourceType, tagKey []*string) error

func (MockNLB) UpdateLoadBalancerProtection

func (m MockNLB) UpdateLoadBalancerProtection(ctx context.Context, lbId string,
	delCfg *nlbmodel.DeletionProtectionConfig, modCfg *nlbmodel.ModificationProtectionConfig) error

func (MockNLB) UpdateNLB

func (m MockNLB) UpdateNLB(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

func (MockNLB) UpdateNLBAddressType

func (m MockNLB) UpdateNLBAddressType(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

func (MockNLB) UpdateNLBIPv6AddressType

func (m MockNLB) UpdateNLBIPv6AddressType(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

func (MockNLB) UpdateNLBListener

func (m MockNLB) UpdateNLBListener(ctx context.Context, lis *nlbmodel.ListenerAttribute) error

func (MockNLB) UpdateNLBSecurityGroupIds

func (m MockNLB) UpdateNLBSecurityGroupIds(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer, added, removed []string) error

func (MockNLB) UpdateNLBServerGroup

func (m MockNLB) UpdateNLBServerGroup(ctx context.Context, sg *nlbmodel.ServerGroup) error

func (MockNLB) UpdateNLBServers

func (m MockNLB) UpdateNLBServers(ctx context.Context, sgId string, backends []nlbmodel.ServerGroupServer) error

func (MockNLB) UpdateNLBZones

func (m MockNLB) UpdateNLBZones(ctx context.Context, mdl *nlbmodel.NetworkLoadBalancer) error

type MockPVTZ

type MockPVTZ struct {
	// contains filtered or unexported fields
}

func NewMockPVTZ

func NewMockPVTZ(
	auth *base.ClientMgr,
) *MockPVTZ

func (*MockPVTZ) DeletePVTZ

func (p *MockPVTZ) DeletePVTZ(ctx context.Context, ep *model.PvtzEndpoint) error

func (*MockPVTZ) ListPVTZ

func (p *MockPVTZ) ListPVTZ(ctx context.Context) ([]*model.PvtzEndpoint, error)

func (*MockPVTZ) SearchPVTZ

func (p *MockPVTZ) SearchPVTZ(ctx context.Context, ep *model.PvtzEndpoint, exact bool) ([]*model.PvtzEndpoint, error)

func (*MockPVTZ) UpdatePVTZ

func (p *MockPVTZ) UpdatePVTZ(ctx context.Context, ep *model.PvtzEndpoint) error

type MockSLS

type MockSLS struct {
	// contains filtered or unexported fields
}

func NewMockSLS

func NewMockSLS(
	auth *base.ClientMgr,
) *MockSLS

func (MockSLS) AnalyzeProductLog

func (s MockSLS) AnalyzeProductLog(request *sls.AnalyzeProductLogRequest) (response *sls.AnalyzeProductLogResponse, err error)

type MockVPC

type MockVPC struct {
	// contains filtered or unexported fields
}

func NewMockVPC

func NewMockVPC(
	auth *base.ClientMgr,
) *MockVPC

func (*MockVPC) CreateRoute

func (m *MockVPC) CreateRoute(ctx context.Context, table string, provideID string, destinationCIDR string) (*model.Route, error)

func (*MockVPC) DeleteRoute

func (m *MockVPC) DeleteRoute(ctx context.Context, table, provideID, destinationCIDR string) error

func (*MockVPC) DescribeEipAddresses

func (m *MockVPC) DescribeEipAddresses(ctx context.Context, instanceType string, instanceId string) ([]string, error)

func (*MockVPC) DescribeVSwitches

func (m *MockVPC) DescribeVSwitches(ctx context.Context, vpcID string) ([]servicesvpc.VSwitch, error)

func (*MockVPC) DescribeVpcCIDRBlock

func (m *MockVPC) DescribeVpcCIDRBlock(ctx context.Context, vpcId string, ipVersion model.AddressIPVersionType) ([]*net.IPNet, error)

func (*MockVPC) FindRoute

func (m *MockVPC) FindRoute(ctx context.Context, table, pvid, cidr string) (*model.Route, error)

func (*MockVPC) ListRoute

func (m *MockVPC) ListRoute(ctx context.Context, table string) ([]*model.Route, error)

func (*MockVPC) ListRouteTables

func (m *MockVPC) ListRouteTables(ctx context.Context, vpcID string) ([]string, error)

Jump to

Keyboard shortcuts

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