File: action.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 (39 lines) | stat: -rw-r--r-- 1,164 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
package schema

import "time"

// Action defines the schema of an action.
type Action struct {
	ID        int64                     `json:"id"`
	Status    string                    `json:"status"`
	Command   string                    `json:"command"`
	Progress  int                       `json:"progress"`
	Started   time.Time                 `json:"started"`
	Finished  *time.Time                `json:"finished"`
	Error     *ActionError              `json:"error"`
	Resources []ActionResourceReference `json:"resources"`
}

// ActionResourceReference defines the schema of an action resource reference.
type ActionResourceReference struct {
	ID   int64  `json:"id"`
	Type string `json:"type"`
}

// ActionError defines the schema of an error embedded
// in an action.
type ActionError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

// ActionGetResponse is the schema of the response when
// retrieving a single action.
type ActionGetResponse struct {
	Action Action `json:"action"`
}

// ActionListResponse defines the schema of the response when listing actions.
type ActionListResponse struct {
	Actions []Action `json:"actions"`
}