mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 16:21:30 +00:00
7cb453a336
Mechanical reformat. The new 'gofmt drift' CI step (added in
ci-pipeline-cleanup Phase 4, commit 0f205a8) surfaced 111 files
with accumulated gofmt drift across cmd/, internal/, and deploy/test/.
Each file's diff is gofmt-standard: whitespace adjustments, intra-
group import sorting (alphabetical by import path within blank-line-
separated groups), and struct-tag column alignment. No semantic
changes — verified via 'git diff --ignore-all-space' which shows only
the line-position deltas from import reordering.
The gate stays in place after this commit. Going forward it catches
gofmt drift at PR time.
72 lines
2.8 KiB
Go
72 lines
2.8 KiB
Go
package domain
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Job represents a unit of work in the certificate control plane.
|
|
type Job struct {
|
|
ID string `json:"id"`
|
|
Type JobType `json:"type"`
|
|
CertificateID string `json:"certificate_id"`
|
|
TargetID *string `json:"target_id,omitempty"`
|
|
AgentID *string `json:"agent_id,omitempty"`
|
|
Status JobStatus `json:"status"`
|
|
Attempts int `json:"attempts"`
|
|
MaxAttempts int `json:"max_attempts"`
|
|
LastError *string `json:"last_error,omitempty"`
|
|
ScheduledAt time.Time `json:"scheduled_at"`
|
|
StartedAt *time.Time `json:"started_at,omitempty"`
|
|
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
VerificationStatus VerificationStatus `json:"verification_status"`
|
|
VerifiedAt *time.Time `json:"verified_at,omitempty"`
|
|
VerificationError *string `json:"verification_error,omitempty"`
|
|
VerificationFp *string `json:"verification_fingerprint,omitempty"`
|
|
}
|
|
|
|
// JobType represents the classification of work to be performed.
|
|
type JobType string
|
|
|
|
const (
|
|
JobTypeIssuance JobType = "Issuance"
|
|
JobTypeRenewal JobType = "Renewal"
|
|
JobTypeDeployment JobType = "Deployment"
|
|
JobTypeValidation JobType = "Validation"
|
|
)
|
|
|
|
// JobStatus represents the execution state of a job.
|
|
type JobStatus string
|
|
|
|
const (
|
|
JobStatusPending JobStatus = "Pending"
|
|
JobStatusAwaitingCSR JobStatus = "AwaitingCSR"
|
|
JobStatusAwaitingApproval JobStatus = "AwaitingApproval"
|
|
JobStatusRunning JobStatus = "Running"
|
|
JobStatusCompleted JobStatus = "Completed"
|
|
JobStatusFailed JobStatus = "Failed"
|
|
JobStatusCancelled JobStatus = "Cancelled"
|
|
)
|
|
|
|
// DeploymentJob represents a job that deploys a certificate to a target via an agent.
|
|
type DeploymentJob struct {
|
|
Job `json:"job"`
|
|
AgentID string `json:"agent_id"`
|
|
DeploymentResult json.RawMessage `json:"deployment_result,omitempty"`
|
|
}
|
|
|
|
// WorkItem enriches a Job with target details so the agent knows which connector to use.
|
|
// Returned by GET /api/v1/agents/{id}/work.
|
|
type WorkItem struct {
|
|
ID string `json:"id"`
|
|
Type JobType `json:"type"`
|
|
CertificateID string `json:"certificate_id"`
|
|
CommonName string `json:"common_name,omitempty"`
|
|
SANs []string `json:"sans,omitempty"`
|
|
TargetID *string `json:"target_id,omitempty"`
|
|
TargetType string `json:"target_type,omitempty"`
|
|
TargetConfig json.RawMessage `json:"target_config,omitempty"`
|
|
Status JobStatus `json:"status"`
|
|
}
|