This documents the rest api dedicatedserver provides.
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: v2
- Package version: 1.0.0
- Generator version: 7.10.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import dedicatedserver "github.com/leaseweb/leaseweb-go-sdk/dedicatedserver"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value dedicatedserver.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), dedicatedserver.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value dedicatedserver.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), dedicatedserver.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using dedicatedserver.ContextOperationServerIndices
and dedicatedserver.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), dedicatedserver.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), dedicatedserver.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
All URIs are relative to https://api.leaseweb.com/bareMetals/v2
Class | Method | HTTP request | Description |
---|---|---|---|
DedicatedserverAPI | AddServerToPrivateNetwork | Put /servers/{serverId}/privateNetworks/{privateNetworkId} | Add a server to private network |
DedicatedserverAPI | CancelActiveJob | Post /servers/{serverId}/cancelActiveJob | Cancel active job |
DedicatedserverAPI | CloseNetworkInterface | Post /servers/{serverId}/networkInterfaces/{networkTypeURL}/close | Close network interface |
DedicatedserverAPI | CloseNetworkInterfaces | Post /servers/{serverId}/networkInterfaces/close | Close all network interfaces |
DedicatedserverAPI | CreateNetworkEquipmentCredential | Post /networkEquipments/{networkEquipmentId}/credentials | Create new network equipment credentials |
DedicatedserverAPI | CreateServerBandwidthNotificationSetting | Post /servers/{serverId}/notificationSettings/bandwidth | Create a bandwidth notification setting |
DedicatedserverAPI | CreateServerCredential | Post /servers/{serverId}/credentials | Create new server credentials |
DedicatedserverAPI | CreateServerDataTrafficNotificationSetting | Post /servers/{serverId}/notificationSettings/datatraffic | Create a data traffic notification setting |
DedicatedserverAPI | CreateServerDhcpReservation | Post /servers/{serverId}/leases | Create a DHCP reservation |
DedicatedserverAPI | DeleteNetworkEquipmentCredential | Delete /networkEquipments/{networkEquipmentId}/credentials/{type}/{username} | Delete network equipment credentials |
DedicatedserverAPI | DeleteServerBandwidthNotificationSetting | Delete /servers/{serverId}/notificationSettings/bandwidth/{notificationSettingId} | Delete a bandwidth notification setting |
DedicatedserverAPI | DeleteServerCredential | Delete /servers/{serverId}/credentials/{type}/{username} | Delete server credentials |
DedicatedserverAPI | DeleteServerDataTrafficNotificationSetting | Delete /servers/{serverId}/notificationSettings/datatraffic/{notificationSettingId} | Delete a data traffic notification setting |
DedicatedserverAPI | DeleteServerDhcpReservation | Delete /servers/{serverId}/leases | Delete a DHCP reservation |
DedicatedserverAPI | DeleteServerFromPrivateNetwork | Delete /servers/{serverId}/privateNetworks/{privateNetworkId} | Delete a server from a private network |
DedicatedserverAPI | EnableServerRescueMode | Post /servers/{serverId}/rescueMode | Launch rescue mode |
DedicatedserverAPI | ExpireActiveJob | Post /servers/{serverId}/expireActiveJob | Expire active job |
DedicatedserverAPI | GetControlPanelList | Get /controlPanels | List control panels |
DedicatedserverAPI | GetControlPanelListByOperatingSystemId | Get /operatingSystems/{operatingSystemId}/controlPanels | List control panels by Operating System |
DedicatedserverAPI | GetDdosNotificationSetting | Get /servers/{serverId}/notificationSettings/ddos | Inspect DDoS notification settings |
DedicatedserverAPI | GetNetworkEquipment | Get /networkEquipments/{networkEquipmentId} | Get network equipment |
DedicatedserverAPI | GetNetworkEquipmentCredential | Get /networkEquipments/{networkEquipmentId}/credentials/{type}/{username} | Show network equipment credentials |
DedicatedserverAPI | GetNetworkEquipmentCredentialList | Get /networkEquipments/{networkEquipmentId}/credentials | List network equipment credentials |
DedicatedserverAPI | GetNetworkEquipmentCredentialListByType | Get /networkEquipments/{networkEquipmentId}/credentials/{type} | List network equipment credentials by type |
DedicatedserverAPI | GetNetworkEquipmentIp | Get /networkEquipments/{networkEquipmentId}/ips/{ip} | Show a network equipment IP |
DedicatedserverAPI | GetNetworkEquipmentIpList | Get /networkEquipments/{networkEquipmentId}/ips | List IPs |
DedicatedserverAPI | GetNetworkEquipmentList | Get /networkEquipments | List network equipment |
DedicatedserverAPI | GetNetworkEquipmentNullRouteHistory | Get /networkEquipments/{networkEquipmentId}/nullRouteHistory | Show null route history |
DedicatedserverAPI | GetNetworkEquipmentPowerStatus | Get /networkEquipments/{networkEquipmentId}/powerInfo | Show power status |
DedicatedserverAPI | GetNetworkInterface | Get /servers/{serverId}/networkInterfaces/{networkTypeURL} | Show a network interface |
DedicatedserverAPI | GetNetworkInterfaceList | Get /servers/{serverId}/networkInterfaces | List network interfaces |
DedicatedserverAPI | GetOperatingSystem | Get /operatingSystems/{operatingSystemId} | Show an operating system |
DedicatedserverAPI | GetOperatingSystemList | Get /operatingSystems | List Operating Systems |
DedicatedserverAPI | GetRescueImageList | Get /rescueImages | Rescue Images |
DedicatedserverAPI | GetServer | Get /servers/{serverId} | Get server |
DedicatedserverAPI | GetServerBandwidthMetrics | Get /servers/{serverId}/metrics/bandwidth | Show bandwidth metrics |
DedicatedserverAPI | GetServerBandwidthNotificationSetting | Get /servers/{serverId}/notificationSettings/bandwidth/{notificationSettingId} | Show a bandwidth notification setting |
DedicatedserverAPI | GetServerBandwidthNotificationSettingList | Get /servers/{serverId}/notificationSettings/bandwidth | List bandwidth notification settings |
DedicatedserverAPI | GetServerCredential | Get /servers/{serverId}/credentials/{type}/{username} | Show server credentials |
DedicatedserverAPI | GetServerCredentialList | Get /servers/{serverId}/credentials | List server credentials |
DedicatedserverAPI | GetServerCredentialListByType | Get /servers/{serverId}/credentials/{type} | List server credentials by type |
DedicatedserverAPI | GetServerDataTrafficMetrics | Get /servers/{serverId}/metrics/datatraffic | Show datatraffic metrics |
DedicatedserverAPI | GetServerDataTrafficNotificationSetting | Get /servers/{serverId}/notificationSettings/datatraffic/{notificationSettingId} | Show a data traffic notification setting |
DedicatedserverAPI | GetServerDataTrafficNotificationSettingList | Get /servers/{serverId}/notificationSettings/datatraffic | List data traffic notification settings |
DedicatedserverAPI | GetServerDhcpReservationList | Get /servers/{serverId}/leases | List DHCP reservations |
DedicatedserverAPI | GetServerHardware | Get /servers/{serverId}/hardwareInfo | Show hardware information |
DedicatedserverAPI | GetServerIp | Get /servers/{serverId}/ips/{ip} | Show a server IP |
DedicatedserverAPI | GetServerIpList | Get /servers/{serverId}/ips | List IPs |
DedicatedserverAPI | GetServerJob | Get /servers/{serverId}/jobs/{jobId} | Show a job |
DedicatedserverAPI | GetServerJobList | Get /servers/{serverId}/jobs | List jobs |
DedicatedserverAPI | GetServerList | Get /servers | List servers |
DedicatedserverAPI | GetServerNullRouteHistory | Get /servers/{serverId}/nullRouteHistory | Show null route history |
DedicatedserverAPI | GetServerPowerStatus | Get /servers/{serverId}/powerInfo | Show power status |
DedicatedserverAPI | InstallOperatingSystem | Post /servers/{serverId}/install | Launch installation |
DedicatedserverAPI | IpmiResetServer | Post /servers/{serverId}/ipmiReset | Launch IPMI reset |
DedicatedserverAPI | NullIpRoute | Post /servers/{serverId}/ips/{ip}/null | Null route an IP |
DedicatedserverAPI | NullNetworkEquipmentIpRoute | Post /networkEquipments/{networkEquipmentId}/ips/{ip}/null | Null route an IP |
DedicatedserverAPI | OpenNetworkInterface | Post /servers/{serverId}/networkInterfaces/{networkTypeURL}/open | Open network interface |
DedicatedserverAPI | OpenNetworkInterfaces | Post /servers/{serverId}/networkInterfaces/open | Open all network interfaces |
DedicatedserverAPI | PowerCycleNetworkEquipment | Post /networkEquipments/{networkEquipmentId}/powerCycle | Power cycle a network equipment |
DedicatedserverAPI | PowerCycleServer | Post /servers/{serverId}/powerCycle | Power cycle a server |
DedicatedserverAPI | PowerNetworkEquipmentOff | Post /networkEquipments/{networkEquipmentId}/powerOff | Power off network equipment |
DedicatedserverAPI | PowerNetworkEquipmentOn | Post /networkEquipments/{networkEquipmentId}/powerOn | Power on network equipment |
DedicatedserverAPI | PowerServerOff | Post /servers/{serverId}/powerOff | Power off server |
DedicatedserverAPI | PowerServerOn | Post /servers/{serverId}/powerOn | Power on server |
DedicatedserverAPI | RemoveNullIpRoute | Post /servers/{serverId}/ips/{ip}/unnull | Remove a null route |
DedicatedserverAPI | RetryServerJob | Post /servers/{serverId}/jobs/{jobId}/retry | Retry a job |
DedicatedserverAPI | ScanHardware | Post /servers/{serverId}/hardwareScan | Launch hardware scan |
DedicatedserverAPI | UnNullNetworkEquipmentIpRoute | Post /networkEquipments/{networkEquipmentId}/ips/{ip}/unnull | Remove a null route |
DedicatedserverAPI | UpdateDdosNotificationSetting | Put /servers/{serverId}/notificationSettings/ddos | Update DDoS notification settings |
DedicatedserverAPI | UpdateIpProfile | Put /servers/{serverId}/ips/{ip} | Update an IP |
DedicatedserverAPI | UpdateNetworkEquipmentCredential | Put /networkEquipments/{networkEquipmentId}/credentials/{type}/{username} | Update network equipment credentials |
DedicatedserverAPI | UpdateNetworkEquipmentIp | Put /networkEquipments/{networkEquipmentId}/ips/{ip} | Update an IP |
DedicatedserverAPI | UpdateNetworkEquipmentReference | Put /networkEquipments/{networkEquipmentId} | Update network equipment |
DedicatedserverAPI | UpdateServerBandwidthNotificationSetting | Put /servers/{serverId}/notificationSettings/bandwidth/{notificationSettingId} | Update a bandwidth notification setting |
DedicatedserverAPI | UpdateServerCredential | Put /servers/{serverId}/credentials/{type}/{username} | Update server credentials |
DedicatedserverAPI | UpdateServerDataTrafficNotificationSetting | Put /servers/{serverId}/notificationSettings/datatraffic/{notificationSettingId} | Update a data traffic notification setting |
DedicatedserverAPI | UpdateServerReference | Put /servers/{serverId} | Update server |
- Actions
- AddServerToPrivateNetworkOpts
- Attribute
- Attributes
- AutoNegotiation
- BandwidthNotificationSetting
- BandwidthNotificationSettingOpts
- Chassis
- Contract
- ControlPanel
- ControlPanelList
- Cpu
- Cpu1
- CpuCapabilities
- CpuSettings
- CreateNetworkEquipmentCredentialOpts
- CreateServerCredentialOpts
- CreateServerDhcpReservationOpts
- Credential
- CredentialList
- CredentialType
- CredentialWithoutPassword
- CurrentServerJob
- DDos
- DataTrafficNotificationSetting
- DataTrafficNotificationSettingOpts
- Defaults
- Disk
- EnableServerRescueModeOpts
- ErrorResult
- FeatureAvailability
- Firmware
- GetDdosNotificationSettingResult
- GetNetworkEquipmentIpListResult
- GetNetworkEquipmentListResult
- GetNetworkEquipmentNullRouteHistoryResult
- GetNetworkEquipmentPowerStatusResult
- GetNetworkInterfaceListResult
- GetOperatingSystemListResult
- GetOperatingSystemResult
- GetRescueImageListResult
- GetServerBandwidthNotificationSettingListResult
- GetServerDataTrafficNotificationSettingListResult
- GetServerDhcpReservationListResult
- GetServerHardwareResult
- GetServerListResult
- GetServerNullRouteHistoryResult
- GetServerPowerStatusResult
- Hdd
- InstallOperatingSystemOpts
- InstallOperatingSystemPayload
- InstallationJob
- InstallationJobPayload
- Ip
- Ipmi
- Ipmi1
- IpmiResetServerOpts
- JobMetadata
- JobType
- LastClientRequest
- Lease
- LinkSpeed
- LinkSpeeds
- Lldp
- LldpChassis
- Location
- MemoryBank
- Metadata
- Metric
- MetricValue
- MetricValues
- Metrics
- MetricsMetadata
- Motherboard
- Network
- NetworkCapabilities
- NetworkEquipment
- NetworkEquipmentSpecs
- NetworkInterface
- NetworkInterfaces
- NetworkSettings
- NetworkTraffic
- NetworkType
- NetworkTypeURL
- NotificationSetting
- NullRoute
- OperatingSystem
- OperationNetworkInterface
- Os
- Partition
- Payload
- PciCard
- Pdu
- Port
- Port1
- PrivateNetwork
- Progress
- Rack
- RackType
- Raid
- RaidLevel
- RaidType
- Ram
- RescueImage
- Result
- ScanHardwareOpts
- Server
- ServerJob
- ServerJobList
- ServerJobPayload
- ServerSpecs
- SmartSupport
- Smartctl
- SoftwareLicense
- Subnet
- Task
- UpdateDdosNotificationSettingOpts
- UpdateIpProfileOpts
- UpdateNetworkEquipmentCredentialOpts
- UpdateNetworkEquipmentIpOpts
- UpdateNetworkEquipmentReferenceOpts
- UpdateServerCredentialOpts
- UpdateServerReferenceOpts
- Vlan
Authentication schemes defined for the API:
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), dedicatedserver.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
- Type: API key
- API key parameter name: X-LSW-Auth
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: X-LSW-Auth and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
dedicatedserver.ContextAPIKeys,
map[string]dedicatedserver.APIKey{
"X-LSW-Auth": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime