Documentation ¶
Index ¶
- Constants
- func CloudEventToJSONMap(evt *cloudevents.Event) (datatypes.JSONMap, error)
- func DecodeBundleStatus(status datatypes.JSONMap) (map[string]interface{}, error)
- func DecodeManifest(manifest datatypes.JSONMap) (map[string]interface{}, map[string]interface{}, map[string]interface{}, error)
- func DecodeManifestBundle(manifest datatypes.JSONMap) (map[string]any, *workpayload.ManifestBundle, error)
- func DecodeManifestBundleToObjects(manifest datatypes.JSONMap) ([]map[string]interface{}, error)
- func DecodeStatus(status datatypes.JSONMap) (map[string]interface{}, error)
- func EncodeManifest(manifest, deleteOption, updateStrategy map[string]interface{}) (datatypes.JSONMap, error)
- func JSONMAPToCloudEvent(res datatypes.JSONMap) (*cloudevents.Event, error)
- func NewID() string
- func SendAPI(w http.ResponseWriter, r *http.Request)
- func SendAPIV1(w http.ResponseWriter, r *http.Request)
- func SendNotFound(w http.ResponseWriter, r *http.Request)
- func SendPanic(w http.ResponseWriter, r *http.Request)
- func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
- type CollectionMetadata
- type Consumer
- type ConsumerIndex
- type ConsumerList
- type ConsumerPatchRequest
- type Error
- type Event
- type EventIndex
- type EventInstance
- type EventInstanceList
- type EventList
- type EventType
- type Meta
- type Metadata
- type PagingMeta
- type ReconcileStatus
- type Resource
- type ResourceBundleStatus
- type ResourceIndex
- type ResourceList
- type ResourcePatchRequest
- type ResourceStatus
- type ResourceType
- type ServerInstance
- type ServerInstanceList
- type StatusEvent
- type StatusEventIndex
- type StatusEventList
- type StatusEventType
- type VersionMetadata
Constants ¶
const ErrorType = "Error"
ErrorType is the name of the type used to report errors.
Variables ¶
This section is empty.
Functions ¶
func CloudEventToJSONMap ¶
func CloudEventToJSONMap(evt *cloudevents.Event) (datatypes.JSONMap, error)
CloudEventToJSONMap converts a CloudEvent to a JSONMap (resource manifest or status)
func DecodeBundleStatus ¶
DecodeBundleStatus converts a CloudEvent JSONMap representation of a resource bundle status into resource bundle status (map[string]interface{}) in openapi output.
func DecodeManifest ¶
func DecodeManifest(manifest datatypes.JSONMap) (map[string]interface{}, map[string]interface{}, map[string]interface{}, error)
DecodeManifest converts a CloudEvent JSONMap representation of a resource manifest into resource manifest, deleteOption and updateStrategy (map[string]interface{}).
func DecodeManifestBundle ¶
func DecodeManifestBundle(manifest datatypes.JSONMap) (map[string]any, *workpayload.ManifestBundle, error)
DecodeManifestBundle converts a CloudEvent JSONMap representation of a list of resource manifest into manifest bundle payload.
func DecodeManifestBundleToObjects ¶
DecodeManifestBundleToObjects converts a CloudEvent JSONMap representation of a list of resource manifest into a list of resource object (map[string]interface{}).
func DecodeStatus ¶
DecodeStatus converts a CloudEvent JSONMap representation of a resource status into resource status (map[string]interface{}).
func EncodeManifest ¶
func EncodeManifest(manifest, deleteOption, updateStrategy map[string]interface{}) (datatypes.JSONMap, error)
EncodeManifest converts resource manifest, deleteOption and updateStrategy (map[string]interface{}) into a CloudEvent JSONMap representation.
func JSONMAPToCloudEvent ¶
func JSONMAPToCloudEvent(res datatypes.JSONMap) (*cloudevents.Event, error)
JSONMAPToCloudEvent converts a JSONMap (resource manifest or status) to a CloudEvent
func SendAPI ¶
func SendAPI(w http.ResponseWriter, r *http.Request)
SendAPI sends API documentation response.
func SendAPIV1 ¶
func SendAPIV1(w http.ResponseWriter, r *http.Request)
SendAPIV1 sends API version v1 documentation response.
func SendNotFound ¶
func SendNotFound(w http.ResponseWriter, r *http.Request)
SendNotFound sends a 404 response with some details about the non existing resource.
func SendPanic ¶
func SendPanic(w http.ResponseWriter, r *http.Request)
SendPanic sends a panic error response to the client, but it doesn't end the process.
func SendUnauthorized ¶
func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
Types ¶
type CollectionMetadata ¶
type CollectionMetadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` }
CollectionMetadata represents a collection.
type Consumer ¶
type Consumer struct { Meta // Name must be unique and not null, it can be treated as the consumer external ID. // The format of the name should be follow the RFC 1123 (same as the k8s namespace). // When creating a consumer, if its name is not specified, the consumer id will be used as its name. // // Cannot be updated. Name string Labels *db.StringMap }
type ConsumerIndex ¶
type ConsumerList ¶
type ConsumerList []*Consumer
func (ConsumerList) Index ¶
func (l ConsumerList) Index() ConsumerIndex
type ConsumerPatchRequest ¶
type ConsumerPatchRequest struct { }
type Error ¶
type Error struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` HREF string `json:"href,omitempty"` Code string `json:"code,omitempty"` Reason string `json:"reason,omitempty"` }
Error represents an error reported by the API.
type Event ¶
type EventIndex ¶
type EventInstance ¶
type EventInstanceList ¶
type EventInstanceList []*EventInstance
type EventList ¶
type EventList []*Event
func (EventList) Index ¶
func (l EventList) Index() EventIndex
type Meta ¶
type Meta struct { ID string CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
Meta is base model definition, embedded in all kinds
type Metadata ¶
type Metadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` Versions []VersionMetadata `json:"versions"` }
Metadata api metadata.
type ReconcileStatus ¶
type Resource ¶
type Resource struct { Meta Version int32 Source string ConsumerName string Type ResourceType Payload datatypes.JSONMap Status datatypes.JSONMap // Name must be unique and not null, it can be treated as the resource external ID. // The format of the name should be follow the RFC 1123 (same as the k8s namespace). // When creating a resource, if its name is not specified, the resource id will be used as its name. // Cannot be updated. Name string }
func (*Resource) GetDeletionTimestamp ¶
func (*Resource) GetResourceVersion ¶
type ResourceBundleStatus ¶
type ResourceBundleStatus struct { ObservedVersion int32 SequenceID string *workpayload.ManifestBundleStatus }
type ResourceIndex ¶
type ResourceList ¶
type ResourceList []*Resource
func (ResourceList) Index ¶
func (l ResourceList) Index() ResourceIndex
type ResourcePatchRequest ¶
type ResourcePatchRequest struct{}
type ResourceStatus ¶
type ResourceStatus struct { ContentStatus datatypes.JSONMap ReconcileStatus *ReconcileStatus }
type ResourceType ¶
type ResourceType string
const ( ResourceTypeSingle ResourceType = "Single" ResourceTypeBundle ResourceType = "Bundle" )
type ServerInstance ¶
type ServerInstance struct { Meta LastHeartbeat time.Time // LastHeartbeat indicates the last time the instance sent a heartbeat. Ready bool // Ready indicates whether the instance is ready to serve requests. }
ServerInstance is employed by Maestro to discover active server instances. The updatedAt field determines the liveness of the instance; if the instance remains unchanged for three consecutive check intervals (30 seconds by default), it is marked as dead. However, it is not meant for direct exposure to end users through the API.
func (*ServerInstance) String ¶
func (i *ServerInstance) String() string
String returns the identifier of the maestro instance.
type ServerInstanceList ¶
type ServerInstanceList []*ServerInstance
type StatusEvent ¶
type StatusEvent struct { Meta ResourceID string ResourceSource string ResourceType ResourceType Payload datatypes.JSONMap Status datatypes.JSONMap StatusEventType StatusEventType // Update|Delete ReconciledDate *time.Time `json:"gorm:null"` }
func (*StatusEvent) BeforeCreate ¶
func (e *StatusEvent) BeforeCreate(tx *gorm.DB) error
type StatusEventIndex ¶
type StatusEventIndex map[string]*StatusEvent
type StatusEventList ¶
type StatusEventList []*StatusEvent
func (StatusEventList) Index ¶
func (l StatusEventList) Index() StatusEventIndex
type StatusEventType ¶
type StatusEventType string
const ( StatusUpdateEventType StatusEventType = "StatusUpdate" StatusDeleteEventType StatusEventType = "StatusDelete" )
type VersionMetadata ¶
type VersionMetadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` Collections []CollectionMetadata `json:"collections"` }
VersionMetadata represents a version.