apikit

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package apikit is the shared API layer for the platform's JSON services.

It owns the conventions every API endpoint follows:

  • typed, safe errors (Error with BadRequest, NotFound, Conflict and friends) written through WriteError and WriteEnvelope as one standard error body;
  • pagination (limit and cursor parsing, NextLink, ListMeta);
  • query and body helpers: QueryInt rejects bad input with a 400, QueryIntOr falls back to a default, ClampInt bounds a value, WriteBodyDecodeError and WriteMethodNotAllowed map common failures to the standard envelope.

It also carries the request and response types of the platform-api endpoints that more than one module calls (the /internal/* service-to-service endpoints and shared records such as TeamMembership and UserDeactivationResult), so a field rename fails to compile on both sides of the split. Those files (wire_*.go) hold data shapes only: no handlers, storage or business rules.

Transport construction, TLS and tracing are deliberately not here (see transport), and generic response primitives live in httpx.

Index

Constants

View Source
const (
	CodeInternalError         = "internal_error"
	CodeInvalidRequestBody    = "invalid_request_body"
	CodeRequestTooLarge       = "request_too_large"
	CodeInvalidQueryParam     = "invalid_query_param"
	CodeMethodNotAllowed      = "method_not_allowed"
	CodeUnauthorized          = "unauthorized"
	CodeForbidden             = "forbidden"
	CodeNotFound              = "not_found"
	CodeConflict              = "conflict"
	CodeServiceUnavailable    = "service_unavailable"
	CodeQueryFailed           = "query_failed"
	CodeAuthFailed            = "auth_failed"
	CodePlatformUnavailable   = "platform_unavailable"
	CodeKubernetesUnavailable = "kubernetes_unavailable"
	CodeInvalidVersionTag     = "invalid_version_tag"
	CodeTooManyRequests       = "too_many_requests"
)

Stable machine-readable error codes. Wording in human messages may change; codes must not be derived from message text at runtime.

View Source
const (
	DefaultListLimit = 50
	MaxListLimit     = 200
)
View Source
const (
	GrantIntentStateActive  = "Active"
	GrantIntentStateRevoked = "Revoked"
	GrantIntentStateDeleted = "Deleted"
)

GrantIntentState values describe the authoritative desired lifecycle state of one grant incarnation in Platform API.

View Source
const (
	AccessIntentOutcomeApplied    = "Applied"
	AccessIntentOutcomeCleaned    = "Cleaned"
	AccessIntentOutcomeActivated  = "Activated"
	AccessIntentOutcomeSuperseded = "Superseded"
	AccessIntentOutcomeFailed     = "Failed"
	AccessIntentOutcomeTerminal   = "Terminal"
)

AccessIntentOutcome values describe bounded execution receipts written by runtime workers for a specific intent incarnation and desired revision.

View Source
const (
	AccessIntentErrorTransient         = "transient"
	AccessIntentErrorOwnershipConflict = "ownership_conflict"
	AccessIntentErrorInvalidConfig     = "invalid_config"
	AccessIntentErrorAuthorityRevoked  = "authority_revoked"
	AccessIntentErrorExhausted         = "exhausted"
)

AccessIntentErrorClass values classify worker reconciliation failures.

View Source
const (
	AccessIntentHealthPending     = "Pending"
	AccessIntentHealthProgressing = "Progressing"
	AccessIntentHealthReady       = "Ready"
	AccessIntentHealthDegraded    = "Degraded"
	AccessIntentHealthRevoked     = "Revoked"
	AccessIntentHealthDeleted     = "Deleted"
	AccessIntentHealthUnknown     = "Unknown"
)

AccessIntentHealth values describe independently observed Kubernetes and gateway health for access-control intents.

View Source
const (
	GrantPropagationVerified   = "Verified"
	GrantPropagationPending    = "Pending"
	GrantPropagationUnverified = "Unverified"
	GrantPropagationUnknown    = "Unknown"
)

GrantPropagationStatus values describe independently verified gateway propagation for a grant revision. Propagation is never inferred from Kubernetes projection alone.

View Source
const (
	EnrollmentStatePending    = "Pending"
	EnrollmentStateSubmitted  = "Submitted"
	EnrollmentStateIssued     = "Issued"
	EnrollmentStateActivated  = "Activated"
	EnrollmentStateRevoked    = "Revoked"
	EnrollmentStateFailed     = "Failed"
	EnrollmentStateSuperseded = "Superseded"
)

EnrollmentState values describe the durable lifecycle state of an adapter certificate enrollment operation. Private keys and raw secrets are never persisted in enrollment intents or receipts.

View Source
const (
	OperationTeamCreate = "team.create"

	OperationPending    = "Pending"
	OperationRunning    = "Running"
	OperationSucceeded  = "Succeeded"
	OperationFailed     = "Failed"
	OperationSuperseded = "Superseded"
)
View Source
const (
	TeamIntentHealthPending     = "Pending"
	TeamIntentHealthProgressing = "Progressing"
	TeamIntentHealthReady       = "Ready"
	TeamIntentHealthDegraded    = "Degraded"
	TeamIntentHealthDeleted     = "Deleted"
	TeamIntentHealthUnknown     = "Unknown"
)

TeamIntentHealth values describe observed Kubernetes namespace health independently from River job execution state.

View Source
const (
	TeamIntentOutcomeApplied    = "Applied"
	TeamIntentOutcomeCleaned    = "Cleaned"
	TeamIntentOutcomeSuperseded = "Superseded"
	TeamIntentOutcomeFailed     = "Failed"
	TeamIntentOutcomeTerminal   = "Terminal"
)

TeamIntentOutcome values describe bounded execution receipts recorded by runtime workers for a specific team incarnation and desired revision.

View Source
const (
	TeamIntentErrorTransient         = "transient"
	TeamIntentErrorOwnershipConflict = "ownership_conflict"
	TeamIntentErrorInvalidConfig     = "invalid_config"
	TeamIntentErrorExhausted         = "exhausted"
)

TeamIntentErrorClass values classify worker reconciliation failures.

View Source
const (
	WorkloadIntentHealthPending     = "Pending"
	WorkloadIntentHealthProgressing = "Progressing"
	WorkloadIntentHealthReady       = "Ready"
	WorkloadIntentHealthDegraded    = "Degraded"
	WorkloadIntentHealthDeleted     = "Deleted"
	WorkloadIntentHealthUnknown     = "Unknown"
)

WorkloadIntentHealth values describe independently observed Kubernetes workload health without coupling it to River job execution state.

View Source
const (
	WorkloadIntentOutcomeApplied           = "Applied"
	WorkloadIntentOutcomeCleaned           = "Cleaned"
	WorkloadIntentOutcomeSuperseded        = "Superseded"
	WorkloadIntentOutcomeFailed            = "Failed"
	WorkloadIntentOutcomeTerminal          = "Terminal"
	WorkloadIntentOutcomeBlockedDependency = "BlockedDependency"
)

WorkloadIntentOutcome values describe bounded execution receipts recorded by runtime workers for a specific desired revision and execution fence.

View Source
const (
	WorkloadIntentErrorTransient         = "transient"
	WorkloadIntentErrorOwnershipConflict = "ownership_conflict"
	WorkloadIntentErrorInvalidConfig     = "invalid_config"
	WorkloadIntentErrorDependencyPending = "dependency_pending"
	WorkloadIntentErrorExhausted         = "exhausted"
)

WorkloadIntentErrorClass values classify worker reconciliation failures.

View Source
const (
	ServerLifecycleActive   = "Active"
	ServerLifecycleRetiring = "Retiring"
	ServerLifecycleRetired  = "Retired"
)

ServerLifecycle values describe the durable lifecycle of an MCPServer intent.

View Source
const (
	ImageUploadStateUploading = "Uploading"
	ImageUploadStateFinalized = "Finalized"
	ImageUploadStateAborted   = "Aborted"
	ImageUploadStateExpired   = "Expired"
)

ImageUploadState values track durable staging upload progress prior to queue acceptance. Only Finalized uploads may be enqueued for registry publication.

View Source
const (
	ImagePublicationStatusUploading  = "Uploading"
	ImagePublicationStatusQueued     = "Queued"
	ImagePublicationStatusPublishing = "Publishing"
	ImagePublicationStatusPublished  = "Published"
	ImagePublicationStatusFailed     = "Failed"
	ImagePublicationStatusAborted    = "Aborted"
)

ImagePublicationStatus values track the durable image publication lifecycle.

View Source
const (
	MutableTagPolicyRejectOverlap = "reject_overlap"
	MutableTagPolicyAllowOverlap  = "allow_overlap"
)

MutableTagPolicy values control concurrent publication overlap for the same registry/repository:tag target.

View Source
const (
	RestartStatusQueued     = "Queued"
	RestartStatusInProgress = "InProgress"
	RestartStatusCompleted  = "Completed"
	RestartStatusFailed     = "Failed"
)

RestartStatus values track durable imperative component restart operations.

View Source
const ApplyMaxBytes = 64 * 1024

Variables

This section is empty.

Functions

func ClampInt

func ClampInt(n, minValue, maxValue int) int

ClampInt limits n to the inclusive range [minValue, maxValue].

func EncodeCursor

func EncodeCursor(offset int) string

EncodeCursor returns the next opaque cursor for a list page.

func NextLink(r *http.Request, nextCursor string, limit int) string

NextLink builds an absolute or path-only next URL with cursor and limit query params.

func ParseCursor

func ParseCursor(raw string) (int, error)

ParseCursor decodes an opaque cursor or returns offset 0 when absent.

func ParseLimit

func ParseLimit(r *http.Request, defaultLimit, maxLimit int) (int, error)

ParseLimit reads limit with defaults and strict bounds. Invalid values return an *Error.

func QueryInt

func QueryInt(r *http.Request, key string, fallback, minValue, maxValue int) (int, error)

QueryInt parses a required-shape integer query param. Empty uses fallback. Non-integer or out-of-range values return *Error with CodeInvalidQueryParam.

func QueryIntOr

func QueryIntOr(r *http.Request, key string, fallback int) int

QueryIntOr parses an optional integer query param and returns fallback when the value is missing, blank or not an integer. It never rejects the request; use QueryInt when invalid input must be a 400.

func QueryRFC3339Time

func QueryRFC3339Time(r *http.Request, key string) (time.Time, error)

QueryRFC3339Time parses an optional RFC3339 timestamp query param.

func WriteBodyDecodeError

func WriteBodyDecodeError(w http.ResponseWriter, err error)

WriteBodyDecodeError maps decode failures to the standard error envelope.

func WriteEnvelope

func WriteEnvelope(w http.ResponseWriter, status int, code, message string)

WriteEnvelope writes {"error":"<code>","message":"<description>"}.

func WriteError

func WriteError(w http.ResponseWriter, logger *zap.Logger, err error)

WriteError renders err as the standard JSON error envelope.

func WriteMethodNotAllowed

func WriteMethodNotAllowed(w http.ResponseWriter, methods ...string)

WriteMethodNotAllowed sets Allow and returns method_not_allowed.

Types

type AccessIntentObserverLeaseRequest

type AccessIntentObserverLeaseRequest struct {
	ClusterKey string `json:"cluster_key,omitempty"`
	ObserverID string `json:"observer_id"`
}

AccessIntentObserverLeaseRequest is POST /internal/access-intents/observer-lease.

type AccessIntentObserverLeaseResponse

type AccessIntentObserverLeaseResponse struct {
	ClusterKey    string `json:"cluster_key"`
	ObserverID    string `json:"observer_id"`
	ObserverEpoch int64  `json:"observer_epoch"`
}

AccessIntentObserverLeaseResponse is POST /internal/access-intents/observer-lease.

type Agent

type Agent struct {
	ID            string     `json:"id"`
	TeamID        string     `json:"team_id"`
	TeamSlug      string     `json:"team_slug"`
	Name          string     `json:"name"`
	Status        string     `json:"status"`
	CreatedBy     string     `json:"created_by,omitempty"`
	CreatedAt     time.Time  `json:"created_at"`
	UpdatedAt     time.Time  `json:"updated_at"`
	DeactivatedAt *time.Time `json:"deactivated_at,omitempty"`
	DeactivatedBy string     `json:"deactivated_by,omitempty"`
}

type AgentCleanupFenceRequest

type AgentCleanupFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

AgentCleanupFenceRequest is POST /internal/access-intents/agent-cleanups/{agent_id}/fence.

type AgentCleanupFenceResponse

type AgentCleanupFenceResponse struct {
	FenceEpoch int64              `json:"fence_epoch"`
	Intent     AgentCleanupIntent `json:"intent"`
}

AgentCleanupFenceResponse is POST /internal/access-intents/agent-cleanups/{agent_id}/fence.

type AgentCleanupIntent

type AgentCleanupIntent struct {
	AgentID              string               `json:"agent_id"`
	TeamID               string               `json:"team_id"`
	DesiredRevisionID    string               `json:"desired_revision_id"`
	DeactivatedAt        time.Time            `json:"deactivated_at"`
	RevokedSessionsCount int64                `json:"revoked_sessions_count"`
	UpdatedAt            time.Time            `json:"updated_at"`
	Receipt              *AgentCleanupReceipt `json:"receipt,omitempty"`
}

AgentCleanupIntent records the durable post-deactivation follow-up work committed atomically alongside agent deactivation and session revocation.

type AgentCleanupReceipt

type AgentCleanupReceipt struct {
	FenceEpoch        int64      `json:"fence_epoch"`
	FenceHolder       string     `json:"fence_holder,omitempty"`
	AppliedRevisionID string     `json:"applied_revision_id,omitempty"`
	Outcome           string     `json:"outcome,omitempty"`
	Attempt           int        `json:"attempt,omitempty"`
	WorkerID          string     `json:"worker_id,omitempty"`
	LastErrorClass    string     `json:"last_error_class,omitempty"`
	LastError         string     `json:"last_error,omitempty"`
	AppliedAt         *time.Time `json:"applied_at,omitempty"`
	UpdatedAt         time.Time  `json:"updated_at"`
}

AgentCleanupReceipt records fenced execution progress for post-deactivation follow-up reconciliation after an agent has already been atomically deactivated in PostgreSQL.

type AgentCleanupReceiptRequest

type AgentCleanupReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

AgentCleanupReceiptRequest is PUT /internal/access-intents/agent-cleanups/{agent_id}/receipt.

type AgentCreateRequest

type AgentCreateRequest struct {
	Name      string `json:"name"`
	CreatedBy string `json:"created_by"`
}

type AgentPage

type AgentPage struct {
	Agents     []Agent `json:"agents"`
	NextCursor string  `json:"next_cursor,omitempty"`
}

type AgentRenameRequest

type AgentRenameRequest struct {
	Name string `json:"name"`
}

type AuditEvent

type AuditEvent struct {
	UserID           string `json:"user_id,omitempty"`
	Action           string `json:"action"`
	Resource         string `json:"resource"`
	Namespace        string `json:"namespace,omitempty"`
	Status           string `json:"status"`
	Message          string `json:"message,omitempty"`
	ActorIP          string `json:"actor_ip,omitempty"`
	RequestID        string `json:"request_id,omitempty"`
	Source           string `json:"source,omitempty"`
	AuthIdentity     string `json:"auth_identity,omitempty"`
	ImageRef         string `json:"image_ref,omitempty"`
	ServerName       string `json:"server_name,omitempty"`
	DeploymentTarget string `json:"deployment_target,omitempty"`
	AgentID          string `json:"agent_id,omitempty"`
	TeamID           string `json:"team_id,omitempty"`
}

AuditEvent is POST /internal/audit.

type CertificateActivity

type CertificateActivity struct {
	Recorded uint64                `json:"recorded"`
	Since    time.Time             `json:"since"`
	Until    time.Time             `json:"until"`
	Recent   []CertificateIssuance `json:"recent"`
}

CertificateActivity counts recorded issuance events within an explicit window. Older/unrecorded certificates cannot be inferred from session counts.

type CertificateIssuance

type CertificateIssuance struct {
	Namespace   string    `json:"namespace"`
	Session     string    `json:"session"`
	Server      string    `json:"server"`
	HumanID     string    `json:"human_id"`
	Serial      string    `json:"serial"`
	Fingerprint string    `json:"fingerprint_sha256"`
	SPIFFEID    string    `json:"spiffe_id"`
	NotBefore   time.Time `json:"not_before"`
	NotAfter    time.Time `json:"not_after"`
	IssuedAt    time.Time `json:"issued_at"`
}

CertificateIssuance contains public identity metadata, never key material or PEM.

type ComponentRestartCheckpoint

type ComponentRestartCheckpoint struct {
	Component string     `json:"component"`
	Completed bool       `json:"completed"`
	PatchedAt *time.Time `json:"patched_at,omitempty"`
	TargetUID string     `json:"target_uid,omitempty"`
	Error     string     `json:"error,omitempty"`
}

ComponentRestartCheckpoint records durable completion of one component patch inside a restart operation.

type CreateUserRequest

type CreateUserRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Role     string `json:"role"`
}

CreateUserRequest is POST /internal/identity/users.

type CreateUserResponse

type CreateUserResponse struct {
	User User `json:"user"`
}

CreateUserResponse is POST /internal/identity/users.

type CursorPayload

type CursorPayload struct {
	Offset int `json:"offset"`
}

CursorPayload is the opaque cursor encoding (base64url JSON).

type DeploymentIntent

type DeploymentIntent struct {
	DeploymentID        string                     `json:"deployment_id"`
	Namespace           string                     `json:"namespace"`
	Name                string                     `json:"name"`
	TeamID              string                     `json:"team_id,omitempty"`
	DesiredRevisionID   string                     `json:"desired_revision_id"`
	Deleted             bool                       `json:"deleted"`
	Image               string                     `json:"image"`
	Version             string                     `json:"version,omitempty"`
	Port                int32                      `json:"port"`
	Replicas            int32                      `json:"replicas"`
	SpecDigest          string                     `json:"spec_digest,omitempty"`
	TargetDeploymentUID string                     `json:"target_deployment_uid,omitempty"`
	UpdatedAt           time.Time                  `json:"updated_at"`
	Receipt             *WorkloadExecutionReceipt  `json:"receipt,omitempty"`
	Observation         *WorkloadStatusObservation `json:"observation,omitempty"`
}

DeploymentIntent is Platform API's authoritative desired state for a raw managed Kubernetes Deployment and Service (bypassing the MCPServer operator).

type DeploymentIntentDeleteRequest

type DeploymentIntentDeleteRequest struct {
	TargetDeploymentUID string `json:"target_deployment_uid,omitempty"`
}

DeploymentIntentDeleteRequest is POST /internal/workload-intents/deployments/{deployment_id}/delete.

type DeploymentIntentFenceRequest

type DeploymentIntentFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

DeploymentIntentFenceRequest is POST /internal/workload-intents/deployments/{deployment_id}/fence.

type DeploymentIntentFenceResponse

type DeploymentIntentFenceResponse struct {
	FenceEpoch int64            `json:"fence_epoch"`
	Intent     DeploymentIntent `json:"intent"`
}

DeploymentIntentFenceResponse is POST /internal/workload-intents/deployments/{deployment_id}/fence.

type DeploymentIntentListResponse

type DeploymentIntentListResponse struct {
	Intents []DeploymentIntent `json:"intents"`
}

DeploymentIntentListResponse is GET /internal/workload-intents/deployments.

type DeploymentIntentObservationRequest

type DeploymentIntentObservationRequest struct {
	ClusterKey         string                    `json:"cluster_key,omitempty"`
	ObserverID         string                    `json:"observer_id"`
	ObserverEpoch      int64                     `json:"observer_epoch"`
	ObservedRevisionID string                    `json:"observed_revision_id,omitempty"`
	TargetUID          string                    `json:"target_uid,omitempty"`
	ObservedGeneration int64                     `json:"observed_generation,omitempty"`
	Health             string                    `json:"health"`
	Reason             string                    `json:"reason,omitempty"`
	Message            string                    `json:"message,omitempty"`
	Conditions         []WorkloadIntentCondition `json:"conditions,omitempty"`
	VerifiedAt         time.Time                 `json:"verified_at,omitempty"`
}

DeploymentIntentObservationRequest is PUT /internal/workload-intents/deployments/{deployment_id}/observation.

type DeploymentIntentReceiptRequest

type DeploymentIntentReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	TargetUID         string `json:"target_uid,omitempty"`
	TargetGeneration  int64  `json:"target_generation,omitempty"`
	SpecDigest        string `json:"spec_digest,omitempty"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

DeploymentIntentReceiptRequest is PUT /internal/workload-intents/deployments/{deployment_id}/receipt.

type DeploymentIntentUpsertRequest

type DeploymentIntentUpsertRequest struct {
	DeploymentID string `json:"deployment_id"`
	Namespace    string `json:"namespace"`
	Name         string `json:"name"`
	TeamID       string `json:"team_id,omitempty"`
	Image        string `json:"image"`
	Version      string `json:"version,omitempty"`
	Port         int32  `json:"port"`
	Replicas     int32  `json:"replicas"`
	SpecDigest   string `json:"spec_digest,omitempty"`
}

DeploymentIntentUpsertRequest is POST /internal/workload-intents/deployments.

type EnrollmentIntent

type EnrollmentIntent struct {
	OperationID            string                 `json:"operation_id"`
	SessionUID             string                 `json:"session_uid"`
	ServerUID              string                 `json:"server_uid"`
	AgentID                string                 `json:"agent_id,omitempty"`
	Namespace              string                 `json:"namespace"`
	SessionName            string                 `json:"session_name"`
	CSRSHA256              string                 `json:"csr_sha256"`
	DesiredRevisionID      string                 `json:"desired_revision_id"`
	State                  string                 `json:"state"`
	CertificateRequestName string                 `json:"certificate_request_name"`
	CreatedAt              time.Time              `json:"created_at"`
	UpdatedAt              time.Time              `json:"updated_at"`
	ActivatedAt            *time.Time             `json:"activated_at,omitempty"`
	Receipt                *EnrollmentReceipt     `json:"receipt,omitempty"`
	Observation            *EnrollmentObservation `json:"observation,omitempty"`
}

EnrollmentIntent is Platform API's durable record for one adapter certificate enrollment operation, keyed idempotently to (SessionUID, ServerUID, CSRSHA256). Private keys are never stored.

type EnrollmentIntentActivateRequest

type EnrollmentIntentActivateRequest struct {
	DesiredRevisionID      string `json:"desired_revision_id"`
	FenceEpoch             int64  `json:"fence_epoch"`
	WorkerID               string `json:"worker_id"`
	CertificateRequestName string `json:"certificate_request_name,omitempty"`
	CertificateRequestUID  string `json:"certificate_request_uid,omitempty"`
	Serial                 string `json:"serial,omitempty"`
	Fingerprint            string `json:"fingerprint,omitempty"`
}

EnrollmentIntentActivateRequest is POST /internal/access-intents/enrollments/{op_id}/activate.

type EnrollmentIntentCreateRequest

type EnrollmentIntentCreateRequest struct {
	SessionUID  string `json:"session_uid"`
	ServerUID   string `json:"server_uid"`
	AgentID     string `json:"agent_id,omitempty"`
	Namespace   string `json:"namespace"`
	SessionName string `json:"session_name"`
	CSRSHA256   string `json:"csr_sha256"`
}

EnrollmentIntentCreateRequest is POST /internal/access-intents/enrollments.

type EnrollmentIntentFenceRequest

type EnrollmentIntentFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

EnrollmentIntentFenceRequest is POST /internal/access-intents/enrollments/{op_id}/fence.

type EnrollmentIntentFenceResponse

type EnrollmentIntentFenceResponse struct {
	FenceEpoch int64            `json:"fence_epoch"`
	Intent     EnrollmentIntent `json:"intent"`
}

EnrollmentIntentFenceResponse is POST /internal/access-intents/enrollments/{op_id}/fence.

type EnrollmentIntentListResponse

type EnrollmentIntentListResponse struct {
	Enrollments []EnrollmentIntent `json:"enrollments"`
}

EnrollmentIntentListResponse is GET /internal/access-intents/enrollments.

type EnrollmentIntentReceiptRequest

type EnrollmentIntentReceiptRequest struct {
	DesiredRevisionID      string `json:"desired_revision_id"`
	FenceEpoch             int64  `json:"fence_epoch"`
	State                  string `json:"state,omitempty"`
	Outcome                string `json:"outcome"`
	CertificateRequestName string `json:"certificate_request_name,omitempty"`
	CertificateRequestUID  string `json:"certificate_request_uid,omitempty"`
	Attempt                int    `json:"attempt,omitempty"`
	WorkerID               string `json:"worker_id"`
	LastErrorClass         string `json:"last_error_class,omitempty"`
	LastError              string `json:"last_error,omitempty"`
}

EnrollmentIntentReceiptRequest is PUT /internal/access-intents/enrollments/{op_id}/receipt.

type EnrollmentObservation

type EnrollmentObservation struct {
	ObserverID            string    `json:"observer_id,omitempty"`
	ObserverEpoch         int64     `json:"observer_epoch"`
	ObservedRevisionID    string    `json:"observed_revision_id,omitempty"`
	CertificateRequestUID string    `json:"certificate_request_uid,omitempty"`
	Health                string    `json:"health"`
	Reason                string    `json:"reason,omitempty"`
	Message               string    `json:"message,omitempty"`
	LastTransitionAt      time.Time `json:"last_transition_at"`
	LastVerifiedAt        time.Time `json:"last_verified_at"`
	UpdatedAt             time.Time `json:"updated_at"`
}

EnrollmentObservation records independently observed CertificateRequest state for one adapter enrollment operation.

type EnrollmentReceipt

type EnrollmentReceipt struct {
	FenceEpoch             int64      `json:"fence_epoch"`
	FenceHolder            string     `json:"fence_holder,omitempty"`
	AppliedRevisionID      string     `json:"applied_revision_id,omitempty"`
	CertificateRequestName string     `json:"certificate_request_name,omitempty"`
	CertificateRequestUID  string     `json:"certificate_request_uid,omitempty"`
	Outcome                string     `json:"outcome,omitempty"`
	Attempt                int        `json:"attempt,omitempty"`
	WorkerID               string     `json:"worker_id,omitempty"`
	LastErrorClass         string     `json:"last_error_class,omitempty"`
	LastError              string     `json:"last_error,omitempty"`
	AppliedAt              *time.Time `json:"applied_at,omitempty"`
	UpdatedAt              time.Time  `json:"updated_at"`
}

EnrollmentReceipt records bounded execution progress for one adapter enrollment operation without persisting keys or raw certificate secrets.

type Error

type Error struct {
	Status  int
	Code    string
	Message string
	Cause   error
}

Error is a safe, typed HTTP error for JSON API responses.

func BadRequest

func BadRequest(code, message string, cause ...error) *Error

func Conflict

func Conflict(message string, cause ...error) *Error

func Forbidden

func Forbidden(message string, cause ...error) *Error

func Internal

func Internal(message string, cause ...error) *Error

func NotFound

func NotFound(message string, cause ...error) *Error

func ServiceUnavailable

func ServiceUnavailable(code, message string, cause ...error) *Error

func Unauthorized

func Unauthorized(message string, cause ...error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type GrantGatewayPropagation

type GrantGatewayPropagation struct {
	RevocationCommitted   bool       `json:"revocation_committed"`
	RevocationCommittedAt *time.Time `json:"revocation_committed_at,omitempty"`
	ProjectionApplied     bool       `json:"projection_applied"`
	ProjectionAppliedAt   *time.Time `json:"projection_applied_at,omitempty"`
	PropagationVerified   bool       `json:"propagation_verified"`
	PropagationVerifiedAt *time.Time `json:"propagation_verified_at,omitempty"`
	PropagationStatus     string     `json:"propagation_status"`
}

GrantGatewayPropagation separates authoritative database revocation, Kubernetes projection application, and independent gateway propagation verification into distinct milestones.

func ComputeGrantGatewayPropagation

func ComputeGrantGatewayPropagation(
	state string,
	desiredRevisionID string,
	revocationCommittedAt *time.Time,
	receipt *GrantReceipt,
	observation *GrantObservation,
) GrantGatewayPropagation

ComputeGrantGatewayPropagation derives strict milestone states from authoritative desired state, the latest execution receipt, and the latest independent gateway observation.

type GrantGatewayReplicaEvidence

type GrantGatewayReplicaEvidence struct {
	PodName               string    `json:"pod_name"`
	Ready                 bool      `json:"ready"`
	Reachable             bool      `json:"reachable"`
	ServerUID             string    `json:"server_uid,omitempty"`
	PolicyRevision        string    `json:"policy_revision,omitempty"`
	PolicyDigest          string    `json:"policy_digest,omitempty"`
	SessionSyncReady      bool      `json:"session_sync_ready"`
	SessionSyncAgeSeconds *float64  `json:"session_sync_age_seconds,omitempty"`
	LastReloadError       string    `json:"last_reload_error,omitempty"`
	Error                 string    `json:"error,omitempty"`
	ObservedAt            time.Time `json:"observed_at,omitempty"`
}

GrantGatewayReplicaEvidence records the sanitized status reported by one serving gateway replica for a target MCPServer UID.

type GrantIntent

type GrantIntent struct {
	GrantID               string                  `json:"grant_id"`
	Namespace             string                  `json:"namespace"`
	Name                  string                  `json:"name"`
	TeamID                string                  `json:"team_id"`
	ServerName            string                  `json:"server_name"`
	ServerUID             string                  `json:"server_uid"`
	Subject               GrantSubjectSummary     `json:"subject"`
	SpecJSON              json.RawMessage         `json:"spec_json"`
	DesiredRevisionID     string                  `json:"desired_revision_id"`
	State                 string                  `json:"state"`
	RevocationCommittedAt *time.Time              `json:"revocation_committed_at,omitempty"`
	CreatedAt             time.Time               `json:"created_at"`
	UpdatedAt             time.Time               `json:"updated_at"`
	Receipt               *GrantReceipt           `json:"receipt,omitempty"`
	Observation           *GrantObservation       `json:"observation,omitempty"`
	GatewayPropagation    GrantGatewayPropagation `json:"gateway_propagation"`
}

GrantIntent is Platform API's authoritative desired state for one grant incarnation, paired with its latest execution receipt, independent observation, and separated gateway propagation milestones.

type GrantIntentFenceRequest

type GrantIntentFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

GrantIntentFenceRequest is POST /internal/access-intents/grants/{grant_id}/fence.

type GrantIntentFenceResponse

type GrantIntentFenceResponse struct {
	FenceEpoch int64       `json:"fence_epoch"`
	Intent     GrantIntent `json:"intent"`
}

GrantIntentFenceResponse is POST /internal/access-intents/grants/{grant_id}/fence.

type GrantIntentListResponse

type GrantIntentListResponse struct {
	Grants []GrantIntent `json:"grants"`
}

GrantIntentListResponse is GET /internal/access-intents/grants.

type GrantIntentObservationRequest

type GrantIntentObservationRequest struct {
	ClusterKey           string                        `json:"cluster_key,omitempty"`
	ObserverID           string                        `json:"observer_id"`
	ObserverEpoch        int64                         `json:"observer_epoch"`
	ObservedRevisionID   string                        `json:"observed_revision_id,omitempty"`
	TargetUID            string                        `json:"target_uid,omitempty"`
	Health               string                        `json:"health"`
	Reason               string                        `json:"reason,omitempty"`
	Message              string                        `json:"message,omitempty"`
	PropagationStatus    string                        `json:"propagation_status"`
	ServingReplicas      int                           `json:"serving_replicas"`
	AcknowledgedReplicas int                           `json:"acknowledged_replicas"`
	GatewayEvidence      []GrantGatewayReplicaEvidence `json:"gateway_evidence,omitempty"`
	VerifiedAt           time.Time                     `json:"verified_at,omitempty"`
}

GrantIntentObservationRequest is PUT /internal/access-intents/grants/{grant_id}/observation.

type GrantIntentReceiptRequest

type GrantIntentReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	TargetUID         string `json:"target_uid,omitempty"`
	TargetGeneration  int64  `json:"target_generation,omitempty"`
	SpecDigest        string `json:"spec_digest,omitempty"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

GrantIntentReceiptRequest is PUT /internal/access-intents/grants/{grant_id}/receipt.

type GrantIntentRevokeRequest

type GrantIntentRevokeRequest struct {
	Delete bool   `json:"delete,omitempty"`
	Reason string `json:"reason,omitempty"`
}

GrantIntentRevokeRequest is an optional body for DELETE /internal/access-intents/grants/{grant_id}.

type GrantIntentUpsertRequest

type GrantIntentUpsertRequest struct {
	GrantID    string              `json:"grant_id,omitempty"`
	Namespace  string              `json:"namespace"`
	Name       string              `json:"name"`
	TeamID     string              `json:"team_id"`
	ServerName string              `json:"server_name"`
	ServerUID  string              `json:"server_uid"`
	Subject    GrantSubjectSummary `json:"subject"`
	SpecJSON   json.RawMessage     `json:"spec_json"`
}

GrantIntentUpsertRequest is POST /internal/access-intents/grants.

type GrantObservation

type GrantObservation struct {
	ObserverID           string                        `json:"observer_id,omitempty"`
	ObserverEpoch        int64                         `json:"observer_epoch"`
	ObservedRevisionID   string                        `json:"observed_revision_id,omitempty"`
	TargetUID            string                        `json:"target_uid,omitempty"`
	Health               string                        `json:"health"`
	Reason               string                        `json:"reason,omitempty"`
	Message              string                        `json:"message,omitempty"`
	PropagationStatus    string                        `json:"propagation_status"`
	ServingReplicas      int                           `json:"serving_replicas"`
	AcknowledgedReplicas int                           `json:"acknowledged_replicas"`
	GatewayEvidence      []GrantGatewayReplicaEvidence `json:"gateway_evidence,omitempty"`
	LastTransitionAt     time.Time                     `json:"last_transition_at"`
	LastVerifiedAt       time.Time                     `json:"last_verified_at"`
	UpdatedAt            time.Time                     `json:"updated_at"`
}

GrantObservation records the latest independently observed Kubernetes CR and gateway replica propagation state for one grant incarnation.

type GrantReceipt

type GrantReceipt struct {
	FenceEpoch        int64      `json:"fence_epoch"`
	FenceHolder       string     `json:"fence_holder,omitempty"`
	AppliedRevisionID string     `json:"applied_revision_id,omitempty"`
	TargetUID         string     `json:"target_uid,omitempty"`
	TargetGeneration  int64      `json:"target_generation,omitempty"`
	SpecDigest        string     `json:"spec_digest,omitempty"`
	Outcome           string     `json:"outcome,omitempty"`
	Attempt           int        `json:"attempt,omitempty"`
	WorkerID          string     `json:"worker_id,omitempty"`
	LastErrorClass    string     `json:"last_error_class,omitempty"`
	LastError         string     `json:"last_error,omitempty"`
	AppliedAt         *time.Time `json:"applied_at,omitempty"`
	UpdatedAt         time.Time  `json:"updated_at"`
}

GrantReceipt records the latest fenced execution state written by a runtime worker for one grant incarnation.

type GrantSubjectSummary

type GrantSubjectSummary struct {
	HumanID string `json:"human_id,omitempty"`
	AgentID string `json:"agent_id,omitempty"`
	TeamID  string `json:"team_id,omitempty"`
}

GrantSubjectSummary identifies the subject bound by a durable grant intent.

type ImagePublicationAbortRequest

type ImagePublicationAbortRequest struct {
	UploadState string `json:"upload_state,omitempty"`
	Reason      string `json:"reason,omitempty"`
}

ImagePublicationAbortRequest is POST /internal/workload-intents/publications/{publication_id}/abort.

type ImagePublicationBeginRequest

type ImagePublicationBeginRequest struct {
	PublicationID    string `json:"publication_id,omitempty"`
	TeamID           string `json:"team_id,omitempty"`
	Namespace        string `json:"namespace"`
	Registry         string `json:"registry"`
	Repository       string `json:"repository"`
	Tag              string `json:"tag"`
	MutableTagPolicy string `json:"mutable_tag_policy,omitempty"`
}

ImagePublicationBeginRequest is POST /internal/workload-intents/publications.

type ImagePublicationFenceRequest

type ImagePublicationFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

ImagePublicationFenceRequest is POST /internal/workload-intents/publications/{publication_id}/fence.

type ImagePublicationFenceResponse

type ImagePublicationFenceResponse struct {
	FenceEpoch int64                  `json:"fence_epoch"`
	Intent     ImagePublicationIntent `json:"intent"`
}

ImagePublicationFenceResponse is POST /internal/workload-intents/publications/{publication_id}/fence.

type ImagePublicationFinalizeRequest

type ImagePublicationFinalizeRequest struct {
	ArtifactRef       string `json:"artifact_ref"`
	ArtifactSHA256    string `json:"artifact_sha256"`
	ArtifactSizeBytes int64  `json:"artifact_size_bytes"`
}

ImagePublicationFinalizeRequest is POST /internal/workload-intents/publications/{publication_id}/finalize.

type ImagePublicationIntent

type ImagePublicationIntent struct {
	PublicationID     string                    `json:"publication_id"`
	TeamID            string                    `json:"team_id,omitempty"`
	Namespace         string                    `json:"namespace"`
	Registry          string                    `json:"registry"`
	Repository        string                    `json:"repository"`
	Tag               string                    `json:"tag"`
	MutableTagPolicy  string                    `json:"mutable_tag_policy"`
	UploadState       string                    `json:"upload_state"`
	ArtifactRef       string                    `json:"artifact_ref,omitempty"`
	ArtifactSHA256    string                    `json:"artifact_sha256,omitempty"`
	ArtifactSizeBytes int64                     `json:"artifact_size_bytes,omitempty"`
	HelperName        string                    `json:"helper_name,omitempty"`
	VerifiedDigest    string                    `json:"verified_digest,omitempty"`
	DesiredRevisionID string                    `json:"desired_revision_id"`
	Status            string                    `json:"status"`
	UpdatedAt         time.Time                 `json:"updated_at"`
	Receipt           *WorkloadExecutionReceipt `json:"receipt,omitempty"`
}

ImagePublicationIntent is Platform API's authoritative state for a durable registry archive publication backed by staged immutable artifacts.

type ImagePublicationListResponse

type ImagePublicationListResponse struct {
	Intents []ImagePublicationIntent `json:"intents"`
}

ImagePublicationListResponse is GET /internal/workload-intents/publications.

type ImagePublicationReceiptRequest

type ImagePublicationReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	Status            string `json:"status,omitempty"`
	HelperName        string `json:"helper_name,omitempty"`
	VerifiedDigest    string `json:"verified_digest,omitempty"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

ImagePublicationReceiptRequest is PUT /internal/workload-intents/publications/{publication_id}/receipt.

type Meta

type Meta struct {
	Limit      int    `json:"limit"`
	NextCursor string `json:"next_cursor,omitempty"`
	HasMore    bool   `json:"has_more"`
}

Meta accompanies list responses.

func ListMeta

func ListMeta(limit, offset, returned int) Meta

ListMeta builds pagination metadata for handlers that fetch exactly `limit` rows. HasMore is therefore optimistic on exact-fit pages unless the caller uses a limit+1 platform query upstream.

type NamespacesListResponse

type NamespacesListResponse struct {
	Namespaces []map[string]any `json:"namespaces"`
}

NamespacesListResponse is GET /internal/identity/namespaces.

type Operation

type Operation struct {
	ID                string    `json:"id"`
	Kind              string    `json:"kind"`
	ResourceID        string    `json:"resource_id"`
	Namespace         string    `json:"namespace"`
	DesiredRevisionID string    `json:"desired_revision_id"`
	State             string    `json:"state"`
	ErrorClass        string    `json:"error_class,omitempty"`
	RequestID         string    `json:"request_id,omitempty"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
}

Operation describes one accepted bounded execution step. Success does not imply that the resulting resource is currently Ready.

type OverviewCounts

type OverviewCounts struct {
	Teams          int64 `json:"teams"`
	Users          int64 `json:"users"`
	Agents         int64 `json:"agents"`
	ActiveSessions int64 `json:"active_sessions"`
}

OverviewCounts contains complete platform directory totals, never page lengths.

type ResolveIDsRequest

type ResolveIDsRequest struct {
	UserIDs []string `json:"user_ids"`
	TeamIDs []string `json:"team_ids"`
}

ResolveIDsRequest is POST /internal/identity/resolve-ids.

type ResolveIDsResponse

type ResolveIDsResponse struct {
	Users map[string]string `json:"users"`
	Teams map[string]string `json:"teams"`
}

ResolveIDsResponse is POST /internal/identity/resolve-ids.

type RestartComponentCheckpointRequest

type RestartComponentCheckpointRequest struct {
	DesiredRevisionID string                     `json:"desired_revision_id"`
	FenceEpoch        int64                      `json:"fence_epoch"`
	WorkerID          string                     `json:"worker_id"`
	Checkpoint        ComponentRestartCheckpoint `json:"checkpoint"`
}

RestartComponentCheckpointRequest is PUT /internal/workload-intents/restarts/{operation_id}/checkpoint.

type RestartOperationCreateRequest

type RestartOperationCreateRequest struct {
	OperationID      string   `json:"operation_id,omitempty"`
	RequestedBy      string   `json:"requested_by"`
	TargetComponents []string `json:"target_components"`
	RestartedAt      string   `json:"restarted_at,omitempty"`
}

RestartOperationCreateRequest is POST /internal/workload-intents/restarts.

type RestartOperationFenceRequest

type RestartOperationFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

RestartOperationFenceRequest is POST /internal/workload-intents/restarts/{operation_id}/fence.

type RestartOperationFenceResponse

type RestartOperationFenceResponse struct {
	FenceEpoch int64                  `json:"fence_epoch"`
	Intent     RestartOperationIntent `json:"intent"`
}

RestartOperationFenceResponse is POST /internal/workload-intents/restarts/{operation_id}/fence.

type RestartOperationIntent

type RestartOperationIntent struct {
	OperationID          string                                `json:"operation_id"`
	RequestedBy          string                                `json:"requested_by"`
	TargetComponents     []string                              `json:"target_components"`
	RestartedAt          string                                `json:"restarted_at"`
	ComponentCheckpoints map[string]ComponentRestartCheckpoint `json:"component_checkpoints,omitempty"`
	DesiredRevisionID    string                                `json:"desired_revision_id"`
	Status               string                                `json:"status"`
	UpdatedAt            time.Time                             `json:"updated_at"`
	Receipt              *WorkloadExecutionReceipt             `json:"receipt,omitempty"`
}

RestartOperationIntent is Platform API's authoritative desired state for an imperative component restart using a fixed acceptance-time RestartedAt token.

type RestartOperationListResponse

type RestartOperationListResponse struct {
	Intents []RestartOperationIntent `json:"intents"`
}

RestartOperationListResponse is GET /internal/workload-intents/restarts.

type RestartOperationReceiptRequest

type RestartOperationReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	Status            string `json:"status,omitempty"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

RestartOperationReceiptRequest is PUT /internal/workload-intents/restarts/{operation_id}/receipt.

type ServerIntent

type ServerIntent struct {
	ServerID              string                      `json:"server_id"`
	Namespace             string                      `json:"namespace"`
	Name                  string                      `json:"name"`
	TeamID                string                      `json:"team_id,omitempty"`
	DesiredRevisionID     string                      `json:"desired_revision_id"`
	Lifecycle             string                      `json:"lifecycle"`
	SpecJSON              json.RawMessage             `json:"spec_json,omitempty"`
	SpecDigest            string                      `json:"spec_digest,omitempty"`
	PublicationID         string                      `json:"publication_id,omitempty"`
	RetirementCheckpoints ServerRetirementCheckpoints `json:"retirement_checkpoints"`
	TargetCRUID           string                      `json:"target_cr_uid,omitempty"`
	UpdatedAt             time.Time                   `json:"updated_at"`
	Receipt               *WorkloadExecutionReceipt   `json:"receipt,omitempty"`
	Observation           *WorkloadStatusObservation  `json:"observation,omitempty"`
}

ServerIntent is Platform API's authoritative desired state for one MCPServer, paired with ordered retirement checkpoints, execution receipt, and independent health observation.

type ServerIntentFenceRequest

type ServerIntentFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

ServerIntentFenceRequest is POST /internal/workload-intents/servers/{server_id}/fence.

type ServerIntentFenceResponse

type ServerIntentFenceResponse struct {
	FenceEpoch int64        `json:"fence_epoch"`
	Intent     ServerIntent `json:"intent"`
}

ServerIntentFenceResponse is POST /internal/workload-intents/servers/{server_id}/fence.

type ServerIntentListResponse

type ServerIntentListResponse struct {
	Intents []ServerIntent `json:"intents"`
}

ServerIntentListResponse is GET /internal/workload-intents/servers.

type ServerIntentObservationRequest

type ServerIntentObservationRequest struct {
	ClusterKey         string                    `json:"cluster_key,omitempty"`
	ObserverID         string                    `json:"observer_id"`
	ObserverEpoch      int64                     `json:"observer_epoch"`
	ObservedRevisionID string                    `json:"observed_revision_id,omitempty"`
	TargetUID          string                    `json:"target_uid,omitempty"`
	ObservedGeneration int64                     `json:"observed_generation,omitempty"`
	Health             string                    `json:"health"`
	Reason             string                    `json:"reason,omitempty"`
	Message            string                    `json:"message,omitempty"`
	Conditions         []WorkloadIntentCondition `json:"conditions,omitempty"`
	VerifiedAt         time.Time                 `json:"verified_at,omitempty"`
}

ServerIntentObservationRequest is PUT /internal/workload-intents/servers/{server_id}/observation.

type ServerIntentReceiptRequest

type ServerIntentReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	TargetUID         string `json:"target_uid,omitempty"`
	TargetGeneration  int64  `json:"target_generation,omitempty"`
	SpecDigest        string `json:"spec_digest,omitempty"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

ServerIntentReceiptRequest is PUT /internal/workload-intents/servers/{server_id}/receipt.

type ServerIntentRetireRequest

type ServerIntentRetireRequest struct {
	TargetCRUID string `json:"target_cr_uid,omitempty"`
}

ServerIntentRetireRequest is POST /internal/workload-intents/servers/{server_id}/retire.

type ServerIntentUpsertRequest

type ServerIntentUpsertRequest struct {
	ServerID      string          `json:"server_id"`
	Namespace     string          `json:"namespace"`
	Name          string          `json:"name"`
	TeamID        string          `json:"team_id,omitempty"`
	SpecJSON      json.RawMessage `json:"spec_json"`
	SpecDigest    string          `json:"spec_digest,omitempty"`
	PublicationID string          `json:"publication_id,omitempty"`
}

ServerIntentUpsertRequest is POST /internal/workload-intents/servers.

type ServerRetirementCheckpointRequest

type ServerRetirementCheckpointRequest struct {
	DesiredRevisionID string                      `json:"desired_revision_id"`
	FenceEpoch        int64                       `json:"fence_epoch"`
	WorkerID          string                      `json:"worker_id"`
	TargetCRUID       string                      `json:"target_cr_uid,omitempty"`
	Checkpoints       ServerRetirementCheckpoints `json:"checkpoints"`
}

ServerRetirementCheckpointRequest is PUT /internal/workload-intents/servers/{server_id}/checkpoint.

type ServerRetirementCheckpoints

type ServerRetirementCheckpoints struct {
	RetiringMarked     bool `json:"retiring_marked"`
	SessionsFenced     bool `json:"sessions_fenced"`
	GrantsRetired      bool `json:"grants_retired"`
	CredentialsCleaned bool `json:"credentials_cleaned"`
	CRDeleted          bool `json:"cr_deleted"`
}

ServerRetirementCheckpoints records durable ordered retirement progress so crash recovery resumes cleanly without repeating or reordering steps.

type Team

type Team struct {
	ID        string    `json:"id"`
	Slug      string    `json:"slug"`
	Name      string    `json:"name"`
	Namespace string    `json:"namespace"`
	CreatedAt time.Time `json:"created_at"`
}

Team is a managed platform team and its Kubernetes namespace.

type TeamCreateRequest

type TeamCreateRequest struct {
	Slug            string `json:"slug"`
	Name            string `json:"name"`
	CreatedByUserID string `json:"created_by_user_id"`
}

TeamCreateRequest is POST /internal/identity/teams.

type TeamIntentCondition

type TeamIntentCondition struct {
	Type             string    `json:"type"`
	Status           string    `json:"status"`
	Reason           string    `json:"reason"`
	Message          string    `json:"message,omitempty"`
	RevisionID       string    `json:"revision_id,omitempty"`
	LastTransitionAt time.Time `json:"last_transition_at,omitempty"`
}

TeamIntentCondition is one platform-facing condition observed on a managed team namespace.

type TeamIntentFenceRequest

type TeamIntentFenceRequest struct {
	WorkerID string `json:"worker_id"`
}

TeamIntentFenceRequest is POST /internal/team-intents/{team_id}/fence.

type TeamIntentFenceResponse

type TeamIntentFenceResponse struct {
	FenceEpoch int64               `json:"fence_epoch"`
	Intent     TeamNamespaceIntent `json:"intent"`
}

TeamIntentFenceResponse is POST /internal/team-intents/{team_id}/fence.

type TeamIntentObservationRequest

type TeamIntentObservationRequest struct {
	ClusterKey         string                `json:"cluster_key,omitempty"`
	ObserverID         string                `json:"observer_id"`
	ObserverEpoch      int64                 `json:"observer_epoch"`
	ObservedRevisionID string                `json:"observed_revision_id,omitempty"`
	NamespaceUID       string                `json:"namespace_uid,omitempty"`
	Health             string                `json:"health"`
	Reason             string                `json:"reason,omitempty"`
	Message            string                `json:"message,omitempty"`
	Conditions         []TeamIntentCondition `json:"conditions,omitempty"`
	VerifiedAt         time.Time             `json:"verified_at,omitempty"`
}

TeamIntentObservationRequest is PUT /internal/team-intents/{team_id}/observation.

type TeamIntentObserverLeaseRequest

type TeamIntentObserverLeaseRequest struct {
	ClusterKey string `json:"cluster_key,omitempty"`
	ObserverID string `json:"observer_id"`
}

TeamIntentObserverLeaseRequest is POST /internal/team-intents/observer-lease.

type TeamIntentObserverLeaseResponse

type TeamIntentObserverLeaseResponse struct {
	ClusterKey    string `json:"cluster_key"`
	ObserverID    string `json:"observer_id"`
	ObserverEpoch int64  `json:"observer_epoch"`
}

TeamIntentObserverLeaseResponse is POST /internal/team-intents/observer-lease.

type TeamIntentReceiptRequest

type TeamIntentReceiptRequest struct {
	DesiredRevisionID string `json:"desired_revision_id"`
	FenceEpoch        int64  `json:"fence_epoch"`
	Outcome           string `json:"outcome"`
	NamespaceUID      string `json:"namespace_uid,omitempty"`
	Attempt           int    `json:"attempt,omitempty"`
	WorkerID          string `json:"worker_id"`
	LastErrorClass    string `json:"last_error_class,omitempty"`
	LastError         string `json:"last_error,omitempty"`
}

TeamIntentReceiptRequest is PUT /internal/team-intents/{team_id}/receipt.

type TeamMembersListResponse

type TeamMembersListResponse struct {
	Members []TeamMembership `json:"members"`
}

TeamMembersListResponse is GET /internal/identity/teams/{slug}/members.

type TeamMembership

type TeamMembership struct {
	TeamID        string    `json:"team_id"`
	TeamSlug      string    `json:"team_slug"`
	TeamName      string    `json:"team_name"`
	TeamNamespace string    `json:"team_namespace"`
	UserID        string    `json:"user_id"`
	Email         string    `json:"email,omitempty"`
	Role          string    `json:"role"`
	CreatedAt     time.Time `json:"created_at"`
}

TeamMembership is the shared API contract for platform team membership data.

type TeamMembershipPutRequest

type TeamMembershipPutRequest struct {
	Role   string `json:"role"`
	UserID string `json:"userID"`
}

TeamMembershipPutRequest is PUT /internal/identity/teams/{slug}/members/{userID}.

type TeamMembershipResponse

type TeamMembershipResponse struct {
	Membership TeamMembership `json:"membership"`
}

TeamMembershipResponse wraps a membership mutation result.

type TeamMembershipUpsertRequest

type TeamMembershipUpsertRequest struct {
	UserID string `json:"userID"`
	Role   string `json:"role"`
}

TeamMembershipUpsertRequest is POST /internal/identity/teams/{slug}/members.

type TeamNamespaceIntent

type TeamNamespaceIntent struct {
	TeamID              string                    `json:"team_id"`
	Slug                string                    `json:"slug"`
	Name                string                    `json:"name"`
	Namespace           string                    `json:"namespace"`
	DesiredRevisionID   string                    `json:"desired_revision_id"`
	Deleted             bool                      `json:"deleted"`
	UpdatedAt           time.Time                 `json:"updated_at"`
	ActiveOwnerTeamID   string                    `json:"active_owner_team_id,omitempty"`
	PriorDeletedTeamIDs []string                  `json:"prior_deleted_team_ids,omitempty"`
	Receipt             *TeamNamespaceReceipt     `json:"receipt,omitempty"`
	Observation         *TeamNamespaceObservation `json:"observation,omitempty"`
}

TeamNamespaceIntent is Platform API's authoritative desired state for one team incarnation, paired with its latest execution receipt and observation.

type TeamNamespaceIntentListResponse

type TeamNamespaceIntentListResponse struct {
	Intents []TeamNamespaceIntent `json:"intents"`
}

TeamNamespaceIntentListResponse is GET /internal/team-intents.

type TeamNamespaceObservation

type TeamNamespaceObservation struct {
	ObserverID         string                `json:"observer_id,omitempty"`
	ObserverEpoch      int64                 `json:"observer_epoch"`
	ObservedRevisionID string                `json:"observed_revision_id,omitempty"`
	NamespaceUID       string                `json:"namespace_uid,omitempty"`
	Health             string                `json:"health"`
	Reason             string                `json:"reason,omitempty"`
	Message            string                `json:"message,omitempty"`
	Conditions         []TeamIntentCondition `json:"conditions,omitempty"`
	LastTransitionAt   time.Time             `json:"last_transition_at"`
	LastVerifiedAt     time.Time             `json:"last_verified_at"`
	UpdatedAt          time.Time             `json:"updated_at"`
}

TeamNamespaceObservation records the latest independently observed Kubernetes state for a managed team incarnation.

type TeamNamespaceReceipt

type TeamNamespaceReceipt struct {
	FenceEpoch        int64      `json:"fence_epoch"`
	FenceHolder       string     `json:"fence_holder,omitempty"`
	AppliedRevisionID string     `json:"applied_revision_id,omitempty"`
	Outcome           string     `json:"outcome,omitempty"`
	NamespaceUID      string     `json:"namespace_uid,omitempty"`
	Attempt           int        `json:"attempt,omitempty"`
	WorkerID          string     `json:"worker_id,omitempty"`
	LastErrorClass    string     `json:"last_error_class,omitempty"`
	LastError         string     `json:"last_error,omitempty"`
	AppliedAt         *time.Time `json:"applied_at,omitempty"`
	UpdatedAt         time.Time  `json:"updated_at"`
}

TeamNamespaceReceipt records the latest fenced execution state written by a runtime worker. It records bounded step execution, not ongoing health.

type TeamUserCreateRequest

type TeamUserCreateRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Role     string `json:"role"`
}

TeamUserCreateRequest is POST /internal/identity/teams/{slug}/users.

type TeamUserCreateResponse

type TeamUserCreateResponse struct {
	User       User           `json:"user"`
	Membership TeamMembership `json:"membership"`
}

TeamUserCreateResponse is POST /internal/identity/teams/{slug}/users.

type TeamsListResponse

type TeamsListResponse struct {
	Teams []Team `json:"teams"`
}

TeamsListResponse is GET /internal/identity/teams.

type User

type User struct {
	ID    string `json:"id"`
	Email string `json:"email"`
	Role  string `json:"role"`
}

User is a platform user record returned by identity APIs.

type UserDeactivationResult

type UserDeactivationResult struct {
	UserID                     string `json:"user_id"`
	Status                     string `json:"status"`
	AlreadyDeactivated         bool   `json:"already_deactivated"`
	RevokedAPIKeys             int64  `json:"revoked_api_keys"`
	RevokedRegistryCredentials int64  `json:"revoked_registry_credentials"`
	RevokedRefreshTokens       int64  `json:"revoked_refresh_tokens"`
	RevokedSessions            int64  `json:"revoked_sessions"`
	RemovedMemberships         int64  `json:"removed_memberships"`
}

UserDeactivationResult contains non-secret, transactionally committed cleanup counts.

type WorkloadExecutionReceipt

type WorkloadExecutionReceipt struct {
	FenceEpoch        int64      `json:"fence_epoch"`
	FenceHolder       string     `json:"fence_holder,omitempty"`
	AppliedRevisionID string     `json:"applied_revision_id,omitempty"`
	Outcome           string     `json:"outcome,omitempty"`
	TargetUID         string     `json:"target_uid,omitempty"`
	TargetGeneration  int64      `json:"target_generation,omitempty"`
	SpecDigest        string     `json:"spec_digest,omitempty"`
	Attempt           int        `json:"attempt,omitempty"`
	WorkerID          string     `json:"worker_id,omitempty"`
	LastErrorClass    string     `json:"last_error_class,omitempty"`
	LastError         string     `json:"last_error,omitempty"`
	AppliedAt         *time.Time `json:"applied_at,omitempty"`
	UpdatedAt         time.Time  `json:"updated_at"`
}

WorkloadExecutionReceipt records the latest fenced execution state written by a runtime worker. It tracks bounded step execution, never ongoing health.

type WorkloadIntentCondition

type WorkloadIntentCondition struct {
	Type             string    `json:"type"`
	Status           string    `json:"status"`
	Reason           string    `json:"reason"`
	Message          string    `json:"message,omitempty"`
	RevisionID       string    `json:"revision_id,omitempty"`
	LastTransitionAt time.Time `json:"last_transition_at,omitempty"`
}

WorkloadIntentCondition is one platform-facing condition observed on a managed Kubernetes workload.

type WorkloadObserverLeaseRequest

type WorkloadObserverLeaseRequest struct {
	ClusterKey string `json:"cluster_key,omitempty"`
	ObserverID string `json:"observer_id"`
}

WorkloadObserverLeaseRequest is POST /internal/workload-intents/observer-lease.

type WorkloadObserverLeaseResponse

type WorkloadObserverLeaseResponse struct {
	ClusterKey    string `json:"cluster_key"`
	ObserverID    string `json:"observer_id"`
	ObserverEpoch int64  `json:"observer_epoch"`
}

WorkloadObserverLeaseResponse is POST /internal/workload-intents/observer-lease.

type WorkloadStatusObservation

type WorkloadStatusObservation struct {
	ObserverID         string                    `json:"observer_id,omitempty"`
	ObserverEpoch      int64                     `json:"observer_epoch"`
	ObservedRevisionID string                    `json:"observed_revision_id,omitempty"`
	TargetUID          string                    `json:"target_uid,omitempty"`
	ObservedGeneration int64                     `json:"observed_generation,omitempty"`
	Health             string                    `json:"health"`
	Reason             string                    `json:"reason,omitempty"`
	Message            string                    `json:"message,omitempty"`
	Conditions         []WorkloadIntentCondition `json:"conditions,omitempty"`
	LastTransitionAt   time.Time                 `json:"last_transition_at"`
	LastVerifiedAt     time.Time                 `json:"last_verified_at"`
	UpdatedAt          time.Time                 `json:"updated_at"`
}

WorkloadStatusObservation records independently observed Kubernetes workload state keyed by monotonic observer_epoch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL