internal

package
v0.0.0-...-3de950c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVICES = "services"
	SERVICE  = "service"
	PROJECTS = "projects"
	PROJECT  = "project"
	USERS    = "users"
	USER     = "user"

	VOLUMES   = "volumes"
	SNAPSHOTS = "snapshots"
	BACKUPS   = "backups"

	ROUTERS  = "routers"
	ROUTER   = "router"
	NETWORKS = "networks"
	NETWORK  = "network"
	SUBNETS  = "subnets"
	SUBNET   = "subnet"
	PORTS    = "ports"
	PORT     = "port"

	SERVERS = "servers"
	SERVER  = "server"
)

response body key

View Source
const DEFAULT_IMAGE_LIMIT = 1000
View Source
const X_OPENSTACK_NOVA_API_VERSION = "X-Openstack-Nova-Api-Version"

Variables

View Source
var ErrActionFailed = errors.New("action is failed")
View Source
var ErrActionNotFinish = errors.New("action is not finished")
View Source
var ErrResourceMulti = errors.New("multiple resources")
View Source
var ErrResourceNotFound = errors.New("resource not found")
View Source
var ErrServerIsError = errors.New("server is error")
View Source
var ErrServerIsNotDeleted = errors.New("server is not deleted")
View Source
var ErrServerNotStopped = errors.New("server is not stopped")
View Source
var ErrServerStatusNotExpect = errors.New("server status is not expect")

Functions

func DeleteResource

func DeleteResource(c *ServiceClient, u string, query ...url.Values) error

func DeleteResourceWithResp

func DeleteResourceWithResp(c *ServiceClient, u string, query ...url.Values) (*resty.Response, error)

func FindResource

func FindResource[T any](c *ServiceClient, u string, bodyKey string) (*T, error)

func GetResource

func GetResource[T any](c *ServiceClient, u string, bodyKey string) (*T, error)

func NewPasswordAuth

func NewPasswordAuth(authUrl string, user model.User, project model.Project) *auth_plugin.PasswordAuthPlugin

func ParsetVersionFromString

func ParsetVersionFromString(vertionStr string) microVersion

func QueryByIdOrName

func QueryByIdOrName[T any](
	idOrName string,
	showFunc func(id string) (*T, error),
	listFunc func(query url.Values) ([]T, error),
) (*T, error)

func QueryResource

func QueryResource[T any](c *ServiceClient, u string, query url.Values, bodyKey string) ([]T, error)

Types

type CinderV2

type CinderV2 struct{ *ServiceClient }

func (CinderV2) CreateBackup

func (c CinderV2) CreateBackup(volumeId string, name string, force bool) (*cinder.Backup, error)

func (CinderV2) CreateSnapshot

func (c CinderV2) CreateSnapshot(volumeId string, name string, force bool) (*cinder.Snapshot, error)

func (CinderV2) CreateType

func (c CinderV2) CreateType(params map[string]any) (*cinder.VolumeType, error)

func (CinderV2) CreateVolume

func (c CinderV2) CreateVolume(options map[string]any) (*cinder.Volume, error)

func (CinderV2) CreateVolumeAndWait

func (c CinderV2) CreateVolumeAndWait(options map[string]any, timeoutSeconds int) (*cinder.Volume, error)

func (CinderV2) DeleteBackup

func (c CinderV2) DeleteBackup(id string) error

func (CinderV2) DeleteSnapshot

func (c CinderV2) DeleteSnapshot(id string) error

func (CinderV2) DeleteType

func (c CinderV2) DeleteType(id string) error

func (CinderV2) DeleteVolume

func (c CinderV2) DeleteVolume(id string, force bool, cascade bool) error

func (CinderV2) ExtendVolume

func (c CinderV2) ExtendVolume(id string, size int) error

func (CinderV2) FindBackup

func (c CinderV2) FindBackup(idOrName string, allTenats ...bool) (*cinder.Backup, error)

func (CinderV2) FindSnapshot

func (c CinderV2) FindSnapshot(idOrName string, allTenats ...bool) (*cinder.Snapshot, error)

func (CinderV2) FindType

func (c CinderV2) FindType(idOrName string) (*cinder.VolumeType, error)

func (CinderV2) FindVolume

func (c CinderV2) FindVolume(idOrName string, allTenats ...bool) (*cinder.Volume, error)

func (CinderV2) GetBackup

func (c CinderV2) GetBackup(id string) (*cinder.Backup, error)

func (CinderV2) GetCurrentVersion

func (c CinderV2) GetCurrentVersion() (*model.ApiVersion, error)

func (CinderV2) GetDefaultType

func (c CinderV2) GetDefaultType() (*cinder.VolumeType, error)

func (CinderV2) GetSnapshot

func (c CinderV2) GetSnapshot(id string) (*cinder.Snapshot, error)

func (CinderV2) GetType

func (c CinderV2) GetType(id string) (*cinder.VolumeType, error)

func (CinderV2) GetVolume

func (c CinderV2) GetVolume(id string) (*cinder.Volume, error)

func (CinderV2) ListBackup

func (c CinderV2) ListBackup(query url.Values, details ...bool) ([]cinder.Backup, error)

func (CinderV2) ListByName

func (c CinderV2) ListByName(name string, details ...bool) ([]cinder.Volume, error)

func (CinderV2) ListService

func (c CinderV2) ListService(query url.Values) ([]cinder.Service, error)

func (CinderV2) ListSnapshot

func (c CinderV2) ListSnapshot(query url.Values, details ...bool) ([]cinder.Snapshot, error)

func (CinderV2) ListType

func (c CinderV2) ListType(query url.Values) ([]cinder.VolumeType, error)

func (CinderV2) ListVolume

func (c CinderV2) ListVolume(query url.Values, details ...bool) ([]cinder.Volume, error)

func (CinderV2) RetypeVolume

func (c CinderV2) RetypeVolume(id string, newType string, migrationPolicy string) error

func (CinderV2) RevertVolume

func (c CinderV2) RevertVolume(id string, snapshotId string) error

type GlanceV2

type GlanceV2 struct{ *ServiceClient }

func (GlanceV2) CreateImage

func (c GlanceV2) CreateImage(options glance.Image) (*glance.Image, error)

func (GlanceV2) DeleteImage

func (c GlanceV2) DeleteImage(id string) error

func (GlanceV2) DownloadImage

func (c GlanceV2) DownloadImage(id string, fileName string, process ...bool) error

func (GlanceV2) FindImage

func (c GlanceV2) FindImage(idOrName string) (*glance.Image, error)

func (GlanceV2) FoundByName

func (c GlanceV2) FoundByName(name string) (*glance.Image, error)

func (GlanceV2) GetCurrentVersion

func (c GlanceV2) GetCurrentVersion() (*model.ApiVersion, error)

func (GlanceV2) GetImage

func (c GlanceV2) GetImage(id string) (*glance.Image, error)

func (GlanceV2) ListImage

func (c GlanceV2) ListImage(query url.Values) ([]glance.Image, error)

func (GlanceV2) ListWithTotal

func (c GlanceV2) ListWithTotal(query url.Values, total int) ([]glance.Image, error)

func (GlanceV2) UpdateImage

func (c GlanceV2) UpdateImage(id string, params map[string]any) (*glance.Image, error)

func (GlanceV2) UploadImage

func (c GlanceV2) UploadImage(id string, file string, progress ...bool) error

type KeystoneV3

type KeystoneV3 struct{ *ServiceClient }

func (KeystoneV3) CreateEndpoint

func (c KeystoneV3) CreateEndpoint(endpoint keystone.Endpoint) (*keystone.Endpoint, error)

func (KeystoneV3) CreateService

func (c KeystoneV3) CreateService(service keystone.Service) (*keystone.Service, error)

func (KeystoneV3) DeleteEndpoint

func (c KeystoneV3) DeleteEndpoint(id string) error

func (KeystoneV3) DeleteProject

func (c KeystoneV3) DeleteProject(id string) error

func (KeystoneV3) DeleteService

func (c KeystoneV3) DeleteService(id string) error

func (KeystoneV3) FindProject

func (c KeystoneV3) FindProject(idOrName string) (*model.Project, error)

func (KeystoneV3) FindService

func (c KeystoneV3) FindService(idOrName string) (*keystone.Service, error)

func (KeystoneV3) FindUser

func (c KeystoneV3) FindUser(idOrName string) (*model.User, error)

func (KeystoneV3) GetProject

func (c KeystoneV3) GetProject(id string) (*model.Project, error)

func (KeystoneV3) GetService

func (c KeystoneV3) GetService(id string) (*keystone.Service, error)

func (KeystoneV3) GetServiceByName

func (c KeystoneV3) GetServiceByName(t string) (*keystone.Service, error)

func (KeystoneV3) GetServiceByType

func (c KeystoneV3) GetServiceByType(t string) (*keystone.Service, error)

func (KeystoneV3) GetStableVersion

func (c KeystoneV3) GetStableVersion() (*model.ApiVersion, error)

func (KeystoneV3) GetUser

func (c KeystoneV3) GetUser(id string) (*model.User, error)

func (KeystoneV3) ListByName

func (c KeystoneV3) ListByName(name string) ([]keystone.Service, error)

func (KeystoneV3) ListEndpoint

func (c KeystoneV3) ListEndpoint(query url.Values) ([]keystone.Endpoint, error)

func (KeystoneV3) ListEndpointByService

func (c KeystoneV3) ListEndpointByService(service_id string) ([]keystone.Endpoint, error)

func (KeystoneV3) ListProject

func (c KeystoneV3) ListProject(query url.Values) ([]model.Project, error)

func (KeystoneV3) ListRegion

func (c KeystoneV3) ListRegion(query url.Values) ([]keystone.Region, error)

func (KeystoneV3) ListRoleAssigment

func (c KeystoneV3) ListRoleAssigment(query url.Values) ([]keystone.RoleAssigment, error)

func (KeystoneV3) ListService

func (c KeystoneV3) ListService(query url.Values) ([]keystone.Service, error)

func (KeystoneV3) ListUser

func (c KeystoneV3) ListUser(query url.Values) ([]model.User, error)

user api

func (KeystoneV3) ListUsersByProject

func (c KeystoneV3) ListUsersByProject(projectId string) ([]model.User, error)

type NeutronV2

type NeutronV2 struct {
	*ServiceClient
	// contains filtered or unexported fields
}

func (NeutronV2) AddRouterPort

func (c NeutronV2) AddRouterPort(routerId, portId string) error

func (NeutronV2) AddRouterSubnet

func (c NeutronV2) AddRouterSubnet(routerId, subnetId string) error

func (NeutronV2) CreateNetwork

func (c NeutronV2) CreateNetwork(params map[string]any) (*neutron.Network, error)

func (NeutronV2) CreatePort

func (c NeutronV2) CreatePort(params map[string]any) (*neutron.Port, error)

func (NeutronV2) CreateRouter

func (c NeutronV2) CreateRouter(params map[string]any) (*neutron.Router, error)

func (NeutronV2) CreateSubnet

func (c NeutronV2) CreateSubnet(params map[string]any) (*neutron.Subnet, error)

func (NeutronV2) DeleteNetwork

func (c NeutronV2) DeleteNetwork(id string) error

func (NeutronV2) DeletePort

func (c NeutronV2) DeletePort(id string) error

func (NeutronV2) DeleteRouter

func (c NeutronV2) DeleteRouter(id string) error

func (NeutronV2) DeleteSubnet

func (c NeutronV2) DeleteSubnet(id string) error

func (NeutronV2) FindNetwork

func (c NeutronV2) FindNetwork(idOrName string) (*neutron.Network, error)

func (NeutronV2) FindPort

func (c NeutronV2) FindPort(idOrName string) (*neutron.Port, error)

func (NeutronV2) FindQosPolicy

func (c NeutronV2) FindQosPolicy(idOrName string) (*neutron.QosPolicy, error)

func (NeutronV2) FindRouter

func (c NeutronV2) FindRouter(idOrName string) (*neutron.Router, error)

func (NeutronV2) FindSecurityGroup

func (c NeutronV2) FindSecurityGroup(idOrName string) (*neutron.SecurityGroup, error)

func (NeutronV2) FindSubnet

func (c NeutronV2) FindSubnet(idOrName string) (*neutron.Subnet, error)

func (*NeutronV2) GetCurrentVersion

func (c *NeutronV2) GetCurrentVersion() (*model.ApiVersion, error)

func (NeutronV2) GetNetwork

func (c NeutronV2) GetNetwork(id string) (*neutron.Network, error)

func (NeutronV2) GetPort

func (c NeutronV2) GetPort(id string) (*neutron.Port, error)

func (NeutronV2) GetQosPolicy

func (c NeutronV2) GetQosPolicy(id string) (*neutron.QosPolicy, error)

func (NeutronV2) GetRouter

func (c NeutronV2) GetRouter(id string) (*neutron.Router, error)

func (NeutronV2) GetSecurityGroup

func (c NeutronV2) GetSecurityGroup(id string) (*neutron.SecurityGroup, error)

func (NeutronV2) GetSecurityGroupRule

func (c NeutronV2) GetSecurityGroupRule(id string) (*neutron.SecurityGroupRule, error)

func (NeutronV2) GetSubnet

func (c NeutronV2) GetSubnet(id string) (*neutron.Subnet, error)

func (NeutronV2) ListAgent

func (c NeutronV2) ListAgent(query url.Values) ([]neutron.Agent, error)

func (NeutronV2) ListNetwork

func (c NeutronV2) ListNetwork(query url.Values) ([]neutron.Network, error)

func (NeutronV2) ListNetwrkByName

func (c NeutronV2) ListNetwrkByName(name string) ([]neutron.Network, error)

func (NeutronV2) ListPort

func (c NeutronV2) ListPort(query url.Values) ([]neutron.Port, error)

func (NeutronV2) ListPortByDeviceId

func (c NeutronV2) ListPortByDeviceId(deviceId string) (neutron.Ports, error)

func (NeutronV2) ListPortByName

func (c NeutronV2) ListPortByName(name string) ([]neutron.Port, error)

func (NeutronV2) ListQosPolicy

func (c NeutronV2) ListQosPolicy(query url.Values) ([]neutron.QosPolicy, error)

func (NeutronV2) ListQosRule

func (c NeutronV2) ListQosRule(query url.Values) ([]neutron.QosRule, error)

func (NeutronV2) ListRouter

func (c NeutronV2) ListRouter(query url.Values) ([]neutron.Router, error)

func (NeutronV2) ListRouterByName

func (c NeutronV2) ListRouterByName(name string) ([]neutron.Router, error)

func (NeutronV2) ListSecurityGroup

func (c NeutronV2) ListSecurityGroup(query url.Values) ([]neutron.SecurityGroup, error)

func (NeutronV2) ListSecurityGroupRule

func (c NeutronV2) ListSecurityGroupRule(query url.Values) ([]neutron.SecurityGroupRule, error)

func (NeutronV2) ListSubnet

func (c NeutronV2) ListSubnet(query url.Values) ([]neutron.Subnet, error)

func (NeutronV2) ListSubnetByName

func (c NeutronV2) ListSubnetByName(name string) ([]neutron.Subnet, error)

func (NeutronV2) RemoveRouterPort

func (c NeutronV2) RemoveRouterPort(routerId, portId string) error

func (NeutronV2) RemoveRouterSubnet

func (c NeutronV2) RemoveRouterSubnet(routerId, subnetId string) error

func (NeutronV2) UpdatePort

func (c NeutronV2) UpdatePort(id string, options map[string]any) (*neutron.Port, error)

type NovaV2

type NovaV2 struct {
	*ServiceClient
}

func (NovaV2) AggAddHost

func (c NovaV2) AggAddHost(id int, host string) (*nova.Aggregate, error)

func (NovaV2) AggRemoveHost

func (c NovaV2) AggRemoveHost(id int, host string) (*nova.Aggregate, error)

func (NovaV2) CopyFlavor

func (c NovaV2) CopyFlavor(id string, newName string, newId string,
	newVcpus int, newRam int, newDisk int, newSwap int,
	newEphemeral int, newRxtxFactor float32, setProperties map[string]string,
	unsetProperties []string,
) (*nova.Flavor, error)

func (NovaV2) CreateAgg

func (c NovaV2) CreateAgg(agg nova.Aggregate) (*nova.Aggregate, error)

func (NovaV2) CreateFlavor

func (c NovaV2) CreateFlavor(flavor nova.Flavor) (*nova.Flavor, error)

func (NovaV2) CreateKeypair

func (c NovaV2) CreateKeypair(name string, keyType string, opt nova.KeypairOpt) (*nova.Keypair, error)

func (NovaV2) CreateServer

func (c NovaV2) CreateServer(options nova.ServerOpt) (*nova.Server, error)

func (NovaV2) CreateServerAndWait

func (c NovaV2) CreateServerAndWait(options nova.ServerOpt) (*nova.Server, error)

func (NovaV2) Delete

func (c NovaV2) Delete(id string) error

func (NovaV2) DeleteAgg

func (c NovaV2) DeleteAgg(id int) error

func (NovaV2) DeleteFlavor

func (c NovaV2) DeleteFlavor(id string) error

func (NovaV2) DeleteFlavorExtraSpec

func (c NovaV2) DeleteFlavorExtraSpec(id string, extraSpec string) error

func (NovaV2) DeleteKeypair

func (c NovaV2) DeleteKeypair(name string) error

func (NovaV2) DeleteServer

func (c NovaV2) DeleteServer(id string) error

func (NovaV2) DeleteServerInterfaceAndWait

func (c NovaV2) DeleteServerInterfaceAndWait(id string, portId string, timeout time.Duration) error

func (NovaV2) DeleteServerVolumeAndWait

func (c NovaV2) DeleteServerVolumeAndWait(id string, volumeId string, waitSeconds int) error

func (NovaV2) DeleteService

func (c NovaV2) DeleteService(host string, binary string) error

func (NovaV2) Detail

func (c NovaV2) Detail(query url.Values) ([]nova.Hypervisor, error)

func (NovaV2) DisableService

func (c NovaV2) DisableService(host string, binary string, reason string) (*nova.Service, error)

func (*NovaV2) DiscoverMicroVersion

func (c *NovaV2) DiscoverMicroVersion() error

func (NovaV2) DownService

func (c NovaV2) DownService(host string, binary string) (*nova.Service, error)

func (NovaV2) EnableService

func (c NovaV2) EnableService(host string, binary string) (*nova.Service, error)

func (NovaV2) EvacuateServer

func (c NovaV2) EvacuateServer(id string, password string, host string, force bool) error

func (NovaV2) FindAgg

func (c NovaV2) FindAgg(idOrName string) (*nova.Aggregate, error)

func (NovaV2) FindFlavor

func (c NovaV2) FindFlavor(idOrName string) (*nova.Flavor, error)

func (NovaV2) FindHypervisor

func (c NovaV2) FindHypervisor(idOrHostName string) (*nova.Hypervisor, error)

func (NovaV2) FindServer

func (c NovaV2) FindServer(idOrName string, allTenants ...bool) (*nova.Server, error)

func (NovaV2) GetAgg

func (c NovaV2) GetAgg(id string) (*nova.Aggregate, error)

func (*NovaV2) GetApiVersions

func (c *NovaV2) GetApiVersions() (model.ApiVersions, error)

func (NovaV2) GetByHostBinary

func (c NovaV2) GetByHostBinary(host string, binary string) (*nova.Service, error)

func (NovaV2) GetFlavor

func (c NovaV2) GetFlavor(id string) (*nova.Flavor, error)

func (NovaV2) GetFlavorExtraSpecs

func (c NovaV2) GetFlavorExtraSpecs(id string) (nova.ExtraSpecs, error)

func (NovaV2) GetFlavorWithExtraSpecs

func (c NovaV2) GetFlavorWithExtraSpecs(id string) (*nova.Flavor, error)

func (NovaV2) GetHypervisor

func (c NovaV2) GetHypervisor(id string) (*nova.Hypervisor, error)

func (NovaV2) GetHypervisorByHostname

func (c NovaV2) GetHypervisorByHostname(hostname string) (*nova.Hypervisor, error)

func (NovaV2) GetHypervisorFlavorCapacities

func (c NovaV2) GetHypervisorFlavorCapacities(query url.Values) (*nova.FlavorCapacities, error)

func (NovaV2) GetHypervisorUptime

func (c NovaV2) GetHypervisorUptime(id string) (*nova.Hypervisor, error)

func (NovaV2) GetKeypair

func (c NovaV2) GetKeypair(name string) (*nova.Keypair, error)

func (*NovaV2) GetMicroVersion

func (c *NovaV2) GetMicroVersion() string

func (NovaV2) GetQuotaSet

func (c NovaV2) GetQuotaSet(projectId string) (*nova.QuotaSet, error)

func (NovaV2) GetServer

func (c NovaV2) GetServer(id string) (*nova.Server, error)

func (NovaV2) GetServerAction

func (c NovaV2) GetServerAction(id, requestId string) (*nova.InstanceAction, error)

func (NovaV2) GetServerConsoleLog

func (c NovaV2) GetServerConsoleLog(id string, length uint) (*nova.ConsoleLog, error)

func (NovaV2) GetServerConsoleUrl

func (c NovaV2) GetServerConsoleUrl(id string, consoleType string) (*nova.Console, error)

func (NovaV2) ListAZ

func (c NovaV2) ListAZ(query url.Values, detail ...bool) ([]nova.AvailabilityZone, error)

func (NovaV2) ListAgg

func (c NovaV2) ListAgg(query url.Values) ([]nova.Aggregate, error)

func (NovaV2) ListByName

func (c NovaV2) ListByName(hostname string) ([]nova.Hypervisor, error)

func (NovaV2) ListComputeService

func (c NovaV2) ListComputeService() ([]nova.Service, error)

func (NovaV2) ListFlavors

func (c NovaV2) ListFlavors(query url.Values, details ...bool) ([]nova.Flavor, error)

func (NovaV2) ListHypervisor

func (c NovaV2) ListHypervisor(query url.Values, details ...bool) ([]nova.Hypervisor, error)

func (NovaV2) ListKeypair

func (c NovaV2) ListKeypair(query url.Values) ([]nova.Keypair, error)

func (NovaV2) ListMigration

func (c NovaV2) ListMigration(query url.Values) ([]nova.Migration, error)

func (NovaV2) ListServer

func (c NovaV2) ListServer(query url.Values, details ...bool) ([]nova.Server, error)

func (NovaV2) ListServerActions

func (c NovaV2) ListServerActions(id string) ([]nova.InstanceAction, error)

func (NovaV2) ListServerActionsWithEvents

func (c NovaV2) ListServerActionsWithEvents(id string, actionName string, requestId string, last int) ([]nova.InstanceAction, error)

func (NovaV2) ListServerGroup

func (c NovaV2) ListServerGroup(query url.Values) ([]nova.ServerGroup, error)

func (NovaV2) ListServerInterfaces

func (c NovaV2) ListServerInterfaces(id string) ([]nova.InterfaceAttachment, error)

func (NovaV2) ListServerMigrations

func (c NovaV2) ListServerMigrations(id string, query url.Values) ([]nova.Migration, error)

func (NovaV2) ListServerVolumes

func (c NovaV2) ListServerVolumes(id string) ([]nova.VolumeAttachment, error)

func (NovaV2) ListService

func (c NovaV2) ListService(query url.Values) ([]nova.Service, error)

service api

func (*NovaV2) MicroVersionLargeEqual

func (c *NovaV2) MicroVersionLargeEqual(version string) bool

func (NovaV2) PauseServer

func (c NovaV2) PauseServer(id string) error

func (NovaV2) RebootServer

func (c NovaV2) RebootServer(id string, hard bool) error

func (NovaV2) RebuildServer

func (c NovaV2) RebuildServer(id string, opt nova.RebuilOpt) error

func (NovaV2) ResizeConfirm

func (c NovaV2) ResizeConfirm(id string) error

func (NovaV2) ResizeRevert

func (c NovaV2) ResizeRevert(id string) error

func (NovaV2) ResizeServer

func (c NovaV2) ResizeServer(id string, flavorRef string) error

func (NovaV2) ResumeServer

func (c NovaV2) ResumeServer(id string) error

func (NovaV2) ServerAddInterface

func (c NovaV2) ServerAddInterface(id, netId, portId string) (*nova.InterfaceAttachment, error)

func (NovaV2) ServerAddVolume

func (c NovaV2) ServerAddVolume(id, volumeId string) (*nova.VolumeAttachment, error)

func (NovaV2) ServerCreateImage

func (c NovaV2) ServerCreateImage(id string, imagName string, metadata map[string]string) (string, error)

func (NovaV2) ServerDeleteInterface

func (c NovaV2) ServerDeleteInterface(id, portId string) (*resty.Response, error)

func (NovaV2) ServerDeleteVolume

func (c NovaV2) ServerDeleteVolume(id, volumeId string) error

func (NovaV2) ServerLiveMigrate

func (c NovaV2) ServerLiveMigrate(id string, blockMigrate any, host string) error

func (NovaV2) ServerMigrate

func (c NovaV2) ServerMigrate(id string, host string) error

func (NovaV2) ServerRegionLiveMigrate

func (c NovaV2) ServerRegionLiveMigrate(id string, destRegion string, blockMigrate bool, dryRun bool, destHost string) (*nova.RegionMigrateResp, error)

func (NovaV2) ServerRename

func (c NovaV2) ServerRename(id string, name string) error

func (NovaV2) ServerSetName

func (c NovaV2) ServerSetName(id string, name string) error

func (NovaV2) SetFlavorExtraSpecs

func (c NovaV2) SetFlavorExtraSpecs(id string, extraSpecs map[string]string) (nova.ExtraSpecs, error)

func (NovaV2) SetServer

func (c NovaV2) SetServer(id string, params map[string]any) error

func (NovaV2) SetServerPassword

func (c NovaV2) SetServerPassword(id string, password, user string) error

func (NovaV2) SetServerState

func (c NovaV2) SetServerState(id string, active bool) error

func (NovaV2) ShelveServer

func (c NovaV2) ShelveServer(id string) error

func (NovaV2) StartServer

func (c NovaV2) StartServer(id string) error

func (NovaV2) StopServer

func (c NovaV2) StopServer(id string) error

func (NovaV2) StopServerAndWait

func (c NovaV2) StopServerAndWait(id string) error

func (*NovaV2) String

func (c *NovaV2) String() string

func (NovaV2) SuspendServer

func (c NovaV2) SuspendServer(id string) error

func (NovaV2) UnpauseServer

func (c NovaV2) UnpauseServer(id string) error

func (NovaV2) UnshelveServer

func (c NovaV2) UnshelveServer(id string) error

func (NovaV2) UpService

func (c NovaV2) UpService(host string, binary string) (*nova.Service, error)

func (NovaV2) WaitServerBooted

func (c NovaV2) WaitServerBooted(id string) (*nova.Server, error)

func (NovaV2) WaitServerDeleted

func (c NovaV2) WaitServerDeleted(id string) error

func (NovaV2) WaitServerRebooted

func (c NovaV2) WaitServerRebooted(id string, newFlavorName string) (*nova.Server, error)

func (NovaV2) WaitServerResized

func (c NovaV2) WaitServerResized(id string, newFlavorName string) (*nova.Server, error)

func (NovaV2) WaitServerStatus

func (c NovaV2) WaitServerStatus(serverId string, status string, interval int) (*nova.Server, error)

func (NovaV2) WaitServerTask

func (c NovaV2) WaitServerTask(id string, taskState string) (*nova.Server, error)

type ReqBody

type ReqBody map[string]map[string]any

type ServiceClient

type ServiceClient struct {
	*resty.Client
	IsAdmin bool
}

func NewServiceClient

func NewServiceClient(regionName string, sType, sName, sInterface string, version string, authPlugin auth_plugin.AuthPlugin) *ServiceClient

func (*ServiceClient) BaserUrl

func (c *ServiceClient) BaserUrl() string

func (*ServiceClient) Header

func (c *ServiceClient) Header() http.Header

func (*ServiceClient) Index

func (c *ServiceClient) Index(result any) (*resty.Response, error)

func (*ServiceClient) IndexUrl

func (c *ServiceClient) IndexUrl() (string, error)

type UrlPath

type UrlPath string
const (
	// server
	URL_SERVERS             UrlPath = "servers"
	URL_SERVERS_DETAIL      UrlPath = "servers/detail"
	URL_SERVER              UrlPath = "servers/%s"
	URL_SERVER_VOLUMES_BOOT UrlPath = "os-volumes_boot"
	// URL_SERVER_METADATA = "servers/%s/metadata"
	// URL_SERVER_METADATA_ITEM = "servers/%s/metadata/%s"
	URL_SERVER_CONSOLE         UrlPath = "servers/%s/console"
	URL_COMPUTE_SERVICES       UrlPath = "os-services"
	URL_COMPUTE_SERVICE        UrlPath = "os-services/%s"
	URL_COMPUTE_SERVICE_ACTION UrlPath = "os-services/%s"
	URL_HYPERVISORS            UrlPath = "os-hypervisors"
	URL_HYPERVISORS_DETAIL     UrlPath = "os-hypervisors/detail"
	URL_HYPERVISOR             UrlPath = "os-hypervisors/%s"
	URL_HYPERVISOR_UPTIME      UrlPath = "os-hypervisors/%s/uptime"
	URL_HYPERVISOR_CAPACITIES  UrlPath = "os-hypervisors/statistics/flavor-capacities"
	URL_SERVER_ACTION          UrlPath = "servers/%s/action"
	// 虚拟机接口
	URL_SERVER_INTERFACES UrlPath = "servers/%s/os-interface"
	URL_SERVER_INTERFACE  UrlPath = "servers/%s/os-interface/%s"
	// 安全组
	URL_SERVER_SECURITY_GROUPS UrlPath = "servers/%s/os-security-groups"
	URL_SERVER_SECURITY_GROUP  UrlPath = "servers/%s/os-security-groups/%s"
	// 密钥对
	URL_KEYPAIRS UrlPath = "os-keypairs"
	URL_KEYPAIR  UrlPath = "os-keypairs/%s"
	// 可用区
	URL_AVAILABILITY_ZONES        UrlPath = "os-availability-zone"
	URL_AVAILABILITY_ZONES_DETAIL UrlPath = "os-availability-zone/detail"
	// 聚合
	URL_AGGREGATES        UrlPath = "os-aggregates"
	URL_AGGREGATE         UrlPath = "os-aggregates/%s"
	URL_AGGREGATE_ACTION  UrlPath = "os-aggregates/%s/action"
	URL_AGGREGATES_DETAIL UrlPath = "os-aggregates/detail"
	// 虚拟机迁移
	URL_MIGRATIONS_LIST UrlPath = "os-migrations"
	// 配额
	URL_QUOTAS_LIST    UrlPath = "os-quota-sets"
	URL_QUOTA_DETAIL   UrlPath = "os-quota-sets/%s"
	URL_QUOTA_DEFAULTS UrlPath = "os-quota-sets/%s/defaults"
	// 虚拟机类型
	URL_FLAVORS            UrlPath = "flavors"
	URL_FLAVORS_DETAIL     UrlPath = "flavors/detail"
	URL_FLAVOR             UrlPath = "flavors/%s"
	URL_FLAVOR_EXTRA_SPECS UrlPath = "flavors/%s/os-extra_specs"
	URL_FLAVOR_EXTRA_SPEC  UrlPath = "flavors/%s/os-extra_specs/%s"
	// 虚拟机卷
	URL_SERVER_VOLUMES UrlPath = "servers/%s/os-volume_attachments"
	URL_SERVER_VOLUME  UrlPath = "servers/%s/os-volume_attachments/%s"
	//
	URL_SERVERS_REMOTE_CONSOLES UrlPath = "servers/%s/remote-consoles"
	//
	URL_SERVER_INSTANCE_ACTIONS UrlPath = "servers/%s/os-instance-actions"
	URL_SERVER_INSTANCE_ACTION  UrlPath = "servers/%s/os-instance-actions/%s"
	URL_SERVER_MIGRATIONS       UrlPath = "servers/%s/migrations"
	// 群组
	URL_SERVER_GROUPS UrlPath = "os-server-groups"
	// 虚拟机标签
	URL_SERVER_TAGS = "servers/%s/tags"
	URL_SERVER_TAG  = "servers/%s/tags/%s"

	// 卷
	URL_VOLUMES        UrlPath = "volumes"
	URL_VOLUMES_DETAIL UrlPath = "volumes/detail"
	URL_VOLUME         UrlPath = "volumes/%s"
	URL_VOLUME_ACTION  UrlPath = "volumes/%s/action"
	// 快照
	URL_SNAPSHOTS        UrlPath = "snapshots"
	URL_SNAPSHOTS_DETAIL UrlPath = "snapshots/detail"
	URL_SNAPSHOT         UrlPath = "snapshots/%s"
	// 备份
	URL_BACKUPS        UrlPath = "backups"
	URL_BACKUPS_DETAIL UrlPath = "backups/detail"
	URL_BACKUP         UrlPath = "backups/%s"
	// 卷类型
	URL_VOLUME_TYPES        UrlPath = "types"
	URL_VOLUME_TYPE         UrlPath = "types/%s"
	URL_VOLUME_TYPE_DEFAULT UrlPath = "types/default"
	URL_VOLUME_SERVICES     UrlPath = "os-services"

	// 镜像
	URL_IMAGES     UrlPath = "images"
	URL_IMAGE      UrlPath = "images/%s"
	URL_IMAGE_FILE UrlPath = "images/%s/file"

	// region
	URL_REGIONS UrlPath = "regions"
	// 服务
	URL_SERVICES UrlPath = "services"
	URL_SERVICE  UrlPath = "services/%s"
	// endpoint
	URL_ENDPOINTS UrlPath = "endpoints"
	URL_ENDPOINT  UrlPath = "endpoints/%s"
	// 租户
	URL_PROJECTS UrlPath = "projects"
	URL_PROJECT  UrlPath = "projects/%s"
	// 用户
	URL_USERS UrlPath = "users"
	URL_USER  UrlPath = "users/%s"
	// 角色
	URL_ROLE_ASSIGNMENTS UrlPath = "role_assignments"

	URL_AGENTS UrlPath = "agents"

	URL_NETWORKS UrlPath = "networks"
	URL_NETWORK  UrlPath = "networks/%s"

	URL_SUBNETS UrlPath = "subnets"
	URL_SUBNET  UrlPath = "subnets/%s"

	URL_PORTS UrlPath = "ports"
	URL_PORT  UrlPath = "ports/%s"

	URL_ROUTERS                 UrlPath = "routers"
	URL_ROUTER                  UrlPath = "routers/%s"
	URL_ROUTER_ADD_INTERFACE    UrlPath = "routers/%s/add_router_interface"
	URL_ROUTER_REMOVE_INTERFACE UrlPath = "routers/%s/remove_router_interface"

	URL_FLOATINGIPS UrlPath = "floatingips"
	URL_FLOATINGIP  UrlPath = "floatingips/%s"

	URL_SECURITY_GROUPS      UrlPath = "security-groups"
	URL_SECURITY_GROUP       UrlPath = "security-groups/%s"
	URL_SECURITY_GROUP_RULES UrlPath = "security-group-rules"
	URL_SECURITY_GROUP_RULE  UrlPath = "security-group-rules/%s"

	URL_LOADBALANCERS UrlPath = "lbaas/loadbalancers"
	URL_LOADBALANCER  UrlPath = "lbaas/loadbalancers/%s"
	URL_LISTENERS     UrlPath = "lbaas/listeners"
	URL_LISTENER      UrlPath = "lbaas/listeners/%s"

	URL_POOLS UrlPath = "lbaas/pools"
	URL_POOL  UrlPath = "lbaas/pools/%s"

	URL_HEALTH_MONITORS UrlPath = "lbaas/healthmonitors"
	URL_HEALTH_MONITOR  UrlPath = "lbaas/healthmonitors/%s"

	URL_FIREWALLS         UrlPath = "fw/firewalls"
	URL_FIREWALL          UrlPath = "fw/firewalls/%s"
	URL_FIREWALL_POLICIES UrlPath = "fw/firewall_policies"
	URL_FIREWALL_POLICY   UrlPath = "fw/firewall_policies/%s"
	URL_FIREWALL_RULES    UrlPath = "fw/firewall_rules"
	URL_FIREWALL_RULE     UrlPath = "fw/firewall_rules/%s"

	URL_QOS_POLICIES     UrlPath = "qos/policies"
	URL_QOS_POLICY       UrlPath = "qos/policies/%s"
	URL_QOS_POLICY_RULES UrlPath = "qos/policies-rules"
)

func (UrlPath) A

func (t UrlPath) A(path string) UrlPath

添加路径

func (UrlPath) F

func (t UrlPath) F(args ...any) string

格式化后的值

func (UrlPath) WithDetail

func (t UrlPath) WithDetail() UrlPath

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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