|
| 1 | +package v1alpha1 |
| 2 | + |
| 3 | +import ( |
| 4 | + "time" |
| 5 | + |
| 6 | + "github.com/armosec/armoapi-go/identifiers" |
| 7 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 8 | +) |
| 9 | + |
| 10 | +type OperatorCommandList struct { |
| 11 | + metav1.TypeMeta `json:",inline"` |
| 12 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 13 | + |
| 14 | + Items []OperatorCommand `json:"items"` |
| 15 | +} |
| 16 | + |
| 17 | +type OperatorCommand struct { |
| 18 | + metav1.TypeMeta `json:",inline"` |
| 19 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 20 | + |
| 21 | + Spec OperatorCommandSpec `json:"spec,omitempty"` |
| 22 | + Status OperatorCommandStatus `json:"status,omitempty"` |
| 23 | +} |
| 24 | + |
| 25 | +type OperatorCommandSpec struct { |
| 26 | + GUID string `json:"guid"` // GUID is a unique identifier for the command |
| 27 | + CommandType string `json:"commandType"` // CommandType is the type of the command |
| 28 | + CommandVersion string `json:"commandVersion,omitempty"` // CommandVersion is the version of the command |
| 29 | + Designators []identifiers.PortalDesignator `json:"designators,omitempty"` // Designators are the designators for the command |
| 30 | + Body []byte `json:"body,omitempty"` // Body is the body of the command |
| 31 | + TTL time.Duration `json:"ttl,omitempty"` // TTL is the time to live for the command |
| 32 | + Args map[string]interface{} `json:"args,omitempty"` // Args are the arguments for the command |
| 33 | + CommandIndex *int `json:"commandIndex,omitempty"` // CommandIndex is the index of the command in the sequence |
| 34 | + CommandCount *int `json:"commandCount,omitempty"` // CommandCount is the total number of commands in the sequence |
| 35 | +} |
| 36 | + |
| 37 | +type OperatorCommandStatus struct { |
| 38 | + Started bool `json:"started"` // Started indicates if the command has started |
| 39 | + StartedAt *metav1.Time `json:"startedAt,omitempty"` // StartedAt is the time at which the command was started |
| 40 | + Completed bool `json:"completed"` // Completed indicates if the command has completed |
| 41 | + CompletedAt *metav1.Time `json:"completedAt,omitempty"` // CompletedAt is the time at which the command was completed |
| 42 | + Executer string `json:"executer,omitempty"` // Executer is the entity that executed the command |
| 43 | + Error *OperatorCommandStatusError `json:"error,omitempty"` // Error is the error that occurred during the execution of the command (if any) |
| 44 | +} |
| 45 | + |
| 46 | +type OperatorCommandStatusError struct { |
| 47 | + Reason string `json:"reason,omitempty"` // reason for the error (optional) |
| 48 | + Message string `json:"message,omitempty"` // error message (optional) |
| 49 | + ErrorCode int `json:"errorCode,omitempty"` // error code (optional) |
| 50 | +} |
0 commit comments