var result =SnapshotsDelete(ctx, snapshotId) .Pretty(pretty) .Depth(depth) .XContractNumber(xContractNumber) .Execute()
Delete snapshots
Example
packagemainimport ("context""fmt""os" compute "github.com/ionos-cloud/sdk-go-bundle/products/compute""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { snapshotId :="snapshotId_example"// string | The unique ID of the snapshot. 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 := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") apiClient := compute.NewAPIClient(configuration) resource, resp, err := apiClient.SnapshotsApi.SnapshotsDelete(context.Background(), snapshotId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()if err !=nil { fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsApi.SnapshotsDelete``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) }}
Path Parameters
Name
Type
Description
Notes
ctx
context.Context
context for authentication, logging, cancellation, deadlines, tracing, etc.
snapshotId
string
The unique ID of the snapshot.
Other Parameters
Other parameters are passed through a pointer to an apiSnapshotsDeleteRequest struct via the builder pattern
Name
Type
Description
Notes
pretty
bool
Controls whether the response is pretty-printed (with indentations and new lines).
[default to true]
depth
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
[default to 0]
xContractNumber
int32
Users with multiple contracts must provide the contract number, for which all API requests are to be executed.
Return type
(empty response body)
HTTP request headers
Content-Type: Not defined
Accept: application/json
SnapshotsFindById
var result Snapshot=SnapshotsFindById(ctx, snapshotId) .Pretty(pretty) .Depth(depth) .XContractNumber(xContractNumber) .Execute()
Retrieve snapshots by ID
Example
packagemainimport ("context""fmt""os" compute "github.com/ionos-cloud/sdk-go-bundle/products/compute""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { snapshotId :="snapshotId_example"// string | The unique ID of the snapshot. 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 := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") apiClient := compute.NewAPIClient(configuration) resource, resp, err := apiClient.SnapshotsApi.SnapshotsFindById(context.Background(), snapshotId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()if err !=nil { fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsApi.SnapshotsFindById``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) }// response from `SnapshotsFindById`: Snapshot fmt.Fprintf(os.Stdout, "Response from `SnapshotsApi.SnapshotsFindById`: %v\n", resource)}
Path Parameters
Name
Type
Description
Notes
ctx
context.Context
context for authentication, logging, cancellation, deadlines, tracing, etc.
snapshotId
string
The unique ID of the snapshot.
Other Parameters
Other parameters are passed through a pointer to an apiSnapshotsFindByIdRequest struct via the builder pattern
Name
Type
Description
Notes
pretty
bool
Controls whether the response is pretty-printed (with indentations and new lines).
[default to true]
depth
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
[default to 0]
xContractNumber
int32
Users with multiple contracts must provide the contract number, for which all API requests are to be executed.
var result Snapshots=SnapshotsGet(ctx) .Pretty(pretty) .Depth(depth) .XContractNumber(xContractNumber) .Execute()
List snapshots
Example
packagemainimport ("context""fmt""os" compute "github.com/ionos-cloud/sdk-go-bundle/products/compute""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { 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 := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") apiClient := compute.NewAPIClient(configuration) resource, resp, err := apiClient.SnapshotsApi.SnapshotsGet(context.Background()).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()if err !=nil { fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsApi.SnapshotsGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) }// response from `SnapshotsGet`: Snapshots fmt.Fprintf(os.Stdout, "Response from `SnapshotsApi.SnapshotsGet`: %v\n", resource)}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to an apiSnapshotsGetRequest struct via the builder pattern
Name
Type
Description
Notes
pretty
bool
Controls whether the response is pretty-printed (with indentations and new lines).
[default to true]
depth
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
[default to 0]
xContractNumber
int32
Users with multiple contracts must provide the contract number, for which all API requests are to be executed.
var result Snapshot=SnapshotsPatch(ctx, snapshotId) .Snapshot(snapshot) .Pretty(pretty) .Depth(depth) .XContractNumber(xContractNumber) .Execute()
Partially modify snapshots
Example
packagemainimport ("context""fmt""os" compute "github.com/ionos-cloud/sdk-go-bundle/products/compute""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { snapshotId :="snapshotId_example"// string | The unique ID of the snapshot. snapshot :=*openapiclient.NewSnapshotProperties() // SnapshotProperties | The properties of the snapshot 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 := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") apiClient := compute.NewAPIClient(configuration) resource, resp, err := apiClient.SnapshotsApi.SnapshotsPatch(context.Background(), snapshotId).Snapshot(snapshot).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()if err !=nil { fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsApi.SnapshotsPatch``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) }// response from `SnapshotsPatch`: Snapshot fmt.Fprintf(os.Stdout, "Response from `SnapshotsApi.SnapshotsPatch`: %v\n", resource)}
Path Parameters
Name
Type
Description
Notes
ctx
context.Context
context for authentication, logging, cancellation, deadlines, tracing, etc.
snapshotId
string
The unique ID of the snapshot.
Other Parameters
Other parameters are passed through a pointer to an apiSnapshotsPatchRequest struct via the builder pattern
Controls whether the response is pretty-printed (with indentations and new lines).
[default to true]
depth
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
[default to 0]
xContractNumber
int32
Users with multiple contracts must provide the contract number, for which all API requests are to be executed.
var result Snapshot=SnapshotsPut(ctx, snapshotId) .Snapshot(snapshot) .Pretty(pretty) .Depth(depth) .XContractNumber(xContractNumber) .Execute()
Modify snapshots
Example
packagemainimport ("context""fmt""os" compute "github.com/ionos-cloud/sdk-go-bundle/products/compute""github.com/ionos-cloud/sdk-go-bundle/shared")funcmain() { snapshotId :="snapshotId_example"// string | The unique ID of the snapshot. snapshot :=*openapiclient.NewSnapshot(*openapiclient.NewSnapshotProperties()) // Snapshot | The modified snapshot 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 := shared.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL") apiClient := compute.NewAPIClient(configuration) resource, resp, err := apiClient.SnapshotsApi.SnapshotsPut(context.Background(), snapshotId).Snapshot(snapshot).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()if err !=nil { fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsApi.SnapshotsPut``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp) }// response from `SnapshotsPut`: Snapshot fmt.Fprintf(os.Stdout, "Response from `SnapshotsApi.SnapshotsPut`: %v\n", resource)}
Path Parameters
Name
Type
Description
Notes
ctx
context.Context
context for authentication, logging, cancellation, deadlines, tracing, etc.
snapshotId
string
The unique ID of the snapshot.
Other Parameters
Other parameters are passed through a pointer to an apiSnapshotsPutRequest struct via the builder pattern
Controls whether the response is pretty-printed (with indentations and new lines).
[default to true]
depth
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
[default to 0]
xContractNumber
int32
Users with multiple contracts must provide the contract number, for which all API requests are to be executed.