package governance import "time" type ReleaseOperation string const ( ReleaseOperationPublish ReleaseOperation = "publish" ReleaseOperationRollback ReleaseOperation = "rollback" ) func (operation ReleaseOperation) Valid() bool { return operation == ReleaseOperationPublish || operation == ReleaseOperationRollback } type ReleaseExecutionState string const ( ReleaseExecutionPending ReleaseExecutionState = "pending" ReleaseExecutionRunning ReleaseExecutionState = "running" // R4: a rollback execution compensates in rolling_back and terminates in // rolled_back (all compensated) or rollback_failed (manual action needed). ReleaseExecutionRollingBack ReleaseExecutionState = "rolling_back" ReleaseExecutionRolledBack ReleaseExecutionState = "rolled_back" ReleaseExecutionRollbackFailed ReleaseExecutionState = "rollback_failed" ReleaseExecutionCompleted ReleaseExecutionState = "completed" ReleaseExecutionFailed ReleaseExecutionState = "failed" ) func (state ReleaseExecutionState) Valid() bool { switch state { case ReleaseExecutionPending, ReleaseExecutionRunning, ReleaseExecutionRollingBack, ReleaseExecutionRolledBack, ReleaseExecutionRollbackFailed, ReleaseExecutionCompleted, ReleaseExecutionFailed: return true default: return false } } type ReleaseExecution struct { ID string `json:"id"` ReleaseBatchID string `json:"release_batch_id"` Operation ReleaseOperation `json:"operation"` PriorExecutionID string `json:"prior_execution_id"` State ReleaseExecutionState `json:"state"` FailureLevel string `json:"failure_level"` RestoreTrigger string `json:"restore_trigger"` ReleaseChangeSetID string `json:"release_change_set_id"` TargetEnvironment string `json:"target_environment"` AuthorizedBy string `json:"authorized_by"` AuthorizationCode string `json:"authorization_code"` JobID string `json:"job_id"` ManifestSHA256 string `json:"manifest_sha256"` ItemCount int `json:"item_count"` BatchSize int `json:"batch_size"` CurrentBatch int `json:"current_batch"` TotalBatches int `json:"total_batches"` CompletedItemCount int `json:"completed_item_count"` FailedItemCount int `json:"failed_item_count"` ErrorCode string `json:"error_code"` CreatedAt time.Time `json:"created_at"` StartedAt *time.Time `json:"started_at"` CompletedAt *time.Time `json:"completed_at"` } type AuthorizeReleaseBatchRequest struct { BatchID string AuthorizedBy string AuthorizationCode string Now time.Time } type AuthorizeReleaseRollbackRequest struct { PriorExecutionID string AuthorizedBy string AuthorizationCode string Now time.Time } type RetryReleaseExecutionRequest struct { ExecutionID string Now time.Time } type ReleaseExecutionFilter struct { Operation string State string Limit int Offset int } type ReleaseExecutionPage struct { Items []ReleaseExecution Total int Limit int Offset int } type ReleaseItemExecutionView struct { PublicationID string `json:"publication_id"` Title string `json:"title"` Action string `json:"action"` State string `json:"state"` PreviousProductionRevision string `json:"previous_production_revision"` ProductionRevision string `json:"production_revision"` ErrorCode string `json:"error_code"` CreatedAt time.Time `json:"created_at"` CompletedAt *time.Time `json:"completed_at"` // TargetKnowledgeBaseID 是该项冻结的目标知识库(迁移 000044 起)。旧行可能为空。 TargetKnowledgeBaseID string `json:"target_knowledge_base_id"` } type ReleaseExecutionDetail struct { ReleaseExecution Items []ReleaseItemExecutionView `json:"items"` }