Documentation
¶
Index ¶
- Variables
- func Initialize(workspace string, manifest project.Manifest) (string, error)
- type EntityMutation
- type EntityPresence
- type EntityRecord
- type EntityReference
- type EntityReferencedError
- type EntityReferences
- type EntityView
- type GitPrepareInput
- type PlanInvalidatedError
- type ProviderInfo
- type ReleaseConfirmation
- type ReleaseRequest
- type RemoteETagMismatchError
- type RemoteProjection
- type RemoteValueProjection
- type RollbackRequest
- type Service
- func (s *Service) CheckPlanForPublish(ctx context.Context, id string) (plan.Plan, error)
- func (s *Service) CreateEnvironment(_ context.Context, expectedRevision uint64, environment project.Environment) (project.Snapshot, project.Environment, error)
- func (s *Service) CreateRollbackPreview(ctx context.Context, environmentID, releaseID string) (operation.Operation, error)
- func (s *Service) Defaults(_ context.Context, environmentID, format string) ([]byte, string, string, error)
- func (s *Service) DeleteEnvironment(_ context.Context, expectedRevision uint64, environmentID string) (project.Snapshot, error)
- func (s *Service) Diagnostics(ctx context.Context, environmentID string) (validation.Result, uint64, error)
- func (s *Service) GetDraft(_ context.Context, environmentID string) (draft.View, uint64, error)
- func (s *Service) GetEntity(_ context.Context, environmentID, entityType, entityID string) (EntityView, uint64, error)
- func (s *Service) GetEntityReferences(_ context.Context, environmentID, entityType, entityID string) (EntityReferences, uint64, error)
- func (s *Service) GetEnvironment(ctx context.Context, environmentID string) (project.Snapshot, project.Environment, error)
- func (s *Service) GetPack(_ context.Context, name, version string) (packs.Definition, uint64, error)
- func (s *Service) GetPackSchema(_ context.Context, name, version string, requestedVersion *uint64) (packs.Schema, uint64, error)
- func (s *Service) GetPlan(ctx context.Context, id string) (plan.Plan, error)
- func (s *Service) GitCommit(ctx context.Context, files []string, message, idempotencyKey string) (gitreview.CommitResult, error)
- func (s *Service) GitCreateBranch(ctx context.Context, branch, idempotencyKey string) (gitreview.BranchResult, error)
- func (s *Service) GitPrepare(ctx context.Context, input GitPrepareInput) (gitreview.PrepareResult, error)
- func (s *Service) GitStatus(ctx context.Context) (gitreview.Status, error)
- func (s *Service) ImportSource(ctx context.Context, environmentID string, expectedRevision uint64, ...) (draft.View, uint64, error)
- func (s *Service) InspectSource(_ context.Context) (SourceInspectResult, error)
- func (s *Service) ListEntities(_ context.Context, environmentID, entityType string) ([]EntityView, uint64, error)
- func (s *Service) ListPacks(_ context.Context) packs.Snapshot
- func (s *Service) MutateDraft(_ context.Context, environmentID string, mutation draft.Mutation) (draft.View, uint64, error)
- func (s *Service) MutateEntity(_ context.Context, environmentID string, mutation EntityMutation) (EntityView, uint64, error)
- func (s *Service) Operation(_ context.Context, id string) (operation.Operation, error)
- func (s *Service) PlanArtifact(ctx context.Context, planID, name string) ([]byte, plan.ArtifactMetadata, plan.Plan, error)
- func (s *Service) PreviewSourceSave(ctx context.Context, environmentID string) (source.Preview, error)
- func (s *Service) ProviderStatus(ctx context.Context, environmentID string) (ProviderInfo, error)
- func (s *Service) Release(ctx context.Context, id string) (release.Release, bool)
- func (s *Service) ReleaseWithError(_ context.Context, id string) (release.Release, bool, error)
- func (s *Service) Releases(ctx context.Context, environmentID string) []release.Release
- func (s *Service) ReleasesPage(_ context.Context, environmentID string, limit int, cursor string) ([]release.Release, error)
- func (s *Service) RemoteProjection(ctx context.Context, environmentID string) (RemoteProjection, error)
- func (s *Service) RollbackPreview(_ context.Context, environmentID, releaseID string) (release.RollbackPreview, error)
- func (s *Service) SaveDraft(_ context.Context, environmentID string, expectedRevision uint64, ...) (draft.View, uint64, error)
- func (s *Service) Snapshot(_ context.Context) (project.Snapshot, error)
- func (s *Service) SourceInfo(_ context.Context) (SourceInfo, error)
- func (s *Service) StartPlan(ctx context.Context, environmentID string) (operation.Operation, error)
- func (s *Service) StartProviderConnect(ctx context.Context, environmentID, credentialsPath string) (operation.Operation, error)
- func (s *Service) StartPull(ctx context.Context, environmentID string) (operation.Operation, error)
- func (s *Service) StartRelease(ctx context.Context, environmentID, idempotencyKey string, ...) (operation.Operation, error)
- func (s *Service) StartRemoteValidate(ctx context.Context, environmentID, planID string) (operation.Operation, error)
- func (s *Service) StartRollback(ctx context.Context, environmentID, releaseID, idempotencyKey string, ...) (operation.Operation, error)
- func (s *Service) UpdateEnvironment(_ context.Context, expectedRevision uint64, environmentID string, ...) (project.Snapshot, project.Environment, error)
- func (s *Service) UpdateProject(_ context.Context, expectedRevision uint64, metadata project.Project) (project.Snapshot, error)
- func (s *Service) ValidateDraft(_ context.Context, environmentID string) (validation.Result, uint64, error)
- type SourceInfo
- type SourceInspectResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrEntityNotFound = errors.New("entity not found") ErrEntityTypeInvalid = errors.New("entity type is not declared by the Pack") ErrEntityIDInvalid = errors.New("entity ID is invalid") ErrEntityIDImmutable = errors.New("entity ID is immutable") ErrEntityExists = errors.New("entity already exists") )
var ( ErrConfirmationInvalid = errors.New("release confirmation is invalid") ErrIdempotencyRequired = errors.New("idempotency key is required") )
var ( ErrRollbackPreviewInvalid = errors.New("rollback preview is invalid") ErrReleaseNotFound = errors.New("release not found") ErrDefaultsFormat = errors.New("defaults format is invalid") )
var ( ErrLastEnvironment = errors.New("cannot delete the last environment") ErrProviderProjectIDMissing = errors.New("先在环境管理中填写 Firebase 项目 ID") )
Functions ¶
Types ¶
type EntityMutation ¶
type EntityPresence ¶
type EntityPresence struct {
Present bool `json:"present"`
Value *EntityRecord `json:"value,omitempty"`
}
func (EntityPresence) MarshalJSON ¶
func (p EntityPresence) MarshalJSON() ([]byte, error)
type EntityRecord ¶
EntityRecord is the Pack-neutral record representation exposed by the entity resource. Its runtime collection shape is owned by entities.Record.
type EntityReference ¶
type EntityReferencedError ¶
type EntityReferencedError struct {
Revision uint64
References []EntityReference
}
func (*EntityReferencedError) Error ¶
func (e *EntityReferencedError) Error() string
type EntityReferences ¶
type EntityReferences struct {
EntityRef string `json:"entity_ref"`
ReferencedBy []EntityReference `json:"referenced_by"`
}
type EntityView ¶
type EntityView struct {
EntityRef string `json:"entity_ref"`
EntityType string `json:"entity_type"`
EntityID string `json:"entity_id"`
Source EntityPresence `json:"source"`
Draft EntityPresence `json:"draft"`
Resolved EntityPresence `json:"resolved"`
Effective EntityPresence `json:"effective"`
Origin string `json:"origin"`
SourceRevision string `json:"source_revision"`
}
type GitPrepareInput ¶
type PlanInvalidatedError ¶
type PlanInvalidatedError struct{ PlanID, Reason string }
PlanInvalidatedError is the 409 precondition domain for local inputs. Remote ETag conflicts intentionally use RemoteETagMismatchError instead.
func (*PlanInvalidatedError) Error ¶
func (e *PlanInvalidatedError) Error() string
type ProviderInfo ¶
type ReleaseConfirmation ¶
type ReleaseRequest ¶
type ReleaseRequest struct {
PlanID string
ExpectedDraftRevision uint64
ExpectedRemoteETag string
Confirmation ReleaseConfirmation
}
ReleaseRequest is the frozen POST /releases body expressed independently of HTTP. Risk severity and environment kind are intentionally absent.
type RemoteETagMismatchError ¶
type RemoteETagMismatchError struct {
PlanID, EnvironmentID, Expected string
Current remote.Snapshot
}
RemoteETagMismatchError is the 412 domain used by a publish preflight. It contains only the protected remote summary, never provider credentials.
func (*RemoteETagMismatchError) Error ¶
func (e *RemoteETagMismatchError) Error() string
type RemoteProjection ¶
type RemoteProjection struct {
EnvironmentID string `json:"environment_id"`
SnapshotETag string `json:"snapshot_etag"`
ObservedAt string `json:"observed_at"`
Projections []RemoteValueProjection `json:"projections"`
}
type RemoteValueProjection ¶
type RemoteValueProjection struct {
ProjectionID string `json:"projection_id"`
EntityRef string `json:"entity_ref"`
FieldPath string `json:"field_path"`
ParameterKey string `json:"parameter_key"`
ValueSummary string `json:"value_summary"`
SnapshotETag string `json:"snapshot_etag"`
ObservedAt string `json:"observed_at"`
Availability string `json:"availability"`
Redacted bool `json:"redacted"`
ReasonCode string `json:"reason_code,omitempty"`
}
type RollbackRequest ¶
type RollbackRequest struct {
RollbackPreviewID string
ExpectedRemoteETag string
Confirmation ReleaseConfirmation
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func OpenWithPacks ¶
func OpenWithPacksAndProviderFactory ¶
func OpenWithPacksAndProviderFactory(workspace string, registry *packs.Registry, factory func(project.Environment) (provider.Adapter, error)) (*Service, error)
OpenWithPacksAndProviderFactory keeps the application orchestration testable without allowing provider protocol details into the app package.
func (*Service) CheckPlanForPublish ¶
CheckPlanForPublish is the reusable preflight boundary for Spec 009. It is deliberately not an HTTP endpoint: this Spec creates Plans but does not add publishing. Its typed errors preserve the frozen 409/412 error separation.
func (*Service) CreateEnvironment ¶
func (*Service) CreateRollbackPreview ¶
func (s *Service) CreateRollbackPreview(ctx context.Context, environmentID, releaseID string) (operation.Operation, error)
CreateRollbackPreview reads the live provider state before constructing an immutable preview. The protected target template is taken from the release audit store, never from an API caller.
func (*Service) Defaults ¶
func (s *Service) Defaults(_ context.Context, environmentID, format string) ([]byte, string, string, error)
Defaults exports values from the protected current remote snapshot. These values are client defaults already intended for distribution; credentials and provider tokens are not part of the snapshot or this format.
func (*Service) DeleteEnvironment ¶
func (*Service) Diagnostics ¶
func (s *Service) Diagnostics(ctx context.Context, environmentID string) (validation.Result, uint64, error)
Diagnostics returns the latest stored complete-validation result.
func (*Service) GetEntityReferences ¶
func (*Service) GetEnvironment ¶
func (*Service) GetPackSchema ¶
func (*Service) GitCreateBranch ¶
func (*Service) GitPrepare ¶
func (s *Service) GitPrepare(ctx context.Context, input GitPrepareInput) (gitreview.PrepareResult, error)
func (*Service) GitStatus ¶
GitStatus is available only to Git JSON projects. It intentionally exposes workspace-relative paths and commit metadata, never Git credentials.
func (*Service) ImportSource ¶
func (s *Service) ImportSource(ctx context.Context, environmentID string, expectedRevision uint64, expectedSourceRevision string) (draft.View, uint64, error)
ImportSource installs the current source snapshot as explicit target-layer draft replacements. The source itself is never modified by import.
func (*Service) InspectSource ¶
func (s *Service) InspectSource(_ context.Context) (SourceInspectResult, error)
func (*Service) ListEntities ¶
func (*Service) MutateDraft ¶
func (*Service) MutateEntity ¶
func (s *Service) MutateEntity(_ context.Context, environmentID string, mutation EntityMutation) (EntityView, uint64, error)
func (*Service) PlanArtifact ¶
func (*Service) PreviewSourceSave ¶
func (*Service) ProviderStatus ¶
func (*Service) ReleaseWithError ¶
func (*Service) ReleasesPage ¶
func (*Service) RemoteProjection ¶
func (*Service) RollbackPreview ¶
func (*Service) SaveDraft ¶
func (s *Service) SaveDraft(_ context.Context, environmentID string, expectedRevision uint64, expectedSourceRevision string) (draft.View, uint64, error)
SaveDraft writes the resolved source replacement for the selected view and then consumes that view's draft replacements. The draft Store retains the existing lock/snapshot boundary from Spec 004.
func (*Service) SourceInfo ¶
func (s *Service) SourceInfo(_ context.Context) (SourceInfo, error)
func (*Service) StartPlan ¶
StartPlan always creates a durable Operation before starting work. The operation store is deliberately the recovery authority for callers that disconnect while this local workflow runs.
func (*Service) StartProviderConnect ¶
func (*Service) StartRelease ¶
func (*Service) StartRemoteValidate ¶
func (*Service) StartRollback ¶
func (*Service) UpdateEnvironment ¶
func (*Service) UpdateProject ¶
func (*Service) ValidateDraft ¶
func (s *Service) ValidateDraft(_ context.Context, environmentID string) (validation.Result, uint64, error)
ValidateDraft runs the complete Spec 007 validation against one captured DraftView and stores the resulting project-level draft revision.
type SourceInfo ¶
type SourceInfo struct {
Type string
Capabilities source.Capabilities
Status source.Status
}
type SourceInspectResult ¶
type SourceInspectResult struct {
Workspace source.GitWorkspace
ProfilePath string
Matched bool
Diagnostics []source.MappingDiagnostic
}