Documentation
¶
Overview ¶
Package sdk is a Go client library for the vStack Cloud Panel API.
It provides a typed client for managing cloud resources — servers, networks, server NICs, volumes, snapshots, SSH keys, DNS zones, gateways, affinity groups, project metadata and the read-only VMware catalog (locations with their disk types, OS images, GPU slicing profiles) — exposed by the vStack Cloud Panel (for example https://api.example.com).
Getting started ¶
Build a configuration with your API token and the API base URL, then create a client:
config, err := sdk.NewConfig(apiKey, "https://api.example.com")
if err != nil {
log.Fatal(err)
}
client, err := sdk.NewClient(config)
if err != nil {
log.Fatal(err)
}
project, err := client.GetProject(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Println(project.ID, project.Balance, project.Currency)
Authentication ¶
Requests are authenticated with the API token sent in the X-API-KEY header. The token is created in the vStack Cloud Panel for a specific project.
Configuration ¶
NewConfig accepts functional options such as WithTimeout, WithLogger, WithLogLevel and WithPollingInterval, plus the retry options WithMaxRetries, WithRetryWaitMinMax, WithRetryableStatus and WithRetryableCodes. Sensible defaults are applied when options are omitted.
Long-running operations ¶
Many mutating calls have an "AndWait" variant (for example CreateServerAndWait) that polls the associated task until it completes, so callers need not implement polling themselves.
The VMware section provides the same variant for every mutator that starts a task — creates, edits, deletes, power actions, volumes, snapshots, NICs, firewalls, NAT and VPN. Each returns the resulting entity where the API makes it identifiable, and a plain error otherwise. The delete variants (DeleteVmwareServerAndWait, DeleteVmwareNetworkAndWait) additionally wait for the object to actually disappear, because the task alone completes too early.
The non-waiting form of each method is still available and returns a *VmwareTaskID; await it with WaitVmwareTaskRef, or with WaitVmwareTask / WaitVmwareTaskWithTimeout for a bare ID.
Retries and concurrency ¶
The client automatically retries transient failures (configurable HTTP statuses and API error codes) with exponential backoff. A CloudClient is safe for concurrent use by multiple goroutines and should be reused rather than created per request.
Index ¶
- Constants
- Variables
- func HasAPICode(err error, code int) bool
- func IsAlreadyCompletedTaskID(taskID string) bool
- func IsAlreadyExists(err error) bool
- func IsConflict(err error) bool
- func IsInvalidLocation(err error) bool
- func IsNetworkInUse(err error) bool
- func IsNotFound(err error) bool
- func IsTaskFailed(err error) bool
- func IsVmwareNestedHypervisorNotSupportedInLocation(err error) bool
- func IsVmwareNoFreePublicNetwork(err error) bool
- func IsVmwareOperationNotSupportedForGpuServer(err error) bool
- func IsVmwareServerSuspended(err error) bool
- func IsVmwareTaskID(taskID string) bool
- type AddNetworkTagRequest
- type CloudClient
- func (c *CloudClient) AddNetworkTag(ctx context.Context, networkID string, req *AddNetworkTagRequest) error
- func (c *CloudClient) ChangeVmwareServerComputerName(ctx context.Context, serverID int, req *entities.VmwareComputerNameRequest) (*VmwareTaskID, error)
- func (c *CloudClient) ChangeVmwareServerComputerNameAndWait(ctx context.Context, serverID int, req *entities.VmwareComputerNameRequest) (*entities.VmwareServer, error)
- func (c *CloudClient) ChangeVmwareServerConfiguration(ctx context.Context, serverID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) ChangeVmwareServerConfigurationAndWait(ctx context.Context, serverID int, ...) (*entities.VmwareServer, error)
- func (c *CloudClient) Config() Config
- func (c *CloudClient) ConnectNetwork(ctx context.Context, gatewayID string, req *entities.ConnectNetworkRequest) (*TaskID, error)
- func (c *CloudClient) ConnectNetworkAndWait(ctx context.Context, gatewayID string, req *entities.ConnectNetworkRequest) error
- func (c *CloudClient) ConnectVmwareClientNetwork(ctx context.Context, serverID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) ConnectVmwareClientNetworkAndWait(ctx context.Context, serverID int, ...) ([]*entities.VmwareNIC, error)
- func (c *CloudClient) ConnectVmwareServers(ctx context.Context, networkID int, req *entities.VmwareConnectServersRequest) ([]*VmwareTaskID, error)
- func (c *CloudClient) ConnectVmwareServersAndWait(ctx context.Context, networkID int, req *entities.VmwareConnectServersRequest) error
- func (c *CloudClient) ConnectVmwareSharedNetwork(ctx context.Context, serverID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) ConnectVmwareSharedNetworkAndWait(ctx context.Context, serverID int, ...) ([]*entities.VmwareNIC, error)
- func (c *CloudClient) CopyVmwareServer(ctx context.Context, serverID int, req *entities.VmwareCopyServerRequest) (*entities.VmwareServerOrder, error)
- func (c *CloudClient) CopyVmwareServerAndWait(ctx context.Context, serverID int, req *entities.VmwareCopyServerRequest) (*entities.VmwareServer, error)
- func (c *CloudClient) CreateAffinityGroup(ctx context.Context, req *entities.CreateAffinityGroupRequest) (*entities.AffinityGroup, error)
- func (c *CloudClient) CreateDomain(ctx context.Context, req *entities.CreateDomainRequest) (*TaskID, error)
- func (c *CloudClient) CreateDomainAndWait(ctx context.Context, req *entities.CreateDomainRequest) (*entities.Domain, error)
- func (c *CloudClient) CreateDomainRecord(ctx context.Context, domainName string, req *entities.CreateRecordRequest) (*TaskID, error)
- func (c *CloudClient) CreateDomainRecordAndWait(ctx context.Context, domainName string, req *entities.CreateRecordRequest) (*entities.DNSRecord, error)
- func (c *CloudClient) CreateGateway(ctx context.Context, req *entities.CreateGatewayRequest) (*TaskID, error)
- func (c *CloudClient) CreateGatewayAndWait(ctx context.Context, req *entities.CreateGatewayRequest) (*entities.Gateway, error)
- func (c *CloudClient) CreateGatewayTag(ctx context.Context, gatewayID string, req *entities.CreateGatewayTagRequest) error
- func (c *CloudClient) CreateNetwork(ctx context.Context, req *entities.CreateNetworkRequest) (*TaskID, error)
- func (c *CloudClient) CreateNetworkAndWait(ctx context.Context, req *entities.CreateNetworkRequest) (*entities.Network, error)
- func (c *CloudClient) CreateSSHKey(ctx context.Context, req *entities.CreateSSHKeyRequest) (*entities.SSHKey, error)
- func (c *CloudClient) CreateServer(ctx context.Context, req *entities.CreateServerRequest) (*TaskID, error)
- func (c *CloudClient) CreateServerAndWait(ctx context.Context, req *entities.CreateServerRequest) (*entities.Server, error)
- func (c *CloudClient) CreateServerNIC(ctx context.Context, serverID string, req *entities.CreateNICRequest) (*TaskID, error)
- func (c *CloudClient) CreateServerNICAndWait(ctx context.Context, serverID string, req *entities.CreateNICRequest) (*entities.NIC, error)
- func (c *CloudClient) CreateServerSnapshot(ctx context.Context, serverID string, req *entities.CreateSnapshotRequest) (*TaskID, error)
- func (c *CloudClient) CreateServerSnapshotAndWait(ctx context.Context, serverID string, req *entities.CreateSnapshotRequest) (*entities.Snapshot, error)
- func (c *CloudClient) CreateServerTag(ctx context.Context, serverID string, req *entities.CreateServerTagRequest) error
- func (c *CloudClient) CreateServerVolume(ctx context.Context, serverID string, req *entities.CreateVolumeRequest) (*TaskID, error)
- func (c *CloudClient) CreateServerVolumeAndWait(ctx context.Context, serverID string, req *entities.CreateVolumeRequest) (*entities.Volume, error)
- func (c *CloudClient) CreateVmwareIsolatedNetwork(ctx context.Context, req *entities.VmwareCreateIsolatedNetworkRequest) (*VmwareTaskID, error)
- func (c *CloudClient) CreateVmwareIsolatedNetworkAndWait(ctx context.Context, req *entities.VmwareCreateIsolatedNetworkRequest) (*entities.VmwareNetwork, error)
- func (c *CloudClient) CreateVmwarePublicNetwork(ctx context.Context, req *entities.VmwareCreatePublicNetworkRequest) (*VmwareTaskID, error)
- func (c *CloudClient) CreateVmwarePublicNetworkAndWait(ctx context.Context, req *entities.VmwareCreatePublicNetworkRequest) (*entities.VmwareNetwork, error)
- func (c *CloudClient) CreateVmwareRoutedNetwork(ctx context.Context, req *entities.VmwareCreateRoutedNetworkRequest) (*VmwareTaskID, error)
- func (c *CloudClient) CreateVmwareRoutedNetworkAndWait(ctx context.Context, req *entities.VmwareCreateRoutedNetworkRequest) (*entities.VmwareNetwork, error)
- func (c *CloudClient) CreateVmwareServer(ctx context.Context, req *entities.VmwareCreateServerRequest) (*entities.VmwareServerOrder, error)
- func (c *CloudClient) CreateVmwareServerAndWait(ctx context.Context, req *entities.VmwareCreateServerRequest) (*entities.VmwareServer, error)
- func (c *CloudClient) CreateVmwareSnapshot(ctx context.Context, serverID int, req *entities.VmwareCreateSnapshotRequest) (*VmwareTaskID, error)
- func (c *CloudClient) CreateVmwareSnapshotAndWait(ctx context.Context, serverID int, req *entities.VmwareCreateSnapshotRequest) (*entities.VmwareSnapshot, error)
- func (c *CloudClient) CreateVmwareVolume(ctx context.Context, serverID int, req *entities.VmwareCreateVolumeRequest) (*VmwareTaskID, error)
- func (c *CloudClient) CreateVmwareVolumeAndWait(ctx context.Context, serverID int, req *entities.VmwareCreateVolumeRequest) error
- func (c *CloudClient) DefaultRetryPolicy(resp *http.Response, err error) RetryDecision
- func (c *CloudClient) DeleteAffinityGroup(ctx context.Context, groupID string) error
- func (c *CloudClient) DeleteDomain(ctx context.Context, domainName string) error
- func (c *CloudClient) DeleteDomainAndWait(ctx context.Context, domainName string) error
- func (c *CloudClient) DeleteDomainRecord(ctx context.Context, domainName string, recordID int) error
- func (c *CloudClient) DeleteDomainRecordAndWait(ctx context.Context, domainName string, recordID int) error
- func (c *CloudClient) DeleteGateway(ctx context.Context, gatewayID string) error
- func (c *CloudClient) DeleteGatewayTag(ctx context.Context, gatewayID, tag string) error
- func (c *CloudClient) DeleteNetwork(ctx context.Context, networkID string) error
- func (c *CloudClient) DeleteNetworkTag(ctx context.Context, networkID, tag string) error
- func (c *CloudClient) DeleteSSHKey(ctx context.Context, keyID int) error
- func (c *CloudClient) DeleteServer(ctx context.Context, serverID string) error
- func (c *CloudClient) DeleteServerNIC(ctx context.Context, serverID string, nicID int) error
- func (c *CloudClient) DeleteServerNICAndWait(ctx context.Context, serverID string, nicID int) error
- func (c *CloudClient) DeleteServerSnapshot(ctx context.Context, serverID string, snapshotID int) error
- func (c *CloudClient) DeleteServerSnapshotAndWait(ctx context.Context, serverID string, snapshotID int) error
- func (c *CloudClient) DeleteServerTag(ctx context.Context, serverID string, tag string) error
- func (c *CloudClient) DeleteServerVolume(ctx context.Context, serverID string, volumeID int) error
- func (c *CloudClient) DeleteServerVolumeAndWait(ctx context.Context, serverID string, volumeID int) error
- func (c *CloudClient) DeleteVmwareEdgeNATRule(ctx context.Context, networkID, ruleID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareEdgeNATRuleAndWait(ctx context.Context, networkID, ruleID int) error
- func (c *CloudClient) DeleteVmwareEdgeVPNTunnel(ctx context.Context, networkID, tunnelID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareEdgeVPNTunnelAndWait(ctx context.Context, networkID, tunnelID int) error
- func (c *CloudClient) DeleteVmwareNIC(ctx context.Context, serverID, nicID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareNICAndWait(ctx context.Context, serverID, nicID int) error
- func (c *CloudClient) DeleteVmwareNetwork(ctx context.Context, networkID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareNetworkAndWait(ctx context.Context, networkID int) error
- func (c *CloudClient) DeleteVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareServerAndWait(ctx context.Context, serverID int) error
- func (c *CloudClient) DeleteVmwareSnapshot(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareSnapshotAndWait(ctx context.Context, serverID int) error
- func (c *CloudClient) DeleteVmwareVolume(ctx context.Context, serverID, volumeID int) (*VmwareTaskID, error)
- func (c *CloudClient) DeleteVmwareVolumeAndWait(ctx context.Context, serverID, volumeID int) error
- func (c *CloudClient) DisableVmwareServerNestedHypervisor(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) DisableVmwareServerNestedHypervisorAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) DisconnectNetwork(ctx context.Context, gatewayID string, nicID int) error
- func (c *CloudClient) DisconnectNetworkAndWait(ctx context.Context, gatewayID string, nicID int) error
- func (c *CloudClient) EditVmwareNetwork(ctx context.Context, networkID int, req *entities.VmwareEditNetworkRequest) (*VmwareTaskID, error)
- func (c *CloudClient) EditVmwareNetworkAndWait(ctx context.Context, networkID int, req *entities.VmwareEditNetworkRequest) (*entities.VmwareNetwork, error)
- func (c *CloudClient) EditVmwareVolume(ctx context.Context, serverID, volumeID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) EditVmwareVolumeAndWait(ctx context.Context, serverID, volumeID int, ...) (*entities.VmwareVolume, error)
- func (c *CloudClient) EnableVmwareServerNestedHypervisor(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) EnableVmwareServerNestedHypervisorAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) GetAffinityGroup(ctx context.Context, groupID string) (*entities.AffinityGroup, error)
- func (c *CloudClient) GetAffinityGroupList(ctx context.Context) ([]*entities.AffinityGroup, error)
- func (c *CloudClient) GetApplications(ctx context.Context, locationID string) ([]entities.Application, error)
- func (c *CloudClient) GetDomain(ctx context.Context, domainName string) (*entities.Domain, error)
- func (c *CloudClient) GetDomainRecord(ctx context.Context, domainName string, recordID int) (*entities.DNSRecord, error)
- func (c *CloudClient) GetDomainRecords(ctx context.Context, domainName string) ([]entities.DNSRecord, error)
- func (c *CloudClient) GetDomains(ctx context.Context) ([]*entities.Domain, error)
- func (c *CloudClient) GetFirewallRules(ctx context.Context, gatewayID string) ([]entities.FirewallRule, error)
- func (c *CloudClient) GetGateway(ctx context.Context, gatewayID string) (*entities.Gateway, error)
- func (c *CloudClient) GetGatewayList(ctx context.Context) ([]*entities.Gateway, error)
- func (c *CloudClient) GetImages(ctx context.Context) ([]entities.Image, error)
- func (c *CloudClient) GetLocations(ctx context.Context) ([]entities.Location, error)
- func (c *CloudClient) GetNATRules(ctx context.Context, gatewayID string) ([]entities.NATRule, error)
- func (c *CloudClient) GetNetwork(ctx context.Context, networkID string) (*entities.Network, error)
- func (c *CloudClient) GetNetworkList(ctx context.Context) ([]*entities.Network, error)
- func (c *CloudClient) GetProject(ctx context.Context) (*entities.Project, error)
- func (c *CloudClient) GetSSHKey(ctx context.Context, keyID int) (*entities.SSHKey, error)
- func (c *CloudClient) GetSSHKeyList(ctx context.Context) ([]*entities.SSHKey, error)
- func (c *CloudClient) GetServer(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) GetServerList(ctx context.Context) ([]*entities.Server, error)
- func (c *CloudClient) GetServerNIC(ctx context.Context, serverID string, nicID int) (*entities.NIC, error)
- func (c *CloudClient) GetServerNICs(ctx context.Context, serverID string) ([]entities.NIC, error)
- func (c *CloudClient) GetServerPrice(ctx context.Context, req *entities.GetServerPriceRequest) (float64, error)
- func (c *CloudClient) GetServerSnapshot(ctx context.Context, serverID string, snapshotID int) (*entities.Snapshot, error)
- func (c *CloudClient) GetServerSnapshots(ctx context.Context, serverID string) ([]entities.Snapshot, error)
- func (c *CloudClient) GetServerVolume(ctx context.Context, serverID string, volumeID int) (*entities.Volume, error)
- func (c *CloudClient) GetServerVolumes(ctx context.Context, serverID string) ([]entities.Volume, error)
- func (c *CloudClient) GetTask(ctx context.Context, taskID string) (*entities.TaskResponse, error)
- func (c *CloudClient) GetVMwareDiskTypes(ctx context.Context, locationID int) ([]entities.VMwareDiskType, error)deprecated
- func (c *CloudClient) GetVMwareGPUModels(ctx context.Context, locationID int) ([]entities.VMwareGPUModel, error)deprecated
- func (c *CloudClient) GetVMwareImages(ctx context.Context, locationID int, gpuOnly bool) ([]entities.VMwareImage, error)deprecated
- func (c *CloudClient) GetVMwareLocations(ctx context.Context) ([]entities.VMwareLocation, error)deprecated
- func (c *CloudClient) GetVMwareStorageProfiles(ctx context.Context, locationID, diskTypeID int) ([]entities.VMwareStorageProfile, error)deprecated
- func (c *CloudClient) GetVmwareEdgeFirewall(ctx context.Context, networkID int) (*entities.VmwareEdgeFirewall, error)
- func (c *CloudClient) GetVmwareEdgeNAT(ctx context.Context, networkID int) (*entities.VmwareEdgeNAT, error)
- func (c *CloudClient) GetVmwareEdgeVPN(ctx context.Context, networkID int) (*entities.VmwareEdgeVPN, error)
- func (c *CloudClient) GetVmwareGPUModelList(ctx context.Context, locationID *int) ([]*entities.VmwareGPUModel, error)
- func (c *CloudClient) GetVmwareImageList(ctx context.Context, locationID *int, gpu *string) ([]*entities.VmwareImage, error)
- func (c *CloudClient) GetVmwareLocationList(ctx context.Context) ([]*entities.VmwareLocation, error)
- func (c *CloudClient) GetVmwareNetwork(ctx context.Context, networkID int) (*entities.VmwareNetwork, error)
- func (c *CloudClient) GetVmwareNetworkList(ctx context.Context, locationID *int) ([]*entities.VmwareNetwork, error)
- func (c *CloudClient) GetVmwareServer(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) GetVmwareServerFirewall(ctx context.Context, serverID int) ([]entities.VmwareServerFirewallRule, error)
- func (c *CloudClient) GetVmwareServerList(ctx context.Context, locationID *int) ([]*entities.VmwareServer, error)
- func (c *CloudClient) GetVmwareServerNICs(ctx context.Context, serverID int) ([]*entities.VmwareNIC, error)
- func (c *CloudClient) GetVmwareServerVolumes(ctx context.Context, serverID int) ([]*entities.VmwareVolume, error)
- func (c *CloudClient) GetVmwareSnapshot(ctx context.Context, serverID int) (*entities.VmwareSnapshot, error)
- func (c *CloudClient) GetVmwareTask(ctx context.Context, taskID string) (*entities.VmwareTask, error)
- func (c *CloudClient) GetVmwareVolume(ctx context.Context, serverID, volumeID int) (*entities.VmwareVolume, error)
- func (c *CloudClient) PatchServer(ctx context.Context, serverID string, req *entities.PatchServerRequest) (*TaskID, error)
- func (c *CloudClient) PatchServerAndWait(ctx context.Context, serverID string, req *entities.PatchServerRequest) (*entities.Server, error)
- func (c *CloudClient) PowerOffServer(ctx context.Context, serverID string) (*TaskID, error)
- func (c *CloudClient) PowerOffServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) PowerOffVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) PowerOffVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) PowerOnServer(ctx context.Context, serverID string) (*TaskID, error)
- func (c *CloudClient) PowerOnServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) PowerOnVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) PowerOnVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) RebootServer(ctx context.Context, serverID string) (*TaskID, error)
- func (c *CloudClient) RebootServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) RebootVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) RebootVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) RebuildVmwareServer(ctx context.Context, serverID int, req *entities.VmwareRebuildServerRequest) (*entities.VmwareServerOrder, error)
- func (c *CloudClient) RebuildVmwareServerAndWait(ctx context.Context, serverID int, req *entities.VmwareRebuildServerRequest) (*entities.VmwareServer, error)
- func (c *CloudClient) RenameServer(ctx context.Context, serverID string, req *entities.RenameServerRequest) (*TaskID, error)
- func (c *CloudClient) RenameServerAndWait(ctx context.Context, serverID string, req *entities.RenameServerRequest) (*entities.Server, error)
- func (c *CloudClient) RenameVmwareServer(ctx context.Context, serverID int, req *entities.VmwareRenameServerRequest) error
- func (c *CloudClient) ResetServer(ctx context.Context, serverID string) (*TaskID, error)
- func (c *CloudClient) ResetServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) ResetVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) ResetVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) RestartGateway(ctx context.Context, gatewayID string) (*TaskID, error)
- func (c *CloudClient) RestartGatewayAndWait(ctx context.Context, gatewayID string) (*entities.Gateway, error)
- func (c *CloudClient) RestoreVmwareSnapshot(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) RestoreVmwareSnapshotAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) RollbackServerSnapshot(ctx context.Context, serverID string, snapshotID int) (*TaskID, error)
- func (c *CloudClient) RollbackServerSnapshotAndWait(ctx context.Context, serverID string, snapshotID int) (*entities.Server, error)
- func (c *CloudClient) ShutdownServer(ctx context.Context, serverID string) (*TaskID, error)
- func (c *CloudClient) ShutdownServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) ShutdownVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
- func (c *CloudClient) ShutdownVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) StartGateway(ctx context.Context, gatewayID string) (*TaskID, error)
- func (c *CloudClient) StartGatewayAndWait(ctx context.Context, gatewayID string) (*entities.Gateway, error)
- func (c *CloudClient) StopGateway(ctx context.Context, gatewayID string) (*TaskID, error)
- func (c *CloudClient) StopGatewayAndWait(ctx context.Context, gatewayID string) (*entities.Gateway, error)
- func (c *CloudClient) UpdateDomainRecord(ctx context.Context, domainName string, recordID int, ...) (*TaskID, error)
- func (c *CloudClient) UpdateDomainRecordAndWait(ctx context.Context, domainName string, recordID int, ...) (*entities.DNSRecord, error)
- func (c *CloudClient) UpdateFirewallRules(ctx context.Context, gatewayID string, ...) (*TaskID, error)
- func (c *CloudClient) UpdateFirewallRulesAndWait(ctx context.Context, gatewayID string, ...) error
- func (c *CloudClient) UpdateGateway(ctx context.Context, gatewayID string, req *entities.UpdateGatewayRequest) (*entities.Gateway, error)
- func (c *CloudClient) UpdateGatewayBandwidth(ctx context.Context, gatewayID string, ...) (*TaskID, error)
- func (c *CloudClient) UpdateGatewayBandwidthAndWait(ctx context.Context, gatewayID string, ...) (*entities.Gateway, error)
- func (c *CloudClient) UpdateNATRules(ctx context.Context, gatewayID string, req *entities.UpdateNATRulesRequest) (*TaskID, error)
- func (c *CloudClient) UpdateNATRulesAndWait(ctx context.Context, gatewayID string, req *entities.UpdateNATRulesRequest) error
- func (c *CloudClient) UpdateNetwork(ctx context.Context, networkID string, req *entities.UpdateNetworkRequest) (*entities.Network, error)
- func (c *CloudClient) UpdateServer(ctx context.Context, serverID string, req *entities.UpdateServerRequest) (*TaskID, error)
- func (c *CloudClient) UpdateServerAndWait(ctx context.Context, serverID string, req *entities.UpdateServerRequest) (*entities.Server, error)
- func (c *CloudClient) UpdateServerNIC(ctx context.Context, serverID string, nicID int, ...) (*TaskID, error)
- func (c *CloudClient) UpdateServerNICAndWait(ctx context.Context, serverID string, nicID int, ...) (*entities.NIC, error)
- func (c *CloudClient) UpdateServerVolume(ctx context.Context, serverID string, volumeID int, ...) (*TaskID, error)
- func (c *CloudClient) UpdateServerVolumeAndWait(ctx context.Context, serverID string, volumeID int, ...) (*entities.Volume, error)
- func (c *CloudClient) UpdateVmwareEdgeBandwidth(ctx context.Context, networkID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) UpdateVmwareEdgeBandwidthAndWait(ctx context.Context, networkID int, ...) (*entities.VmwareNetwork, error)
- func (c *CloudClient) UpdateVmwareEdgeFirewall(ctx context.Context, networkID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) UpdateVmwareEdgeFirewallAndWait(ctx context.Context, networkID int, ...) (*entities.VmwareEdgeFirewall, error)
- func (c *CloudClient) UpdateVmwareNIC(ctx context.Context, serverID, nicID int, req *entities.VmwareUpdateNICRequest) (*VmwareTaskID, error)
- func (c *CloudClient) UpdateVmwareNICAndWait(ctx context.Context, serverID, nicID int, req *entities.VmwareUpdateNICRequest) ([]*entities.VmwareNIC, error)
- func (c *CloudClient) UpdateVmwareServerFirewall(ctx context.Context, serverID int, ...) (*VmwareTaskID, error)
- func (c *CloudClient) UpdateVmwareServerFirewallAndWait(ctx context.Context, serverID int, ...) ([]entities.VmwareServerFirewallRule, error)
- func (c *CloudClient) UpsertVmwareEdgeNATRule(ctx context.Context, networkID int, req *entities.VmwareUpsertNATRuleRequest) (*VmwareTaskID, error)
- func (c *CloudClient) UpsertVmwareEdgeNATRuleAndWait(ctx context.Context, networkID int, req *entities.VmwareUpsertNATRuleRequest) (*entities.VmwareEdgeNAT, error)
- func (c *CloudClient) UpsertVmwareEdgeVPNTunnel(ctx context.Context, networkID int, req *entities.VmwareUpsertVPNTunnelRequest) (*VmwareTaskID, error)
- func (c *CloudClient) UpsertVmwareEdgeVPNTunnelAndWait(ctx context.Context, networkID int, req *entities.VmwareUpsertVPNTunnelRequest) (*entities.VmwareEdgeVPN, error)
- func (c *CloudClient) VerifyVmwareServer(ctx context.Context, req *entities.VmwareCreateServerRequest) error
- func (c *CloudClient) WaitGatewayActive(ctx context.Context, gatewayID string) (*entities.Gateway, error)
- func (c *CloudClient) WaitGatewayActiveWithTimeout(ctx context.Context, gatewayID string, timeout time.Duration) (*entities.Gateway, error)
- func (c *CloudClient) WaitGatewayTaskCompletion(ctx context.Context, gatewayID string, taskID string) (*entities.Gateway, error)
- func (c *CloudClient) WaitServerActive(ctx context.Context, serverID string) (*entities.Server, error)
- func (c *CloudClient) WaitServerActiveWithTimeout(ctx context.Context, serverID string, timeout time.Duration) (*entities.Server, error)
- func (c *CloudClient) WaitServerTaskCompletion(ctx context.Context, serverID string, taskID string) (*entities.Server, error)
- func (c *CloudClient) WaitVmwareNetworkActive(ctx context.Context, networkID int) (*entities.VmwareNetwork, error)
- func (c *CloudClient) WaitVmwareNetworkGone(ctx context.Context, networkID int) error
- func (c *CloudClient) WaitVmwareNetworkState(ctx context.Context, networkID int, wantStates ...string) (*entities.VmwareNetwork, error)
- func (c *CloudClient) WaitVmwareServerActive(ctx context.Context, serverID int) (*entities.VmwareServer, error)
- func (c *CloudClient) WaitVmwareServerGone(ctx context.Context, serverID int) error
- func (c *CloudClient) WaitVmwareServerState(ctx context.Context, serverID int, wantStates ...string) (*entities.VmwareServer, error)
- func (c *CloudClient) WaitVmwareTask(ctx context.Context, taskID string) (*entities.VmwareTask, error)
- func (c *CloudClient) WaitVmwareTaskRef(ctx context.Context, task *VmwareTaskID) (*entities.VmwareTask, error)
- func (c *CloudClient) WaitVmwareTaskWithTimeout(ctx context.Context, taskID string, timeout time.Duration) (*entities.VmwareTask, error)
- type Config
- type ErrorParam
- type GetAffinityGroupResponse
- type GetDomainResponse
- type GetFirewallRulesResponse
- type GetGatewayResponse
- type GetNATRulesResponse
- type GetNICResponse
- type GetNetworkResponse
- type GetProjectResponse
- type GetRecordResponse
- type GetSSHKeyResponse
- type GetServerResponse
- type GetSnapshotResponse
- type GetVolumeResponse
- type LeveledLogger
- type ListAffinityGroupsResponse
- type ListApplicationsResponse
- type ListDomainsResponse
- type ListGatewaysResponse
- type ListImagesResponse
- type ListLocationsResponse
- type ListNICsResponse
- type ListNetworksResponse
- type ListRecordsResponse
- type ListSSHKeysResponse
- type ListServersResponse
- type ListSnapshotsResponse
- type ListVMwareDiskTypesResponsedeprecated
- type ListVMwareGPUModelsResponsedeprecated
- type ListVMwareImagesResponsedeprecated
- type ListVMwareLocationsResponsedeprecated
- type ListVMwareStorageProfilesResponsedeprecated
- type ListVolumesResponse
- type LogLevel
- type Logger
- type Option
- func WithContext(ctx context.Context) Option
- func WithHTTPClient(client *http.Client) Option
- func WithLogLevel(level LogLevel) Option
- func WithLogger(logger Logger) Option
- func WithMaxRetries(maxRetries int) Option
- func WithPollingInterval(interval time.Duration) Option
- func WithPollingTimeout(timeout time.Duration) Option
- func WithRetryWaitMinMax(min, max time.Duration) Option
- func WithRetryableCodes(codes []int) Option
- func WithRetryableStatus(codes []int) Option
- func WithTimeout(timeout time.Duration) Option
- func WithUserAgent(userAgent string) Option
- type RequestError
- type RetryDecision
- type RetryPolicy
- type RetryReason
- type TaskID
- type ValidationError
- type VmwareTaskID
Constants ¶
const ( DefaultTimeout = 30 * time.Second DefaultPollingInterval = 5 * time.Second DefaultUserAgent = "vstack-cloud-panel-go-sdk/1.0.0" DefaultMaxRetries = 7 DefaultRetryWaitMin = 3 * time.Second DefaultRetryWaitMax = 30 * time.Second )
const ( // APICodeConflict — "a conflict occurred during the competitive change of the // object" — the API serializes changes to an object (e.g. a DNS zone); the // code is transient and is retried by default (see Config.RetryableCodes). APICodeConflict = -4000 // APICodeAlreadyExists — "Record already exists" (for example, a second // CNAME for the same name, or a record with identical rdata). APICodeAlreadyExists = -5542 // APICodeNetworkInUse — "Servers are connected to the network": the network // cannot be deleted while servers or gateways are connected to it. APICodeNetworkInUse = -19511 // APICodeAffinityGroupNotEmpty — "There must not be any servers in the group": // the group cannot be deleted while it contains servers. APICodeAffinityGroupNotEmpty = -19619 // APICodeDCLocationDoesNotExist — "the data center location does not exist": // the VMware endpoints answer 400 with this code for an unknown // location_id instead of silently returning an empty list. APICodeDCLocationDoesNotExist = -8049 // APICodeVmwareNoFreePublicNetwork — "There is no free network at the moment": // CreateVmwarePublicNetwork asked for a valid capacity, but the location has no // free public address block left. This is an infrastructure condition rather // than a bad request, and worth telling apart from the neighbouring -12042. APICodeVmwareNoFreePublicNetwork = -12043 // APICodeVmwareInvalidPublicNetworkCapacity — "The capacity of public network // is invalid": the requested size is not one the location offers. APICodeVmwareInvalidPublicNetworkCapacity = -12042 // APICodeVmwareOperationNotSupportedForGpuServer — "This operation is not // supported for GPU VMs": nested virtualization is mutually exclusive with a // GPU allocation, at order time and when enabling it on an existing server. APICodeVmwareOperationNotSupportedForGpuServer = -8149 // APICodeVmwareServerIsSuspended — "The operation is not available for a // suspended VM": the server is suspended and must be resumed first. APICodeVmwareServerIsSuspended = -8154 // APICodeVmwareNestedHypervisorNotSupportedInLocation — "The location has no // available VDC that supports nested hypervisor": the capability is reported // up front by VmwareLocation.NestedHypervisorSupported. APICodeVmwareNestedHypervisorNotSupportedInLocation = -8155 )
Well-known API error codes.
const AlreadyCompletedTaskID = "already_completed_task"
AlreadyCompletedTaskID is the synthetic task id the vStack delete operations that run synchronously return when asked for a task (?return_task=true): no real task is created, and tasks/already_completed_task always answers Completed. A caller that awaits whatever id the API handed it does not have to tell the synchronous case apart.
const VmwareTaskIDPrefix = "vmw"
VmwareTaskIDPrefix is the prefix every VMware task id carries ("vmw{N}"). The backend routes GET /tasks/{id} by this prefix, and it is what lets the SDK keep the two task families apart.
const VmwareTaskWaitDefaultTimeout = 30 * time.Minute
VmwareTaskWaitDefaultTimeout is the default wait applied by WaitVmwareTask.
VMware operations run far longer than the 2m base PollingTimeout, and their duration varies wildly for identical work: the same server order took 4m30s in one run and 21m30s in another, and two rebuilds of the same server took 4m40s and 24m30s (earlier measurements reached ~26m). VMware task waiting therefore has its own floor, and the base PollingTimeout is left alone.
This is a FLOOR, not a value: WithPollingTimeout raises the wait but cannot lower it below this. To wait for less, call WaitVmwareTaskWithTimeout.
The observed maxima sit only 4-5 minutes below this floor, so raise it with WithPollingTimeout for rebuild, or wherever a timeout would be costly.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound — a sentinel for a semantic "object not found" without an HTTP 404: some endpoints respond with 200 and an empty object, and objects-within-an-object (a server's volume/NIC/snapshot) are found by filtering a list. The SDK wraps such errors via %w so that IsNotFound treats them the same as a 404.
var ErrTaskFailed = errors.New("backend task failed")
ErrTaskFailed — a sentinel for "the API accepted the request and the backend task then failed". Such a failure carries no error code: the task object only reports the status. It is often transient (the same payload succeeds on a retry, typically when the project is busy with other operations on the same kind of object), so callers of idempotent operations can retry on it.
Functions ¶
func HasAPICode ¶
HasAPICode reports whether err carries the given API error code.
func IsAlreadyCompletedTaskID ¶ added in v1.2.0
IsAlreadyCompletedTaskID reports whether taskID is the synthetic always-completed task id — see AlreadyCompletedTaskID.
func IsAlreadyExists ¶
IsAlreadyExists reports whether err is the API "already exists" error (-5542).
func IsConflict ¶
IsConflict reports whether err is the transient API conflict error (-4000).
The API serializes concurrent changes to one object, so a mutation issued while another is still running on the same server or network is rejected with this code. It is retried automatically (Config.RetryableCodes); this helper is for callers that drive their own sequencing.
func IsInvalidLocation ¶ added in v1.1.2
IsInvalidLocation reports whether err is the API "location does not exist" error (-8049) — the 400 returned for an unknown location_id filter.
func IsNetworkInUse ¶ added in v1.1.3
IsNetworkInUse reports whether err is the API "servers are connected to the network" error (-19511) — a network cannot be deleted while servers or gateways are still attached to it.
func IsNotFound ¶
IsNotFound reports whether err means the requested object does not exist: either an HTTP 404 from the API or a semantic not-found (see ErrNotFound).
This intentionally does NOT cover the "location does not exist" error (APICodeDCLocationDoesNotExist, -8049), which the backend returns as HTTP 400. Recognizing a 400 as not-found here would be a leaky hack that misclassifies other 400s, so that case has its own helper — IsInvalidLocation.
func IsTaskFailed ¶ added in v1.1.0
IsTaskFailed reports whether err is a failed backend task (see ErrTaskFailed).
func IsVmwareNestedHypervisorNotSupportedInLocation ¶ added in v1.2.0
IsVmwareNestedHypervisorNotSupportedInLocation reports whether err is the VMware "the location has no available VDC that supports nested hypervisor" error (-8155); VmwareLocation.NestedHypervisorSupported reports the capability up front.
func IsVmwareNoFreePublicNetwork ¶ added in v1.1.3
IsVmwareNoFreePublicNetwork reports whether err is the VMware "there is no free network at the moment" error (-12043) — the requested public network capacity is valid, but the location has no free address block left. Distinct from APICodeVmwareInvalidPublicNetworkCapacity (-12042), which means the size itself is not offered.
func IsVmwareOperationNotSupportedForGpuServer ¶ added in v1.2.0
IsVmwareOperationNotSupportedForGpuServer reports whether err is the VMware "this operation is not supported for GPU VMs" error (-8149) — nested virtualization cannot be combined with a GPU allocation.
func IsVmwareServerSuspended ¶ added in v1.2.0
IsVmwareServerSuspended reports whether err is the VMware "the operation is not available for a suspended VM" error (-8154) — the server has to be resumed before the operation can be retried.
func IsVmwareTaskID ¶ added in v1.1.2
IsVmwareTaskID reports whether taskID belongs to the VMware id space ("vmw{N}") rather than to the base one ("l{N}t{N}", "dns{N}", "k8s_{f|m}{N}").
Types ¶
type AddNetworkTagRequest ¶
type AddNetworkTagRequest struct {
Tag string `json:"value" binding:"required"`
}
Request types
type CloudClient ¶
type CloudClient struct {
// contains filtered or unexported fields
}
CloudClient represents the main client for interacting with the cloud API. Clients are safe for concurrent use by multiple goroutines.
func NewClient ¶
func NewClient(config *Config) (*CloudClient, error)
NewClient creates a new CloudClient instance with the provided configuration. The client is safe for concurrent use and should be reused rather than created per-request.
func (*CloudClient) AddNetworkTag ¶
func (c *CloudClient) AddNetworkTag(ctx context.Context, networkID string, req *AddNetworkTagRequest) error
AddNetworkTag adds a tag to a network
func (*CloudClient) ChangeVmwareServerComputerName ¶ added in v1.1.2
func (c *CloudClient) ChangeVmwareServerComputerName(ctx context.Context, serverID int, req *entities.VmwareComputerNameRequest) (*VmwareTaskID, error)
ChangeVmwareServerComputerName changes the guest OS hostname and returns the background task to await.
The backend upper-cases the value it stores, so the name read back will not match the one sent unless it was already upper case. Compare case-insensitively.
func (*CloudClient) ChangeVmwareServerComputerNameAndWait ¶ added in v1.1.2
func (c *CloudClient) ChangeVmwareServerComputerNameAndWait(ctx context.Context, serverID int, req *entities.VmwareComputerNameRequest) (*entities.VmwareServer, error)
ChangeVmwareServerComputerNameAndWait changes the guest hostname, waits for the task and returns the refreshed server.
func (*CloudClient) ChangeVmwareServerConfiguration ¶ added in v1.1.2
func (c *CloudClient) ChangeVmwareServerConfiguration(ctx context.Context, serverID int, req *entities.VmwareChangeConfigurationRequest) (*VmwareTaskID, error)
ChangeVmwareServerConfiguration changes the CPU, RAM and system disk of a server and returns the background task to await.
func (*CloudClient) ChangeVmwareServerConfigurationAndWait ¶ added in v1.1.2
func (c *CloudClient) ChangeVmwareServerConfigurationAndWait(ctx context.Context, serverID int, req *entities.VmwareChangeConfigurationRequest) (*entities.VmwareServer, error)
ChangeVmwareServerConfigurationAndWait changes the configuration, waits for the task and returns the refreshed server.
func (*CloudClient) Config ¶
func (c *CloudClient) Config() Config
Config returns a copy of the client configuration. Note: This returns a shallow copy. Modifying nested objects (like HTTPClient) will affect the original config.
func (*CloudClient) ConnectNetwork ¶
func (c *CloudClient) ConnectNetwork(ctx context.Context, gatewayID string, req *entities.ConnectNetworkRequest) (*TaskID, error)
ConnectNetwork connects an isolated network to gateway and returns a task ID
func (*CloudClient) ConnectNetworkAndWait ¶
func (c *CloudClient) ConnectNetworkAndWait(ctx context.Context, gatewayID string, req *entities.ConnectNetworkRequest) error
ConnectNetworkAndWait connects network and waits for completion
func (*CloudClient) ConnectVmwareClientNetwork ¶ added in v1.1.2
func (c *CloudClient) ConnectVmwareClientNetwork(ctx context.Context, serverID int, req *entities.VmwareConnectClientNetworkRequest) (*VmwareTaskID, error)
ConnectVmwareClientNetwork attaches a server to a client network and returns the background task to await.
func (*CloudClient) ConnectVmwareClientNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) ConnectVmwareClientNetworkAndWait(ctx context.Context, serverID int, req *entities.VmwareConnectClientNetworkRequest) ([]*entities.VmwareNIC, error)
ConnectVmwareClientNetworkAndWait attaches a server to a client network, waits for the task and returns the server's NICs.
func (*CloudClient) ConnectVmwareServers ¶ added in v1.1.2
func (c *CloudClient) ConnectVmwareServers(ctx context.Context, networkID int, req *entities.VmwareConnectServersRequest) ([]*VmwareTaskID, error)
ConnectVmwareServers connects a set of servers to a network and returns one task per server, in the order the request listed them.
The tasks come back as typed references rather than bare strings. A partial failure is reported through the error's ErrorParams, which name the offending element (see RequestError.ErrorParams).
func (*CloudClient) ConnectVmwareServersAndWait ¶ added in v1.1.2
func (c *CloudClient) ConnectVmwareServersAndWait(ctx context.Context, networkID int, req *entities.VmwareConnectServersRequest) error
ConnectVmwareServersAndWait connects servers to a network and waits for every task it started. The tasks are awaited in order.
func (*CloudClient) ConnectVmwareSharedNetwork ¶ added in v1.1.2
func (c *CloudClient) ConnectVmwareSharedNetwork(ctx context.Context, serverID int, req *entities.VmwareConnectSharedNetworkRequest) (*VmwareTaskID, error)
ConnectVmwareSharedNetwork attaches a server to a shared (public) network and returns the background task to await.
func (*CloudClient) ConnectVmwareSharedNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) ConnectVmwareSharedNetworkAndWait(ctx context.Context, serverID int, req *entities.VmwareConnectSharedNetworkRequest) ([]*entities.VmwareNIC, error)
ConnectVmwareSharedNetworkAndWait attaches a server to a shared network, waits for the task and returns the server's NICs.
func (*CloudClient) CopyVmwareServer ¶ added in v1.1.2
func (c *CloudClient) CopyVmwareServer(ctx context.Context, serverID int, req *entities.VmwareCopyServerRequest) (*entities.VmwareServerOrder, error)
CopyVmwareServer creates a copy of a server and returns the order (the id of the new server plus the id of the background task).
func (*CloudClient) CopyVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) CopyVmwareServerAndWait(ctx context.Context, serverID int, req *entities.VmwareCopyServerRequest) (*entities.VmwareServer, error)
CopyVmwareServerAndWait copies a server, waits for the task and returns the new server. Copying takes minutes.
func (*CloudClient) CreateAffinityGroup ¶
func (c *CloudClient) CreateAffinityGroup(ctx context.Context, req *entities.CreateAffinityGroupRequest) (*entities.AffinityGroup, error)
CreateAffinityGroup creates a new affinity or anti-affinity group
func (*CloudClient) CreateDomain ¶
func (c *CloudClient) CreateDomain(ctx context.Context, req *entities.CreateDomainRequest) (*TaskID, error)
CreateDomain creates a new domain and returns a task ID
func (*CloudClient) CreateDomainAndWait ¶
func (c *CloudClient) CreateDomainAndWait(ctx context.Context, req *entities.CreateDomainRequest) (*entities.Domain, error)
CreateDomainAndWait creates a domain and waits for completion
func (*CloudClient) CreateDomainRecord ¶
func (c *CloudClient) CreateDomainRecord(ctx context.Context, domainName string, req *entities.CreateRecordRequest) (*TaskID, error)
CreateDomainRecord creates a new DNS record and returns a task ID.
The record name can be given in DNS-standard full form; for SRV records the full name (_sip._tcp.zone.) is automatically split into a base name + service/protocol — the server itself adds the `_service._proto.` prefix, and without normalization the name would end up doubled.
func (*CloudClient) CreateDomainRecordAndWait ¶
func (c *CloudClient) CreateDomainRecordAndWait(ctx context.Context, domainName string, req *entities.CreateRecordRequest) (*entities.DNSRecord, error)
CreateDomainRecordAndWait creates a DNS record and waits for completion
func (*CloudClient) CreateGateway ¶
func (c *CloudClient) CreateGateway(ctx context.Context, req *entities.CreateGatewayRequest) (*TaskID, error)
CreateGateway creates a new gateway and returns a task ID
func (*CloudClient) CreateGatewayAndWait ¶
func (c *CloudClient) CreateGatewayAndWait(ctx context.Context, req *entities.CreateGatewayRequest) (*entities.Gateway, error)
CreateGatewayAndWait creates a gateway and waits for completion
func (*CloudClient) CreateGatewayTag ¶
func (c *CloudClient) CreateGatewayTag(ctx context.Context, gatewayID string, req *entities.CreateGatewayTagRequest) error
CreateGatewayTag creates a tag for gateway
func (*CloudClient) CreateNetwork ¶
func (c *CloudClient) CreateNetwork(ctx context.Context, req *entities.CreateNetworkRequest) (*TaskID, error)
CreateNetwork creates a new isolated network
func (*CloudClient) CreateNetworkAndWait ¶
func (c *CloudClient) CreateNetworkAndWait(ctx context.Context, req *entities.CreateNetworkRequest) (*entities.Network, error)
CreateNetworkAndWait creates a network and waits for completion
func (*CloudClient) CreateSSHKey ¶
func (c *CloudClient) CreateSSHKey(ctx context.Context, req *entities.CreateSSHKeyRequest) (*entities.SSHKey, error)
CreateSSHKey creates a new SSH key
func (*CloudClient) CreateServer ¶
func (c *CloudClient) CreateServer(ctx context.Context, req *entities.CreateServerRequest) (*TaskID, error)
CreateServer creates a new server and returns a task ID
func (*CloudClient) CreateServerAndWait ¶
func (c *CloudClient) CreateServerAndWait(ctx context.Context, req *entities.CreateServerRequest) (*entities.Server, error)
CreateServerAndWait creates a server and waits for it to become Active
func (*CloudClient) CreateServerNIC ¶
func (c *CloudClient) CreateServerNIC(ctx context.Context, serverID string, req *entities.CreateNICRequest) (*TaskID, error)
CreateServerNIC creates a new network interface and returns a task ID
func (*CloudClient) CreateServerNICAndWait ¶
func (c *CloudClient) CreateServerNICAndWait(ctx context.Context, serverID string, req *entities.CreateNICRequest) (*entities.NIC, error)
CreateServerNICAndWait creates a network interface and waits for server to become Active
func (*CloudClient) CreateServerSnapshot ¶
func (c *CloudClient) CreateServerSnapshot(ctx context.Context, serverID string, req *entities.CreateSnapshotRequest) (*TaskID, error)
CreateServerSnapshot creates a new snapshot and returns a task ID
func (*CloudClient) CreateServerSnapshotAndWait ¶
func (c *CloudClient) CreateServerSnapshotAndWait(ctx context.Context, serverID string, req *entities.CreateSnapshotRequest) (*entities.Snapshot, error)
CreateServerSnapshotAndWait creates a snapshot and waits for server to become Active
func (*CloudClient) CreateServerTag ¶
func (c *CloudClient) CreateServerTag(ctx context.Context, serverID string, req *entities.CreateServerTagRequest) error
CreateServerTag creates tag for server
func (*CloudClient) CreateServerVolume ¶
func (c *CloudClient) CreateServerVolume(ctx context.Context, serverID string, req *entities.CreateVolumeRequest) (*TaskID, error)
CreateServerVolume creates a new volume and returns a task ID
func (*CloudClient) CreateServerVolumeAndWait ¶
func (c *CloudClient) CreateServerVolumeAndWait(ctx context.Context, serverID string, req *entities.CreateVolumeRequest) (*entities.Volume, error)
CreateServerVolumeAndWait creates a volume and waits for server to become Active
func (*CloudClient) CreateVmwareIsolatedNetwork ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareIsolatedNetwork(ctx context.Context, req *entities.VmwareCreateIsolatedNetworkRequest) (*VmwareTaskID, error)
CreateVmwareIsolatedNetwork creates an isolated VMware network and returns the background task to await.
func (*CloudClient) CreateVmwareIsolatedNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareIsolatedNetworkAndWait(ctx context.Context, req *entities.VmwareCreateIsolatedNetworkRequest) (*entities.VmwareNetwork, error)
CreateVmwareIsolatedNetworkAndWait creates an isolated VMware network, waits for the background task to finish and returns the created network.
func (*CloudClient) CreateVmwarePublicNetwork ¶ added in v1.1.2
func (c *CloudClient) CreateVmwarePublicNetwork(ctx context.Context, req *entities.VmwareCreatePublicNetworkRequest) (*VmwareTaskID, error)
CreateVmwarePublicNetwork creates a public VMware network and returns the background task to await.
func (*CloudClient) CreateVmwarePublicNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) CreateVmwarePublicNetworkAndWait(ctx context.Context, req *entities.VmwareCreatePublicNetworkRequest) (*entities.VmwareNetwork, error)
CreateVmwarePublicNetworkAndWait creates a public VMware network, waits for the background task to finish and returns the created network.
func (*CloudClient) CreateVmwareRoutedNetwork ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareRoutedNetwork(ctx context.Context, req *entities.VmwareCreateRoutedNetworkRequest) (*VmwareTaskID, error)
CreateVmwareRoutedNetwork creates a routed VMware network and returns the background task to await. A routed network carries an edge gateway, so the firewall / NAT / VPN methods below apply to it.
func (*CloudClient) CreateVmwareRoutedNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareRoutedNetworkAndWait(ctx context.Context, req *entities.VmwareCreateRoutedNetworkRequest) (*entities.VmwareNetwork, error)
CreateVmwareRoutedNetworkAndWait creates a routed VMware network, waits for the background task to finish and returns the created network.
func (*CloudClient) CreateVmwareServer ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareServer(ctx context.Context, req *entities.VmwareCreateServerRequest) (*entities.VmwareServerOrder, error)
CreateVmwareServer places an order for a new VMware server and returns the order (the id of the created server plus the id of the background task).
The order carries the task id as a bare string; wrap it with VmwareTaskID{ID: order.TaskID} to await it, or use CreateVmwareServerAndWait.
func (*CloudClient) CreateVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareServerAndWait(ctx context.Context, req *entities.VmwareCreateServerRequest) (*entities.VmwareServer, error)
CreateVmwareServerAndWait creates a VMware server, waits for the provisioning task to complete and returns the created server.
Provisioning takes minutes, which is why VMware task waiting has its own timeout floor (VmwareTaskWaitDefaultTimeout) rather than the 2m base PollingTimeout.
func (*CloudClient) CreateVmwareSnapshot ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareSnapshot(ctx context.Context, serverID int, req *entities.VmwareCreateSnapshotRequest) (*VmwareTaskID, error)
CreateVmwareSnapshot creates the snapshot of a server and returns the background task to await. A server holds at most one snapshot.
Takes *entities.VmwareCreateSnapshotRequest instead of a bare string, in line with the base CreateServerSnapshot, so a future second field is not a breaking change.
func (*CloudClient) CreateVmwareSnapshotAndWait ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareSnapshotAndWait(ctx context.Context, serverID int, req *entities.VmwareCreateSnapshotRequest) (*entities.VmwareSnapshot, error)
CreateVmwareSnapshotAndWait creates the snapshot, waits for the task and returns it.
func (*CloudClient) CreateVmwareVolume ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareVolume(ctx context.Context, serverID int, req *entities.VmwareCreateVolumeRequest) (*VmwareTaskID, error)
CreateVmwareVolume creates a data volume on a server and returns the background task to await.
DiskType is the Title of one of the location's disk types (VmwareLocation.DiskTypes), and SizeMB must respect that entry's MinMB/MaxMB/StepMB.
func (*CloudClient) CreateVmwareVolumeAndWait ¶ added in v1.1.2
func (c *CloudClient) CreateVmwareVolumeAndWait(ctx context.Context, serverID int, req *entities.VmwareCreateVolumeRequest) error
CreateVmwareVolumeAndWait creates a data volume and waits for its task.
The API does not return the new volume's id — neither the response nor the completed task carries it — so this reports completion only; read the volume back with GetVmwareServerVolumes.
func (*CloudClient) DefaultRetryPolicy ¶
func (c *CloudClient) DefaultRetryPolicy(resp *http.Response, err error) RetryDecision
DefaultRetryPolicy is the policy the client uses when none is configured. It retries transport errors, the HTTP statuses in Config.RetryableStatus and the API error codes in Config.RetryableCodes, and honours a Retry-After header when the response carries one.
func (*CloudClient) DeleteAffinityGroup ¶
func (c *CloudClient) DeleteAffinityGroup(ctx context.Context, groupID string) error
DeleteAffinityGroup deletes an affinity group
func (*CloudClient) DeleteDomain ¶
func (c *CloudClient) DeleteDomain(ctx context.Context, domainName string) error
DeleteDomain deletes a domain.
Deletion is asynchronous: 200 OK means the deletion was accepted, but the zone still exists for some time. If you need to wait for actual deletion, use DeleteDomainAndWait.
func (*CloudClient) DeleteDomainAndWait ¶
func (c *CloudClient) DeleteDomainAndWait(ctx context.Context, domainName string) error
DeleteDomainAndWait deletes a domain and waits until it is actually gone. DELETE does not return a task_id, so waiting is implemented by polling GetDomain until 404 (the interval/timeout come from the client configuration).
func (*CloudClient) DeleteDomainRecord ¶
func (c *CloudClient) DeleteDomainRecord(ctx context.Context, domainName string, recordID int) error
DeleteDomainRecord deletes a DNS record.
Deletion is asynchronous: 200 OK means the deletion was accepted, but the record remains in the zone for about 10-20 more seconds. If you need to wait for actual deletion, use DeleteDomainRecordAndWait.
func (*CloudClient) DeleteDomainRecordAndWait ¶
func (c *CloudClient) DeleteDomainRecordAndWait(ctx context.Context, domainName string, recordID int) error
DeleteDomainRecordAndWait deletes a DNS record and waits until it is actually gone. DELETE does not return a task_id, so waiting is implemented by polling GetDomainRecord until 404 (the interval/timeout come from the client configuration).
func (*CloudClient) DeleteGateway ¶
func (c *CloudClient) DeleteGateway(ctx context.Context, gatewayID string) error
DeleteGateway deletes a gateway
func (*CloudClient) DeleteGatewayTag ¶
func (c *CloudClient) DeleteGatewayTag(ctx context.Context, gatewayID, tag string) error
DeleteGatewayTag deletes a tag from gateway
func (*CloudClient) DeleteNetwork ¶
func (c *CloudClient) DeleteNetwork(ctx context.Context, networkID string) error
DeleteNetwork deletes a network and returns a task ID
func (*CloudClient) DeleteNetworkTag ¶
func (c *CloudClient) DeleteNetworkTag(ctx context.Context, networkID, tag string) error
DeleteNetworkTag removes a tag from an isolated network
func (*CloudClient) DeleteSSHKey ¶
func (c *CloudClient) DeleteSSHKey(ctx context.Context, keyID int) error
DeleteSSHKey deletes an SSH key
func (*CloudClient) DeleteServer ¶
func (c *CloudClient) DeleteServer(ctx context.Context, serverID string) error
DeleteServer deletes a server
func (*CloudClient) DeleteServerNIC ¶
DeleteServerNIC deletes a network interface
func (*CloudClient) DeleteServerNICAndWait ¶
DeleteServerNICAndWait deletes a network interface and waits for server to become Active
func (*CloudClient) DeleteServerSnapshot ¶
func (c *CloudClient) DeleteServerSnapshot(ctx context.Context, serverID string, snapshotID int) error
DeleteServerSnapshot deletes a snapshot
func (*CloudClient) DeleteServerSnapshotAndWait ¶
func (c *CloudClient) DeleteServerSnapshotAndWait(ctx context.Context, serverID string, snapshotID int) error
DeleteServerSnapshotAndWait deletes a snapshot and waits for server to become Active
func (*CloudClient) DeleteServerTag ¶
DeleteServerTag delete tag for server
func (*CloudClient) DeleteServerVolume ¶
DeleteServerVolume deletes a volume
func (*CloudClient) DeleteServerVolumeAndWait ¶
func (c *CloudClient) DeleteServerVolumeAndWait(ctx context.Context, serverID string, volumeID int) error
DeleteServerVolumeAndWait deletes a volume and waits for server to become Active
func (*CloudClient) DeleteVmwareEdgeNATRule ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareEdgeNATRule(ctx context.Context, networkID, ruleID int) (*VmwareTaskID, error)
DeleteVmwareEdgeNATRule deletes a NAT rule and returns the background task to await.
RuleID is VmwareEdgeNATRule.ID as returned by GetVmwareEdgeNAT — the internal DB id this endpoint accepts.
func (*CloudClient) DeleteVmwareEdgeNATRuleAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareEdgeNATRuleAndWait(ctx context.Context, networkID, ruleID int) error
DeleteVmwareEdgeNATRuleAndWait deletes a NAT rule and waits for its task.
func (*CloudClient) DeleteVmwareEdgeVPNTunnel ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareEdgeVPNTunnel(ctx context.Context, networkID, tunnelID int) (*VmwareTaskID, error)
DeleteVmwareEdgeVPNTunnel deletes a VPN tunnel and returns the background task to await.
TunnelID is VmwareEdgeVPNTunnel.ID as returned by GetVmwareEdgeVPN — the internal DB id this endpoint accepts.
func (*CloudClient) DeleteVmwareEdgeVPNTunnelAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareEdgeVPNTunnelAndWait(ctx context.Context, networkID, tunnelID int) error
DeleteVmwareEdgeVPNTunnelAndWait deletes a VPN tunnel and waits for its task.
func (*CloudClient) DeleteVmwareNIC ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareNIC(ctx context.Context, serverID, nicID int) (*VmwareTaskID, error)
DeleteVmwareNIC detaches a network interface from a server and returns the background task to await.
func (*CloudClient) DeleteVmwareNICAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareNICAndWait(ctx context.Context, serverID, nicID int) error
DeleteVmwareNICAndWait detaches a NIC and waits for its task.
func (*CloudClient) DeleteVmwareNetwork ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareNetwork(ctx context.Context, networkID int) (*VmwareTaskID, error)
DeleteVmwareNetwork deletes a VMware network and returns the background task to await.
A network with servers or gateways attached cannot be deleted; that is reported as APICodeNetworkInUse (see IsNetworkInUse).
func (*CloudClient) DeleteVmwareNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareNetworkAndWait(ctx context.Context, networkID int) error
DeleteVmwareNetworkAndWait deletes a network and waits until it is really gone — the task can complete while the object is still readable.
func (*CloudClient) DeleteVmwareServer ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
DeleteVmwareServer deletes a server and returns the background task to await.
func (*CloudClient) DeleteVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareServerAndWait(ctx context.Context, serverID int) error
DeleteVmwareServerAndWait deletes a server and waits until it is really gone.
It waits for both the task AND the disappearance of the object: a completed delete task does not guarantee the server is no longer readable (it has been observed lingering in state "deleting" for minutes after a rebuild replaced it), and the difference is not something a caller can predict. See WaitVmwareServerGone.
func (*CloudClient) DeleteVmwareSnapshot ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareSnapshot(ctx context.Context, serverID int) (*VmwareTaskID, error)
DeleteVmwareSnapshot deletes the snapshot of a server and returns the background task to await.
func (*CloudClient) DeleteVmwareSnapshotAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareSnapshotAndWait(ctx context.Context, serverID int) error
DeleteVmwareSnapshotAndWait deletes the snapshot and waits for its task.
func (*CloudClient) DeleteVmwareVolume ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareVolume(ctx context.Context, serverID, volumeID int) (*VmwareTaskID, error)
DeleteVmwareVolume deletes a data volume of a server and returns the background task to await.
func (*CloudClient) DeleteVmwareVolumeAndWait ¶ added in v1.1.2
func (c *CloudClient) DeleteVmwareVolumeAndWait(ctx context.Context, serverID, volumeID int) error
DeleteVmwareVolumeAndWait deletes a data volume and waits for its task.
func (*CloudClient) DisableVmwareServerNestedHypervisor ¶ added in v1.2.0
func (c *CloudClient) DisableVmwareServerNestedHypervisor(ctx context.Context, serverID int) (*VmwareTaskID, error)
DisableVmwareServerNestedHypervisor turns nested virtualization off and returns the background task to await, or (nil, nil) when it is already disabled. Like enabling, it power-cycles a running server.
func (*CloudClient) DisableVmwareServerNestedHypervisorAndWait ¶ added in v1.2.0
func (c *CloudClient) DisableVmwareServerNestedHypervisorAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
DisableVmwareServerNestedHypervisorAndWait turns nested virtualization off, waits for the task and returns the refreshed server. When it was already disabled there is no task to wait for and the current server state is returned.
func (*CloudClient) DisconnectNetwork ¶
DisconnectNetwork disconnects an isolated network from gateway
func (*CloudClient) DisconnectNetworkAndWait ¶
func (c *CloudClient) DisconnectNetworkAndWait(ctx context.Context, gatewayID string, nicID int) error
DisconnectNetworkAndWait disconnects an isolated network from gateway and waits until the NIC is removed
func (*CloudClient) EditVmwareNetwork ¶ added in v1.1.2
func (c *CloudClient) EditVmwareNetwork(ctx context.Context, networkID int, req *entities.VmwareEditNetworkRequest) (*VmwareTaskID, error)
EditVmwareNetwork updates the name and/or bandwidth of a VMware network.
Bandwidth here is the same field as a routed network's edge bandwidth, which UpdateVmwareEdgeBandwidth writes.
Bandwidth does not apply to an isolated network — send only Name.
An isolated-network edit is answered synchronously, with HTTP 204 and no task, and this method returns (nil, nil) in that case. A routed or public network answers 200 with a task to await. The two cases are distinguishable by the result: a nil task means the change is already applied.
func (*CloudClient) EditVmwareNetworkAndWait ¶ added in v1.1.2
func (c *CloudClient) EditVmwareNetworkAndWait(ctx context.Context, networkID int, req *entities.VmwareEditNetworkRequest) (*entities.VmwareNetwork, error)
EditVmwareNetworkAndWait edits a network, waits for the task (if any) and returns the refreshed network.
func (*CloudClient) EditVmwareVolume ¶ added in v1.1.2
func (c *CloudClient) EditVmwareVolume(ctx context.Context, serverID, volumeID int, req *entities.VmwareEditVolumeRequest) (*VmwareTaskID, error)
EditVmwareVolume edits a data volume of a server and returns the background task to await. A volume can only grow.
func (*CloudClient) EditVmwareVolumeAndWait ¶ added in v1.1.2
func (c *CloudClient) EditVmwareVolumeAndWait(ctx context.Context, serverID, volumeID int, req *entities.VmwareEditVolumeRequest) (*entities.VmwareVolume, error)
EditVmwareVolumeAndWait edits a data volume, waits for the task and returns the refreshed volume.
func (*CloudClient) EnableVmwareServerNestedHypervisor ¶ added in v1.2.0
func (c *CloudClient) EnableVmwareServerNestedHypervisor(ctx context.Context, serverID int) (*VmwareTaskID, error)
EnableVmwareServerNestedHypervisor turns nested virtualization on and returns the background task to await, or (nil, nil) when it is already enabled.
The feature is offered per location — check VmwareLocation.NestedHypervisorSupported before ordering it — and the current setting of a server is VmwareServer.NestedHypervisor. The backend saga power-cycles a running server; a server that is off stays off. A server busy with another task is refused with 409 (IsConflict); a GPU server, a suspended server and a location without the capability are refused with their own codes, see IsVmwareOperationNotSupportedForGpuServer, IsVmwareServerSuspended and IsVmwareNestedHypervisorNotSupportedInLocation.
func (*CloudClient) EnableVmwareServerNestedHypervisorAndWait ¶ added in v1.2.0
func (c *CloudClient) EnableVmwareServerNestedHypervisorAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
EnableVmwareServerNestedHypervisorAndWait turns nested virtualization on, waits for the task and returns the refreshed server. When it was already enabled there is no task to wait for and the current server state is returned.
func (*CloudClient) GetAffinityGroup ¶
func (c *CloudClient) GetAffinityGroup(ctx context.Context, groupID string) (*entities.AffinityGroup, error)
GetAffinityGroup retrieves a specific affinity group by ID
func (*CloudClient) GetAffinityGroupList ¶
func (c *CloudClient) GetAffinityGroupList(ctx context.Context) ([]*entities.AffinityGroup, error)
GetAffinityGroupList retrieves all affinity groups
func (*CloudClient) GetApplications ¶
func (c *CloudClient) GetApplications(ctx context.Context, locationID string) ([]entities.Application, error)
GetApplications retrieves list of available applications locationID is optional - if provided, filters applications by location
func (*CloudClient) GetDomainRecord ¶
func (c *CloudClient) GetDomainRecord(ctx context.Context, domainName string, recordID int) (*entities.DNSRecord, error)
GetDomainRecord retrieves a specific DNS record
func (*CloudClient) GetDomainRecords ¶
func (c *CloudClient) GetDomainRecords(ctx context.Context, domainName string) ([]entities.DNSRecord, error)
GetDomainRecords retrieves all records for a specific domain
func (*CloudClient) GetDomains ¶
GetDomains retrieves all domains in the project
func (*CloudClient) GetFirewallRules ¶
func (c *CloudClient) GetFirewallRules(ctx context.Context, gatewayID string) ([]entities.FirewallRule, error)
GetFirewallRules retrieves firewall rules for a gateway
func (*CloudClient) GetGateway ¶
GetGateway retrieves a specific gateway by ID
func (*CloudClient) GetGatewayList ¶
GetGatewayList retrieves all gateways
func (*CloudClient) GetLocations ¶
GetLocations retrieves list of available locations with volume size limits
func (*CloudClient) GetNATRules ¶
func (c *CloudClient) GetNATRules(ctx context.Context, gatewayID string) ([]entities.NATRule, error)
GetNATRules retrieves NAT rules for a gateway
func (*CloudClient) GetNetwork ¶
GetNetwork retrieves a specific network by ID
func (*CloudClient) GetNetworkList ¶
GetNetworkList retrieves all networks
func (*CloudClient) GetProject ¶
GetProject retrieves current project information including ID and balance
func (*CloudClient) GetSSHKeyList ¶
GetSSHKeyList retrieves all SSH keys
func (*CloudClient) GetServerList ¶
GetServerList retrieves all servers
func (*CloudClient) GetServerNIC ¶
func (c *CloudClient) GetServerNIC(ctx context.Context, serverID string, nicID int) (*entities.NIC, error)
GetServerNIC retrieves a specific network interface by ID
func (*CloudClient) GetServerNICs ¶
GetServerNICs retrieves all network interfaces for a server
func (*CloudClient) GetServerPrice ¶
func (c *CloudClient) GetServerPrice(ctx context.Context, req *entities.GetServerPriceRequest) (float64, error)
GetServerPrice retrieves the monthly price for a server configuration
func (*CloudClient) GetServerSnapshot ¶
func (c *CloudClient) GetServerSnapshot(ctx context.Context, serverID string, snapshotID int) (*entities.Snapshot, error)
GetServerSnapshot retrieves a specific snapshot by ID
func (*CloudClient) GetServerSnapshots ¶
func (c *CloudClient) GetServerSnapshots(ctx context.Context, serverID string) ([]entities.Snapshot, error)
GetServerSnapshots retrieves all snapshots for a server
func (*CloudClient) GetServerVolume ¶
func (c *CloudClient) GetServerVolume(ctx context.Context, serverID string, volumeID int) (*entities.Volume, error)
GetServerVolume retrieves a specific volume by ID
func (*CloudClient) GetServerVolumes ¶
func (c *CloudClient) GetServerVolumes(ctx context.Context, serverID string) ([]entities.Volume, error)
GetServerVolumes retrieves all volumes for a server
func (*CloudClient) GetTask ¶
func (c *CloudClient) GetTask(ctx context.Context, taskID string) (*entities.TaskResponse, error)
GetTask retrieves a specific task by ID, in any of the task ID formats the endpoint serves: vStack ("l{N}t{N}"), DNS ("dns{N}"), Kubernetes ("k8s_{f|m}{N}") and VMware ("vmw{N}").
entities.TaskResponse decodes all of them. The unified part of the model (state, type, progress, timestamps, Resources) is identical for every service, and the deprecated per-resource ID fields a given service does not send simply stay empty — a VMware task sends none of them and reports its server and network through Resources only.
GetVmwareTask returns the same VMware task in the VMware-typed model, whose ServerID/NetworkID accessors hand back ints. Waiting, unlike reading, is not family-agnostic: VMware tasks run far longer than the base PollingTimeout, so await them with WaitVmwareTask.
func (*CloudClient) GetVMwareDiskTypes
deprecated
added in
v1.1.2
func (c *CloudClient) GetVMwareDiskTypes(ctx context.Context, locationID int) ([]entities.VMwareDiskType, error)
GetVMwareDiskTypes retrieves the VMware disk types allowed for the project. locationID is optional — pass 0 to list the disk types of every location.
Deprecated: read VmwareLocation.DiskTypes from GetVmwareLocationList instead. /vmware/disk-types is not a Public API route — the catalog exists only under the AdminV2 prefix — so this call is always answered with 404.
func (*CloudClient) GetVMwareGPUModels
deprecated
added in
v1.1.2
func (c *CloudClient) GetVMwareGPUModels(ctx context.Context, locationID int) ([]entities.VMwareGPUModel, error)
GetVMwareGPUModels retrieves the VMware GPU models available to the partner. locationID is optional — pass 0 to list the models of every location.
Deprecated: use GetVmwareGPUModelList, which distinguishes an absent max_server_ram_mb / is_available from a zero one.
func (*CloudClient) GetVMwareImages
deprecated
added in
v1.1.2
func (c *CloudClient) GetVMwareImages(ctx context.Context, locationID int, gpuOnly bool) ([]entities.VMwareImage, error)
GetVMwareImages retrieves the VMware OS images available to the project. locationID is optional — pass 0 to list the images of every location. gpuOnly restricts the result to GPU-only images; false returns every image.
Deprecated: use GetVmwareImageList. The GPU filter of the endpoint has three states, and this two-state parameter cannot ask for the third ("unsupported", the images that cannot use a GPU at all).
func (*CloudClient) GetVMwareLocations
deprecated
added in
v1.1.2
func (c *CloudClient) GetVMwareLocations(ctx context.Context) ([]entities.VMwareLocation, error)
GetVMwareLocations retrieves the VMware locations connected to the partner and available to the project.
Deprecated: use GetVmwareLocationList, which returns the same endpoint's response and is the family the rest of the VMware section is built on.
func (*CloudClient) GetVMwareStorageProfiles
deprecated
added in
v1.1.2
func (c *CloudClient) GetVMwareStorageProfiles(ctx context.Context, locationID, diskTypeID int) ([]entities.VMwareStorageProfile, error)
GetVMwareStorageProfiles retrieves the active VMware storage profiles. Both filters are optional — pass 0 to skip a filter.
Deprecated: the Public API publishes no storage-profile resource — profiles are an internal join behind a location's disk types. /vmware/storage-profiles exists only under the AdminV2 prefix, so this call is always answered with 404.
func (*CloudClient) GetVmwareEdgeFirewall ¶ added in v1.1.2
func (c *CloudClient) GetVmwareEdgeFirewall(ctx context.Context, networkID int) (*entities.VmwareEdgeFirewall, error)
GetVmwareEdgeFirewall retrieves the edge firewall configuration of a VMware network. Only a routed network has an edge.
func (*CloudClient) GetVmwareEdgeNAT ¶ added in v1.1.2
func (c *CloudClient) GetVmwareEdgeNAT(ctx context.Context, networkID int) (*entities.VmwareEdgeNAT, error)
GetVmwareEdgeNAT retrieves the edge NAT configuration of a VMware network.
func (*CloudClient) GetVmwareEdgeVPN ¶ added in v1.1.2
func (c *CloudClient) GetVmwareEdgeVPN(ctx context.Context, networkID int) (*entities.VmwareEdgeVPN, error)
GetVmwareEdgeVPN retrieves the edge VPN configuration of a VMware network.
func (*CloudClient) GetVmwareGPUModelList ¶ added in v1.1.2
func (c *CloudClient) GetVmwareGPUModelList(ctx context.Context, locationID *int) ([]*entities.VmwareGPUModel, error)
GetVmwareGPUModelList returns the GPU slicing profiles, optionally filtered by location.
Pointers intentionally kept for the optional int filter.
The returned ID is NOT unique — see VmwareGPUModel.
func (*CloudClient) GetVmwareImageList ¶ added in v1.1.2
func (c *CloudClient) GetVmwareImageList(ctx context.Context, locationID *int, gpu *string) ([]*entities.VmwareImage, error)
GetVmwareImageList lists images, optionally filtered by location and GPU support.
LocationID is a pointer because 0 is an ambiguous "unset" value.
Gpu is a three-state filter — VmwareImageGPURequired ("required", GPU-only images), VmwareImageGPUUnsupported ("unsupported", images that cannot use a GPU), or nil for no filter. Any other value is rejected by the API with HTTP 400.
Both filters are omitted from the query string when unset rather than sent empty: the API answers an empty value of a declared query parameter with HTTP 500 and an empty body, so the SDK never emits one.
func (*CloudClient) GetVmwareLocationList ¶ added in v1.1.2
func (c *CloudClient) GetVmwareLocationList(ctx context.Context) ([]*entities.VmwareLocation, error)
GetVmwareLocationList returns the VMware locations catalog.
Each location carries its own disk_types (VmwareLocation.DiskTypes): the standalone /vmware/disk-types and /vmware/storage-profiles catalogs exist only under the AdminV2 prefix, so this is the only source of the disk-type names and size limits that the create/verify requests accept.
func (*CloudClient) GetVmwareNetwork ¶ added in v1.1.2
func (c *CloudClient) GetVmwareNetwork(ctx context.Context, networkID int) (*entities.VmwareNetwork, error)
GetVmwareNetwork retrieves a specific VMware network by ID.
func (*CloudClient) GetVmwareNetworkList ¶ added in v1.1.2
func (c *CloudClient) GetVmwareNetworkList(ctx context.Context, locationID *int) ([]*entities.VmwareNetwork, error)
GetVmwareNetworkList retrieves all VMware networks, optionally filtered by location.
locationID is omitted from the query string when nil rather than sent empty — an empty value of a declared query parameter makes the API answer HTTP 500.
func (*CloudClient) GetVmwareServer ¶ added in v1.1.2
func (c *CloudClient) GetVmwareServer(ctx context.Context, serverID int) (*entities.VmwareServer, error)
GetVmwareServer returns a single VMware server by its id.
func (*CloudClient) GetVmwareServerFirewall ¶ added in v1.1.2
func (c *CloudClient) GetVmwareServerFirewall(ctx context.Context, serverID int) ([]entities.VmwareServerFirewallRule, error)
GetVmwareServerFirewall returns the firewall rules of a server.
A server with no rules answers 200 with an empty set, so a 404 here means only "no such server".
The returned rules are the same type UpdateVmwareServerFirewall accepts, so they can be modified and written straight back.
func (*CloudClient) GetVmwareServerList ¶ added in v1.1.2
func (c *CloudClient) GetVmwareServerList(ctx context.Context, locationID *int) ([]*entities.VmwareServer, error)
GetVmwareServerList returns the VMware servers of the account, optionally filtered by location.
List items omit the live-only VmwareServer.VmToolsInstalled, which stays nil here; fetch a server by id to read it.
locationID is a pointer so that "no filter" is distinguishable from 0, and the parameter is omitted from the query string rather than sent empty — an empty value of a declared query parameter makes the API answer HTTP 500.
func (*CloudClient) GetVmwareServerNICs ¶ added in v1.1.2
func (c *CloudClient) GetVmwareServerNICs(ctx context.Context, serverID int) ([]*entities.VmwareNIC, error)
GetVmwareServerNICs returns the network interfaces of a server.
Renamed from GetVmwareServerNicList to the sub-resource plural form (Nic -> NIC) used elsewhere in the package.
func (*CloudClient) GetVmwareServerVolumes ¶ added in v1.1.2
func (c *CloudClient) GetVmwareServerVolumes(ctx context.Context, serverID int) ([]*entities.VmwareVolume, error)
GetVmwareServerVolumes returns the additional data volumes of a server. A server without extra volumes yields an empty slice, not an error.
Renamed from GetVmwareVolumeList to the sub-resource plural form used elsewhere in the package.
func (*CloudClient) GetVmwareSnapshot ¶ added in v1.1.2
func (c *CloudClient) GetVmwareSnapshot(ctx context.Context, serverID int) (*entities.VmwareSnapshot, error)
GetVmwareSnapshot returns the snapshot of a server (a server has at most one).
A server with no snapshot answers HTTP 200 with the body {} — the API sets the snapshot field to null and its NullValueHandling.Ignore drops it — so the empty answer is turned into ErrNotFound here. HTTP 404 means the server itself does not exist, so IsNotFound(err) does not tell "no snapshot" from "no server"; errors.Is(err, ErrNotFound) is the "no snapshot" signal.
func (*CloudClient) GetVmwareTask ¶ added in v1.1.2
func (c *CloudClient) GetVmwareTask(ctx context.Context, taskID string) (*entities.VmwareTask, error)
GetVmwareTask returns the status of a VMware task by its id (a string of the form "vmw{N}").
A base task id is rejected before the request is sent. Its body would decode into entities.VmwareTask — the unified task model is the same for every service — but VmwareTask.ServerID and NetworkID read a resource id as a decimal integer, which is how VMware and only VMware addresses a resource: a vStack task's encoded ids would come back as "not present". Use GetTask for base task ids; it decodes any family.
func (*CloudClient) GetVmwareVolume ¶ added in v1.1.2
func (c *CloudClient) GetVmwareVolume(ctx context.Context, serverID, volumeID int) (*entities.VmwareVolume, error)
GetVmwareVolume returns a single data volume of a server by its id.
func (*CloudClient) PatchServer ¶
func (c *CloudClient) PatchServer(ctx context.Context, serverID string, req *entities.PatchServerRequest) (*TaskID, error)
PatchServer updates server resources (PATCH - CPU or RAM or both) and returns a task ID
func (*CloudClient) PatchServerAndWait ¶
func (c *CloudClient) PatchServerAndWait(ctx context.Context, serverID string, req *entities.PatchServerRequest) (*entities.Server, error)
PatchServerAndWait patches server and waits for it to become Active
func (*CloudClient) PowerOffServer ¶
PowerOffServer shuts down a server via operating system (graceful shutdown) and returns a task ID
func (*CloudClient) PowerOffServerAndWait ¶
func (c *CloudClient) PowerOffServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
PowerOffServerAndWait powers off server and waits for it to become Active
func (*CloudClient) PowerOffVmwareServer ¶ added in v1.1.2
func (c *CloudClient) PowerOffVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
PowerOffVmwareServer hard-powers off a server and returns the background task to await.
func (*CloudClient) PowerOffVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) PowerOffVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
PowerOffVmwareServerAndWait hard-powers off a server, waits for the task and returns the refreshed server.
func (*CloudClient) PowerOnServer ¶
PowerOnServer turns on the server power and returns a task ID
func (*CloudClient) PowerOnServerAndWait ¶
func (c *CloudClient) PowerOnServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
PowerOnServerAndWait powers on server and waits for it to become Active
func (*CloudClient) PowerOnVmwareServer ¶ added in v1.1.2
func (c *CloudClient) PowerOnVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
PowerOnVmwareServer powers on a server and returns the background task to await.
func (*CloudClient) PowerOnVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) PowerOnVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
PowerOnVmwareServerAndWait powers on a server, waits for the task and returns the refreshed server.
func (*CloudClient) RebootServer ¶
RebootServer soft reboots a server (via OS) and returns a task ID
func (*CloudClient) RebootServerAndWait ¶
func (c *CloudClient) RebootServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
RebootServerAndWait reboots server and waits for it to become Active
func (*CloudClient) RebootVmwareServer ¶ added in v1.1.2
func (c *CloudClient) RebootVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
RebootVmwareServer gracefully reboots the guest OS and returns the background task to await. It requires VMware Tools in the guest.
func (*CloudClient) RebootVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) RebootVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
RebootVmwareServerAndWait gracefully reboots the guest OS, waits for the task and returns the refreshed server.
func (*CloudClient) RebuildVmwareServer ¶ added in v1.1.2
func (c *CloudClient) RebuildVmwareServer(ctx context.Context, serverID int, req *entities.VmwareRebuildServerRequest) (*entities.VmwareServerOrder, error)
RebuildVmwareServer rebuilds a server from an image. A NEW server is created, so the returned order carries the new server_id and the original one is scheduled for deletion.
func (*CloudClient) RebuildVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) RebuildVmwareServerAndWait(ctx context.Context, serverID int, req *entities.VmwareRebuildServerRequest) (*entities.VmwareServer, error)
RebuildVmwareServerAndWait rebuilds a server, waits for the task and returns the NEW server.
This is the longest and least predictable operation in the section. Two rebuilds of the same server from the same image, in one run, took 4m40s and 24m30s; earlier measurements gave >12m, ~20m and ~26m. So it fits inside VmwareTaskWaitDefaultTimeout, but ~26m leaves little headroom — pass a larger WithPollingTimeout when calling it.
Prefer the two-step form (RebuildVmwareServer, then WaitVmwareTaskWithTimeout) when a lost server would matter: the replacement is created as soon as the POST returns, so if the wait times out here the new server exists but its id is not returned. It is named in the error message, and RebuildVmwareServer hands it back directly.
The replaced server outlives the task: it has been observed still readable in state "deleting" minutes after the task reported completed. Follow up with WaitVmwareServerGone on the original id if that matters.
func (*CloudClient) RenameServer ¶
func (c *CloudClient) RenameServer(ctx context.Context, serverID string, req *entities.RenameServerRequest) (*TaskID, error)
RenameServer changes the server name and returns a task ID
func (*CloudClient) RenameServerAndWait ¶
func (c *CloudClient) RenameServerAndWait(ctx context.Context, serverID string, req *entities.RenameServerRequest) (*entities.Server, error)
RenameServerAndWait renames server and waits for it to become Active
func (*CloudClient) RenameVmwareServer ¶ added in v1.1.2
func (c *CloudClient) RenameVmwareServer(ctx context.Context, serverID int, req *entities.VmwareRenameServerRequest) error
RenameVmwareServer changes the display name of a server. The operation is synchronous — the backend answers 200 with an empty body and starts no task, so there is nothing to await and no ...AndWait variant.
Takes *entities.VmwareRenameServerRequest instead of a bare string, in line with the base RenameServer, so a future second field is not a breaking change.
func (*CloudClient) ResetServer ¶
ResetServer hard reboots a server (power cycle) and returns a task ID
func (*CloudClient) ResetServerAndWait ¶
func (c *CloudClient) ResetServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
ResetServerAndWait resets server and waits for it to become Active
func (*CloudClient) ResetVmwareServer ¶ added in v1.1.2
func (c *CloudClient) ResetVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
ResetVmwareServer hard-resets a server and returns the background task to await.
func (*CloudClient) ResetVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) ResetVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
ResetVmwareServerAndWait hard-resets a server, waits for the task and returns the refreshed server.
func (*CloudClient) RestartGateway ¶
RestartGateway restarts the gateway and returns a task ID
func (*CloudClient) RestartGatewayAndWait ¶
func (c *CloudClient) RestartGatewayAndWait(ctx context.Context, gatewayID string) (*entities.Gateway, error)
RestartGatewayAndWait restarts gateway and waits for completion
func (*CloudClient) RestoreVmwareSnapshot ¶ added in v1.1.2
func (c *CloudClient) RestoreVmwareSnapshot(ctx context.Context, serverID int) (*VmwareTaskID, error)
RestoreVmwareSnapshot restores a server to its snapshot and returns the background task to await.
func (*CloudClient) RestoreVmwareSnapshotAndWait ¶ added in v1.1.2
func (c *CloudClient) RestoreVmwareSnapshotAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
RestoreVmwareSnapshotAndWait restores the snapshot, waits for the task and returns the refreshed server.
func (*CloudClient) RollbackServerSnapshot ¶
func (c *CloudClient) RollbackServerSnapshot(ctx context.Context, serverID string, snapshotID int) (*TaskID, error)
RollbackServerSnapshot rolls back server to a snapshot and returns a task ID
func (*CloudClient) RollbackServerSnapshotAndWait ¶
func (c *CloudClient) RollbackServerSnapshotAndWait(ctx context.Context, serverID string, snapshotID int) (*entities.Server, error)
RollbackServerSnapshotAndWait rolls back server to a snapshot and waits for completion
func (*CloudClient) ShutdownServer ¶
ShutdownServer shuts down a server via power off (hard shutdown) and returns a task ID
func (*CloudClient) ShutdownServerAndWait ¶
func (c *CloudClient) ShutdownServerAndWait(ctx context.Context, serverID string) (*entities.Server, error)
ShutdownServerAndWait shuts down server and waits for it to become Active
func (*CloudClient) ShutdownVmwareServer ¶ added in v1.1.2
func (c *CloudClient) ShutdownVmwareServer(ctx context.Context, serverID int) (*VmwareTaskID, error)
ShutdownVmwareServer gracefully shuts down the guest OS and returns the background task to await. It requires VMware Tools in the guest (VmwareServer.VmToolsInstalled).
func (*CloudClient) ShutdownVmwareServerAndWait ¶ added in v1.1.2
func (c *CloudClient) ShutdownVmwareServerAndWait(ctx context.Context, serverID int) (*entities.VmwareServer, error)
ShutdownVmwareServerAndWait gracefully shuts down the guest OS, waits for the task and returns the refreshed server.
func (*CloudClient) StartGateway ¶
StartGateway starts the gateway and returns a task ID
func (*CloudClient) StartGatewayAndWait ¶
func (c *CloudClient) StartGatewayAndWait(ctx context.Context, gatewayID string) (*entities.Gateway, error)
StartGatewayAndWait starts gateway and waits for completion
func (*CloudClient) StopGateway ¶
StopGateway stops the gateway and returns a task ID
func (*CloudClient) StopGatewayAndWait ¶
func (c *CloudClient) StopGatewayAndWait(ctx context.Context, gatewayID string) (*entities.Gateway, error)
StopGatewayAndWait stops gateway and waits for completion
func (*CloudClient) UpdateDomainRecord ¶
func (c *CloudClient) UpdateDomainRecord(ctx context.Context, domainName string, recordID int, req *entities.UpdateRecordRequest) (*TaskID, error)
UpdateDomainRecord updates an existing DNS record and returns a task ID.
As with creation, a full SRV name is normalized to its base name (the server adds the `_service._proto.` prefix on PUT as well).
func (*CloudClient) UpdateDomainRecordAndWait ¶
func (c *CloudClient) UpdateDomainRecordAndWait(ctx context.Context, domainName string, recordID int, req *entities.UpdateRecordRequest) (*entities.DNSRecord, error)
UpdateDomainRecordAndWait updates a DNS record and waits for completion
func (*CloudClient) UpdateFirewallRules ¶
func (c *CloudClient) UpdateFirewallRules(ctx context.Context, gatewayID string, req *entities.UpdateFirewallRulesRequest) (*TaskID, error)
UpdateFirewallRules updates firewall rules for a gateway and returns a task ID
func (*CloudClient) UpdateFirewallRulesAndWait ¶
func (c *CloudClient) UpdateFirewallRulesAndWait(ctx context.Context, gatewayID string, req *entities.UpdateFirewallRulesRequest) error
UpdateFirewallRulesAndWait updates firewall rules and waits for completion
func (*CloudClient) UpdateGateway ¶
func (c *CloudClient) UpdateGateway(ctx context.Context, gatewayID string, req *entities.UpdateGatewayRequest) (*entities.Gateway, error)
UpdateGateway updates gateway name
func (*CloudClient) UpdateGatewayBandwidth ¶
func (c *CloudClient) UpdateGatewayBandwidth(ctx context.Context, gatewayID string, req *entities.UpdateGatewayBandwidthRequest) (*TaskID, error)
UpdateGatewayBandwidth updates gateway bandwidth and returns a task ID
func (*CloudClient) UpdateGatewayBandwidthAndWait ¶
func (c *CloudClient) UpdateGatewayBandwidthAndWait(ctx context.Context, gatewayID string, req *entities.UpdateGatewayBandwidthRequest) (*entities.Gateway, error)
UpdateGatewayBandwidthAndWait updates gateway bandwidth and waits for completion
func (*CloudClient) UpdateNATRules ¶
func (c *CloudClient) UpdateNATRules(ctx context.Context, gatewayID string, req *entities.UpdateNATRulesRequest) (*TaskID, error)
UpdateNATRules updates NAT rules for a gateway and returns a task ID
func (*CloudClient) UpdateNATRulesAndWait ¶
func (c *CloudClient) UpdateNATRulesAndWait(ctx context.Context, gatewayID string, req *entities.UpdateNATRulesRequest) error
UpdateNATRulesAndWait updates NAT rules and waits for completion
func (*CloudClient) UpdateNetwork ¶
func (c *CloudClient) UpdateNetwork(ctx context.Context, networkID string, req *entities.UpdateNetworkRequest) (*entities.Network, error)
UpdateNetwork updates the name and description of a network
func (*CloudClient) UpdateServer ¶
func (c *CloudClient) UpdateServer(ctx context.Context, serverID string, req *entities.UpdateServerRequest) (*TaskID, error)
UpdateServer updates server resources (PUT - both CPU and RAM required) and returns a task ID
func (*CloudClient) UpdateServerAndWait ¶
func (c *CloudClient) UpdateServerAndWait(ctx context.Context, serverID string, req *entities.UpdateServerRequest) (*entities.Server, error)
UpdateServerAndWait updates server and waits for it to become Active
func (*CloudClient) UpdateServerNIC ¶
func (c *CloudClient) UpdateServerNIC(ctx context.Context, serverID string, nicID int, req *entities.UpdateNICRequest) (*TaskID, error)
UpdateServerNIC updates a network interface bandwidth and returns a task ID
func (*CloudClient) UpdateServerNICAndWait ¶
func (c *CloudClient) UpdateServerNICAndWait(ctx context.Context, serverID string, nicID int, req *entities.UpdateNICRequest) (*entities.NIC, error)
UpdateServerNICAndWait updates a network interface and waits for completion
func (*CloudClient) UpdateServerVolume ¶
func (c *CloudClient) UpdateServerVolume(ctx context.Context, serverID string, volumeID int, req *entities.UpdateVolumeRequest) (*TaskID, error)
UpdateServerVolume updates a volume and returns a task ID
func (*CloudClient) UpdateServerVolumeAndWait ¶
func (c *CloudClient) UpdateServerVolumeAndWait(ctx context.Context, serverID string, volumeID int, req *entities.UpdateVolumeRequest) (*entities.Volume, error)
UpdateServerVolumeAndWait updates a volume and waits for server to become Active
func (*CloudClient) UpdateVmwareEdgeBandwidth ¶ added in v1.2.0
func (c *CloudClient) UpdateVmwareEdgeBandwidth(ctx context.Context, networkID int, req *entities.VmwareUpdateEdgeBandwidthRequest) (*VmwareTaskID, error)
UpdateVmwareEdgeBandwidth sets the uplink bandwidth (QoS) of a routed network's edge gateway and returns the background task to await.
Edge bandwidth and network bandwidth are one field, so EditVmwareNetwork sets the same value and VmwareNetwork.BandwidthMbps reads it back — this endpoint has no read of its own.
The endpoint applies the value only on a platform deployment that carries the fix for it; an older one completes the task and keeps the previous bandwidth. Use EditVmwareNetwork there.
func (*CloudClient) UpdateVmwareEdgeBandwidthAndWait ¶ added in v1.2.0
func (c *CloudClient) UpdateVmwareEdgeBandwidthAndWait(ctx context.Context, networkID int, req *entities.VmwareUpdateEdgeBandwidthRequest) (*entities.VmwareNetwork, error)
UpdateVmwareEdgeBandwidthAndWait sets the edge bandwidth, waits for the task and returns the refreshed network, whose BandwidthMbps carries the applied value.
func (*CloudClient) UpdateVmwareEdgeFirewall ¶ added in v1.1.2
func (c *CloudClient) UpdateVmwareEdgeFirewall(ctx context.Context, networkID int, req *entities.VmwareUpdateEdgeFirewallRequest) (*VmwareTaskID, error)
UpdateVmwareEdgeFirewall atomically replaces the edge firewall rule set.
Omitting Enabled or DefaultAction now leaves the current value alone, so a read-modify-write no longer risks switching the firewall off. Rules keeps set semantics — resend the rules you want to keep.
func (*CloudClient) UpdateVmwareEdgeFirewallAndWait ¶ added in v1.1.2
func (c *CloudClient) UpdateVmwareEdgeFirewallAndWait(ctx context.Context, networkID int, req *entities.VmwareUpdateEdgeFirewallRequest) (*entities.VmwareEdgeFirewall, error)
UpdateVmwareEdgeFirewallAndWait replaces the edge firewall rule set, waits for the task and returns the resulting configuration.
func (*CloudClient) UpdateVmwareNIC ¶ added in v1.1.2
func (c *CloudClient) UpdateVmwareNIC(ctx context.Context, serverID, nicID int, req *entities.VmwareUpdateNICRequest) (*VmwareTaskID, error)
UpdateVmwareNIC updates a network interface of a server and returns the background task to await.
req.NetworkID is mandatory — the update replaces the NIC's placement, so pass the NIC's current network to keep it there. req.BandwidthMbps only applies to a NIC on a shared/public network and req.IP only to a network with DHCP disabled; see entities.VmwareUpdateNICRequest for what the API rejects.
func (*CloudClient) UpdateVmwareNICAndWait ¶ added in v1.1.2
func (c *CloudClient) UpdateVmwareNICAndWait(ctx context.Context, serverID, nicID int, req *entities.VmwareUpdateNICRequest) ([]*entities.VmwareNIC, error)
UpdateVmwareNICAndWait updates a NIC, waits for the task and returns the server's NICs.
func (*CloudClient) UpdateVmwareServerFirewall ¶ added in v1.1.2
func (c *CloudClient) UpdateVmwareServerFirewall(ctx context.Context, serverID int, req *entities.VmwareUpdateServerFirewallRequest) (*VmwareTaskID, error)
UpdateVmwareServerFirewall atomically replaces the whole server firewall rule set (set semantics).
A non-empty rule set works — each rule must carry name, traffic_direction, action and protocol (enforced by Validate). An empty rule set clears the firewall.
A (nil, nil) result means the API answered without starting a task, so there is nothing to await — it is not an error. Both shapes are handled: a no-task answer is reported as a nil *VmwareTaskID rather than a &VmwareTaskID{ID: ""} that would break a wait.
func (*CloudClient) UpdateVmwareServerFirewallAndWait ¶ added in v1.1.2
func (c *CloudClient) UpdateVmwareServerFirewallAndWait(ctx context.Context, serverID int, req *entities.VmwareUpdateServerFirewallRequest) ([]entities.VmwareServerFirewallRule, error)
UpdateVmwareServerFirewallAndWait replaces the firewall rule set, waits for the task (if any) and returns the resulting rules.
func (*CloudClient) UpsertVmwareEdgeNATRule ¶ added in v1.1.2
func (c *CloudClient) UpsertVmwareEdgeNATRule(ctx context.Context, networkID int, req *entities.VmwareUpsertNATRuleRequest) (*VmwareTaskID, error)
UpsertVmwareEdgeNATRule creates or updates a NAT rule — update when req.RuleID is set, create otherwise.
func (*CloudClient) UpsertVmwareEdgeNATRuleAndWait ¶ added in v1.1.2
func (c *CloudClient) UpsertVmwareEdgeNATRuleAndWait(ctx context.Context, networkID int, req *entities.VmwareUpsertNATRuleRequest) (*entities.VmwareEdgeNAT, error)
UpsertVmwareEdgeNATRuleAndWait upserts a NAT rule, waits for the task and returns the resulting NAT configuration.
func (*CloudClient) UpsertVmwareEdgeVPNTunnel ¶ added in v1.1.2
func (c *CloudClient) UpsertVmwareEdgeVPNTunnel(ctx context.Context, networkID int, req *entities.VmwareUpsertVPNTunnelRequest) (*VmwareTaskID, error)
UpsertVmwareEdgeVPNTunnel creates or updates a VPN tunnel — update when req.TunnelID is set, create otherwise.
MTU, DiffieHellmanGroup and EncryptionType are mandatory despite their optional-looking tags; Validate enforces them, along with the pre-shared key rules, before the request is sent.
func (*CloudClient) UpsertVmwareEdgeVPNTunnelAndWait ¶ added in v1.1.2
func (c *CloudClient) UpsertVmwareEdgeVPNTunnelAndWait(ctx context.Context, networkID int, req *entities.VmwareUpsertVPNTunnelRequest) (*entities.VmwareEdgeVPN, error)
UpsertVmwareEdgeVPNTunnelAndWait upserts a VPN tunnel, waits for the task and returns the resulting VPN configuration.
func (*CloudClient) VerifyVmwareServer ¶ added in v1.1.2
func (c *CloudClient) VerifyVmwareServer(ctx context.Context, req *entities.VmwareCreateServerRequest) error
VerifyVmwareServer performs a dry-run validation of a server order without creating it (the backend answers 200 with an empty body on success).
func (*CloudClient) WaitGatewayActive ¶ added in v1.1.0
func (c *CloudClient) WaitGatewayActive(ctx context.Context, gatewayID string) (*entities.Gateway, error)
WaitGatewayActive waits for a gateway to transition to Active state.
A gateway stays Busy for a while after the task of an operation has already completed, and a change issued in that window is either rejected outright (-19803, "a conflict occurred during the competitive change of the object") or accepted and then fails as a task. Waiting for Active is therefore part of completing a gateway operation, not an optional extra — every *AndWait method in gateway.go does it.
func (*CloudClient) WaitGatewayActiveWithTimeout ¶ added in v1.1.0
func (c *CloudClient) WaitGatewayActiveWithTimeout(ctx context.Context, gatewayID string, timeout time.Duration) (*entities.Gateway, error)
WaitGatewayActiveWithTimeout waits for a gateway to become Active with custom timeout
func (*CloudClient) WaitGatewayTaskCompletion ¶ added in v1.1.0
func (c *CloudClient) WaitGatewayTaskCompletion(ctx context.Context, gatewayID string, taskID string) (*entities.Gateway, error)
WaitGatewayTaskCompletion waits for task completion and then for the gateway to become Active again, so that the next change to the same gateway is not rejected as a competitive change.
func (*CloudClient) WaitServerActive ¶
func (c *CloudClient) WaitServerActive(ctx context.Context, serverID string) (*entities.Server, error)
WaitServerActive waits for a server to transition to Active state
func (*CloudClient) WaitServerActiveWithTimeout ¶
func (c *CloudClient) WaitServerActiveWithTimeout(ctx context.Context, serverID string, timeout time.Duration) (*entities.Server, error)
WaitServerActiveWithTimeout waits for a server to become Active with custom timeout
func (*CloudClient) WaitServerTaskCompletion ¶
func (c *CloudClient) WaitServerTaskCompletion(ctx context.Context, serverID string, taskID string) (*entities.Server, error)
WaitServerTaskCompletion waits for task completion and then for server to become Active.
TaskID must be a base task ID: a VMware task ID ("vmw{N}") is rejected, because VMware tasks need the VMware timeouts — wait for those with WaitVmwareTask. Note also that serverID is a base string server ID — VMware servers are keyed by int.
func (*CloudClient) WaitVmwareNetworkActive ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareNetworkActive(ctx context.Context, networkID int) (*entities.VmwareNetwork, error)
WaitVmwareNetworkActive polls a network until it reports VmwareNetworkStateActive.
func (*CloudClient) WaitVmwareNetworkGone ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareNetworkGone(ctx context.Context, networkID int) error
WaitVmwareNetworkGone polls a network until it no longer exists.
func (*CloudClient) WaitVmwareNetworkState ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareNetworkState(ctx context.Context, networkID int, wantStates ...string) (*entities.VmwareNetwork, error)
WaitVmwareNetworkState polls a network until its state is one of wantStates and returns it.
There is no published enum for VmwareNetwork.State; the observed values are collected as VmwareNetworkState* constants.
func (*CloudClient) WaitVmwareServerActive ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareServerActive(ctx context.Context, serverID int) (*entities.VmwareServer, error)
WaitVmwareServerActive polls a server until it reports VmwareServerStateActive.
func (*CloudClient) WaitVmwareServerGone ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareServerGone(ctx context.Context, serverID int) error
WaitVmwareServerGone polls a server until it no longer exists, and returns immediately if it is already gone.
A completed task is not a reliable "the object is gone" signal. After a rebuild the replaced server has been observed sitting in state "deleting" for minutes past the completion of its task; a plain delete usually has it gone by then. Since the difference is not something a caller can predict, waiting on the object rather than on the task makes the outcome unconditional — at the cost of one extra GET when there was nothing to wait for.
func (*CloudClient) WaitVmwareServerState ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareServerState(ctx context.Context, serverID int, wantStates ...string) (*entities.VmwareServer, error)
WaitVmwareServerState polls a server until its state is one of wantStates and returns it.
A completed task is not the same as a settled resource: after a rebuild the task reports completed while the replaced server is still "deleting", and the server only reaches its final state minutes later. Terraform-style callers that need the resource itself to be ready should wait on the state, not just on the task.
The wait fails fast if the server enters VmwareServerStateError, and it fails if the server disappears (use WaitVmwareServerGone to wait for deletion).
func (*CloudClient) WaitVmwareTask ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareTask(ctx context.Context, taskID string) (*entities.VmwareTask, error)
WaitVmwareTask polls a VMware task until it reaches a terminal state.
The wait is at least VmwareTaskWaitDefaultTimeout; a larger WithPollingTimeout wins, a smaller one is ignored (use WaitVmwareTaskWithTimeout to wait for less).
A base task id is rejected — see GetVmwareTask.
func (*CloudClient) WaitVmwareTaskRef ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareTaskRef(ctx context.Context, task *VmwareTaskID) (*entities.VmwareTask, error)
WaitVmwareTaskRef waits for the task a VMware mutator returned and reports the completed task. A nil or empty reference means the API answered synchronously and there is nothing to await, in which case it returns (nil, nil).
This is the building block behind every VMware "...AndWait" method; it is exported so callers that keep the raw task reference can await it without re-implementing the nil / no-op check.
func (*CloudClient) WaitVmwareTaskWithTimeout ¶ added in v1.1.2
func (c *CloudClient) WaitVmwareTaskWithTimeout(ctx context.Context, taskID string, timeout time.Duration) (*entities.VmwareTask, error)
WaitVmwareTaskWithTimeout polls a VMware task until it reaches a terminal state within the given timeout. It returns an error if the task finishes in a failed or canceled state.
Note that a completed task does NOT guarantee the affected resource has settled: on rebuild the task reports completed while the replaced server is still "deleting". Follow up with WaitVmwareServerState / WaitVmwareServerGone (or the ...AndWait method) when the resource state matters.
A base task id is rejected — see GetVmwareTask.
type Config ¶
type Config struct {
APIKey string
BaseURL string
Timeout time.Duration
PollingInterval time.Duration
// PollingTimeout is the maximum time an "...AndWait" / Wait* call spends polling
// a single task before giving up.
//
// VMware operations run far longer than this 2m default — server create
// and copy take ~4 min, rebuild up to ~26 min — so VMware task waiting does NOT
// use this value as-is: WaitVmwareTask raises it to VmwareTaskWaitDefaultTimeout
// when it is smaller. Setting PollingTimeout above that floor still wins, which is
// worth doing for rebuild; setting it below has no effect on VMware waits (use
// WaitVmwareTaskWithTimeout to wait for less). Base resources use this value
// directly.
PollingTimeout time.Duration
UserAgent string
HTTPClient *http.Client
Logger Logger
LogLevel LogLevel
Context context.Context
// Retry settings
MaxRetries int
RetryWaitMin time.Duration
RetryWaitMax time.Duration
RetryableStatus []int // HTTP status codes for retry
RetryableCodes []int // API error codes for retry
}
Config holds the configuration for the CloudClient
func (*Config) IsRetryableCode ¶
IsRetryableCode checks if the given API error code should trigger a retry
type ErrorParam ¶ added in v1.1.2
ErrorParam is a single name/value pair from an API error's error_params block. The backend uses it to point at the specific field or list element that failed (for example {"name":"Index","value":0} or {"name":"server_ids","value":"999999"}). Value is decoded as-is from JSON, so it may be a string, number, bool or nil.
type GetAffinityGroupResponse ¶
type GetAffinityGroupResponse struct {
AffinityGroup *entities.AffinityGroup `json:"affinity_group,omitempty"`
}
Response types
type GetDomainResponse ¶
GetDomainResponse represents a single domain response
type GetFirewallRulesResponse ¶
type GetFirewallRulesResponse struct {
FirewallRules []entities.FirewallRule `json:"firewall_rules,omitempty"`
}
Response types
type GetGatewayResponse ¶
Response types
type GetNATRulesResponse ¶
Response types
type GetNICResponse ¶
GetNICResponse represents a single NIC response
type GetNetworkResponse ¶
Response types
type GetProjectResponse ¶
GetProjectResponse represents project response
type GetRecordResponse ¶
GetRecordResponse represents a single record response
type GetSSHKeyResponse ¶
Response types
type GetServerResponse ¶
Response types
type GetSnapshotResponse ¶
GetSnapshotResponse represents a single snapshot response
type GetVolumeResponse ¶
GetVolumeResponse represents a single volume response
type LeveledLogger ¶
type LeveledLogger struct {
// contains filtered or unexported fields
}
LeveledLogger - wrapper over Logger with level support
func NewLeveledLogger ¶
func NewLeveledLogger(logger Logger, minLevel LogLevel) *LeveledLogger
NewLeveledLogger creates a new logger with level filtering
func (*LeveledLogger) Debug ¶
func (l *LeveledLogger) Debug(format string, v ...any)
Debug logs a Debug level message
func (*LeveledLogger) Error ¶
func (l *LeveledLogger) Error(format string, v ...any)
Error logs an Error level message
func (*LeveledLogger) Info ¶
func (l *LeveledLogger) Info(format string, v ...any)
Info logs an Info level message
func (*LeveledLogger) Warn ¶
func (l *LeveledLogger) Warn(format string, v ...any)
Warn logs a warning level message
type ListAffinityGroupsResponse ¶
type ListAffinityGroupsResponse struct {
AffinityGroups []*entities.AffinityGroup `json:"affinity_groups,omitempty"`
}
Response types
type ListApplicationsResponse ¶
type ListApplicationsResponse struct {
Applications []entities.Application `json:"applications,omitempty"`
}
ListApplicationsResponse represents applications list response
type ListDomainsResponse ¶
ListDomainsResponse represents a list of domains response
type ListGatewaysResponse ¶
Response types
type ListImagesResponse ¶
ListImagesResponse represents images list response
type ListLocationsResponse ¶
ListLocationsResponse represents locations list response
type ListNICsResponse ¶
ListNICsResponse represents a list of NICs response
type ListNetworksResponse ¶
type ListNetworksResponse struct {
Networks []*entities.Network `json:"isolated_networks,omitempty"`
}
Response types
type ListRecordsResponse ¶
ListRecordsResponse represents a list of records response
type ListSSHKeysResponse ¶
Response types
type ListServersResponse ¶
Response types
type ListSnapshotsResponse ¶
ListSnapshotsResponse represents a list of snapshots response
type ListVMwareDiskTypesResponse
deprecated
added in
v1.1.2
type ListVMwareDiskTypesResponse struct {
DiskTypes []entities.VMwareDiskType `json:"disk_types,omitempty"`
}
ListVMwareDiskTypesResponse represents a VMware disk types list response
Deprecated: the response of GetVMwareDiskTypes, which the Public API does not serve. Disk types arrive inside VmwareLocation.DiskTypes.
type ListVMwareGPUModelsResponse
deprecated
added in
v1.1.2
type ListVMwareGPUModelsResponse struct {
GPUModels []entities.VMwareGPUModel `json:"gpu_models,omitempty"`
}
ListVMwareGPUModelsResponse represents a VMware GPU models list response
Deprecated: GetVmwareGPUModelList supersedes GetVMwareGPUModels.
type ListVMwareImagesResponse
deprecated
added in
v1.1.2
type ListVMwareImagesResponse struct {
Images []entities.VMwareImage `json:"images,omitempty"`
}
ListVMwareImagesResponse represents a VMware images list response
Deprecated: GetVmwareImageList supersedes GetVMwareImages.
type ListVMwareLocationsResponse
deprecated
added in
v1.1.2
type ListVMwareLocationsResponse struct {
Locations []entities.VMwareLocation `json:"locations,omitempty"`
}
ListVMwareLocationsResponse represents a VMware locations list response
Deprecated: GetVmwareLocationList supersedes GetVMwareLocations.
type ListVMwareStorageProfilesResponse
deprecated
added in
v1.1.2
type ListVMwareStorageProfilesResponse struct {
StorageProfiles []entities.VMwareStorageProfile `json:"storage_profiles,omitempty"`
}
ListVMwareStorageProfilesResponse represents a VMware storage profiles list response
Deprecated: the response of GetVMwareStorageProfiles, which the Public API does not serve.
type ListVolumesResponse ¶
ListVolumesResponse represents a list of volumes response
type Option ¶
type Option func(*Config)
Option is a functional option for configuring Config
func WithContext ¶
WithContext sets a context for the config
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client
func WithLogLevel ¶
WithLogLevel sets the minimum log level
func WithMaxRetries ¶
WithMaxRetries sets the maximum number of retry attempts
func WithPollingInterval ¶
WithPollingInterval sets a custom polling interval
func WithPollingTimeout ¶
WithPollingTimeout sets a maximum time for polling operations.
For VMware tasks this raises the wait but cannot lower it: WaitVmwareTask never waits less than VmwareTaskWaitDefaultTimeout. Raising it above that floor is worth doing for rebuild, whose duration varies widely. See Config.PollingTimeout.
func WithRetryWaitMinMax ¶
WithRetryWaitMinMax sets the minimum and maximum wait time between retries
func WithRetryableCodes ¶
WithRetryableCodes sets custom API error codes that trigger retry
func WithRetryableStatus ¶
WithRetryableStatus sets custom HTTP status codes that trigger retry
func WithUserAgent ¶
WithUserAgent sets a custom User-Agent
type RequestError ¶
type RequestError struct {
Status string
StatusCode int
Message string
Body []byte
// Codes — API error codes from the response body ({"errors":[{"code":...}]}).
Codes []int
// ErrorParams — the parsed error_params of every error in the response
// body, flattened across all entries, in the order the API returned them. For
// batch operations (for example ConnectVmwareServers with several NICs) this is
// the only way to tell which element failed. Empty when the API sends none.
ErrorParams []ErrorParam
Err error
}
RequestError represents an HTTP request error with detailed information
func (*RequestError) Error ¶
func (e *RequestError) Error() string
Error implements the error interface
func (*RequestError) HasCode ¶
func (e *RequestError) HasCode(code int) bool
HasCode reports whether the API returned the given error code.
func (*RequestError) Unwrap ¶
func (e *RequestError) Unwrap() error
Unwrap returns the underlying error
type RetryDecision ¶
type RetryDecision struct {
ShouldRetry bool
Reason RetryReason
Details string
}
RetryDecision contains the decision about retry and its reason
type RetryPolicy ¶
type RetryPolicy func(resp *http.Response, err error) RetryDecision
RetryPolicy determines whether a request should be retried
type RetryReason ¶
type RetryReason int
RetryReason describes the reason for retrying a request
const ( NoRetry RetryReason = iota RetryNetworkError RetryHTTPStatus RetryAPIErrorCode )
func (RetryReason) String ¶
func (r RetryReason) String() string
String returns a human-readable name for the retry reason.
type TaskID ¶
type TaskID struct {
ID string `json:"task_id,omitempty"`
}
TaskID wraps a task ID from API responses
type ValidationError ¶
type ValidationError struct {
Message string
}
ValidationError reports a request that failed the SDK's own checks and was therefore never sent. Errors originating from the API are *RequestError instead.
func NewValidationError ¶
func NewValidationError(message string) *ValidationError
NewValidationError builds a ValidationError with the given message.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
type VmwareTaskID ¶ added in v1.1.2
type VmwareTaskID struct {
ID string `json:"task_id,omitempty"`
}
VmwareTaskID references a VMware background task.
This is deliberately a distinct type from TaskID even though both decode the same {"task_id": …} body. The two families differ in how they are awaited and in how their resource ids are shaped, so passing one family's reference to the other family's helper is a bug; keeping the types apart makes it a compile error at every call site that hands a task reference around.
func (*VmwareTaskID) IsZero ¶ added in v1.1.2
func (t *VmwareTaskID) IsZero() bool
IsZero reports whether the reference carries no task. VMware endpoints answer some no-op mutations synchronously, without starting a task; the SDK reports that as a nil *VmwareTaskID, and this helper makes the check safe on a nil receiver.
func (*VmwareTaskID) String ¶ added in v1.1.2
func (t *VmwareTaskID) String() string
String returns the raw task id, so a VmwareTaskID can be logged or formatted directly.