ServersApi
Last updated
Last updated
All URIs are relative to https://api.ionos.com/cloudapi/v6
Method | HTTP request | Description |
---|---|---|
var result = DatacentersServersCdromsDelete(ctx, datacenterId, serverId, cdromId)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Detach a CD-ROM by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
cdromId := "cdromId_example" // string | The unique ID of the CD-ROM.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resp, err := apiClient.ServersApi.DatacentersServersCdromsDelete(context.Background(), datacenterId, serverId, cdromId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersCdromsDelete``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiDatacentersServersCdromsDeleteRequest struct via the builder pattern
(empty response body)
Content-Type: Not defined
Accept: application/json
var result Image = DatacentersServersCdromsFindById(ctx, datacenterId, serverId, cdromId)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Get Attached CD-ROM by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
cdromId := "cdromId_example" // string | The unique ID of the CD-ROM.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersCdromsFindById(context.Background(), datacenterId, serverId, cdromId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersCdromsFindById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersCdromsFindById`: Image
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersCdromsFindById`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersCdromsFindByIdRequest struct via the builder pattern
Content-Type: Not defined
Accept: application/json
var result Cdroms = DatacentersServersCdromsGet(ctx, datacenterId, serverId)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Offset(offset)
.Limit(limit)
.Execute()
Get Attached CD-ROMs
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
offset := int32(56) // int32 | The first element (from the complete list of the elements) to include in the response (used together with <b><i>limit</i></b> for pagination). (optional) (default to 0)
limit := int32(56) // int32 | The maximum number of elements to return (use together with offset for pagination). (optional) (default to 1000)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersCdromsGet(context.Background(), datacenterId, serverId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Offset(offset).Limit(limit).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersCdromsGet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersCdromsGet`: Cdroms
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersCdromsGet`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersCdromsGetRequest struct via the builder pattern
Content-Type: Not defined
Accept: application/json
var result Image = DatacentersServersCdromsPost(ctx, datacenterId, serverId)
.Cdrom(cdrom)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Attach a CD-ROM
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
cdrom := *openapiclient.NewImage(*openapiclient.NewImageProperties("LINUX")) // Image | The CD-ROM to be attached.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersCdromsPost(context.Background(), datacenterId, serverId).Cdrom(cdrom).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersCdromsPost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersCdromsPost`: Image
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersCdromsPost`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersCdromsPostRequest struct via the builder pattern
Content-Type: application/json
Accept: application/json
var result = DatacentersServersDelete(ctx, datacenterId, serverId)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.DeleteVolumes(deleteVolumes)
.Execute()
Delete servers
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
deleteVolumes := true // bool | If true, all attached storage volumes will also be deleted. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resp, err := apiClient.ServersApi.DatacentersServersDelete(context.Background(), datacenterId, serverId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).DeleteVolumes(deleteVolumes).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersDelete``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiDatacentersServersDeleteRequest struct via the builder pattern
(empty response body)
Content-Type: Not defined
Accept: application/json
var result Server = DatacentersServersFindById(ctx, datacenterId, serverId)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Retrieve servers by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersFindById(context.Background(), datacenterId, serverId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersFindById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersFindById`: Server
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersFindById`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersFindByIdRequest struct via the builder pattern
Content-Type: Not defined
Accept: application/json
var result Servers = DatacentersServersGet(ctx, datacenterId)
.Pretty(pretty)
.Depth(depth)
.UpgradeNeeded(upgradeNeeded)
.XContractNumber(xContractNumber)
.Offset(offset)
.Limit(limit)
.Execute()
List servers
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
upgradeNeeded := true // bool | Filter servers that can or that cannot be upgraded. (optional)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
offset := int32(56) // int32 | The first element (from the complete list of the elements) to include in the response (used together with <b><i>limit</i></b> for pagination). (optional) (default to 0)
limit := int32(56) // int32 | The maximum number of elements to return (use together with offset for pagination). (optional) (default to 1000)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersGet(context.Background(), datacenterId).Pretty(pretty).Depth(depth).UpgradeNeeded(upgradeNeeded).XContractNumber(xContractNumber).Offset(offset).Limit(limit).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersGet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersGet`: Servers
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersGet`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersGetRequest struct via the builder pattern
Content-Type: Not defined
Accept: application/json
var result Server = DatacentersServersPatch(ctx, datacenterId, serverId)
.Server(server)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Partially modify servers
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
server := *openapiclient.NewServerProperties() // ServerProperties | The properties of the server to be updated.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersPatch(context.Background(), datacenterId, serverId).Server(server).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersPatch``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersPatch`: Server
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersPatch`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersPatchRequest struct via the builder pattern
Content-Type: application/json
Accept: application/json
var result Server = DatacentersServersPost(ctx, datacenterId)
.Server(server)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Create a Server
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
server := *openapiclient.NewServer(*openapiclient.NewServerProperties()) // Server | The server to create.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersPost(context.Background(), datacenterId).Server(server).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersPost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersPost`: Server
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersPost`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersPostRequest struct via the builder pattern
Content-Type: application/json
Accept: application/json
var result Server = DatacentersServersPut(ctx, datacenterId, serverId)
.Server(server)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Modify a Server by ID
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
server := *openapiclient.NewServer(*openapiclient.NewServerProperties()) // Server | The modified server
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersPut(context.Background(), datacenterId, serverId).Server(server).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersPut``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DatacentersServersPut`: Server
fmt.Fprintf(os.Stdout, "Response from `ServersApi.DatacentersServersPut`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiDatacentersServersPutRequest struct via the builder pattern
Content-Type: application/json
Accept: application/json
var result = DatacentersServersRebootPost(ctx, datacenterId, serverId)
.Pretty(pretty)
.Depth(depth)
.XContractNumber(xContractNumber)
.Execute()
Reboot servers
package main
import (
"context"
"fmt"
"os"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
func main() {
datacenterId := "datacenterId_example" // string | The unique ID of the data center.
serverId := "serverId_example" // string | The unique ID of the server.
pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
depth := int32(56) // int32 | Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on (optional) (default to 0)
xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
configuration := ionoscloud.NewConfiguration()
apiClient := ionoscloud.NewAPIClient(configuration)
resource, resp, err := apiClient.ServersApi.DatacentersServersRebootPost(context.Background(), datacenterId, serverId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServersApi.DatacentersServersRebootPost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Other parameters are passed through a pointer to a apiDatacentersServersRebootPostRequest struct via the builder pattern
(empty response body)
Content-Type: Not defined