Documentation
¶
Overview ¶
Package sdingest provides a typed client for the versioned SDIngest OpenAPI.
Index ¶
- Constants
- Variables
- func IsSubCode(err error, subCode string) bool
- type APIError
- type AppProfile
- type Artifact
- type ArtifactAccess
- type ArtifactJobRef
- type Callback
- type CallbackCredential
- type CallbackData
- type CallbackEnvelope
- type CallbackLog
- type CallbackProgress
- type Client
- func (c *Client) AcknowledgeArtifact(ctx context.Context, artifactID string, idempotencyKey string) (Artifact, error)
- func (c *Client) Authenticate(ctx context.Context) (Token, error)
- func (c *Client) CancelJob(ctx context.Context, jobID string, idempotencyKey string) (Job, error)
- func (c *Client) ConfirmJobManifest(ctx context.Context, jobID string, revision int64, hash string, ...) (Job, error)
- func (c *Client) ConfirmJobManifestSelection(ctx context.Context, input ConfirmJobManifestInput, idempotencyKey string) (Job, error)
- func (c *Client) CreateCallback(ctx context.Context, input CreateCallbackInput, idempotencyKey string) (CallbackCredential, error)
- func (c *Client) CreateJob(ctx context.Context, input CreateJobInput, idempotencyKey string) (Job, error)
- func (c *Client) DisableCallback(ctx context.Context, callbackID string, idempotencyKey string) error
- func (c *Client) EnableCallback(ctx context.Context, callbackID string, idempotencyKey string) error
- func (c *Client) GetAppProfile(ctx context.Context) (AppProfile, error)
- func (c *Client) GetArtifact(ctx context.Context, artifactID string) (Artifact, error)
- func (c *Client) GetArtifactAccess(ctx context.Context, artifactID string, ttl time.Duration) (ArtifactAccess, error)
- func (c *Client) GetCallback(ctx context.Context, callbackID string) (Callback, error)
- func (c *Client) GetItemProgress(ctx context.Context, jobID string, itemID string) (ItemProgress, error)
- func (c *Client) GetJob(ctx context.Context, jobID string) (Job, error)
- func (c *Client) GetJobManifest(ctx context.Context, jobID string, page int, limit int) (ManifestPage, error)
- func (c *Client) GetJobProgress(ctx context.Context, jobID string) (JobProgress, error)
- func (c *Client) ListArtifacts(ctx context.Context, input ListArtifactsInput) (Page[Artifact], error)
- func (c *Client) ListCallbackLogs(ctx context.Context, input ListCallbackLogsInput) (Page[CallbackLog], error)
- func (c *Client) ListCallbacks(ctx context.Context, input ListCallbacksInput) (Page[Callback], error)
- func (c *Client) ListJobs(ctx context.Context, input ListJobsInput) (Page[Job], error)
- func (c *Client) ReplayCallback(ctx context.Context, eventID string, idempotencyKey string) error
- func (c *Client) RetryJob(ctx context.Context, jobID string, idempotencyKey string) (Job, error)
- func (c *Client) RotateCallbackSecret(ctx context.Context, callbackID string, idempotencyKey string) (CallbackCredential, error)
- type Config
- type ConfirmJobManifestInput
- type CreateCallbackInput
- type CreateJobInput
- type FileFilter
- type HTTPDoer
- type ItemProgress
- type Job
- type JobAppRef
- type JobPoolRef
- type JobProgress
- type JobTargetRef
- type ListArtifactsInput
- type ListCallbackLogsInput
- type ListCallbacksInput
- type ListJobsInput
- type Liveness
- type Manifest
- type ManifestItem
- type ManifestPage
- type Page
- type ProtocolError
- type Source
- type Token
- type TransferProgress
Constants ¶
View Source
const ( CallbackHeaderEventID = "X-SDIngest-Event-ID" CallbackHeaderTimestamp = "X-SDIngest-Timestamp" CallbackHeaderSignature = "X-SDIngest-Signature" CallbackEventManifestReady = "job.manifest.ready" CallbackEventPhaseChanged = "job.phase_changed" CallbackEventProgressChanged = "job.progress_changed" CallbackEventStalled = "job.stalled" CallbackEventRetrying = "job.retrying" CallbackEventAccountWaiting = "job.account.waiting" CallbackEventAccountRecovered = "job.account.recovered" CallbackEventTargetWaiting = "job.target.waiting" CallbackEventTargetRecovered = "job.target.recovered" CallbackEventSucceeded = "job.succeeded" CallbackEventPartial = "job.partial" CallbackEventFailed = "job.failed" CallbackEventCanceled = "job.canceled" )
View Source
const ( JobStatusPending = "pending" JobStatusRunning = "running" JobStatusWaiting = "waiting" JobStatusPartial = "partial" JobStatusSucceeded = "succeeded" JobStatusFailed = "failed" JobStatusCanceled = "canceled" )
View Source
const ( ManifestModeAuto = "auto" ManifestModeManual = "manual" )
Variables ¶
View Source
var ( ErrNilContext = errors.New("sdingest: nil context") ErrInvalidConfig = errors.New("sdingest: invalid client config") ErrIdempotencyKeyRequired = errors.New("sdingest: idempotency key is required") ErrInvalidCallback = errors.New("sdingest: invalid callback") ErrCallbackSignature = errors.New("sdingest: callback signature mismatch") ErrCallbackTimestamp = errors.New("sdingest: callback timestamp is outside the allowed window") )
Functions ¶
Types ¶
type APIError ¶
type AppProfile ¶
type AppProfile struct {
AppID string `json:"app_id"`
Name string `json:"name"`
Status string `json:"status"`
Scope []string `json:"scope"`
RateLimit int64 `json:"rate_limit"`
JobLimit int `json:"job_limit"`
ByteLimit int64 `json:"byte_limit"`
StorageMode string `json:"storage_mode"`
DefaultTarget json.RawMessage `json:"default_target,omitempty"`
DefaultCallbackID string `json:"default_callback_id,omitempty"`
DefaultFilterID string `json:"default_filter_id,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Artifact ¶
type Artifact struct {
ArtifactID string `json:"artifact_id"`
JobID string `json:"job_id"`
ItemID string `json:"item_id"`
TargetID string `json:"target_id"`
TargetName string `json:"target_name"`
TargetDriver string `json:"target_driver"`
TargetEndpoint string `json:"target_endpoint"`
TargetBucket string `json:"target_bucket"`
ObjectURI string `json:"object_uri"`
Key string `json:"key"`
Name string `json:"name"`
Path string `json:"path"`
MIME string `json:"mime,omitempty"`
Size int64 `json:"size"`
Checksum string `json:"checksum,omitempty"`
ETag string `json:"etag,omitempty"`
Status string `json:"status"`
AckAt *time.Time `json:"ack_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
Job ArtifactJobRef `json:"job"`
}
type ArtifactAccess ¶
type ArtifactJobRef ¶
type ArtifactJobRef struct {
JobID string `json:"job_id"`
SourceName string `json:"source_name,omitempty"`
ExternalRef string `json:"external_ref,omitempty"`
Provider string `json:"provider"`
Status string `json:"status"`
Phase string `json:"phase"`
CreatedAt time.Time `json:"created_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
type Callback ¶
type Callback struct {
CallbackID string `json:"callback_id"`
AppID string `json:"app_id,omitempty"`
Name string `json:"name"`
URL string `json:"url"`
Events []string `json:"events"`
Status string `json:"status"`
SecretVer int64 `json:"secret_ver"`
LastTestAt *time.Time `json:"last_test_at,omitempty"`
Error string `json:"err,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CallbackCredential ¶
type CallbackData ¶
type CallbackData struct {
JobID string `json:"job_id"`
ExternalRef string `json:"external_ref,omitempty"`
Status string `json:"status"`
Phase string `json:"phase"`
Revision int64 `json:"revision"`
WaitingReason string `json:"waiting_reason,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
Progress *CallbackProgress `json:"progress,omitempty"`
}
type CallbackEnvelope ¶
type CallbackEnvelope struct {
EventID string `json:"event_id"`
Event string `json:"event"`
Timestamp time.Time `json:"timestamp"`
Data CallbackData `json:"data"`
}
type CallbackLog ¶
type CallbackLog struct {
EventID string `json:"event_id"`
Event string `json:"event"`
CallbackID string `json:"callback_id"`
JobID string `json:"job_id"`
AttemptNo int `json:"attempt_no"`
SecretVer int64 `json:"secret_ver"`
Status string `json:"status"`
LatencyMS int64 `json:"latency_ms"`
NextAt *time.Time `json:"next_at,omitempty"`
Error string `json:"err,omitempty"`
Response string `json:"response,omitempty"`
CreatedAt time.Time `json:"created_at"`
Callback json.RawMessage `json:"callback,omitempty"`
Job json.RawMessage `json:"job,omitempty"`
}
type CallbackProgress ¶
type CallbackProgress struct {
CurrentItemID string `json:"current_item_id,omitempty"`
DownBytes int64 `json:"down_bytes"`
UpBytes int64 `json:"up_bytes"`
TotalBytes int64 `json:"total_bytes"`
ItemTotal int64 `json:"item_total"`
ItemDone int64 `json:"item_done"`
ItemFailed int64 `json:"item_failed"`
IsAlive bool `json:"is_alive"`
SnapshotAt time.Time `json:"snapshot_at"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AcknowledgeArtifact ¶
func (*Client) ConfirmJobManifest ¶
func (*Client) ConfirmJobManifestSelection ¶
func (*Client) CreateCallback ¶
func (c *Client) CreateCallback(ctx context.Context, input CreateCallbackInput, idempotencyKey string) (CallbackCredential, error)
func (*Client) DisableCallback ¶
func (*Client) EnableCallback ¶
func (*Client) GetAppProfile ¶
func (c *Client) GetAppProfile(ctx context.Context) (AppProfile, error)
func (*Client) GetArtifact ¶
func (*Client) GetArtifactAccess ¶
func (*Client) GetCallback ¶
func (*Client) GetItemProgress ¶
func (*Client) GetJobManifest ¶
func (*Client) GetJobProgress ¶
func (*Client) ListArtifacts ¶
func (*Client) ListCallbackLogs ¶
func (c *Client) ListCallbackLogs(ctx context.Context, input ListCallbackLogsInput) (Page[CallbackLog], error)
func (*Client) ListCallbacks ¶
func (*Client) ReplayCallback ¶
func (*Client) RotateCallbackSecret ¶
type ConfirmJobManifestInput ¶
type CreateCallbackInput ¶
type CreateJobInput ¶
type CreateJobInput struct {
ExternalRef string `json:"external_ref,omitempty"`
Source Source `json:"source"`
Filter FileFilter `json:"filter,omitempty"`
ManifestMode string `json:"manifest_mode,omitempty"`
TargetID string `json:"target_id,omitempty"`
PoolID string `json:"pool_id,omitempty"`
CallbackID string `json:"callback_id,omitempty"`
FailPolicy string `json:"fail_policy,omitempty"`
Priority int16 `json:"priority,omitempty"`
}
type FileFilter ¶
type FileFilter struct {
IncludeExtensions []string `json:"include_extensions,omitempty"`
ExcludeExtensions []string `json:"exclude_extensions,omitempty"`
IncludeGlobs []string `json:"include_globs,omitempty"`
ExcludeGlobs []string `json:"exclude_globs,omitempty"`
MinSize *int64 `json:"min_size,omitempty"`
MaxSize *int64 `json:"max_size,omitempty"`
MaxFiles *int64 `json:"max_files,omitempty"`
MaxTotalBytes *int64 `json:"max_total_bytes,omitempty"`
MaxDepth *int `json:"max_depth,omitempty"`
}
type ItemProgress ¶
type ItemProgress struct {
JobID string `json:"job_id"`
ItemID string `json:"item_id"`
Source string `json:"source"`
Status string `json:"status"`
Phase string `json:"phase"`
Download TransferProgress `json:"download"`
Upload TransferProgress `json:"upload"`
Overall TransferProgress `json:"overall"`
Liveness Liveness `json:"liveness"`
}
type Job ¶
type Job struct {
JobID string `json:"job_id"`
SourceName string `json:"source_name,omitempty"`
TargetID string `json:"target_id"`
PoolID string `json:"pool_id,omitempty"`
CallbackID string `json:"callback_id,omitempty"`
ExternalRef string `json:"external_ref,omitempty"`
Provider string `json:"provider"`
SourceMode string `json:"source_mode"`
ManifestMode string `json:"manifest_mode"`
Filter FileFilter `json:"filter"`
FailPolicy string `json:"fail_policy"`
Priority int16 `json:"priority"`
Status string `json:"status"`
Phase string `json:"phase"`
WaitingReason string `json:"waiting_reason,omitempty"`
Revision int64 `json:"revision"`
ItemTotal int64 `json:"item_total"`
ItemDone int64 `json:"item_done"`
ItemFailed int64 `json:"item_failed"`
TotalBytes int64 `json:"total_bytes"`
DownBytes int64 `json:"down_bytes"`
UpBytes int64 `json:"up_bytes"`
HeartbeatAt *time.Time `json:"heartbeat_at,omitempty"`
LastProgressAt *time.Time `json:"last_progress_at,omitempty"`
NextRetryAt *time.Time `json:"next_retry_at,omitempty"`
CancelAt *time.Time `json:"cancel_at,omitempty"`
ErrorCode string `json:"err_code,omitempty"`
ErrorMessage string `json:"err_msg,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
App JobAppRef `json:"app"`
Target JobTargetRef `json:"target"`
Pool *JobPoolRef `json:"pool,omitempty"`
Source *Source `json:"source,omitempty"`
Raw json.RawMessage `json:"-"`
}
type JobPoolRef ¶
type JobProgress ¶
type JobProgress struct {
JobID string `json:"job_id"`
CurrentItemID string `json:"current_item_id,omitempty"`
CurrentAttemptID string `json:"current_attempt_id,omitempty"`
Source string `json:"source"`
Status string `json:"status"`
Phase string `json:"phase"`
ItemTotal int64 `json:"item_total"`
ItemDone int64 `json:"item_done"`
ItemFailed int64 `json:"item_failed"`
Download TransferProgress `json:"download"`
Upload TransferProgress `json:"upload"`
Overall TransferProgress `json:"overall"`
Liveness Liveness `json:"liveness"`
}
func (JobProgress) Terminal ¶
func (p JobProgress) Terminal() bool
type JobTargetRef ¶
type ListArtifactsInput ¶
type ListCallbackLogsInput ¶
type ListCallbacksInput ¶
type ListJobsInput ¶
type Liveness ¶
type Liveness struct {
State string `json:"state"`
IsAlive bool `json:"is_alive"`
AttemptID string `json:"attempt_id,omitempty"`
WorkerID string `json:"worker_id,omitempty"`
NodeID string `json:"node_id,omitempty"`
HeartbeatAt *time.Time `json:"heartbeat_at,omitempty"`
StateChangedAt *time.Time `json:"state_changed_at,omitempty"`
LastProgressAt *time.Time `json:"last_progress_at,omitempty"`
NoProgressSeconds int64 `json:"no_progress_seconds"`
SnapshotRevision int64 `json:"snapshot_revision"`
}
type Manifest ¶
type Manifest struct {
JobID string `json:"job_id"`
Revision int64 `json:"revision"`
Hash string `json:"hash"`
Filter json.RawMessage `json:"filter"`
Status string `json:"status"`
ItemCount int64 `json:"item_count"`
TotalBytes int64 `json:"total_bytes"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
ConfirmedAt *time.Time `json:"confirmed_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type ManifestItem ¶
type ManifestItem struct {
ItemID string `json:"item_id"`
ArtifactID string `json:"artifact_id,omitempty"`
Path string `json:"path"`
Name string `json:"name"`
Size int64 `json:"size"`
MTime *time.Time `json:"mtime,omitempty"`
Checksum string `json:"checksum,omitempty"`
Selected bool `json:"selected"`
SkipReason string `json:"skip_reason,omitempty"`
Status string `json:"status"`
Phase string `json:"phase"`
LocalSize int64 `json:"local_size"`
MIME string `json:"mime,omitempty"`
HashType string `json:"hash_type,omitempty"`
HashValue string `json:"hash_value,omitempty"`
Media json.RawMessage `json:"media,omitempty"`
DownBytes int64 `json:"down_bytes"`
UpBytes int64 `json:"up_bytes"`
ErrorCode string `json:"err_code,omitempty"`
ErrorMsg string `json:"err_msg,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
type ManifestPage ¶
type ManifestPage struct {
Manifest Manifest `json:"manifest"`
Items []ManifestItem `json:"items"`
Total int64 `json:"total"`
}
type ProtocolError ¶
func (*ProtocolError) Error ¶
func (e *ProtocolError) Error() string
func (*ProtocolError) Unwrap ¶
func (e *ProtocolError) Unwrap() error
type TransferProgress ¶
type TransferProgress struct {
TransferredBytes int64 `json:"transferred_bytes"`
TotalBytes int64 `json:"total_bytes"`
Percent *float64 `json:"percent"`
BytesPerSecond int64 `json:"bytes_per_second"`
StartedAt *time.Time `json:"started_at,omitempty"`
LastProgressAt *time.Time `json:"last_progress_at,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.