{"modulePath":"github.com/openshift-hyperfleet/hyperfleet-api","version":"v0.4.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\n## Constants\n\n```go\nconst (\n\tMaxLabelKeyLen   = 255\n\tMaxLabelValueLen = 255\n)\n```\n\n```go\nconst (\n\tResourceTypeCluster  = \"Cluster\"\n\tResourceTypeNodePool = \"NodePool\"\n)\n```\nResource type constants\n\n```go\nconst (\n\tAdapterConditionTypeAvailable  = \"Available\"\n\tAdapterConditionTypeApplied    = \"Applied\"\n\tAdapterConditionTypeHealth     = \"Health\"\n\tAdapterConditionTypeReconciled = \"Reconciled\"\n\tAdapterConditionTypeFinalized  = \"Finalized\"\n)\n```\nAdapter condition type constants (used in adapter.conditions reported by adapters)\n\n```go\nconst (\n\tResourceConditionTypeAvailable           = \"Available\"\n\tResourceConditionTypeHealth              = \"Health\"\n\tResourceConditionTypeReconciled          = \"Reconciled\"\n\tResourceConditionTypeFinalized           = \"Finalized\"\n\tResourceConditionTypeLastKnownReconciled = \"LastKnownReconciled\"\n)\n```\nResource condition type constants (used in resource.status.conditions aggregated from adapters)\n\n## Variables\n\n```go\nvar BuildTime = \"unknown\"\n```\nBuildTime is the time when the binary was built, set at compile time via ldflags\n\n```go\nvar Commit = \"unknown\"\n```\nCommit is the git commit SHA set at compile time via ldflags\n\n```go\nvar Version = \"0.0.0-dev\"\n```\nVersion is the application version set at compile time via ldflags\n\n## Functions\n\n```go\nfunc NewID() (string, error)\n```\nNewID generates a new RFC4122 UUID v7 identifier in lowercase format. UUID v7 embeds a Unix timestamp (millisecond precision) in the first 48 bits, providing time-ordering and improved database index performance. The resulting 36-character string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) is suitable for use in REST APIs, database storage, and Kubernetes resource names.\n\nThe lowercase UUID format is DNS-1123 compliant (contains only a-f, 0-9, and hyphens; starts and ends with alphanumeric; 36 chars \\\u003c 253 char subdomain limit).\n\nReturns an error if UUID generation fails (extremely unlikely in practice).\n\n```go\nfunc SendNotFound(w http.ResponseWriter, r *http.Request)\n```\nSendNotFound sends a 404 response in RFC 9457 Problem Details format.\n\n```go\nfunc SendPanic(w http.ResponseWriter, r *http.Request)\n```\nSendPanic sends a panic error response in RFC 9457 Problem Details format. It attempts to include trace\\_id and timestamp dynamically, falling back to a pre-computed body if marshaling fails.\n\n```go\nfunc ValidateLabel(key, value string) error\n```\n\n## Types\n\n```go\ntype AdapterCondition struct {\n\tLastTransitionTime time.Time              `json:\"last_transition_time\"`\n\tReason             *string                `json:\"reason,omitempty\"`\n\tMessage            *string                `json:\"message,omitempty\"`\n\tType               string                 `json:\"type\"`\n\tStatus             AdapterConditionStatus `json:\"status\"`\n}\n```\nAdapterCondition represents a condition of an adapter Domain equivalent of openapi.AdapterCondition JSON tags match database JSONB structure\n\n```go\ntype AdapterConditionStatus string\n```\nAdapterConditionStatus represents the status of an adapter condition (includes Unknown) Domain equivalent of openapi.AdapterConditionStatus\n\n```go\nconst (\n\tAdapterConditionTrue    AdapterConditionStatus = \"True\"\n\tAdapterConditionFalse   AdapterConditionStatus = \"False\"\n\tAdapterConditionUnknown AdapterConditionStatus = \"Unknown\"\n)\n```\n\n```go\nfunc (s AdapterConditionStatus) IsValid() bool\n```\nIsValid returns true if the status is one of the accepted enum values (True, False, Unknown).\n\n```go\ntype AdapterStatus struct {\n\tLastReportTime time.Time `json:\"last_report_time\" gorm:\"not null\"`\n\tCreatedTime    time.Time `json:\"created_time\" gorm:\"not null\"`\n\tMeta\n\tResourceType       string         `json:\"resource_type\" gorm:\"size:20;index:idx_resource;not null\"`\n\tResourceID         string         `json:\"resource_id\" gorm:\"size:255;index:idx_resource;not null\"`\n\tAdapter            string         `json:\"adapter\" gorm:\"size:255;not null;uniqueIndex:idx_resource_adapter\"`\n\tConditions         datatypes.JSON `json:\"conditions\" gorm:\"type:jsonb;not null\"`\n\tData               datatypes.JSON `json:\"data,omitempty\" gorm:\"type:jsonb\"`\n\tMetadata           datatypes.JSON `json:\"metadata,omitempty\" gorm:\"type:jsonb\"`\n\tObservedGeneration int32          `json:\"observed_generation\" gorm:\"not null\"`\n}\n```\nAdapterStatus database model\n\n```go\nfunc (as *AdapterStatus) BeforeCreate(tx *gorm.DB) error\n```\n\n```go\nfunc (as *AdapterStatus) IsFinalized() bool\n```\n\n```go\ntype AdapterStatusIndex map[string]*AdapterStatus\n```\n\n```go\ntype AdapterStatusList []*AdapterStatus\n```\n\n```go\nfunc (l AdapterStatusList) Index() AdapterStatusIndex\n```\n\n```go\ntype AdapterStatusMetadata struct {\n\tAttempt       *int32     `json:\"attempt,omitempty\"`\n\tCompletedTime *time.Time `json:\"completed_time,omitempty\"`\n\tDuration      *string    `json:\"duration,omitempty\"`\n\tJobName       *string    `json:\"job_name,omitempty\"`\n\tJobNamespace  *string    `json:\"job_namespace,omitempty\"`\n\tStartedTime   *time.Time `json:\"started_time,omitempty\"`\n}\n```\n\n```go\ntype Meta struct {\n\tCreatedTime time.Time\n\tUpdatedTime time.Time\n\tID          string\n}\n```\nMeta is base model definition, embedded in all kinds\n\n```go\ntype Metadata struct {\n\tID        string `json:\"id\"`\n\tHREF      string `json:\"href\"`\n\tKind      string `json:\"kind\"`\n\tVersion   string `json:\"version\"`\n\tBuildTime string `json:\"build_time\"`\n}\n```\nMetadata api metadata.\n\n```go\ntype PagingMeta struct {\n\tPage  int64\n\tSize  int64\n\tTotal int64\n}\n```\nPagingMeta List Paging metadata\n\n```go\ntype ReferenceMap = map[string][]openapi.ObjectReference\n```\nReferenceMap is the API-level representation of resource references, keyed by ref type (e.g. \"wif\\_config\") with a list of object references per type.\n\n```go\ntype Resource struct {\n\tOwnerID     *string    `json:\"owner_id,omitempty\" gorm:\"size:255\"`\n\tOwnerHref   *string    `json:\"owner_href,omitempty\" gorm:\"size:500\"`\n\tOwnerKind   *string    `json:\"owner_kind,omitempty\" gorm:\"size:100\"`\n\tDeletedBy   *string    `json:\"deleted_by,omitempty\" gorm:\"size:255\"`\n\tDeletedTime *time.Time `json:\"deleted_time,omitempty\"`\n\tMeta\n\tKind       string              `json:\"kind\" gorm:\"size:100;not null\"`\n\tName       string              `json:\"name\" gorm:\"size:100;not null\"`\n\tHref       string              `json:\"href,omitempty\" gorm:\"size:500\"`\n\tCreatedBy  string              `json:\"created_by\" gorm:\"size:255;not null\"`\n\tUpdatedBy  string              `json:\"updated_by\" gorm:\"size:255;not null\"`\n\tLabels     []ResourceLabel     `json:\"-\" gorm:\"foreignKey:ResourceID;references:ID\"`\n\tSpec       datatypes.JSON      `json:\"spec\" gorm:\"type:jsonb;not null\"`\n\tTenancy    datatypes.JSON      `json:\"tenancy\" gorm:\"type:jsonb;not null;default:'{}'\"`\n\tConditions []ResourceCondition `json:\"-\" gorm:\"foreignKey:ResourceID;references:ID\"`\n\tReferences []ResourceReference `json:\"-\" gorm:\"foreignKey:SourceID;references:ID\"`\n\tGeneration int32               `json:\"generation\" gorm:\"default:1;not null\"`\n}\n```\nResource is the generic GORM model backing all entity types managed by the entity registry — including Cluster, NodePool, Channel, Version, and WifConfig. Entity kinds are differentiated by the Kind field.\n\n```go\nfunc (r *Resource) BeforeCreate(tx *gorm.DB) error\n```\n\n```go\nfunc (r *Resource) BeforeUpdate(tx *gorm.DB) error\n```\n\n```go\nfunc (r *Resource) IncrementGeneration()\n```\n\n```go\nfunc (r *Resource) MarkDeleted(by string, t time.Time)\n```\n\n```go\nfunc (r *Resource) SetOwner(id, kind, href string)\n```\n\n```go\nfunc (r Resource) TableName() string\n```\n\n```go\ntype ResourceCondition struct {\n\tCreatedTime        time.Time               `json:\"created_time\" gorm:\"not null\"`\n\tLastUpdatedTime    time.Time               `json:\"last_updated_time\" gorm:\"not null\"`\n\tLastTransitionTime time.Time               `json:\"last_transition_time\" gorm:\"not null\"`\n\tReason             *string                 `json:\"reason,omitempty\" gorm:\"type:text\"`\n\tMessage            *string                 `json:\"message,omitempty\" gorm:\"type:text\"`\n\tResourceID         string                  `json:\"-\" gorm:\"primaryKey;size:255;not null\"`\n\tType               string                  `json:\"type\" gorm:\"primaryKey;size:100;not null\"`\n\tStatus             ResourceConditionStatus `json:\"status\" gorm:\"size:10;not null\"`\n\tObservedGeneration int32                   `json:\"observed_generation\" gorm:\"default:0;not null\"`\n}\n```\nResourceCondition is the GORM model for the resource\\_conditions table and the domain type for JSONB deserialization in resources. ResourceID is excluded from JSON to preserve JSONB backward compat.\n\n```go\nfunc (ResourceCondition) TableName() string\n```\n\n```go\ntype ResourceConditionStatus string\n```\nResourceConditionStatus represents the status of a resource condition (True/False only) Domain equivalent of openapi.ResourceConditionStatus\n\n```go\nconst (\n\tConditionTrue  ResourceConditionStatus = \"True\"  // String value matches openapi.TRUE\n\tConditionFalse ResourceConditionStatus = \"False\" // String value matches openapi.FALSE\n)\n```\n\n```go\ntype ResourceLabel struct {\n\tResourceID string `json:\"-\" gorm:\"primaryKey;size:255;not null\"`\n\tKey        string `json:\"key\" gorm:\"primaryKey;size:255;not null\"`\n\tValue      string `json:\"value\" gorm:\"size:255;not null\"`\n}\n```\n\n```go\nfunc (ResourceLabel) TableName() string\n```\n\n```go\ntype ResourceList []*Resource\n```\n\n```go\ntype ResourcePatch struct {\n\tSpec       map[string]interface{}\n\tLabels     map[string]string\n\tReferences ReferenceMap\n}\n```\n\n```go\ntype ResourceReference struct {\n\tSourceID   string `json:\"source_id\" gorm:\"primaryKey;column:source_id;size:255\"`\n\tRefType    string `json:\"ref_type\" gorm:\"primaryKey;column:ref_type;size:255\"`\n\tTargetID   string `json:\"target_id\" gorm:\"primaryKey;column:target_id;size:255\"`\n\tTargetKind string `json:\"target_kind\" gorm:\"column:target_kind;size:100;not null\"`\n}\n```\nResourceReference stores a single non-ownership association between two resources. Table: resource\\_references. Natural composite PK (source\\_id, ref\\_type, target\\_id).\n\n```go\nfunc (ResourceReference) TableName() string\n```\n\n```go\ntype ResourceSummary struct {\n\tKind string\n\tName string\n}\n```\nResourceSummary carries kind + name for error messages (e.g. FindReferencers 409).\n\n","path":"github.com/openshift-hyperfleet/hyperfleet-api/pkg/api","name":"api","synopsis":"","isRedistributable":true}
