File: image.go

package info (click to toggle)
golang-github-hetznercloud-hcloud-go 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,072 kB
  • sloc: sh: 5; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 2,442 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package schema

import "time"

// Image defines the schema of an image.
type Image struct {
	ID           int64             `json:"id"`
	Status       string            `json:"status"`
	Type         string            `json:"type"`
	Name         *string           `json:"name"`
	Description  string            `json:"description"`
	ImageSize    *float32          `json:"image_size"`
	DiskSize     float32           `json:"disk_size"`
	Created      time.Time         `json:"created"`
	CreatedFrom  *ImageCreatedFrom `json:"created_from"`
	BoundTo      *int64            `json:"bound_to"`
	OSFlavor     string            `json:"os_flavor"`
	OSVersion    *string           `json:"os_version"`
	Architecture string            `json:"architecture"`
	RapidDeploy  bool              `json:"rapid_deploy"`
	Protection   ImageProtection   `json:"protection"`
	Deprecated   time.Time         `json:"deprecated"`
	Deleted      time.Time         `json:"deleted"`
	Labels       map[string]string `json:"labels"`
}

// ImageProtection represents the protection level of a image.
type ImageProtection struct {
	Delete bool `json:"delete"`
}

// ImageCreatedFrom defines the schema of the images created from reference.
type ImageCreatedFrom struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

// ImageGetResponse defines the schema of the response when
// retrieving a single image.
type ImageGetResponse struct {
	Image Image `json:"image"`
}

// ImageListResponse defines the schema of the response when
// listing images.
type ImageListResponse struct {
	Images []Image `json:"images"`
}

// ImageUpdateRequest defines the schema of the request to update an image.
type ImageUpdateRequest struct {
	Description *string            `json:"description,omitempty"`
	Type        *string            `json:"type,omitempty"`
	Labels      *map[string]string `json:"labels,omitempty"`
}

// ImageUpdateResponse defines the schema of the response when updating an image.
type ImageUpdateResponse struct {
	Image Image `json:"image"`
}

// ImageActionChangeProtectionRequest defines the schema of the request to change the resource protection of an image.
type ImageActionChangeProtectionRequest struct {
	Delete *bool `json:"delete,omitempty"`
}

// ImageActionChangeProtectionResponse defines the schema of the response when changing the resource protection of an image.
type ImageActionChangeProtectionResponse struct {
	Action Action `json:"action"`
}