@@ -6,46 +6,62 @@ import (
6
6
"errors"
7
7
"fmt"
8
8
"strings"
9
+ "time"
9
10
10
11
"golang.org/x/mod/semver"
11
12
)
12
13
13
- // DiskImage represents a DiskImage for launching instances from
14
+ // DiskImage represents a serialized structure
14
15
type DiskImage struct {
15
- ID string `json:"id,omitempty"`
16
- Name string `json:"name,omitempty"`
17
- Version string `json:"version,omitempty"`
18
- State string `json:"state,omitempty"`
19
- Distribution string `json:"distribution,omitempty"`
20
- Description string `json:"description,omitempty"`
21
- Label string `json:"label,omitempty"`
16
+ ID string `json:"id"`
17
+ Name string `json:"name"`
18
+ Version string `json:"version"`
19
+ State string `json:"state"`
20
+ InitialUser string `json:"initial_user,omitempty"`
21
+ Distribution string `json:"distribution"`
22
+ OS string `json:"os,omitempty"`
23
+ Description string `json:"description"`
24
+ Label string `json:"label"`
25
+ DiskImageURL string `json:"disk_image_url,omitempty"`
26
+ DiskImageSizeBytes int64 `json:"disk_image_size_bytes,omitempty"`
27
+ LogoURL string `json:"logo_url,omitempty"`
28
+ CreatedAt time.Time `json:"created_at,omitempty"`
29
+ CreatedBy string `json:"created_by,omitempty"` // User information (because multiple users can operate under the same account)
30
+ DistributionDefault bool `json:"distribution_default"`
22
31
}
23
32
24
33
// CreateDiskImageParams represents the parameters for creating a new disk image
25
34
type CreateDiskImageParams struct {
26
- Name string `json:"name"`
27
- Distribution string `json:"distribution"`
28
- Version string `json:"version"`
29
- OS string `json:"os,omitempty"`
30
- Region string `json:"region,omitempty"`
31
- ImageSHA256 string `json:"image_sha256"`
32
- ImageMD5 string `json:"image_md5"`
33
- LogoBase64 string `json:"logo_base64,omitempty"`
34
- ImageSize int64 `json:"image_size_bytes"` // Changed from image_size to image_size_bytes
35
+ Name string `json:"name"`
36
+ Distribution string `json:"distribution"`
37
+ Version string `json:"version"`
38
+ Source string `json:"source"`
39
+ OS string `json:"os,omitempty"`
40
+ InitialUser string `json:"initial_user,omitempty"`
41
+ Region string `json:"region,omitempty"`
42
+ ImageSHA256 string `json:"image_sha256"`
43
+ ImageMD5 string `json:"image_md5"`
44
+ LogoBase64 string `json:"logo_base64,omitempty"`
45
+ ImageSizeBytes int64 `json:"image_size_bytes"` // Size of the image in bytes
35
46
}
36
47
37
48
// CreateDiskImageResponse represents the response from creating a new disk image
38
49
type CreateDiskImageResponse struct {
39
- ID string `json:"id"`
40
- Name string `json:"name"`
41
- Distribution string `json:"distribution"`
42
- Version string `json:"version"`
43
- OS string `json:"os"`
44
- Region string `json:"region"`
45
- Status string `json:"status"`
46
- DiskImageURL string `json:"disk_image_url"`
47
- LogoURL string `json:"logo_url"`
48
- ImageSize int64 `json:"image_size"`
50
+ ID string `json:"id"`
51
+ Name string `json:"name"`
52
+ Distribution string `json:"distribution"`
53
+ Version string `json:"version"`
54
+ OS string `json:"os"`
55
+ Region string `json:"region"`
56
+ Status string `json:"status"`
57
+ InitialUser string `json:"initial_user,omitempty"`
58
+ DiskImageURL string `json:"disk_image_url"`
59
+ DiskImageSizeBytes int64 `json:"disk_image_size_bytes,omitempty"`
60
+ LogoURL string `json:"logo_url"`
61
+ ImageSize int64 `json:"image_size"`
62
+ CreatedAt time.Time `json:"created_at,omitempty"`
63
+ CreatedBy string `json:"created_by,omitempty"`
64
+ DistributionDefault bool `json:"distribution_default,omitempty"`
49
65
}
50
66
51
67
// ListDiskImages return all disk image in system
0 commit comments