All URIs are relative to https://infrahub-api.nexgencloud.com/v1
| Method | HTTP request | Description |
|---|---|---|
| CreateCustomImage | Post /core/snapshots/{snapshot_id}/image | Create an image from a snapshot |
| DeleteSnapshot | Delete /core/snapshots/{id} | Delete snapshot |
| FetchSnapshotNameAvailability | Get /core/snapshots/name-availability/{name} | Fetch snapshot name availability |
| GetSnapshot | Get /core/snapshots/{id} | Retrieve a snapshot |
| ListSnapshots | Get /core/snapshots | Retrieve list of snapshots with pagination |
| RestoreSnapshot | Post /core/snapshots/{id}/restore | Restore a snapshot |
CreateImage CreateCustomImage(ctx, snapshotId).Payload(payload).Execute()
Create an image from a snapshot
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/NexGenCloud/hyperstack-sdk-go/hyperstack"
)
func main() {
snapshotId := int32(56) // int32 |
payload := *openapiclient.NewCreateImagePayload("Name_example") // CreateImagePayload |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SnapshotsAPI.CreateCustomImage(context.Background(), snapshotId).Payload(payload).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsAPI.CreateCustomImage``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateCustomImage`: CreateImage
fmt.Fprintf(os.Stdout, "Response from `SnapshotsAPI.CreateCustomImage`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| snapshotId | int32 |
Other parameters are passed through a pointer to a apiCreateCustomImageRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
payload | CreateImagePayload | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ResponseModel DeleteSnapshot(ctx, id).Execute()
Delete snapshot
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/NexGenCloud/hyperstack-sdk-go/hyperstack"
)
func main() {
id := int32(56) // int32 |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SnapshotsAPI.DeleteSnapshot(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsAPI.DeleteSnapshot``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteSnapshot`: ResponseModel
fmt.Fprintf(os.Stdout, "Response from `SnapshotsAPI.DeleteSnapshot`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | int32 |
Other parameters are passed through a pointer to a apiDeleteSnapshotRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
NameAvailableModel FetchSnapshotNameAvailability(ctx, name).Execute()
Fetch snapshot name availability
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/NexGenCloud/hyperstack-sdk-go/hyperstack"
)
func main() {
name := "name_example" // string |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SnapshotsAPI.FetchSnapshotNameAvailability(context.Background(), name).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsAPI.FetchSnapshotNameAvailability``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FetchSnapshotNameAvailability`: NameAvailableModel
fmt.Fprintf(os.Stdout, "Response from `SnapshotsAPI.FetchSnapshotNameAvailability`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| name | string |
Other parameters are passed through a pointer to a apiFetchSnapshotNameAvailabilityRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SnapshotRetrieve GetSnapshot(ctx, id).Execute()
Retrieve a snapshot
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/NexGenCloud/hyperstack-sdk-go/hyperstack"
)
func main() {
id := int32(56) // int32 |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SnapshotsAPI.GetSnapshot(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsAPI.GetSnapshot``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetSnapshot`: SnapshotRetrieve
fmt.Fprintf(os.Stdout, "Response from `SnapshotsAPI.GetSnapshot`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | int32 |
Other parameters are passed through a pointer to a apiGetSnapshotRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Snapshots ListSnapshots(ctx).Page(page).PageSize(pageSize).Search(search).Execute()
Retrieve list of snapshots with pagination
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/NexGenCloud/hyperstack-sdk-go/hyperstack"
)
func main() {
page := "page_example" // string | Page Number (optional)
pageSize := "pageSize_example" // string | Data Per Page (optional)
search := "search_example" // string | Search By Snapshot ID or Name (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SnapshotsAPI.ListSnapshots(context.Background()).Page(page).PageSize(pageSize).Search(search).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsAPI.ListSnapshots``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListSnapshots`: Snapshots
fmt.Fprintf(os.Stdout, "Response from `SnapshotsAPI.ListSnapshots`: %v\n", resp)
}Other parameters are passed through a pointer to a apiListSnapshotsRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| page | string | Page Number | |
| pageSize | string | Data Per Page | |
| search | string | Search By Snapshot ID or Name |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Instance RestoreSnapshot(ctx, id).Payload(payload).Execute()
Restore a snapshot
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/NexGenCloud/hyperstack-sdk-go/hyperstack"
)
func main() {
id := int32(56) // int32 |
payload := *openapiclient.NewSnapshotRestoreRequest("NewVmName_example") // SnapshotRestoreRequest |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.SnapshotsAPI.RestoreSnapshot(context.Background(), id).Payload(payload).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SnapshotsAPI.RestoreSnapshot``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `RestoreSnapshot`: Instance
fmt.Fprintf(os.Stdout, "Response from `SnapshotsAPI.RestoreSnapshot`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| id | int32 |
Other parameters are passed through a pointer to a apiRestoreSnapshotRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
payload | SnapshotRestoreRequest | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]